Skip to content

After a restart, an agent tab asks the terminal host what is running, never "Couldn't confirm the agent started" - #28043

Merged
brennanb2025 merged 8 commits into
mainfrom
brennanb2025/conv-c2-pane-trigger
Oct 13, 2026
Merged

brennanb2025 merged 8 commits into
mainfrom
brennanb2025/conv-c2-pane-trigger

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When Orca quits while an agent tab is still starting, the tab used to remember "a launch was in progress here" in a bookkeeping record. After the restart it read that record instead of checking whether the agent was actually running, and often said "Couldn't confirm the agent started" even when the agent was fine.

Now a restored tab simply asks the terminal service, like every other tab: if the agent is still running you see it, if it exited you get a normal terminal, and if the terminal service itself is gone you see its usual "unavailable" state.

What Changed

The problem. An agent tab that is still starting (an AI button such as "Fix checks", a phone or CLI launch shown on the desktop) has a pane the host laid out before the agent existed. Orca wrote two records about it: the launch's row in the agent-session journal named the pane (ownedPane), and the saved workspace kept the tab's launch state (agentLaunchPane, with its outcome). After a restart, the pane's spawn read those records instead of the terminal host. A row left pending by the quit cannot tell whether the agent started, so the tab said "Couldn't confirm the agent started." The record never sees the process; the terminal host does.

What you'll see differently (every platform): no more "Couldn't confirm the agent started" after a restart. A tab that was launching an agent when Orca quit behaves like any tab: a live agent reattaches, an exited one gives a fresh shell, and a gone terminal service shows its normal unavailable state.

Nothing else changes. During the session a failed launch's "The agent couldn't start" and an unknown one's "Couldn't confirm the agent started." both show exactly as today, with Copy prompt and no shell under them, even if the pane mounts again (for example after switching workspaces); the second still attaches the agent if it turns up. A failed launch's tab is still gone after a reload or restart in any repo where a tab has been split or closed, as today. In a new repo where no tab has been split or closed yet, a failed launch's tab comes back after a restart as a plain terminal (main showed its "The agent couldn't start" notice with no terminal). How launches start, the phone, SSH and paired servers are as today.

Mechanism.

  • While a launch runs in this process, its pane's spawn waits for it. When it fails ("couldn't start") or its outcome is unknown ("Couldn't confirm the agent started."), main keeps that answer for the pane in memory until Orca quits. Every later spawn of the pane in this process, or one racing the launch's end, gets the same answer from main and starts nothing; if a process holds the pane by then, it attaches and the notice goes. Closing the pane, moving it to another tab, or removing its workspace forgets it. The window only shows what main said.
  • After a restart nothing about the launch is left, so the pane is an ordinary pane. Its spawn asks the terminal host, as every tab's does.
  • Deleted: reading the pane's verdict from the launch record (agentLaunchPaneVerdictFromRecord, listAgentSessionOperationRowsOwningPane), and the ownedPane the journal wrote with each claim.
  • Saved session: the window never saves a launch pane's outcome (it keeps the pending part, so a verdict that arrives after a reload still finds its tab). A restart drops the field on load, as other session-only fields are. In a new repo where no tab has been split or closed yet, a failed launch's tab comes back after a restart as a plain terminal (main showed its "The agent couldn't start" notice with no terminal).
  • Old data: journal rows an older build wrote with ownedPane are ignored and expire with the row (24 hours).

Why

The terminal host already knows whether a pane's process is alive. Storing a second copy of that fact in the launch record, and believing it after a restart, is what produced the wrong notice. Deriving the state from the terminal host removes the stored copy and the "work still owed" record that nothing re-derived. A restored tab asking the terminal host what is running is the common pattern.

The alternative was to keep the records and teach the restart path to doubt them, for example by checking the daemon first and the record second. That keeps two sources of truth and the code that reconciles them.

Linked Issue

Part of the launch-convergence plan (restart step). It is based on main and does not depend on C1 (#27692).

Visual Proof

Live QA on hidden test copies of Orca with the real Claude Code, comparing this branch with main (full table in the status comment below).

After a restart with the agent still running, the tab reattaches to the same Claude process, with its scrollback and no notice:

After a restart: the AI-button tab reattaches to the same running Claude, no notice

A launch started from the CLI whose outcome was never confirmed, after a restart: a plain terminal, no "Couldn't confirm the agent started":

After a restart: a CLI-started launch with an unknown outcome opens as a plain terminal, no "Couldn't confirm"

Testing

  • I manually tested these changes locally (live QA on hidden macOS test copies with the real Claude Code; see the status comment)

  • Automated tests added/updated

  • Restart. A restored pane, which is what a launch pane is after a restart (nothing about its launch is restored), spawns as an ordinary pane for a live, an exited and a gone terminal host.

  • Running launch. While a launch runs, its pane waits for it and then attaches or says a definite failure typed. An unknown outcome says "Couldn't confirm the agent started.", attaches if the agent turns up, and after a restart is an ordinary pane.

  • Same session. A spawn of a failed launch's pane after its verdict gets the same refusal from main and starts no shell; closing the pane (also while its launch still runs), moving it to another tab, removing its workspace, or a process holding it, forgets it; a restart forgets everything.

  • Saved state. The saved session keeps a pending launch pane and never its outcome; a restart drops it; a journal claim no longer writes ownedPane.

  • Verified on main at 2233fd36691: tc:node and tc:web pass; check:code-quality:changed, oxlint and the localization checks pass; the changed modules' tests and the launch-convergence characterization suites pass (100 files, 2728 tests, including orca-runtime.test.ts, which runs the runtime spec parts).

Size

Measured with git diff --numstat <base> HEAD -- src, TypeScript only; test files (*.test.ts(x), __tests__/, *.spec.ts, *.test-fixture.ts) count as tests and the locale JSON files on their own. Against main (2233fd36691): production −115, tests −232, locale strings 0.

AI Disclosure

Review

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

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • SSH: a pane's spawn asks the same terminal host it already asked for every other tab, local or SSH.
  • Mixed versions: nothing a paired client and host exchange changes. Old journal rows and saved tabs from an older build are read as above.

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)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason (live QA follows)
  • 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)

… never "couldn't confirm"

A launch pane's spawn read the launch record (and the tab's saved outcome) when no launch was
running for it, so a row left pending by a quit showed "Couldn't confirm the agent started." The
record never observes the process; the terminal host does. With no launch running in this process
the pane now spawns exactly like any tab: a live agent reattaches, an exited or absent one gives a
fresh shell, and a gone daemon shows the normal unavailable state.

- the running launch tells its pane how it ended in memory (finish carries the verdict); only a
  definite failure says "couldn't start", an unknown outcome leaves an ordinary pane
- deleted: agentLaunchPaneVerdictFromRecord, listAgentSessionOperationRowsOwningPane, the
  `unconfirmed` verdict and its notice string, the tab's persisted launch pane, ownedPane writes
- rows written by an older build that carry ownedPane are ignored; they expire with the row
@brennanb2025
brennanb2025 force-pushed the brennanb2025/conv-c2-pane-trigger branch from f20e4ed to 4f4ea55 Compare October 12, 2026 22:51
@brennanb2025 brennanb2025 changed the title Agent tabs start their own terminal from the host's plan; restart asks the terminal host After a restart, an agent tab asks the terminal host what is running, never "Couldn't confirm the agent started" Oct 12, 2026
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/conv-c1-host-planner to main October 12, 2026 22:51
… notice for the session and never spawns a shell under it; a reload saves only a pending launch
…dn't confirm the agent started" for the session, and attaches its agent if it turns up
… its pane until it quits, so the pane never spawns a shell under its notice; the window's spawn gate goes
…osed during its launch, moved to another tab, or its workspace is removed; comments say what an unknown outcome and a reload now do
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Status: review, live QA and CI done; ready for review

The problem. When Orca quit while an agent tab was still starting, the tab kept a bookkeeping record of the launch. After the restart it read that record instead of asking the terminal service what was actually running, so it could say "Couldn't confirm the agent started" even when the agent was fine.

What changes for you. One thing: after a restart you no longer see "Couldn't confirm the agent started". A restored tab asks the terminal service like every other tab: a running agent reattaches, an exited one gives a normal terminal, a gone terminal service shows its usual unavailable state. Everything during a session is as today (both "The agent couldn't start" and "Couldn't confirm the agent started." with Copy prompt and no shell under them). One edge, listed in the body: in a new repo where no tab has been split or closed yet, a failed launch's tab comes back after a restart as a plain terminal (main showed its notice with no terminal).

Review. This PR started as a larger change (agent tabs starting their own terminal from the host's plan) and was split; this part is only the restart change, based on main, independent of #27692. Rounds:

  • Round 1 on the restart change against main (fresh reviewer): 2 real problems, both fixed: a "couldn't start" notice could sit over a working shell after the pane mounted again in the same session; and an AI-button launch whose outcome is unknown went silent mid-session (now main's in-session "Couldn't confirm" again, so only restart behaviour changes).
  • Live QA then found that a refused launch could still get a shell under its notice in-session; fixed by main remembering a failed launch's answer for its pane for the rest of the session (in memory only), so every later start of that pane is refused inside main itself. The window-side check added earlier was deleted.
  • Two delta reviews (one on Codex): the remembered answer is now forgotten when the pane is closed, moved to another tab, or its workspace is removed, including a close that lands before the launch settles; comments corrected.
  • Readiness checklist on the final diff: no P0/P1.

Live QA (hidden macOS test copies of Orca, the real Claude Code, scripted drivers; main as the "before" side), on 111f40e (0c745d9 adds only the forget-on-close/move/removal fix and comments):

Row Result
Restart with the agent running reattaches to the same Claude process, scrollback intact, no notice (= main)
Restart after the agent exited normal terminal + Claude's own resume hint, no notice (= main)
Quit mid-launch (3 tries) reattaches to the running Claude; never "Couldn't confirm"
Launch refused in-session (disabled agent) notice + Copy prompt, no shell, same after switching workspaces away and back; tab gone after reload and after restart (= main)
CLI-started launch with an unknown outcome, then restart plain terminal, no "Couldn't confirm"
Terminal service stopped, then restart fresh terminal, no launch notice
AI-button launch prompt pasted once and submitted (6/6, incl. 4 first launches of a session)

CI. Green at 0c745d9 (static analysis + typecheck, 5 test shards, package incl. Windows). An earlier red run was main's own HtmlDocPreview.tsx max-lines error (#27875), since fixed on main; not this PR. Checked against current main (484a540): merges cleanly; main changed none of this PR's files since the max-lines check (largest merged files 299/300 lines).

Size. Production −115, tests −232 lines vs main (TypeScript only).

Deferred (P3, not fixed here).

  • A pending launch's saved marker can be dropped when main itself rewrites the layout; only a window reload mid-launch in a repo with no split/closed tab, followed by that launch failing, would show a blank pane.
  • A remembered failure can linger (about 100 bytes each, never read again) after a window-internal close or a worktree removal shared with another host.
  • agent-launch-pane-evidence.ts now holds only the liveness check; a rename would read better.

Not verified. main's old "Couldn't confirm" line couldn't be produced on the test copy, so the "before" side of the restart rows shows no notice either. SSH, Windows, Linux and the phone weren't exercised (no platform-specific code here). 0c745d9's last fix was checked by tests and review, not live.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 13, 2026 06:30
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8425b475-7d20-4fbe-9bde-469fe096fce3
📥 Commits

Reviewing files that changed from the base of the PR and between 2233fd3 and 0c745d9.

📒 Files selected for processing (34)
  • src/main/agent-launch/agent-launch-pane-attachment.test.ts
  • src/main/agent-launch/agent-launch-pane-attachment.ts
  • src/main/ipc/pty-agent-launch-pane-attach.test.ts
  • src/main/ipc/pty/ipc/leaf-move.ts
  • src/main/ipc/pty/ipc/spawn-begin.ts
  • src/main/ipc/pty/pane/agent-launch-pane-evidence.test.ts
  • src/main/ipc/pty/pane/agent-launch-pane-evidence.ts
  • src/main/runtime/agent-session-operation-admission.ts
  • src/main/runtime/orca-runtime-resolve-worktree-removal-target.ts
  • src/main/runtime/orca-runtime-tests/mobile-session-tabs-part-07.spec.ts
  • src/main/runtime/rpc/methods/agent-launch-execution-outcome.ts
  • src/main/runtime/rpc/methods/agent-launch-instant-tab.test.ts
  • src/main/runtime/rpc/methods/agent-launch-replay.ts
  • src/main/runtime/rpc/methods/agent-launch-tab-publication.ts
  • src/main/runtime/rpc/methods/agent-launch.ts
  • src/renderer/src/components/terminal-pane/AgentLaunchPaneNotice.tsx
  • src/renderer/src/components/terminal-pane/agent-launch-pane-notice.test.ts
  • src/renderer/src/lib/agent-launch-pane-spawn-hold.ts
  • src/renderer/src/lib/agent-launch-pane-verdict-application.test.ts
  • src/renderer/src/lib/agent-launch-pane-verdict-application.ts
  • src/renderer/src/lib/agent-launch-tab-publication.test.ts
  • src/renderer/src/lib/workspace-session.test.ts
  • src/renderer/src/lib/workspace-session.ts
  • src/shared/agent-launch-pane-verdict.ts
  • src/shared/agent-session-operation-ledger.test.ts
  • src/shared/agent-session-operation-ledger.ts
  • src/shared/terminal-tab-types.ts
  • src/shared/workspace-layout/workspace-layout-disk-fields.ts
  • src/shared/workspace-layout/workspace-layout-fact-locations.test.ts
  • src/shared/workspace-layout/workspace-layout-load-tabs.ts
  • src/shared/workspace-layout/workspace-layout-model.ts
  • src/shared/workspace-layout/workspace-layout-save-tabs.ts
  • src/shared/workspace-session-schema.test.ts
  • src/shared/workspace-session-schema.ts
💤 Files with no reviewable changes (3)
  • src/shared/workspace-layout/workspace-layout-fact-locations.test.ts
  • src/main/ipc/pty/pane/agent-launch-pane-evidence.test.ts
  • src/shared/agent-session-operation-ledger.test.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.

📝 Walkthrough

Agent launch pane verdicts now use process-local launch tracking and pane liveness instead of persisted operation ownership and saved tab outcomes. Launch completion reports typed verdicts and failure codes. Pane attachment and cleanup paths use the new tracking behavior, and session serialization drops launch outcomes while retaining pane identifiers.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 0c745

No actionable issue is established that needs to be fixed before merging.

Pre-merge checks · Passed 3 · Failed 2

Failed Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check Warning The description thoroughly explains the behavior, implementation, rationale, testing, compatibility, and known limitations. However, it does not provide the required actual linked issue, and the visua… Add an actual issue reference under Linked Issue, such as Fixes #<issue-number> or another valid issue link. Provide before-and-after visual proof for the behavior change, or mark the checklist item as N/A with a brief reason if visual pr…
Docstring Coverage Warning Docstring coverage is 51.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 35 functions across 31 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (3 passed)
Check name Status Explanation
Title check Passed The title clearly summarizes the primary change: after restart, restored agent tabs query the terminal host instead of showing the previous confirmation error.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description thoroughly explains the behavior, implementation, rationale, testing, compatibility, and known limitations. However, it does not provide the required actual linked issue, and the visual-proof checklist remains unchecked despite the behavior change.

Resolution

Add an actual issue reference under Linked Issue, such as Fixes #&lt;issue-number&gt; or another valid issue link. Provide before-and-after visual proof for the behavior change, or mark the checklist item as N/A with a brief reason if visual proof is not applicable.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • 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

Comment @coderabbitai help to get the list of available commands.

@brennanb2025
brennanb2025 merged commit e2751d4 into main Oct 13, 2026
63 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/conv-c2-pane-trigger branch October 13, 2026 10:03
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.

1 participant