Repository navigation
A running agent's resume note is not a sleep, so switch-on builds report it connected (dark, layout-owner build only) - #31485
Conversation
…-on builds The shared layout load put every pane resume record into leaf.sleeping, so main's terminal index read a live or quit capture as a slept pane and terminal.list reported running agents as disconnected and unverifiable. Records of slept panes (isPaneSleepRecord) now load to leaf.sleeping and running agents' records to leaf.resume; both save to the same sleepingAgentSessionsByPaneKey entry, so the disk format is unchanged. The disk-field census names both holders, and a model rule refuses a pane holding both.
… drops either record
…esume record as awake
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
ELI5
In test builds where the main process owns the layout (the "layout-owner" switch, still off for users), Orca saves a note for every running coding agent that says how to resume it after a crash. The layout code stored that note in the same place as "this pane is asleep". So every running agent looked asleep, and Orca reported its terminal as disconnected and not writable. Now a resume note for a running agent is kept separately, and only a real sleep counts as asleep.
What Changed
Before (switch-on builds only):
connected: falseandwritable: falsewith verdictunverifiableinterminal.list.'live'for every running agent (and'quit'for one captured at quit, which may still be running after a warm reattach).leaf.sleeping. Main's terminal index (terminal-surface-index.ts,main-terminal-surfaces.ts) turned that into status'sleeping', and the terminal summary forced the pane disconnected.live-background-terminal-mount-authority.spec.ts:521fails for this reason. It has failed on main since Layout-owner build: main answers terminal questions from its own layout (A1, dark) #31187.After:
leaf.sleepingmeans only a real sleep: origin'worktree-sleep'or no origin. That is the desktop's existing rule (isHibernationDoneRecord, and theorigindoc inagent-session-resume.ts). It is now one shared predicate,isPaneSleepRecord.'live'or'quit'record goes to a new optionalLayoutLeaf.resume. It moves and closes with its pane exactly assleepingdoes.sleeping ?? resumeback to the samesleepingAgentSessionsByPaneKeyentry, so the file on disk is byte-identical.sleep: a record-only live or quit capture is routed by the predicate.startPane: an unbound pane with either record is still refused, as today, so a plain start never loses how its agent resumes.wakedrops either record. A waking start wakes only slept panes, never a running agent's pane.shutdown-reconnect-facts.ts) counted a live record as a sleep. That left an agent's SSH relay session, and its workspace, out of what the next startup reconnects. It now uses the same predicate.sleepingdisk table can now name one alternate source (orFrom): "leaf.sleeping.Xorleaf.resume.X".leaf_sleeping_and_resume) is checked after every command in the command tests.The terminal index readers are unchanged: once
leaf.sleepingmeans only sleep, they are correct.Why
The lead ruled that the fix goes at the save/load boundary, so
leaf.sleepinghas one meaning everywhere, rather than every reader learning to skip live records. We considered keeping live and quit records as "carried" records outside the leaf. That needs no census change, but the record would not follow its pane when main moves or re-keys it, so resume after a crash would lose it. A leaf field moves with the pane for free.Linked Issue
Resolves ledger L254.
Visual Proof
N/A: dark change, switch-on builds only. No UI or copy change. It changes what
terminal.listreports for running agents in layout-owner builds.Testing
These tests fail without the fix:
'live'or'quit'record reads connected, writable andlive.startPanerefusal for an unbound pane with a resume record.closePaneandcloseTabs.These pass at both base and head, as they should:
sleeping.sleepingAgentSessionsByPaneKeybyte-identical for all four origins.A waking start leaves a running agent alone.
Gates:
pnpm tcand the CI static-analysis gate pass.src/main/runtime,src/main/persistence,src/renderer/src/runtime,src/renderer/src/components/terminal-paneandsrc/shared/workspace-layoutwas compared at base and head, switch-on and switch-off. No file fails only at head; the only head-only failures were flaky under load:structured-agent-shell-environmenthit a temp-directory cleanup error (ENOTEMPTY) and passes alone;workspace-layout-paired-desktophits a 30 s timeout at base and at head;terminal-tail-redraw-wall-timepasses alone.Server specs (switch-on, fresh build at base 505d671 and at head):
Agent skill upstream boundary
Notes
Resolves ledger L254
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)