Repository navigation
fix(terminal): retire resume authority after a confirmed agent exit - #15666
brennanb2025 wants to merge 15 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe change adds PTY incarnation identity to terminal contracts, connection results, callbacks, sessions, recovery data, parked-pane watchers, and 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes satisfy [ Full details: Out of Scope Changes checkExplanation The PTY incarnation propagation, handoff buffering, alias cleanup, remote-runtime handling, cold-restore behavior, and focused tests support the stated lifecycle and recovery requirements. No unrelated production changes are evident. Full details: Docstring CoverageExplanation Docstring coverage is 17.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 45 functions across 37 files. (2 skipped: 2 too large.) Full details: Description checkExplanation The description follows the required structure and provides the problem, solution, issue link, visual proof, testing, review considerations, and checklist status. The AI Disclosure and Notes headings are not included, but the description is otherwise complete.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
|
Additional sanitized confirmation from a Prime Agent integration (not a duplicate issue request). This appears to be the same generic lifecycle boundary covered by #14228 and this PR, but it is useful to record the Prime provider path explicitly. Environment: Orca 1.4.183 on Fedora Linux x86_64; Prime Agent 0.7.3; Node.js 24.15.0. Prime is recognized as a resumable agent, and its reported In the shipped Orca 1.4.183 bundle, a process-confirmed The important regression boundary for Prime is therefore:
No credentials, transcript bodies, session IDs, or local paths are included here. A Prime-specific lifecycle fixture would make sure the generic fix also covers the provider whose resume locator is a |
|
Codex revision complete. Changed:
Kept:
Non-vacuity proof with the late-fact retirement call neutered: After restoring the product cleanup, the same acceptance filter passed: Verified:
No UI chrome changed, so Electron visual proof is not applicable. |
A clean Claude/shell exit left sleepingAgentSessionsByPaneKey in state working, so relaunch treated it as a crash and spawned claude --resume. Retire that pane's record when the host confirms the agent returned to the shell, keep unexpected PTY loss for crash recovery, and do not treat an unverifiable remote as exited. Co-authored-by: erishforG <[email protected]>
The local mock declared Record<string, { paneKey: string }> while the test
builds a full SleepingAgentSessionRecord, so typecheck rejected the extra
properties.
e03375d to
01b3368
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/renderer/src/components/terminal-pane/pty-connection-main-side-effect-authority.test.ts (1)
477-490: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAssert the teardown call explicitly.
The confirmed fact at line 462 already clears both
paneKeyandduplicatePaneKey, because both records sharesession-1. ThetoHaveBeenCalledWithcheck andinvocationCallOrder[0]therefore both resolve to that earlier call, so theonPtyExitstep adds no verified behavior. Capture the mock call count beforeonPtyExitand assert against the specific call you intend to test.src/renderer/src/lib/confirmed-agent-exit-resume-retirement.test.ts (1)
140-146: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake the remote test exercise an unverifiable exit.
This test seeds a record and asserts it exists. No exit fact is dispatched and no retirement function is called, so the test cannot detect a regression where an unverifiable remote exit retires the record. Dispatch an
agent-exitedfact for the remote PTY withoutexecutionHostConfirmed, then assert the record and the resume count are unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 892fd4a2-6a08-47ed-83b2-ad5df9bd394e
📒 Files selected for processing (24)
src/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/components/terminal-pane/ipc-pty-connect-result.tssrc/renderer/src/components/terminal-pane/ipc-pty-connect.tssrc/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.tssrc/renderer/src/components/terminal-pane/parked-terminal-confirmed-agent-exit-resume.test.tssrc/renderer/src/components/terminal-pane/pty-connection-cold-restore-agent-resume.test.tssrc/renderer/src/components/terminal-pane/pty-connection-main-side-effect-authority.test.tssrc/renderer/src/components/terminal-pane/pty-connection-pty-exit-teardown.test.tssrc/renderer/src/components/terminal-pane/pty-connection-test-store-fixtures.tssrc/renderer/src/components/terminal-pane/pty-connection-test-store-state.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-cold-restore-and-snapshot.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.tssrc/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.tssrc/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.tssrc/renderer/src/components/terminal-pane/pty-transport-reattach-admission.test.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/terminal-side-effect-fact-handoff.tssrc/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.tssrc/renderer/src/lib/confirmed-agent-exit-resume-retirement.test.tssrc/renderer/src/lib/confirmed-agent-exit-resume-retirement.tssrc/renderer/src/store/slices/terminal-tab-retirement-store.test.tssrc/shared/terminal-side-effect-facts.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
|
Review verification (exact final head 5b4b2e3): re-reviewed the same-PTY parked-watcher replacement across capture, reconciliation, handoff, and confirmed-exit authority. The replacement watcher now owns the new incarnation, stale/unknown/misattributed confirmed facts fail closed, and sibling panes remain untouched; the in-scope review is clean with no performance or platform-specific regression. Merge gate remains blocked pending CI and unresolved pre-existing reviewer threads outside this dispatched High finding; no merge performed. |
|
QA/evidence (exact final head 5b4b2e3): focused terminal lifecycle coverage passed (13 files, 198 tests), along with pnpm tc, changed-code quality, type-aware quality, React Doctor, oxlint pre-commit, oxfmt, and git diff checks. Electron CDP attached to the exact sta-4110-fix-r1 devRepoRoot, rendered Orca visibly with zero console errors, and captured /tmp/sta-4110-final-electron-proof.png; the host-confirmed old→new incarnation race is non-visual and remains unit-backed rather than claimed as an Electron journey. Mobile QA was not attempted, CI is pending, and no merge was performed. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 54f1cb86-93fe-4b70-965f-9d0b4ce1d08a
📒 Files selected for processing (14)
src/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-pty-binding.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.tssrc/renderer/src/components/terminal-pane/pty-connection/session-reconcile-dispose.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport-expired-pane-recovery.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport-pane-handle-resolution.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/components/terminal-pane/terminal-parked-pty-watcher.tssrc/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.tssrc/renderer/src/components/terminal-pane/terminal-parked-watcher-registry.tssrc/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.tssrc/shared/runtime-terminal-contracts.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.ts (1)
97-117: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winClear titles for replaced PTYs during
restartAll.A replaced PTY is excluded from
retainedPtyIdsbut not included inretiredPaneIds. IfrestartAllis also true, its old “working” title remains after the new watcher starts. Include replacement pane IDs in therestartAlltitle cleanup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b49c40b2-49d8-4d29-ba2c-e718fba69e6a
📒 Files selected for processing (8)
src/renderer/src/components/terminal-pane/terminal-parked-pty-watcher.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.tssrc/renderer/src/components/terminal-pane/terminal-parked-watcher-partial-reconciliation.test.tssrc/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.test.tssrc/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.tssrc/renderer/src/components/terminal-pane/terminal-parked-watcher-registry.tssrc/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.test.tssrc/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts (1)
1461-1480: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftPass the incarnation ID through web-session rebinds.
This helper forwards
incarnationIdonly when the caller supplies it. The web rebind paths at Line 1527 and Line 1663 still pass only the replacement handle, soonPtyRebindloses the replacement identity. The fail-closed tests insrc/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.test.tsshow that a confirmed exit without this identity is dropped, leaving the resume record eligible for restore. Resolve the replacement pane incarnation and pass it through both web rebind paths.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: da5f5ec1-8b3f-4c1d-9391-ef138610b8bc
📒 Files selected for processing (9)
src/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.tssrc/renderer/src/components/terminal-pane/parked-terminal-confirmed-agent-exit-resume.test.tssrc/renderer/src/components/terminal-pane/pty-connection-test-store-fixtures.tssrc/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/components/terminal-pane/remote-runtime-resubscribe-failure-recovery-routing.test.tssrc/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.test.tssrc/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.tssrc/renderer/src/lib/confirmed-agent-exit-resume-retirement.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/runtime/orca-runtime.ts (1)
19739-19822: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winFix the staleness check so it also applies after the PTY disconnects.
confirmPtyAgentExitstores apendingAgentExitCandidateon the tracker entry, then starts an async foreground-process read. When that read resolves, the code detects whether a newer event already settled or replaced the candidate, but only whencurrent.connectedis stilltrue:if ( current.connected && pendingCandidate && trackerEntry?.pendingAgentExitCandidate !== pendingCandidate ) { return } ... if (!current.connected) { recordExit(true) return }If
settlePendingPtyAgentExitOnCommandFinishedalready consumed this exactpendingCandidate(clearing it tonulland recording anagent-exitedfact withexecutionHostConfirmed: true), and the PTY then disconnects for real before this foreground read resolves, the staleness check is skipped becausecurrent.connectedisfalse. Execution falls through torecordExit(true), which re-emits a secondagent-exitedfact for the same incarnation.recordExit's own guards (current !== pty, incarnation match, title match) do not catch this, becausesettlePendingPtyAgentExitOnCommandFinishednever touchespty.lastOscTitleAtorpty.lastAgentStatus.Move the staleness check ahead of the
current.connectedgate so it also protects the disconnected branch:🐛 Proposed fix
const current = this.ptysById.get(ptyId) if (current !== pty) { return } - if ( - current.connected && - pendingCandidate && - trackerEntry?.pendingAgentExitCandidate !== pendingCandidate - ) { + if (pendingCandidate && trackerEntry?.pendingAgentExitCandidate !== pendingCandidate) { return }Separately,
settlePendingPtyAgentExitOnCommandFinished's attribution check comparesconnectionIdin addition toworktreeId/tabId/paneKey, whilerecordExit's inline attribution check insideconfirmPtyAgentExitdoes not. Consider extracting one shared validator for both call sites to prevent this kind of divergence.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 59929108-e718-41cc-9875-32eb7eabea72
📒 Files selected for processing (2)
src/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.
Review verification — saved exact headVerified PR head and remote branch at State-machine coverage includes intentional agent exit, confirmed shell/PTy exit, unexpected/unverifiable disconnect retention, Orca restart and process reattach, mounted/parked reconciliation, late exit facts, stale PTY incarnations, provider-session aliases, sibling panes, and local/SSH/remote/WSL/folder-workspace routing branches. The failing-first stale-incarnation boundary test failed exactly before the fix and passes now; focused exact-head verification includes Perf audit is clean: no new polling, subprocess churn, startup waits, hot-path scans, or unbounded growth; exit-fact handoff stays bounded to 32 PTYs, 64 batches, and 15 seconds. Plain-language verdict: the implementation is sound and mergeable after the remaining required CI check completes; no proven in-scope code issue remains. Live non-macOS/remoting/package journeys remain QA confidence gaps, not hidden claims. |
Host-validation follow-up — exact head
|
| Arm | Verdict | Confirmed/intentional-exit branch | Genuinely-live branch |
|---|---|---|---|
| Live SSH disconnect/reconnect | VERIFIED | After reconnect, an explicit close of only PTY ssh:ssh-1787870711577-72tx03@@pty-1 produced the sole exit event (code: 0, generation 2, incarnation 16102a14-e04f-4d8a-be4f-7546bbe63ed5); the PTY was absent afterward and did not reopen. |
Before transport loss the real openclaw /bin/bash PTY was live. window.api.ssh.disconnect changed inspection to unavailable with zero exit events (unverifiable, not exited); reconnect advanced the provider generation and restored the same PTY ID/incarnation as live, still with zero exit events. Rendered reconnect proof. |
WSL2 (Ubuntu-24.04) |
UNREACHABLE | Not covered end to end. The real-Windows WSL contract suite passed, including buildWslExecArgs using --exec and captured login-shell exit propagation, but no isolated WSL agent lifecycle journey was completed. |
Not covered end to end. Real-distro banner fencing and argv round trips passed, but no isolated live-at-shutdown reopen journey was completed. Follow-up access failed with orca terminal read --terminal term_0652b8b1-4131-4f53-bfbf-8b4ea4bf1dcd --limit 500 --json → terminal_handle_stale. |
| Native Linux (openclaw, Ubuntu 24.04) | UNREACHABLE | Exact-head build and six focused lifecycle cases passed, including confirmed local/SSH exit retirement, but the built app's supposedly unique profile rendered pre-existing workspaces, so the visible close/restart result was contaminated and rejected. | Same isolation failure prevented trustworthy live-at-shutdown reopen proof. Launch was ORCA_USER_DATA_PATH=<unique profile> <exact-head built Electron> --remote-debugging-port=9452 --no-sandbox; without --no-sandbox the exact error was chrome-sandbox ... must be owned by root and mode 4755, and with it CDP rendered but ignored the requested isolation boundary. |
Native Windows (physical high-spec host, Windows 10.0.26200.9168) |
UNREACHABLE | Exact-head build and the six focused lifecycle cases passed, but the unique-profile/CDP launch displayed pre-existing workspaces, so the confirmed-exit restart result could not be attributed to this worker's session. | Same profile contamination invalidated the live-at-shutdown branch. The exact-head app was launched with a unique ORCA_USER_DATA_PATH and --user-data-dir on CDP 9453; both were behaviorally rejected by the observed pre-existing profile. Follow-up capture command orca terminal read --terminal term_3d541b31-2162-4215-8baa-765e71c11313 --limit 500 --json returned terminal_handle_stale. |
| Paired mixed-version client/host | UNREACHABLE | Not covered. The available builds were exact-head client 858bed00e3, openclaw runtime 1.4.178-rc.2, and Windows runtime 1.4.190, but a new isolated paired host journey could not be established. |
Not covered. Attempt: orca terminal create --worktree 'id:6556cb39-27ad-41af-81d9-e8251f0158dc::/home/brennan/orca/workspaces/orca/qa-15666-host-worker-linux-858bed' --title 'qa15666-mixed-probe' --command 'orca --version; orca serve --help' --json → selector_not_found; therefore neither side's mixed-version retire/reopen interpretation was exercised. |
| Actual packaged restart | UNREACHABLE | Not covered: the signed exact-head arm64 package completed and codesign --verify --deep --strict passed, but it exited before CDP, so an intentionally closed session could not be restarted visibly. |
Not covered for the same reason. Exact attempt: env HOME=/private/tmp/orca-15666-packaged-profile.KZH6Sq/home ORCA_E2E_HOME_DIR=/private/tmp/orca-15666-packaged-profile.KZH6Sq/home ORCA_E2E_USER_DATA_DIR=/private/tmp/orca-15666-packaged-profile.KZH6Sq/user-data ORCA_USER_DATA_PATH=/private/tmp/orca-15666-packaged-profile.KZH6Sq/user-data dist/mac-arm64/Orca.app/Contents/MacOS/Orca --remote-debugging-port=9455 → process exit 1, and curl http://127.0.0.1:9455/json → connection refused. /usr/bin/open -n -a "$PWD/dist/mac-arm64/Orca.app" --args --remote-debugging-port=9455 also produced ERROR: packaged Orca launched with open -n did not expose CDP 9455. |
Backing checks that passed
- Exact HEAD was proved locally and in detached Linux/Windows worktrees.
- Linux and Windows:
pnpm build:desktoppassed. - Linux and Windows:
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/confirmed-agent-exit-resume-retirement.test.ts src/renderer/src/components/terminal-pane/parked-terminal-confirmed-agent-exit-resume.test.ts src/renderer/src/components/terminal-pane/pty-connection-main-side-effect-authority.test.ts src/main/runtime/orca-runtime.test.ts -t "retires a clean-exit record|still offers resume|does not retire an unverifiable|becomes unverifiable|host-certified SSH exit|confirms a local agent exit"passed all 6 selected cases. - Real Windows/WSL2:
pnpm exec vitest run --config config/vitest.config.ts src/shared/wsl-login-shell-command.test.tspassed21with1skip, including real-distro--exec, login-banner fencing,$/awk/positional-argument preservation, and fenced exit status propagation. - Packaged macOS:
pnpm build:maccompleted both slices and produced the signed arm64 package.
Merge verdict
DO NOT MERGE on this evidence. The live SSH loss-of-contact boundary is verified, but WSL lifecycle, native Linux/Windows visible restart journeys, mixed-version pairing, and the actual packaged restart remain authoritative gaps. No code defect was proven and no PR code was changed.
|
STA-4110 blocking fix is now at bc72ee5. Contract boundary: completion-sensitive local PTY inspection now preserves resolver availability and live-child evidence through LocalPtyProvider.inspectProcess and OrcaRuntimeService. Legacy foreground reads remain non-throwing for status/UI callers; exit confirmation only becomes executionHostConfirmed when inspection is available and explicitly sees no children. This avoids changing every non-authoritative caller while preventing a swallowed provider failure from being laundered into an exit. Failing-first production-shaped regression: does not certify an adapter-swallowed foreground query failure as an agent exit failed at 858bed0 because the emitted fact contained executionHostConfirmed: true for inc-unverifiable-exit. It now emits only an unconfirmed agent-exited fact, while separate tests prove a live child also retains resume authority and an authoritative no-child inspection still emits executionHostConfirmed: true. Verification:
The changed-code-quality wrapper itself remains affected by the existing Node 26 engine-warning JSON pollution (package expects Node 24); direct lint and pre-commit quality checks passed. Residual empirical gap is live native Windows/Linux/WSL restart travel; provider/runtime tests cover degraded local and fail-closed remote contract behavior. |
|
Empirical restart evidence for bc72ee5: Dev, isolated profile and CDP ports 28460/28461: identity was Orca: bc72ee5, isDev true, devRepoRoot exactly this PR worktree. Tab 30b05750-c8ac-423b-875b-84606edf33b4 reattached PTY 42e6c2e9-2b94-4cd9-a9bd-6470c269bb18::/Users/brennanbenson/orca/workspaces/orca/pr-15666-adapter-fix-r1@@072af635, and the visible shell PID stayed 14115 before and after restart. Packaged arm64 build 1.4.178-rc.2.local.1787874677190.bc72ee52190a, isolated profile and CDP port 28462: identity was Orca, isDev false, and the renderer loaded from this worktree packaged app. PTY 09e7ba75-5ff3-4a47-b529-c1258a9d7ad9::/Users/brennanbenson/orca/workspaces/orca/pr-15666-adapter-fix-r1@@eeadb812 reattached, and the visible shell PID stayed 80191 before and after restart. Both journeys exercised the rendered terminal through Playwright CDP, not store-only inspection, desktop automation, or the users running Orca. Merge verdict: mergeable once required CI is green; no known in-scope correctness, performance, platform, remoting, or lifecycle blocker remains. |
Host-validation retry — exact commit
|
| Arm | Verdict | Exact evidence at bc72ee5219 |
|---|---|---|
WSL2 (Ubuntu-24.04) |
VERIFIED | On the isolated physical-Windows client, explicit-close tab 3aa715be… stayed absent after restart; live tab 1f73ddf2… returned with the same …@@3126b018 PTY and inspectProcess={foregroundProcess:"wsl.exe",hasChildProcesses:true}. The real-distro contract suite passed 21/21 executed tests (1 capability-dependent skip), including buildWslExecArgs routing through --exec and buildWslCapturedLoginShellCommand dropping login-banner stdout. closed branch · live branch · post-restart |
Native Linux (openclaw) |
VERIFIED | Clean profile /tmp/orca-qa-15666-linux/profile, renderer 29522, dedicated CDP 29521/29523, and identity Orca: bc72ee5219 were checked before captures. User-closed tab b705d064… stayed absent; live tab 95e58546… survived a consumed one-shot fake-ps failure and false exit-shaped title, retained {foregroundProcess:"codex",hasChildProcesses:true}, and reattached with the same …@@89e3eed0 PTY. transient live · post-restart · explicit close |
| Native Windows | VERIFIED | Uniquely named detached worktree and clean profile …\\orca-qa-15666-win-dfd0\\profile, renderer 29602, dedicated CDP 29601/29603/29604, with identity Orca: bc72ee5219. Closed tab 997dd44c… / PTY …@@5debdf63 stayed absent; survivor 2f1e06f9… returned with the same tab ID and …@@f03a18b2 PTY and live-child inspection. both branches · post-restart |
| Mixed-version client/host | VERIFIED | Packaged PR client 1.4.178-rc.2.local.1787878435974.bc72ee52190a paired to stable physical-Windows host 1.4.190. The old b61c… repo prefix reproduced selector_not_found; the correct stable-host selector was id:a0a2b4a4…::C:/Users/neil/orca/workspaces/orca/qa-15666-retry-bc72-dfd0. Explicit-close tab qa15666-mixed-close-tab / handle term_cc7… became exited and stayed absent. A visibly live Codex 0.149.1 tab survived with the same qa15666-mixed-survivor-tab, handle term_c9bc…, and PTY …@@253034dd even though the old host returned the misleading {foregroundProcess:"bash.exe",hasChildProcesses:false}—the fixed PR client correctly treated the mixed-version evidence as unverifiable rather than retiring it. Remote tabs were intentionally background-only, so this arm's decisive evidence is the paired-host RPC/session snapshot and terminal screen read; packaged client after restart. |
| Signed packaged restart (macOS arm64) | VERIFIED | Built package dist/mac-arm64/Orca.app, version 1.4.178-rc.2.local.1787878435974.bc72ee52190a, identity Orca, isDev:false. The original no-CDP startup was diagnosed from a process sample: the main thread was blocked in SecItemAdd → AuthorizationCopyRights on a Keychain prompt; relaunching the same package non-interactively with --use-mock-keychain exposed CDP. Rendered close + Stop Agent removed tab 8ce45790… / PTY …@@a6b9665f; live tab 395998b5… returned after real window.api.app.restart() with the same PTY …@@8f5493ae, incarnation c62b30cb…, and {foregroundProcess:"node",hasChildProcesses:true}. before restart · after restart |
This also incorporates and supersedes the earlier exact-commit packaged-only note. No source files were changed during validation.
Verification evidence for head
|
Host re-validation at current head
|
| Arm | Verdict | Exact evidence at 08f68fd304a9 |
|---|---|---|
WSL2 (Ubuntu-24.04, physical Windows) |
VERIFIED | Dev build in qa-15666-retry-bc72-dfd0 (clean profile orca-qa-15666-r2-win/profile, CDP 29701/29711). Explicitly closed WSL tab / PTY …@@a61f63ec (confirmed through the rendered "Stop running command?" dialog) stayed absent after restart. WSL survivor …@@8c0ea339 reattached with the same PTY and full scrollback (wsl.exe -d Ubuntu-24.04 history intact) and answered a post-restart echo qa15666r2-wsl-alive-42 interactively. Real-distro contract suites at this head: runner + UNC-delete + approved-root-race pass; the banner suite passes 5/5 run in isolation (one 30s timeout appears only when all four files share a run — the runner suite's ~/.profile sleep 60 fixture bleeding into the banner suite on this loaded shared box, not a product defect). four tabs live · after closes · post-restart survivor interactive |
Native Linux (openclaw) |
VERIFIED | Built at head in qa-15666-host-worker-linux-858bed (now checked out to 08f68fd304), clean profile /tmp/orca-qa-15666-r2-linux/profile, CDP 29621/29622, daemon launched with a one-shot failing ps on PATH. The consumed failure made inspectProcess return {foregroundProcess:"node", hasChildProcesses:false, unavailable:true} — the degraded read stayed unverifiable instead of confirming an exit — and the next read recovered {codex, hasChildProcesses:true}. Explicit-close tab …@@002ffe36 (Stop Agent dialog) stayed absent across two app restarts; survivor …@@5136d5b9 reattached both times with the same PTY and live codex. both live · Stop Agent dialog · post-restart |
| Native Windows | VERIFIED | Same dev build/profile as the WSL arm. Explicitly closed codex tab / PTY …@@3f4810a8 stayed absent after restart. Survivor …@@973e3458 reattached with the same PTY, codex TUI interactive at its update prompt, inspection {foregroundProcess:"codex"} (codex.exe reports no children on Windows — live foreground either way). before restart · post-restart tabs · codex survivor |
| Mixed-version client/host | VERIFIED | Packaged PR client 1.4.178-rc.2.local.1787881233862.08f68fd304a9 (this head's daemonProtocolVersion 37 + new inspection contract) paired via pairing code to stable host orca-ide 1.4.190 on openclaw (this round's stable host; the Windows low-spec runtime was unreachable). In remote workspace qa-15666-host-worker-linux-858bed: client-side explicit close of codex tab …@@fc28ccb3 / handle term_ca11a4a3… propagated to the old host and stayed closed after client restart (host terminal list confirms absence). Survivor …@@0df3fc88 / term_8afbc4d8… reattached in the client with the same tab, and the 1.4.190 host independently reports it connected/writable with the codex TUI live. Four pre-existing host sessions in the same workspace were left untouched and all survived. survivor-to-close marked · after close · post-restart reattach |
| Packaged restart (macOS arm64) | VERIFIED | Fresh pnpm build:mac at this head → dist/mac-arm64/Orca.app, isDev:false, version string embeds the SHA; launched non-interactively with --use-mock-keychain and an isolated E2E profile. Explicit close (rendered "Stop running command?" → Stop and Close) removed tab / PTY …@@0e6d69a8; after a real window.api.app.restart() the closed tab stayed absent and survivor …@@af5b28de reattached with the same PTY and live codex ({codex, hasChildProcesses:true}); the survivor then also held across a second restart during the mixed-version pass. both live · after close · post-restart |
Observation outside this PR's diff (dev-only surface, noting for completeness): on Linux and Windows dev builds launched with --remote-debugging-port, the daemon and PTY children inherit the DevTools listener socket, so after window.api.app.restart() the relaunched app cannot rebind the port (Linux came back CDP-less; Windows' relaunched instance, a child of the harness shell, later exited). Verification restarts were completed by quitting and relaunching the same build on a fresh port; the retire/reopen decisions held identically across every restart cycle, including the double-restart cases. The macOS packaged app does not exhibit this — app.restart() reattached CDP on the same port.
No source files were changed during validation.





ELI5
If you quit Claude on purpose and then close its terminal, Orca should not bring that finished session back with
claude --resumethe next time you open the app. Only sessions that were still alive when Orca quit should be restore candidates.Put plainly: when you type
/exitin Claude and get your shell prompt back, that conversation isfinished. Orca kept a "this session was interrupted, offer to resume it" note anyway, so the next
time you opened Orca it could bring the finished conversation back. This change tears up that note
once Orca has watched the agent cleanly exit — and only then. If Orca crashed, or lost contact with
a remote machine and genuinely can't tell what happened, the note is kept, because that is the case
resume exists for.
User-facing before / after
When it bites
Anyone who runs Claude Code in an Orca terminal, quits it on purpose, and relaunches Orca — on any
platform. The SSH row bites whenever a remote connection drops while an agent is running there.
What Changed
agent-exitedfact matches the PTY incarnation and pane attribution.pty-exittab close retains the record.unverifiable, not process death.This supersedes #14534 and fixes the same lifecycle boundary without weakening crash recovery or remote-host safety.
Why
sleepingAgentSessionsByPaneKeyis written while the agent is live and previously survived a clean, process-confirmed return to the shell. Closing the shell terminal intentionally preserves sleeping records for crash recovery, so a deliberately exited session could look interrupted and auto-resume on relaunch.The authoritative signal is the existing main-process fact: the title returned to a shell, the execution host confirmed the foreground process is no longer the agent, the PTY incarnation still matches, and the pane attribution has not changed. Missing, stale, replayed, or unverifiable evidence fails closed by preserving recovery authority.
Reliability Contract
agent-session.provider-ownership): a host-confirmed clean agent exit retires only that provider-session claim and its aliases; crash loss, stale incarnation, mismatched attribution, and unverifiable remote state cannot revoke resume authority.claude --resumeafter an app restart (local macOS, hibernation off) #14228.agent-session.provider-ownershipgate inconfig/reliability-gates.jsonc.Linked Issue
Fixes #14228
STA-4110
Visual Proof
After launching Claude in a fresh terminal, sending
/exit, returning visibly toTerminal 3, and exiting the shell, the target tab and provider-session record were both absent. A renderer reload restored only the two unrelated terminal tabs and did not issueclaude --resumefor the retired session.Testing
onPtySpawn; the regression test passed after propagation was added.agent exitfilter: 5 passed, 1207 skipped.claude→/exit→ visible shell → sleeping record absent → shellexitclosed tab → reload kept target tab/session absent.pnpm typecheckpassed.oxfmt --check, max-lines ratchet, andgit diff --checkpassed.Review
unverifiable; destructive retirement requires execution-host confirmation and matching authority.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Checklist
Author