Skip to content

fix(web): use the drawer close fallback for right-panel terminals - #8421

Open
Adolanium wants to merge 2 commits into
pingdotgg:mainfrom
Adolanium:fix/panel-terminal-close-fallback
Open

fix(web): use the drawer close fallback for right-panel terminals#8421
Adolanium wants to merge 2 commits into
pingdotgg:mainfrom
Adolanium:fix/panel-terminal-close-fallback

Conversation

@Adolanium

@Adolanium Adolanium commented Aug 27, 2026

Copy link
Copy Markdown

What Changed

Right-panel terminal close now uses the same close path as the drawer.

If terminalClose fails, that path writes exit\n so the process dies. Panel close and panel-surface cleanup used to call terminalClose and hide the session, with no fallback.

Why

A failed close left the PTY running. The UI said it was gone. Reload cleared the local hide list, so the closed terminal came back.

The drawer already had the fallback. The panel did not.

UI Changes

None. Closing a tab looks the same. The process is what changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (N/A)
  • I included a video for animation/interaction changes (N/A)

Note

Low Risk
Refactors terminal close call sites in ChatView; behavior improves parity with existing drawer fallback rather than changing auth or data paths.

Overview
Right-panel terminal teardown no longer calls closeTerminalMutation and storeCloseTerminal inline. closeTerminalSession holds the shared logic (mutation, store close, and exit\n fallback when close fails). closeTerminal wraps that and bumps terminalFocusRequestId for user-initiated closes.

closePanelTerminal and confirmed closes go through closeTerminal, so panel tabs get the same PTY cleanup as the drawer. When closing all terminal surfaces on the right panel, the code calls closeTerminalSession only so bulk cleanup does not repeatedly refocus.

Reviewed by Cursor Bugbot for commit 11293b8. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Route right-panel terminal closes through closeTerminalSession fallback

Extracts terminal close logic into a shared closeTerminalSession hook in ChatView.tsx. This hook issues the close mutation, falls back to writing exit\n on failure (excluding interruptions), and updates the local store.

  • Right-panel surface cleanup and closePanelTerminal now call closeTerminalSession instead of inlining the mutation and store update, so they gain the same failure fallback.
  • closeTerminal wraps closeTerminalSession and increments setTerminalFocusRequestId for focus changes; callers that need focus still use this wrapper.
  • Behavioral Change: right-panel terminal closes now issue a single focus request (via closeTerminal) instead of a separate increment, removing the prior duplicate. Surface cleanup closes do not request focus changes.

Macroscope summarized 11293b8.

Drawer close already writes exit if terminalClose fails, so the process
dies. Right-panel close only hid the session. A failed close left a
running PTY, and a reload brought the closed terminal back.

Route panel close and panel-surface cleanup through the same close path
the drawer uses.
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b12eb68b-cc7c-4e68-a149-6043a4283cbf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 27, 2026

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One finding: routing right-panel surface cleanup through the drawer's closeTerminal also inherits its terminal focus bump, which changes keyboard-focus behavior when closing right-panel tabs. Details inline.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/ChatView.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 11293b8

Macroscope's review found this PR approvable — This is a focused one-file fix that gives right-panel terminal closes the same failed-close PTY cleanup already used by the drawer, while preserving intentional focus behavior for explicit closes and avoiding focus changes during bulk cleanup. The change introduces no schema, infrastructure, security, billing, or authentication impact.

You can add or adjust custom eligibility rules. Learn more.

Panel surface cleanup was going through closeTerminal, which also bumps
terminal focus. Closing other right-panel tabs could then focus the
bottom drawer PTY.

Keep the exit fallback on a helper with no focus bump. Drawer and
explicit panel-tab close still bump focus. Cleanup uses the helper only.
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant