fix(web): only confirm closing active terminals - #10180
davidhu2000 wants to merge 3 commits into
Conversation
| const runningTerminalIds = useMemo( | ||
| () => | ||
| knownTerminalSessions | ||
| .filter((session) => session.state.hasRunningSubprocess) |
There was a problem hiding this comment.
🟠 High components/ChatView.tsx:1222
Closing a newly opened terminal with a running subprocess skips the destructive-close confirmation and immediately interrupts the process with deleteHistory: true. runningTerminalIds is derived only from knownTerminalSessions, which is empty or stale while the server metadata for a client-side terminal is still catching up, so this panel treats the terminal as idle; merge the client-side running state or conservatively retain the terminal as running until metadata confirms it is idle.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/ChatView.tsx around line 1222:
Closing a newly opened terminal with a running subprocess skips the destructive-close confirmation and immediately interrupts the process with `deleteHistory: true`. `runningTerminalIds` is derived only from `knownTerminalSessions`, which is empty or stale while the server metadata for a client-side terminal is still catching up, so this panel treats the terminal as idle; merge the client-side running state or conservatively retain the terminal as running until metadata confirms it is idle.
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — This is a focused terminal UI bug fix that removes confirmation only for explicitly idle sessions while retaining it for active or unknown sessions, with targeted tests and no schema or infrastructure changes. An unresolved High-severity finding flags a possible stale-metadata race, but that correctness issue is handled separately from this approvability recommendation. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
Closing an idle terminal no longer shows a destructive confirmation. Drawer and panel buttons, terminal-close shortcuts, and terminal panel-tab close all skip the prompt only when server metadata explicitly reports no running subprocess. Terminals missing from metadata still require confirmation.
A shared confirmed-idle selector keeps that rule consistent without merging client terminal IDs. Closing a panel with several terminals names only the running or unknown terminals in the confirmation.
Proof
Idle terminal closes without confirmation:
no-process.mp4
Running terminal requires confirmation:
has-process.mp4
Implemented by gpt-5.6-sol; reviewed and revised by GPT-6 in T3 Code through the Codex harness.
Note
Fix(web): skip close confirmation for explicitly idle terminals
selectIdleTerminalIdsselector in terminalSessions.ts that returns IDs only for sessions whose subprocess state is exactlyfalse; sessions with missing or non-false metadata are excluded.confirmTerminalClosein terminalCloseConfirm.ts to resolvetruewithout opening a dialog when the label list is empty.ChatView,ThreadTerminalDrawer, and persistent thread panel/drawer components now derive idle IDs and pass empty labels for idle terminals, so only active or unknown-state terminals trigger confirmation.false) still require confirmation — any component relying on implicit idle detection will not skip the dialog.Macroscope summarized 93ec5dc.