fix(web): skip close confirmation for idle terminals - #9728
Open
nobottomline wants to merge 3 commits into
Open
Conversation
nobottomline
marked this pull request as ready for review
September 4, 2026 17:38
Contributor
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR changes the existing terminal-close safety flow and adds a cross-layer subprocess-inspection RPC. Human review is required because it modifies the server auth package and introduces non-opt-in runtime behavior changes across the client and server. You can add or adjust custom eligibility rules. Learn more. |
nobottomline
force-pushed
the
fix/skip-idle-terminal-close-confirmation
branch
from
September 6, 2026 00:04
04ff253 to
22ff7b9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
Terminal close actions now skip the destructive confirmation when every targeted terminal is known to be idle. Immediately before deciding, the client asks the server for a fresh process-table snapshot; terminals with a running subprocess still prompt, and missing or failed inspection state is treated conservatively and still prompts.
The existing behavior remains unchanged for auto-exit cleanup, bulk closes, and clients without the desktop dialog API.
Why
The confirmation added in #7592 protects running work and terminal history, but it also interrupts closing a fresh terminal or one whose command has already exited. The terminal manager already owns subprocess inspection, so the close flow can preserve the safeguard only when work may actually be interrupted without adding a setting or trusting the one-second background polling cache.
UI Changes
Verified in an isolated desktop profile:
sleep 120still showsClose terminal "sleep"?Running-process safeguard:
Verification
vp test run src/terminal/Manager.test.ts(58 tests)vp test run src/auth/RpcAuthorization.test.ts(6 tests)vp test run src/rpc.test.ts src/terminal.test.ts(25 tests)vp test run src/lib/terminalCloseConfirm.test.ts src/components/ThreadTerminalDrawer.test.ts(11 tests)vp run typecheckinapps/server,apps/web,packages/contracts, andpackages/client-runtimevp linton the 12 changed files (no errors; existing React warnings remain outside the changed blocks)--home-dir: idle close bypassed the dialog; running close retained itChecklist
Built with gpt-5.6-sol through the Codex harness in T3 Code.
Note
Skip terminal close confirmation for idle terminals via subprocess inspection
terminalInspectSubprocessesWebSocket RPC, with an input capped at 64 terminal IDs and a per-terminal activity result oftrue,false, ornull(unavailable).TerminalManager.inspectSubprocessesin Manager.ts under the existing per-thread lock. It deduplicates requested IDs, returnsfalsefor missing/non-running sessions, and returnsnullwhen a running session cannot be inspected.ChatViewandThreadTerminalDrawerto inspect subprocess activity before closing. Known-idle terminals skip the destructive confirmation dialog; running, missing, or unknown activity still prompts.confirmTerminalCloseandconfirmInspectedTerminalClosein terminalCloseConfirm.ts now require labeled target objects instead of a label-only array; existing callers must be migrated.Macroscope summarized ef2f694.