Repository navigation
fix(terminal): bring each pane back after a terminal service restart when it is shown - #28880
Conversation
…when it is shown After Settings -> "Restart terminal service", every pane that was open kept its dead process: typing did nothing and agents never resumed until Orca relaunched. A restart-replaced exit now arms the pane: the visible pane spawns its replacement at once, any other pane when it is next shown, through the same fresh spawn and cold-restore agent resume the hibernation wake uses, so old output stays above the new prompt. The exit keeps the agent status the resume reads, and clears the dead binding so the replacement binds as a first spawn. Local spawns wait for an in-flight restart so they reach the new daemon. Claude-Session: p2-headless
…her flow rebound A restart exit is a process death to main's agent-status store, which clears the pane's row before the window sees the exit, so keeping the window's copy changed nothing. The resume reads the live recovery record every agent turn already writes, as a relaunch after a crash does. The replacement also stands down when the pane's stored binding already names another process. Claude-Session: p2-headless
A finished-turn agent pane took the hibernation wake, which gives up when its record changes before the pane is shown. Every restart exit now arms the replacement directly. Claude-Session: p2-headless
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
ELI5
"Restart terminal service" ends every terminal and starts a fresh background service. Until now, every terminal that was already open stayed dead afterwards. Typing did nothing and agents didn't come back until you quit and reopened Orca. Now each terminal comes back like it does after a relaunch: the one you're looking at right away, every other one when you next look at it.
What Changed
Before: after Settings → "Restart terminal service":
After:
Mechanism:
startFreshColdRestoreAgentResume). It does this only if nothing else has given the pane a process in the meantime.Why
Alternatives I rejected:
Linked Issue
N/A (maintainer; layout refactor follow-up to #28852)
Visual Proof
Hidden app, fake agent CLI (no real credentials). Each shot is taken after showing the pane and typing
echo LIVE_….Background tab, before (typing does nothing):

Background tab, after (old output kept, new prompt, echo works):

Agent pane in another workspace, before (dead, no resume):

Agent pane in another workspace, after (resume command runs, then a live shell):

Testing
Real app, hidden window (
ORCA_BACKGROUND_LAUNCH=1), isolated profile and home on macOS. A fakecodexreports through the real hook server. Each pane is shown, thenechois typed into it.More checks:
Two restarts before a visit: the hidden pane still gets exactly one new process when shown.
Layout oracle: all 21 scenarios pass. The live-daemon-restart pane-marker check, which was known to fail on main, now passes, so its entry is removed.
New unit tests,
pty-connection-restart-replacement.test.ts:New unit test,
daemon-restart-state.test.ts: the restart wait settles on success and on failure.Gates:
pnpm tc, oxlint, oxfmt, the changed-code quality gate and the layout, focus, max-lines, sync-spawn and electron ratchets pass. 302 targeted terminal-pane tests pass.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)