Skip to content

fix(web): only confirm closing active terminals - #10180

Open
davidhu2000 wants to merge 3 commits into
pingdotgg:mainfrom
davidhu2000:fix/terminal-close-confirm-running-process
Open

davidhu2000 wants to merge 3 commits into
pingdotgg:mainfrom
davidhu2000:fix/terminal-close-confirm-running-process

Conversation

@davidhu2000

@davidhu2000 davidhu2000 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

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

  • 36 focused tests passed, including terminal metadata transitions, confirmation behavior, and close shortcut handling.
  • Web typecheck passed. Targeted lint completed with existing warnings.
  • Browser evidence of idle and running terminal behavior:

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

  • Adds selectIdleTerminalIds selector in terminalSessions.ts that returns IDs only for sessions whose subprocess state is exactly false; sessions with missing or non-false metadata are excluded.
  • Updates confirmTerminalClose in terminalCloseConfirm.ts to resolve true without 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.
  • Risk: terminals whose subprocess metadata is absent (not explicitly false) still require confirmation — any component relying on implicit idle detection will not skip the dialog.

Macroscope summarized 93ec5dc.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 5, 2026
Comment thread apps/web/src/components/ChatView.tsx Outdated
const runningTerminalIds = useMemo(
() =>
knownTerminalSessions
.filter((session) => session.state.hasRunningSubprocess)

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.

🟠 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.

@macroscopeapp

macroscopeapp Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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:

  • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity

Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more.

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