Repository navigation
fix(agent-status): never drop a running helper for lack of room - #30416
Conversation
Helper state (subagents, background tasks and commands) was bounded by counts and byte budgets that refused or evicted live records once hit, so the agent kept working while Orca listed it wrong. Every one of these records already dies with its session, pane or chat, so the count and size caps go; identity-history, transcript and transport bounds stay.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
15e00f9e-eb8e-4f03-a782-6636feb494ab
📒 Files selected for processing: 70
src/main/acp/acp-background-task-timeline.tssrc/main/acp/acp-subagents.tssrc/main/acp/acp-timeline-background-tasks.test.tssrc/main/agent-hooks/server-claude-child-permission-lifecycle.test.tssrc/main/agent-hooks/server-nested-agent-roster.test.tssrc/main/claude/claude-background-task-roster-merge.tssrc/main/claude/claude-background-task-tracker.test.tssrc/main/claude/claude-background-task-tracker.tssrc/main/claude/claude-child-work-decoder.test.tssrc/main/claude/claude-child-work-decoder.tssrc/main/codex/codex-background-command-tracker.test.tssrc/main/codex/codex-background-command-tracker.tssrc/main/codex/codex-background-task-tracker.tssrc/main/codex/codex-child-work-evidence.test.tssrc/main/codex/codex-child-work-evidence.tssrc/main/codex/codex-item-stream-retention.tssrc/main/codex/codex-persistent-command-retention.test.tssrc/main/codex/codex-structured-item-stream-contracts.tssrc/main/codex/codex-structured-item-streams.tssrc/main/codex/codex-structured-journal-items.tssrc/main/codex/codex-structured-journal-translation-turn-boundaries.tssrc/main/codex/codex-structured-journal-translation-turn-state.test.tssrc/main/codex/codex-structured-journal-translation-turn-state.tssrc/main/codex/codex-structured-journal-translation.test.tssrc/main/codex/codex-structured-session-adapter.tssrc/main/codex/codex-structured-session-background-tasks.test.tssrc/main/codex/codex-subagent-executions.test.tssrc/main/codex/codex-subagent-executions.tssrc/main/ipc/dashboard-payload-validation.tssrc/main/native-chat/agent-session-wire/structured-agent-session-background-task-channel.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-claude-subagent-row.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-status-feed-children.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-status-ownership.test.tssrc/main/pi/agent-status-extension-async-subagents.test.tssrc/main/pi/agent-status-extension-source.tssrc/main/pi/agent-status-subagent-roster-source.tssrc/shared/agent-hook-listener-claude-subagents.test.tssrc/shared/agent-hook-listener-startless-child-lifecycle.test.tssrc/shared/agent-hook-listener/providers/muse-events.tssrc/shared/agent-session-background-task-wire.tssrc/shared/agent-status-child-work-evidence-admission.tssrc/shared/agent-status-child-work-projection.test.tssrc/shared/agent-status-child-work-projection.tssrc/shared/agent-status-child-work-reconciliation.test.tssrc/shared/agent-status-run-alias-index.test.tssrc/shared/agent-status-run-alias-index.tssrc/shared/agent-status-store-bounds.test.tssrc/shared/agent-status-store-byte-budget.test.tssrc/shared/agent-status-store-byte-budget.tssrc/shared/agent-status-store-codec.tssrc/shared/agent-status-store-commit.tssrc/shared/agent-status-store-contract.tssrc/shared/agent-status-store-in-place.test.tssrc/shared/agent-status-store-indexes.tssrc/shared/agent-status-store-mutation.tssrc/shared/agent-status-store-persistence.tssrc/shared/agent-status-store-state.tssrc/shared/agent-status-store-status-codec.tssrc/shared/agent-status-store.test.tssrc/shared/agent-status-subagent-snapshot.tssrc/shared/agent-status-transport-envelope.test.tssrc/shared/agent-status-transport-envelope.tssrc/shared/agent-status-types.test.tssrc/shared/agent-status-types.tssrc/shared/claude-background-task-inventory.tssrc/shared/claude-background-task-status.test.tssrc/shared/claude-subagent-roster.test.tssrc/shared/claude-subagent-roster.tssrc/shared/codex-subagent-roster.test.tssrc/shared/codex-subagent-roster.ts
💤 Files with no reviewable changes: 18
- src/shared/agent-status-types.ts
- src/main/ipc/dashboard-payload-validation.ts
- src/main/codex/codex-background-command-tracker.test.ts
- src/main/codex/codex-background-task-tracker.ts
- src/shared/agent-status-child-work-projection.test.ts
- src/shared/codex-subagent-roster.ts
- src/main/codex/codex-structured-journal-translation.test.ts
- src/main/codex/codex-structured-journal-translation-turn-boundaries.ts
- src/main/agent-hooks/server-claude-child-permission-lifecycle.test.ts
- src/main/codex/codex-structured-session-adapter.ts
- src/shared/claude-background-task-inventory.ts
- src/main/codex/codex-subagent-executions.ts
- src/shared/agent-status-child-work-reconciliation.test.ts
- src/shared/agent-status-store-byte-budget.ts
- src/shared/agent-status-subagent-snapshot.ts
- src/shared/agent-status-store-byte-budget.test.ts
- src/main/codex/codex-child-work-evidence.ts
- src/shared/agent-status-child-work-evidence-admission.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
…subagent roster The previous commit dropped the 256 KiB status check outright; it still guards every other field. Only the roster, whose rows are bounded individually, is left out of the measurement.
|
Problem. When an agent ran many helpers (subagents, background tasks, background commands), several layers of Orca stopped recording new ones at fixed counts or size budgets. The helpers kept running, but Orca listed them wrong or not at all, and once more than 2,048 had finished, cleanup after your next message stopped working. Change. Every helper is now kept for as long as its chat session or terminal pane lives, so running helpers stay listed and big batches of finished ones are cleared. Limits that only remember old run ids, transcript content limits and network message limits stay. Status: review loop, real QA (on Fixed during review (two findings, each rechecked by the same reviewer):
Deferred: a desktop client receiving an extremely large roster (around 10,000 helpers in one chat) would still meet the existing websocket message ceiling. Renderer responsiveness at hundreds of rows was not measured. Real QA (M4Air, real Codex native chat signed in through the isolated QA recipe, main
For Brennan's review
Where judgment matters:
|
…tore-uncapped # Conflicts: # src/shared/agent-status-subagent-snapshot.ts
…parse every envelope the store can write Review follow-up: one long row no longer hides later rows that still fit the request, and the transport envelope's reader no longer refuses a size its writer now produces.






ELI5
When an agent starts lots of helpers (subagents, background tasks, background shell commands), Orca used to stop writing new ones down once a fixed number was reached. The helpers kept running, but Orca listed them wrong or not at all. Now Orca writes every helper down and throws the list away when the chat, session or terminal pane it belongs to ends.
What Changed
Before. Several layers kept helpers in lists with fixed limits, and refused or evicted entries once full:
What you saw when a limit was hit: a running helper with no row, a "Task details are unavailable" note in the chat's task strip, a terminal agent reading done while its helper worked, a restarted Claude helper not shown, a Codex helper's current tool call blanked out, or (Codex active turns and command budget) the whole chat session stalling.
There was also a hidden cleanup bug: after your next message, Orca removes finished helpers in one update, and the per-update limit of 2,048 entries refused that update, so nothing was ever cleaned up once more than 2,048 had finished.
After. None of those layers refuses or evicts a running helper. Each list lives exactly as long as its owner already did: finished helpers are removed after your next message, running ones are settled when the session ends, a terminal pane's list resets on a new session and goes with the pane, and an integration's memory ends with its chat session. The Pi extension now fits its posted list to the hook request's size limit instead of a count.
What stays, on purpose:
No saved format, wire field, RPC or UI changes. Older phones still show at most 32 terminal-agent helpers (they cut the list, they don't reject it). Older Pi extensions keep posting at most 32 until they are regenerated.
Why
These limits were counts placed on state that is already bounded by its lifetime. A count on top of a lifetime bound can only ever drop correct, live data, and every earlier fix in this area patched one consequence of that (the 256-per-chat exemption for subagents, the side lists in the closed PRs about refused helpers, moving lifecycle decisions off the store in #29905). The common pattern keeps helper state for the life of the session that owns it with no count or size admission, and bounds only what goes over the wire. Raising the numbers instead would keep the same failure at a higher threshold and need someone to retune it later.
The store lives in memory on the machine that runs the agent and is never sent to clients whole, so its limits only ever bounded memory; no older client or server depends on them.
Linked Issue
Follow-up to #29905 (STA-10504). Tracked in the closing notes of #28829 and #28812.
Visual Proof
Real Codex native chat on another machine, main vs this branch, 40 helpers running at once (all listed on both, no "unavailable" note). 40 is under main's per-chat limit, so this shows no regression; the old cut-offs are covered by the tests below.
Testing
I manually tested these changes (real Electron QA on another machine, see Visual Proof)
Automated tests added/updated, or explained why not below
Whole flow with the real store and the chat status feed: one chat reports 2,049 finished helpers, 40 subagents and 300 running background tasks; all are listed with no "incomplete" note, and the next message removes every finished one.
Claude terminal roster keeps 40 working subagents; Pi posts 40 running children; Codex accepts more than 256 active turns and still publishes the next helper; a Claude helper that wakes after 300 other tasks ended still reports its restart; ACP keeps a running task's label alongside 130 others.
Tests that pinned the removed limits were deleted or inverted. CI runs the full suite, lint and typecheck.
Review
Review loop finished (two findings fixed); see the status comment on this PR. At the final merge of main, a new 32-helper cut-off in the terminal program-status reader (#30261) was removed the same way; that protocol's own 256-record limit stays.
Agent skill upstream boundary
Notes
Author: @BrennanKB5