You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Agent status changes stop republishing the whole session graph - #42104
At 1,000 workspaces, every agent status change made the window rebuild the whole session graph and send it to main: about 196 KB per status ping. Main then re-derived the phone's session tabs from it. Under a burst of status updates, this graph republication dominates both processes. With #41793 (keyed per-agent status reads), the window stops falling behind, so the unchanged graph sync fires even more rounds. In our fleet benchmark, the status-storm traffic from window to main grew from 14.8 MB to 35.4 MB, and main CPU by 18%. This PR must merge back to back with #41793, never after a gap.
What changes for users
Nothing visible. Phones and paired clients see the same session tabs and status. Status updates stop costing a full session-graph rebuild and send, so the app stays responsive with hundreds of agents.
How
The window sends only what changed. When an agent's status changes, the window sends main just the changed panes' status rows: set or removed, with an epoch and sequence number, coalesced on a short timer. The rows come from the keyed status owner's changed keys. The session graph no longer rebuilds or publishes on status changes: status left the graph sync key and payload, and the old graph status projection is deleted.
Main admits rows only from the authoritative window. It uses the same authority and renderer-generation check the graph uses. Status traffic never promotes a window or satisfies a graph waiter.
Main joins status rows by occupant. It keeps one status row per pane, keyed by pane and by the terminal the window had bound when it accepted the row, and joins those rows with the graph's membership.
A row for a pane the graph hasn't shown yet waits until the graph shows it.
A row for a terminal that has since left the pane is dropped and never comes back.
The phone's title-dependent shaping (hiding status under management titles, split fallback) runs at that join, so a title-only change re-evaluates it.
Only the affected worktree's phone frame is updated and notified. No fleet-wide pass runs on a status-only change. Until the window's first status snapshot for a new epoch arrives, phone notifications are held, so a reload never shows a frame without status.
Main only tracks departed occupants it still has to reject. It fences an occupant that left a pane only while that occupant still has a status row or a pending one. The occupant's final "removed" update (its tombstone) and every snapshot release the fence, so the set returns to live state as panes come and go.
A refused update retries. The local status acknowledgement carries an optional reason: not-ready or superseded. A window refused while main is reloading retries with capped backoff and then a fresh snapshot. A superseded window stops for good and never becomes the publisher. This is same-build local IPC only: no saved data and no remote or phone wire change.
A status change captures only its own pane's terminal binding. It no longer walks the tab's split tree.
Unchanged:worktree.ps, terminal.agentStatus, native-chat structured status, headless sources and paired-host mirrors.
Reads are keyed per entity and fed by the producer's changed keys. When the agent-status producer moves into the backend process, the backend's own rows replace the window's sender. The window-side sender, renderer-generation admission, pending join and snapshot request are then deleted; main's per-pane apply moves with the runtime. Tracked in the backend-process plan.
Benchmark
Benchmark: fleet adapter (~/orca-qa/fleet-adapter), 3 alternating process pairs × 10 warm trials, companion #41793 (7d964f3) → this PR (1df619ff062). Single-run medians of process medians, script proxies (not app frame times).
Workspaces
Event
Window CPU
Main CPU
Window→main bytes
100
Status ping
20.4 → 15.7 ms
13.4 → 10.1 ms
25.9 KB → 1.3 KB
100
Chat status tick
19.8 → 13.6 ms
12.3 → 7.9 ms
17.5 KB → 0
1,000
Status ping
55.8 → 32.8 ms
21.1 → 11.4 ms
195 KB → 1.3 KB
1,000
Chat status tick
49.1 → 27.1 ms
18.4 → 9.0 ms
187 KB → 0
Status storm against main before #41793, at 1,000 workspaces:
Tails at 100 workspaces. On a heavily loaded shared machine (CPU load 32–36), five worst-case tail metrics exceeded the 5% / 1 ms tolerance in all three pairs:
create-tab main loop max: 17.0→23.2, 12.4→15.3, 7.1→12.6 ms;
at 1,000, workspace-switch window and main loop max.
An earlier run's create-tab tail did not repeat in this one. Instrumented runs show identical work counts on these flows, and create-tab allocation did not grow (−2.1% at 100, +0.7% at 1,000). These deltas fall inside the run-to-run spread measured on the baseline itself (for example, the companion's own create-tab main loop max ranged 7–17 ms across pairs), so under the perf-lane gate (one measurement of the main gain, plus no regression beyond noise) they are reported, not treated as regressions. A quiet-machine re-check was attempted on Omarchy but its install was refused by the machine's tool shim, and it was not repeated.
Allocation during workspace switch at 1,000. Main GC counts during workspace switch rose (9–10 → 18–22 per 10 events), with main allocation mixed across pairs (+13.8%, +9.1%, −5.3%). The source is not in any instrumented site.
Focused tests (6 files, 26 tests, plus the repair fixtures) cover:
admission from the authoritative window only;
the replica's membership and pending recovery: pane not yet in the graph; occupant change before and after the graph round; null→bound; remount; X→Y rebind;
phone parity: title shaping hide/show with no status write, split fallback;
coalescing, and snapshot after a window restart;
keyed-owner batch changes;
status excluded from graph sync;
the phone hold until the window's first status snapshot, and its release when the window closes or fails before sending it, with or without a headless server;
status capture that doesn't walk the saved split layout at 100 and 1,000 panes.
Fleet adapter parity: phone/session-tab digests and the scoped worktree.ps and terminal.agentStatus byte hashes are equal to Keep finished agents marked Done while their panes sleep #41793 at 100 and 1,000 workspaces. There is zero graph, hydration, membership or activity work on status-only ticks.
Every agent status change used to rebuild and resend the whole session graph; at 1,000 workspaces that was about 195 KB per ping. This PR publishes only the changed pane facts, with the same tab/status results on phones and paired clients. Land in order: #41793 → #42104.
Restack after #40774 squash-merged. The branch follows #41793 forward by merges (no rewritten history). Its own diff against #41793 is unchanged apart from integration with main's concurrent work:
Main's test-removal campaign deleted two suites carrying this PR's tests. Those cases now live in files named for what they cover: sync-runtime-graph-status-suppression-title.test.ts (exact suppression title through pane/saved/tab/split fallbacks) and src/main/ipc/runtime-agent-status-admission.test.ts (status admitted only from the current main frame). The test bodies are unchanged; the moved cast got the SAFETY comment the changed-code gate requires.
Line limit: main's Move saved server reads and writes off the main thread #42253 pushed session-window-graph.ts past the 300-line limit. The duplicate tab-id check moved to runtime-graph-tab-ids.ts. The renderer-status binding predicate, which this PR had written twice, now lives once in noteStatusBinding beside captureRendererStatusBindings. Both are pure moves of the same condition, so no new review pair was run. The prior Claude/Codex verdicts at 35218826409 still cover this PR's mechanism.
Validation: check:changed against the PR base passed 38/38, including typechecks and unit tests. The session-graph suites passed (18 tests), as did the relocated tests. Current-head CI is green.
The carried fleet benchmark still applies: at 1,000 workspaces, ping window CPU 55.8→32.8 ms, main CPU 21.1→11.4 ms, window→main 195 KB→1.3 KB; storm traffic 35.4 MB→1.36 MB. Earlier deferrals are unchanged: a possible repeat snapshot request above 2,048 unmatched rows with no demonstrated real path, and a defensive branch for a missing accepted phone snapshot.
… instead
Keeps the capture path's lookup behind its UUID and changed-worktree guards; the window graph stays under the line limit by moving the PTY remount check to the graph promotion base.
Every agent status change used to rebuild and resend the whole session graph; at 1,000 workspaces that was about 195 KB per ping. This PR publishes only the changed pane facts, with the same tab/status results on phones and paired clients. Land in order: #41793 → #42104.
Restack after #40774 squash-merged. The branch follows #41793 forward by merges (no rewritten history). Its own diff against #41793 is unchanged apart from integration with main's concurrent work:
Main's test-removal campaign deleted two suites carrying this PR's tests. Those cases now live in files named for what they cover: sync-runtime-graph-status-suppression-title.test.ts (exact suppression title through pane/saved/tab/split fallbacks) and src/main/ipc/runtime-agent-status-admission.test.ts (status admitted only from the current main frame). The test bodies are unchanged; the moved cast got the SAFETY comment the changed-code gate requires.
Line limit: main's Move saved server reads and writes off the main thread #42253 pushed session-window-graph.ts past the 300-line limit. Two unchanged members moved out to fix it: the duplicate tab-id check now lives in runtime-graph-tab-ids.ts, and isLeafRemountingLivePty moved up to the session-graph-promotion.ts base. A first attempt shared the renderer-status binding predicate between its two call sites. A fresh pair caught that this made the capture path look up every leaf before its UUID and changed-worktree guards (Codex P1, Claude P3). That attempt was reverted, so both binding sites are byte-identical to the reviewed code, and a second fresh pair approved the final moves with no findings.
Validation: check:changed against the PR base passed 38/38 before the last main sync. After it, the only failures were the local 30-minute limit and the known environment tests. Typecheck passed. The session-graph suites passed (18 tests), as did the relocated tests. Current-head CI is green. One unrelated native-chat journal /clear test failed once and passed on rerun.
The carried fleet benchmark still applies: at 1,000 workspaces, ping window CPU 55.8→32.8 ms, main CPU 21.1→11.4 ms, window→main 195 KB→1.3 KB; storm traffic 35.4 MB→1.36 MB. Earlier deferrals are unchanged: a possible repeat snapshot request above 2,048 unmatched rows with no demonstrated real path, and a defensive branch for a missing accepted phone snapshot.
No actionable comments were generated in the recent review.
Walkthrough
This change set separates renderer agent status from runtime graph snapshots. It adds shared publication types, a renderer sender, main-process admission and reconciliation, and mobile projection hooks. It removes the previous agent-status snapshot projection and updates sync keys, mobile-session inputs, and terminal-tab data. Tests cover admission, publication, replica reconciliation, mobile projection, and status suppression.
Merge Risk: Low · up to d7964
Agent status now reaches phones through small incremental updates instead of republishing the whole session graph. Two rare edge cases could leave status publication paused until the next graph or status change: a failed first graph sync with no follow-up change, and a superseded reply racing a newer graph acceptance. Both are minor and self-recovering, so the change is reasonable to merge with owner awareness.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: agent status updates now publish only changed pane-status rows instead of rebuilding and resending the whole session graph. The changeset matches this (status left the…
Description check
The description covers the problem, the user-visible impact, the mechanism, benchmarks, limits, and testing, so the main content is present. It departs from the template in places: the ELI5, Visual Pr…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: agent status updates now publish only changed pane-status rows instead of rebuilding and resending the whole session graph. The changeset matches this (status left the graph sync key and payload, a new renderer-status sender and replica were added). The title is specific and not vague.
Full details: Description check
Explanation
The description covers the problem, the user-visible impact, the mechanism, benchmarks, limits, and testing, so the main content is present. It departs from the template in places: the ELI5, Visual Proof, Risk level, and AI Disclosure sections are not filled in as the template asks, and the Linked Issue section reads 'Fixes #' with no issue number. The Risk section discusses risk in the 'Limits' section but does not give a risk level or a backout plan. The 'Review' and 'Agent skill upstream boundary' sections are missing their content. The Checklist items are unchecked. These gaps are non-critical overall, since the core content is complete.
Resolution
Optional improvements: add an ELI5 summary; fill in the Linked Issue number (or state it is a maintainer PR with an existing issue); add a Risk level and backout plan (for example, a plain revert of this PR and #41793 ordering); state whether Visual Proof is N/A, with a reason; and mark the Testing and Checklist items that are complete.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
…ded graph sync
An inactive sender now asks for a graph sync on each status change (base got this
retry from agentStatusEpoch in the sync key), and a superseded ack parks the sender
until the next accepted graph instead of stopping it.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
Every agent status change used to rebuild and resend the whole session graph; at 1,000 workspaces that was about 195 KB per ping. This PR publishes only the changed pane facts, with the same tab/status results on phones and paired clients.
Follow-up to three review threads, all in the renderer status sender, which now publishes status separately from the graph:
Status stuck after a failed first graph sync (fixed). The sender starts only after a graph sync is accepted. Base retried a failed sync because the agent status epoch was part of the graph sync key, and this PR had removed that. Now, while the sender is inactive, each status change asks the existing coalesced graph scheduler for a sync. That is the same trigger base had, and only while inactive. Once a sync is accepted, status changes send status batches only.
A superseded reply stopped the sender for good (fixed). It now goes inactive and asks for a full snapshot, so the next accepted graph sync (how main re-admits the same page) restarts it.
Follow-up from the repair review: a parked sender kept collecting tombstones for removed panes. It now skips staging while a snapshot is pending; main clears its replica when it applies a snapshot, so nothing is lost.
Closed window's status read from the replica (no change). This matches base, where the closed window's last status rode inside the tab the same way.
Review. A fresh Claude and Codex pair reviewed the repair. Claude found no P0–P2 issues. Codex found the tombstone P1 above, which is fixed. A second fresh pair then passed the full repair diff with no P0–P2 findings. One P3 note: an idle session whose first graph sync failed waits for the next store change, which matches base. The updated renderer-status-sender.test.ts case fails if the repair is reverted. No other tests were added.
Validation. Merged current main with no conflicts. Current-head CI is green; one unrelated native-chat Claude compact test failed once on a startup timing check and passed on rerun. check:changed passed 38/38, and pnpm tc passed. The PR's 6 test files pass (27 tests), and the import-path scan found no missing paths. The fleet benchmark from earlier still applies: at 1,000 workspaces, ping window CPU went from 55.8 to 32.8 ms, main CPU from 21.1 to 11.4 ms, and window-to-main traffic from 195 KB to 1.3 KB.
…web clients
The web stub answers every batch with superseded; with superseded now re-arming
on each accepted graph, a web sender would resend snapshots and request graph
syncs for nothing.
Every agent status change used to rebuild and resend the whole session graph; at 1,000 workspaces that was about 195 KB per ping. This PR publishes only the changed pane facts, with the same tab/status results on phones and paired clients.
Follow-up to three review threads, all in the renderer status sender, which now publishes status separately from the graph:
Status stuck after a failed first graph sync (fixed). The sender starts only after a graph sync is accepted. Base retried a failed sync because the agent status epoch was part of the graph sync key, and this PR had removed that. Now, while the sender is inactive, each status change asks the existing coalesced graph scheduler for a sync. That is the same trigger base had, and only while inactive. Once a sync is accepted, status changes send status batches only.
A superseded reply stopped the sender for good (fixed). It now goes inactive and asks for a full snapshot, so the next accepted graph sync (how main re-admits the same page) restarts it.
Follow-up from the repair review: a parked sender kept collecting tombstones for removed panes. It now skips staging while a snapshot is pending; main clears its replica when it applies a snapshot, so nothing is lost.
Paired web clients no longer start the sender. Their stub answers every batch superseded, which used to stop the sender for good. With the re-arm above, it would otherwise resend snapshots and request graph syncs for nothing.
Closed window's status read from the replica (no change). This matches base, where the closed window's last status rode inside the tab the same way.
Review. A fresh Claude and Codex pair reviewed the repair. Claude found no P0–P2 issues. Codex found the tombstone P1 above, which is fixed. A second fresh pair then passed the full repair diff with no P0–P2 findings, and a third passed the web-client gate with no findings. That third pair also ruled out a later external claim that a stale superseded reply could undo a newer accepted graph: main's status handler is synchronous, so its reply always arrives before a later graph reply. One P3 note: an idle session whose first graph sync failed waits for the next store change, which matches base. The updated renderer-status-sender.test.ts case fails if the repair is reverted. No other tests were added.
Validation. Merged current main with no conflicts. Current-head CI is green. On the previous head, one unrelated native-chat Claude compact test failed once on a startup timing check and passed on rerun. check:changed passed 38/38, and pnpm tc passed. The PR's 6 test files pass (27 tests), and the import-path scan found no missing paths. The fleet benchmark from earlier still applies: at 1,000 workspaces, ping window CPU went from 55.8 to 32.8 ms, main CPU from 21.1 to 11.4 ms, and window-to-main traffic from 195 KB to 1.3 KB.
* Remove finished-agent retention and keep sleeping status with panes
* Fix legacy pane projection and sleeping-agent regression fixtures
* Cover sleeping display-only status in parked terminal coverage
* Keep pane conversation identity only across continuous agent observations
* Remove duplicate import and keep sleep fixtures type checked
* Preserve conversation boundaries across replays and inherited clocks
* Cover conversation map stability across a large status batch
* Bound conversation capacity work to changed pane owners
* Pass capacity classifiers their layout input directly
* Finalize conversation provenance once per status batch
* Keep paired snapshot tests focused on observable outcomes
* Type the conversation provenance test fixtures explicitly
* Consolidate agent session imports after main merge
* Preserve provider replacement evidence when resetting conversation continuity
* Separate retention deletion from sleeping agent display
* Restore migration row bucket comparison
* Skip unusable pane identities before title ownership lookups
* Refresh conversation titles when their owning pane changes
* Update completion test sound mock after module move
* Keep finished agent status with sleeping panes and update agents by key
* Forward sleeping pane status and scope paired tab updates
* Preserve keyed selectors and compiler invalidation through final checks
* Keep bound store hooks visible to the compiler and measure published links
* Install provenance measurement before factory capture
* Use a static store hook and name presentation metadata once
* Preserve keyed freshness and atomic agent status publication
* Preserve remote folder dashboard regression after suite retirement
* Model pane wake before live identity reobservation in regression
* Share keyed row transactions and finish main integration
* Align runtime fixtures with keyed agent status reads
* Keep status projections addressed and activity summaries current
* Retire empty workspace status summaries after their source leaves
* Use the standard store fixture for parked terminal graph tests
* Align status fixtures with app types and a fixed test clock
* test: capture stored terminal render failure details
* Read terminal titles and completion prompts from keyed agent status
* Compose foreground agent state in worktree test stores
* test: complete lineage list agent state fixture
* Keep sleeping completion when retiring process authority
* Run durable agent-hook status tests with Node SQLite
* Preserve sleeping Done when renderer retires its process
* Update terminal fixtures for process retirement
* Spike addressed renderer agent status publication
* Join status only against admitted mobile membership
* Scope status membership reconciliation and observe bindings by key
* Cover status admission and scoped replica recovery
* Name the status replica runtime owner type
* Read sleeping pane resume sources by key
* Bind sleep capture fixture to its live panes
* Bound status replica retirement and recover interrupted publication
* Pass the pane tree to the sleep capture fixture graph
* fix(status): skip non-UUID leaves, release phone frames on headless restore, avoid unbound tree scan
- Graph status bindings and replica membership skip leaves that can't carry a status row instead of throwing.
- The pre-seed phone gate only holds frames for the renderer generation that owes the seed; restoring headless authority redelivers the held worktrees.
- Status capture skips the leaf count when the tab has no terminal, and counts saved leaves only up to two.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* fix(status): release held phone frames whenever the unseeded renderer loses the graph
Desktop builds without a headless fallback mark the graph unavailable but keep the renderer generation, so the pre-seed gate stayed shut until a window reopened.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* perf(status): reuse the capped saved-leaf count per immutable layout
Status churn on an unmounted tab with only a tab-level terminal no longer descends a deep saved split tree on every change.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Preserve accepted completion identity through sleep
* Pass a nullable title to the status classifier
* Resolve accepted host status once and preserve delivery order
* Drop published sleep status when its host owner retires
* Use the supported remote completion test envelope
* Preserve published activity when filling completed status
* Update imports for main module moves
* Remove an unreachable native chat owner comparison
* Read host and unread card inputs by address instead of per root
A host-scoped sidebar card re-read every root's row and acknowledgement on
any store write, so one card with many sleeping roots paid for other
workspaces' updates. Card host filtering, the summary pill's unread state
and the workspace unread gate now first compare the workspace's projected
row revision and the changed keys of the tab-keyed layout/PTY maps and
the acknowledgement record. Only an addressed change re-reads the roots.
Acknowledge and unacknowledge annotate their writes so readers can skip
keys they don't show.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Correct sleeping pane test imports after module moves
* Combine duplicate subscription test imports
* Record addressed acknowledgement deletions on row drops
* Type subscription fixture key set for string readers
* Keep accepted updates complete after observer failures
* Seed the send picker with its SSH terminal identity
* Correct status publication imports after preload module move
* perf(layout): skip unused normalization reports in pane commands (#42615)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
* Clarify cleanup pinning and ignored-file protection (#42616)
* test: remove 55 low-value suites and assertion driver (#42605)
Co-authored-by: OrcaWin <[email protected]>
* fix(skills): skip Claude sync scratch folders during skill discovery (#42610)
Claude Code parks replaced skill copies in `.trash` and in-progress syncs
in `.staging` under its skills roots. Discovery walked into both, so each
synced skill showed up as duplicates. Prune those directory names in the
native file walk and in the generated WSL `find` command.
Co-authored-by: Neil <[email protected]>
* test: remove 78 low-value suites and trim redundant cases (#42621)
Co-authored-by: OrcaWin <[email protected]>
* Keep a host card's unchanged agent rows after filtering out another host's pane
Re-lineage clones every row once a host-scoped card filters a row out, so an unrelated pane's status write rebuilt the card's row array and re-ran its signal and rollup memos. Reuse unchanged rows as main's sidebar row selector does.
* Document the runtime stub cast in the status admission test
* Await graph publication in the phone projection status tests
* Share the renderer status binding check and move graph tab-id validation out of the window graph
Main's async graph publication grew session-window-graph past the 300-line limit; the binding predicate now has one owner beside its capture path.
* Seed the Copy Session ID shortcut test through keyed agent status
* Restore the reviewed status binding checks and move the remount check instead
Keeps the capture path's lookup behind its UUID and changed-worktree guards; the window graph stays under the line limit by moving the PTY remount check to the graph promotion base.
* Seed the graph payload partition test through keyed agent status
* fix(agent-status): retry status publication after a failed or superseded graph sync
An inactive sender now asks for a graph sync on each status change (base got this
retry from agentStatusEpoch in the sync key), and a superseded ack parks the sender
until the next accepted graph instead of stopping it.
* fix(agent-status): don't stage status changes while a snapshot is pending
A parked sender kept tombstones for every removed occupant; the next snapshot
recaptures every row and main clears its replica on snapshot.
* fix(agent-status): don't start renderer status publication in paired web clients
The web stub answers every batch with superseded; with superseded now re-arming
on each accepted graph, a web sender would resend snapshots and request graph
syncs for nothing.
---------
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Co-authored-by: Jinjing <[email protected]>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: OrcaWin <[email protected]>
Co-authored-by: OrcaWin <[email protected]>
Co-authored-by: BingZ <[email protected]>
Co-authored-by: Neil <[email protected]>
(cherry picked from commit 47ef2ab)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
At 1,000 workspaces, every agent status change made the window rebuild the whole session graph and send it to main: about 196 KB per status ping. Main then re-derived the phone's session tabs from it. Under a burst of status updates, this graph republication dominates both processes. With #41793 (keyed per-agent status reads), the window stops falling behind, so the unchanged graph sync fires even more rounds. In our fleet benchmark, the status-storm traffic from window to main grew from 14.8 MB to 35.4 MB, and main CPU by 18%. This PR must merge back to back with #41793, never after a gap.
What changes for users
Nothing visible. Phones and paired clients see the same session tabs and status. Status updates stop costing a full session-graph rebuild and send, so the app stays responsive with hundreds of agents.
How
not-readyorsuperseded. A window refused while main is reloading retries with capped backoff and then a fresh snapshot. A superseded window stops for good and never becomes the publisher. This is same-build local IPC only: no saved data and no remote or phone wire change.worktree.ps,terminal.agentStatus, native-chat structured status, headless sources and paired-host mirrors.Reads are keyed per entity and fed by the producer's changed keys. When the agent-status producer moves into the backend process, the backend's own rows replace the window's sender. The window-side sender, renderer-generation admission, pending join and snapshot request are then deleted; main's per-pane apply moves with the runtime. Tracked in the backend-process plan.
Benchmark
Benchmark: fleet adapter (
~/orca-qa/fleet-adapter), 3 alternating process pairs × 10 warm trials, companion #41793 (7d964f3) → this PR (1df619ff062). Single-run medians of process medians, script proxies (not app frame times).Status storm against main before #41793, at 1,000 workspaces:
Limits (disclosed)
Tails at 100 workspaces. On a heavily loaded shared machine (CPU load 32–36), five worst-case tail metrics exceeded the 5% / 1 ms tolerance in all three pairs:
An earlier run's create-tab tail did not repeat in this one. Instrumented runs show identical work counts on these flows, and create-tab allocation did not grow (−2.1% at 100, +0.7% at 1,000). These deltas fall inside the run-to-run spread measured on the baseline itself (for example, the companion's own create-tab main loop max ranged 7–17 ms across pairs), so under the perf-lane gate (one measurement of the main gain, plus no regression beyond noise) they are reported, not treated as regressions. A quiet-machine re-check was attempted on Omarchy but its install was refused by the machine's tool shim, and it was not repeated.
Allocation during workspace switch at 1,000. Main GC counts during workspace switch rose (9–10 → 18–22 per 10 events), with main allocation mixed across pairs (+13.8%, +9.1%, −5.3%). The source is not in any instrumented site.
Local checks.
check:changedpassed 37 of 38 checks, including the full unit tests. The one local typecheck error is in a test file from Keep finished agents marked Done while their panes sleep #41793, and CI's typecheck passes.Testing
worktree.psandterminal.agentStatusbyte hashes are equal to Keep finished agents marked Done while their panes sleep #41793 at 100 and 1,000 workspaces. There is zero graph, hydration, membership or activity work on status-only ticks.Depends on #41793 (and #40774 below it). Merge order: #40774 → #41793 → this PR, back to back.
🤖 Generated with Claude Code