Skip to content

fix(terminal): don't confirm closing an unverifiable idle pane - #50716

Open
Pr1p wants to merge 2 commits into
stablyai:mainfrom
Pr1p:fix/pane-close-unverifiable-confirm
Open

Pr1p wants to merge 2 commits into
stablyai:mainfrom
Pr1p:fix/pane-close-unverifiable-confirm

Conversation

@Pr1p

@Pr1p Pr1p commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When you close a small terminal inside a split tab, Orca was asking "an agent is still running?" even for a terminal that was just sitting idle. It asked because it could not check whether anything was running, and "cannot check" was being treated the same as "definitely running". Now only a real running answer — or a pane on another computer where killing sight-unseen is the real risk — asks first.

What Changed

handleRequestClosePane in use-terminal-pane-close-actions.ts escalated every probe verdict except 'exited' into confirmClose(). The probe returns 'exited' only when it proves the pty has no children; for a pane the window cannot observe (a remote pane, an unreadable host process table, a probe that could not answer) it returns 'unverifiable', and the pane path prompted for every unverifiable.

Now the busy test is verdict === 'live' || (verdict === 'unverifiable' && probe.remote). An unverifiable local pane closes without prompting — the probe could not find anything, and "cannot tell" is not evidence an agent is running. An unverifiable remote pane (probe.remote, i.e. owned by a relay runtime or app SSH host) and a live pane still ask, matching the rule the sibling tab-close guard already applies: do not kill work on a host you cannot see.

The verdict is also only trusted for the pty it was asked about. The transport is captured when the close is requested; if the pane was restarted while the probe was out, paneTransportsRef now holds another one, and the stale answer no longer closes the pane silently — it asks.

Why

The alternative was to keep prompting for all unverifiable answers, which is the reported bug: "cannot inspect" is not the same as "is running". The alternative of matching the tab guard's bound-pty check instead of remote was rejected for the pane case: a pane close carries its own pty, so remote (the probe's own host-ownership signal) is the cleaner seam than consulting the tab's bound-id map for a different ambiguity (layout-leaf vs bound). The timeout unanswered-probe still reaches the dialog through the existing probeTimeout fallback, so a never-answered probe is unchanged.

Linked Issue

Fixes #50711

Visual Proof

N/A — no UI change; the behavior is only visible in whether closing an unverifiable split pane prompts.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

use-terminal-pane-close-actions.test.ts stubs only the probePtyRunningWork seam (and the store/pane plumbing around it), then drives the real handler:

  • an unverifiable local probe must close with no setPendingCloseConfirmation (fails before the fix — it prompted);
  • a live probe must confirm, and an unverifiable remote probe must still confirm;
  • a probe held open while the pane's transport is swapped (what a restart does) must then confirm on an unverifiable answer, not close (fails without the restart guard).

tc:web, oxlint and oxfmt are clean; check:changed passes 32/32 on the branch.

Performance

None — the change is in the confirmation decision, not the probe; no extra RPCs.

Risk

Level: Low

The riskiest part is that a local pane whose process table is genuinely unreadable now closes silently instead of asking — that is the intended trade, and it matches what the tab-close guard does for an unverifiable layout-only candidate. A remote unverifiable still prompts, and a pane restarted mid-probe is treated as unknown rather than trusted, so the only newly-silent case is one the local window could not inspect and would only have prompted about anyway. Backout is a plain revert.

AI Disclosure

Written with Claude Code.

Review

Self-reviewed against the failure mode: the false prompt was reproduced in a test before the fix, and the same test passes after it; the remote, live and restarted cases are asserted so the relaxation cannot hide a real busy pane.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Cross-platform: the verdict paths are host-agnostic; the change only affects which verdicts trigger the dialog.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

Closing an idle pane of a split tab popped the "an agent is still
running" confirmation even when nothing was running. handleRequestClosePane
only treated the probe's 'exited' verdict as safe and escalated every
other verdict, so an 'unverifiable' answer (host the window could not
observe, failed inspection, or an unanswered probe) became a confirm
dialog for a pane that was not running anything.

The pane path now matches the tab-close guard's split between "known
busy" and "unknown": only a 'live' verdict, or an 'unverifiable' verdict
on a remote pane (probe.remote), requests confirmation. An unverifiable
local pane closes.

Co-Authored-By: Claude Code <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pane close action treats live work and unverifiable probes on remote panes as busy. If the probe is not busy and the pane transport has not changed, it closes without confirmation. A changed transport requires confirmation unless the skip-confirmation setting is enabled. Tests cover these decisions, including a transport change while the probe is pending.

Severity of issue fixed: Low

Merge Risk: Minimal · up to 0623f

Closing an idle local pane whose probe cannot be verified no longer shows a spurious "agent still running" prompt. Live panes and remote unverifiable panes still ask first. A pane that restarts while its close probe is running now asks for confirmation instead of being closed silently. No merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(terminal): don't confirm closing an unverifiable idle pane" states the main change: an unverifiable local pane now closes without a confirmation prompt. It matches the summary, objectiv…
Linked Issues check Passed Issue #50711 requires that an unverifiable local pane close without a prompt. Only a live pane, or an unverifiable remote pane, may prompt. At the reviewed head, handleRequestClosePane in use-terminal…
Out of Scope Changes check Passed The production change is limited to the pane-close decision in use-terminal-pane-close-actions.ts. It has two parts. The first is the busy predicate for #50711. The second is a restart guard: when no …
Description check Passed The description explains the bug (an unverifiable local pane prompted for confirmation), the mechanism (busy test changed to verdict === 'live' || (verdict === 'unverifiable' && probe.remote)), the re…
Full details: Title check

Explanation

The title "fix(terminal): don't confirm closing an unverifiable idle pane" states the main change: an unverifiable local pane now closes without a confirmation prompt. It matches the summary, objectives, and linked issue #50711. The title is specific, short, and follows a conventional commit style. It does not mention the remote/live confirmation path or the restart safeguard, but it does not need to cover every detail.

Full details: Linked Issues check

Explanation

Issue #50711 requires that an unverifiable local pane close without a prompt. Only a live pane, or an unverifiable remote pane, may prompt. At the reviewed head, handleRequestClosePane in use-terminal-pane-close-actions.ts sets busy = verdict === 'live' || (verdict === 'unverifiable' && probe.remote). When busy is false, the handler calls close(). This matches the issue. The probeTimeout fallback still calls confirmClose() for an unanswered probe. The issue does not require a change to that fallback. The restart check (paneTransportsRef.get(paneId) !== transport) adds no unmet requirement. The PR objectives report tests for the unverifiable local, live, and unverifiable remote cases. The test file was not read in this review; that evidence comes from the PR summary and the raw summary. No unmet coding requirement was found.

Full details: Out of Scope Changes check

Explanation

The production change is limited to the pane-close decision in use-terminal-pane-close-actions.ts. It has two parts. The first is the busy predicate for #50711. The second is a restart guard: when no pending close exists and the pane's transport differs from the captured transport, the handler confirms instead of closing. The restart guard is in the same decision path and protects the same risk, which is closing a PTY that the verdict did not examine. It is not demonstrably unrelated to #50711. The current PR description does not mention the restart guard, so the description is incomplete. The restart guard changes behavior for a restarted pane, which reviewers should confirm. A new test file covers the handler. No unrelated file or behavior change was found.

Full details: Description check

Explanation

The description explains the bug (an unverifiable local pane prompted for confirmation), the mechanism (busy test changed to verdict === 'live' || (verdict === 'unverifiable' && probe.remote)), the restart guard, and the rationale against the alternatives. It links the issue (Fixes #50711), states testing with a Testing section, and gives a risk level and rollback. Performance and visual proof are covered with reasons. Minor gaps: the 'Level' is filled but the template's 'Visual Proof' N/A is explained, and the final lint/typecheck/test/build checkbox is left unchecked, which the author should confirm before merge. The description is largely complete, so it passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a972bbdb-9018-4a96-a5b3-2be4eecba3ea
Commits

Reviewing files that changed from the base of the PR and between fe8f0c7 and 0623fda.

Files selected for processing: 2

  • src/renderer/src/components/terminal-pane/layout/close/use-terminal-pane-close-actions.test.ts
  • src/renderer/src/components/terminal-pane/layout/close/use-terminal-pane-close-actions.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 085b7c37-4823-48f6-87b9-4e7aee1676a1
Commits

Reviewing files that changed from the base of the PR and between 46a3d6a and fe8f0c7.

Files selected for processing: 2

  • src/renderer/src/components/terminal-pane/layout/close/use-terminal-pane-close-actions.test.ts
  • src/renderer/src/components/terminal-pane/layout/close/use-terminal-pane-close-actions.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

…was out

The probe verdict describes the PTY captured at the close request; a pane that
restarted since then holds a different, possibly live PTY. Before the automatic
close path only (the unverifiable-local close and the skip-confirm setting), require
paneTransportsRef still holds the captured transport; otherwise show the
confirmation instead of closing the replacement. Live and remote-unverifiable
verdicts already ask, so only the auto-close branch needed the check.

Co-Authored-By: Claude Code <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Closing an idle split pane asks to confirm because an unverifiable probe is treated as a running agent

1 participant