Skip to content

Keep finished agents marked Done while their panes sleep - #41793

Merged
brennanb2025 merged 104 commits into
mainfrom
brennanb2025/slept-done
Nov 15, 2026
Merged

brennanb2025 merged 104 commits into
mainfrom
brennanb2025/slept-done

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

You finish a task, then Orca puts its terminal pane to sleep. The pane should still say Done in the workspace card, Agents list and dashboard until you close it. This companion to #40774 keeps that finished result with the sleeping pane, including across an Orca restart.

Files Added Deleted Net
Test 136 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4756 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1378 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3378
Prod 337 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​7508 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4613 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2895

What Changed

  • Before: removing the old finished-row retention in Remove finished-agent retention #40774 also removes Done when a pane sleeps. After: deliberate sleep keeps Done on that exact pane. An ordinary exit or disconnect still removes its row.
  • One agent record: a sleep annotation on the existing status records the deliberate sleep. Updates address the changed agent by its key, instead of copying the full list. Readers refresh the affected entries and derive ordering where displayed.
  • Consistent views: sidebar, Agents list, dashboard and popout, Activity, Workspace Cleanup and paired clients use the same finished state. Sleeping unfinished work never becomes Done.
  • Lifetime and recovery: closing a pane removes its Done state. Waking it and doing more work replaces the old state normally. Sleep preserves the original times and read state, without another completion or unread event; a Done label grants no permission to resume a session.

Why

Orca previously recreated finished rows after live status disappeared. That confused a sleeping pane with an exited process or lost host. #40774 removes that inference; this change records deliberate sleep at its source and keeps the finished result until its pane closes. Updating records by key also removes full-list copies from ordinary status updates.

Merge dependency: #40774, then this PR, then #42104, the separate sender change that sends only changed agent status rather than every workspace, back to back. Brennan requires these changes to merge together in that order. This PR is not ready to merge alone: without the sender change, faster updates here can make the old sender resend the full workspace list more often.

Linked Issue

Tracked in STA-14820.

Visual Proof

Real Windows/WSL and Mac checks verified manual sleep, restart, closing one side of a sleeping split, and real Claude and Codex follow-ups. The final remote Sleep check also preserved the original completion times and kept the workspace read. Local automatic sleep now passes with both real agents. Remote automatic Sleep does not trigger on main or on this branch; it is tracked separately.

Remote Sleep, before: both real agents have replied and the workspace is read.

Remote agents finished before Sleep

Remote Sleep, after: both processes stopped, their sleeping Done rows kept the original times, and the Projects bell stayed at zero.

Sleeping remote agents keep their finished state and read status

Manual sleep: the workspace stays asleep with its finished agents shown as Done.

Done rows after manual sleep

Restart: sleeping Done rows remain after a graceful Orca restart. The paired host preserved their original completion times.

Sleeping agents after restart

Codex resume: waking the pane and sending another message produced a real reply in the previous conversation.

Real Codex follow-up reply

Close while asleep: closing a sleeping tab through its previously issued terminal handle removed its row and left another tab's Done row. The later Mac check also closed the Claude side of an asleep split using its pre-sleep handle: the Claude row left, and the same Codex sibling stayed Done with its original completion time.

Remaining Done row after sleeping tab close

Close one side while asleep: the pre-sleep Claude handle closed only its leaf; the inactive split kept its Codex Done row with the original time.

Codex sibling remains after asleep Claude close

Claude resume: after the remote processes stopped for sleep, Claude reopened the original conversation and recalled the codeword given before sleep. This proves the resume reply. A later targeted remote Sleep check also preserved completion clocks and read state.

Real Claude and Codex replies after remote wake

Local automatic sleep: a finished Claude pane remains Done after its process automatically stops, with its original age and no new unread. Codex passed the same flow separately.

Claude Done after automatic sleep

Testing

  • CI: current head cc8be2168aa7b7c81985a086b3ef53269a48afaf is green, including typechecks, all 12 unit shards, cross-version compatibility, both managed-SSH shards, and the aggregate PR gate. The integration preserves keyed status ownership and main's moved modules. Author checks also passed typechecking and 25 named suites/139 tests. The host-scoped compact-card regression covers 100/1,000 sleeping roots, unrelated updates and row drops, and relevant host/acknowledgement changes.
  • Focused checks: sleep-preserved exit, ordinary exit and close, terminal rebinding, provider conversation capture, paired terminal IDs, and completion clocks have owning regression coverage. Two projection files also passed locally with nine tests. Required changed-code checks ran before every push; some local gates timed out under shared-machine load. The green CI result supplies the complete validation.
  • Windows/WSL: real Claude and Codex panes kept Done and their original completion times across manual sleep and a graceful restart. Codex resumed its conversation and replied, then ordinary exit removed its row. Closing an asleep tab through its pre-sleep handle removed only that tab. The baseline Claude pane returned to a shell, so that attempt did not prove Claude resume.
  • macOS and remote: closing the Claude side of an asleep split removed only that leaf; its sleeping Codex sibling kept its original time. Real remote Claude resumed the prior conversation and recalled a word from before sleep; Codex replied after waking too. The final remote Sleep run stopped both processes, preserved their original completion times, and kept the workspace read. All 101 saved frames during sleep contained both original finished records. Another 66 later drained frames had no saved bodies and are excluded from that claim.
  • Automatic sleep: the real local Codex process automatically stopped after about three minutes. A separate Claude-only run automatically stopped the real Opus 5.5 process after about two and a half minutes. Each exact pane kept Done, its original completion time and read state. The first Claude attempt used mismatched isolated config directories and had no hook identity; aligning the QA directories restored hooks and the real run passed. Both raw-packet audits verified the saved events, frames and process records. Remote automatic sleep did not trigger: a separate existing main-branch bug compares different terminal IDs when deciding which process to sleep and when stopping it. That bug is outside this change and has been reported for a separate fix. Manual remote Sleep passes. No remote automatic-sleep pass is claimed.
  • Host coverage: CI exercises Electron main, orcad and managed SSH startup. Running-app checks cover Windows/WSL, a loopback paired host, and actual SSH server deployment, replies, sleep and wake. Paired commands reconnected individually; continuous disconnect/reconnect was not tested. The unchanged CLI runtime-selection wrapper is UNTESTED.

Benchmark: one M4Air, Node 24.19, pinned main versus this change; 100 and 1,000 active workspaces, three independent processes per side in alternating order, ten trials per process. All 12 runs completed. Values are medians of each side's three process medians, in milliseconds.

Harness work window 100 workspaces: main → this change 1,000 workspaces: main → this change
Agent-status update 3.97 → 3.59 31.7 → 26.0
Create tab 28.0 → 26.5 254.6 → 248.3
Close tab 30.3 → 28.6 269.0 → 296.8

Status updates were consistently faster at both sizes. At 1,000 workspaces, create timings overlapped and close timings were inconclusive: the branch's three process medians were 508.8, 259.4 and 296.8 ms, versus main's 294.5, 268.4 and 269.0 ms. The slow process and run-order effects prevent attributing the close difference to the code; no improvement for large-workspace tab operations is claimed. These windows include React commits, scheduling and garbage collection with a fixed fake-clock tail; they are not Electron frame times or network latency. Later title/prompt handling uses changed pane keys and constant-time active-agent checks; mounted readers have focused real-store coverage and are not measured in the table.

A focused SQL check found no additional database statements: changing one record uses six statements; moving one while deleting another uses seven. Neither reads the full agent list. Four unchanged development-build watcher tests failed on both this branch and pinned main on this Mac with matching Node dependencies; full CI passed.

Risk

Intended error handling: a failed internal state listener is logged without cancelling an accepted update or preventing its remaining notifications and follow-up actions. Errors that reject the update itself still reach the caller.

Level: High. The riskiest part is preserving a sleeping pane's finished result while retiring its process, then removing it on real close. A mistake can hide Done too early or leave a stale row. Remote manual Sleep now passes its completion-time and read-state check. Local automatic sleep passes with both agents and both raw-packet audits are complete. UNTESTED: remote automatic Sleep does not trigger on main or on this branch; tracked separately. The three PRs require joint landing.

  • Intended: a finished result is kept independently of its process. External terminal panes also need exact pane lifetime and existing host identity checks. Older hosts may supply fewer rows; older readers may ignore the optional sleep annotation. No minimum paired-host version is added.
  • Intended, accepted by Brennan November 11: Orca 1.4.255 or 1.4.256 can lose the asleep-Done marker after loading and saving this data. Transcripts and existing resume data remain. No downgrade shim or extra saved field is added.
  • Intended, accepted by Brennan November 10: older paired readers may not announce an earlier completion found only in history after the pane later slept. Ordinary live completion delivery is unchanged.
  • Other observed behavior: the original baseline Claude pane returned to a shell after upgrade; its cause remains unassigned. This is not counted as successful resume.
  • Backout: revert the companion before its base. Older builds ignore the optional sleep annotation and may discard it when saving; a revert cannot restore a discarded marker. Transcripts and existing recovery data remain.

Review

Independent review and carried evidence are recorded in the PR's status comment. Local automatic-sleep evidence and both raw-packet audits are complete. Remote automatic Sleep does not trigger on main or on this branch; tracked separately.

Agent skill upstream boundary

  • Not applicable; this change copies no upstream skill-installer material.

Notes

macOS, Linux, Windows, WSL, remote hosts, mobile and older saved-data compatibility are covered by the tests and CI listed above; the remote Sleep check passed; local automatic sleep passes with both agents, the separate remote automatic-sleep bug remains unresolved, and CLI-wrapper coverage is incomplete.

Checklist

  • Explained the user-facing before/after, mechanism and reason.
  • Stated risk, compatibility limits, dependencies and backout.
  • Independent source review and performance screening completed.
  • Current published-head CI is green; local changed-code checking passed 48/50 gates, with formatting limited by a preserved untracked report and the broad test step timing out. The status comment records the full limitations.
  • Remote Sleep completion-clock and read-state preservation verified.
  • Local Codex automatic sleep verified.
  • Claude automatic sleep and both raw evidence audits completed.
  • Remote automatic-sleep limitation disclosed as existing main behavior, tracked separately.

registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 20, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 20, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 20, 2026
… contract and pane status

The queued-prompt observer imports the send contract from where v1.4.261 regrouped it.
Its test now gives the runtime the per-pane status lookup that v1.4.261's submission
gate reads (stablyai#41793), so the busy agent it models reads as working again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 21, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 21, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 21, 2026
… contract and pane status

The queued-prompt observer imports the send contract from where v1.4.261 regrouped it.
Its test now gives the runtime the per-pane status lookup that v1.4.261's submission
gate reads (stablyai#41793), so the busy agent it models reads as working again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 21, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 21, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 21, 2026
… contract and pane status

The queued-prompt observer imports the send contract from where v1.4.261 regrouped it.
Its test now gives the runtime the per-pane status lookup that v1.4.261's submission
gate reads (stablyai#41793), so the busy agent it models reads as working again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 22, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 22, 2026
… contract and pane status

The queued-prompt observer imports the send contract from where v1.4.261 regrouped it.
Its test now gives the runtime the per-pane status lookup that v1.4.261's submission
gate reads (stablyai#41793), so the busy agent it models reads as working again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 23, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 23, 2026
… contract and pane status

The queued-prompt observer imports the send contract from where v1.4.261 regrouped it.
Its test now gives the runtime the per-pane status lookup that v1.4.261's submission
gate reads (stablyai#41793), so the busy agent it models reads as working again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 23, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 23, 2026
… contract and pane status

The queued-prompt observer imports the send contract from where v1.4.261 regrouped it.
Its test now gives the runtime the per-pane status lookup that v1.4.261's submission
gate reads (stablyai#41793), so the busy agent it models reads as working again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 24, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 24, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 24, 2026
… contract and pane status

The queued-prompt observer imports the send contract from where v1.4.261 regrouped it.
Its test now gives the runtime the per-pane status lookup that v1.4.261's submission
gate reads (stablyai#41793), so the busy agent it models reads as working again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 24, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 24, 2026
… contract and pane status

The queued-prompt observer imports the send contract from where v1.4.261 regrouped it.
Its test now gives the runtime the per-pane status lookup that v1.4.261's submission
gate reads (stablyai#41793), so the busy agent it models reads as working again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 26, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 26, 2026
… contract and pane status

The queued-prompt observer imports the send contract from where v1.4.261 regrouped it.
Its test now gives the runtime the per-pane status lookup that v1.4.261's submission
gate reads (stablyai#41793), so the busy agent it models reads as working again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 26, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 26, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 26, 2026
… contract and pane status

The queued-prompt observer imports the send contract from where v1.4.261 regrouped it.
Its test now gives the runtime the per-pane status lookup that v1.4.261's submission
gate reads (stablyai#41793), so the busy agent it models reads as working again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 27, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 27, 2026
Upstream keeps agent statuses in one live map shared by every store version
(stablyai#41793) and dropped finished-agent retention (stablyai#40774). Indexing that map
like a record finds nothing, so read-aloud never saw a turn finish, Ask
named no target agent and Ctrl+Enter never steered. Ask and steering read
it with get/has; read-aloud keeps its own copy of the rows it last saw,
because the previous store state reads the same live rows as the new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
registered2nd added a commit to registered2nd/orca that referenced this pull request Nov 27, 2026
… contract and pane status

The queued-prompt observer imports the send contract from where v1.4.261 regrouped it.
Its test now gives the runtime the per-pane status lookup that v1.4.261's submission
gate reads (stablyai#41793), so the busy agent it models reads as working again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

4 participants