fix(web): use the drawer close fallback for right-panel terminals - #8421
fix(web): use the drawer close fallback for right-panel terminals#8421Adolanium wants to merge 2 commits into
Conversation
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.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
There was a problem hiding this comment.
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
ApprovabilityVerdict: Approved at 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.
What Changed
Right-panel terminal close now uses the same close path as the drawer.
If
terminalClosefails, that path writesexit\nso the process dies. Panel close and panel-surface cleanup used to callterminalCloseand 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
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
closeTerminalMutationandstoreCloseTerminalinline.closeTerminalSessionholds the shared logic (mutation, store close, andexit\nfallback when close fails).closeTerminalwraps that and bumpsterminalFocusRequestIdfor user-initiated closes.closePanelTerminaland confirmed closes go throughcloseTerminal, so panel tabs get the same PTY cleanup as the drawer. When closing all terminal surfaces on the right panel, the code callscloseTerminalSessiononly 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
closeTerminalSessionfallbackExtracts terminal close logic into a shared
closeTerminalSessionhook in ChatView.tsx. This hook issues the close mutation, falls back to writingexit\non failure (excluding interruptions), and updates the local store.closePanelTerminalnow callcloseTerminalSessioninstead of inlining the mutation and store update, so they gain the same failure fallback.closeTerminalwrapscloseTerminalSessionand incrementssetTerminalFocusRequestIdfor focus changes; callers that need focus still use this wrapper.closeTerminal) instead of a separate increment, removing the prior duplicate. Surface cleanup closes do not request focus changes.Macroscope summarized 11293b8.