Skip to content

fix(agent-status): never drop a running helper for lack of room - #30416

Merged
brennanb2025 merged 5 commits into
mainfrom
brennanb2025/status-store-uncapped
Oct 19, 2026
Merged

brennanb2025 merged 5 commits into
mainfrom
brennanb2025/status-store-uncapped

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 31 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​307 $\color{#cf222e}{\Huge{\mathbf{−}}}$​601 $\color{#cf222e}{\Huge{\mathbf{−}}}$​294
Prod 40 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​158 $\color{#cf222e}{\Huge{\mathbf{−}}}$​669 $\color{#cf222e}{\Huge{\mathbf{−}}}$​511

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:

  • the agent status store: 8,192 helpers per machine, 2,048 agents, 16,384 aliases and facts, a 16 MB size budget, and at most 2,048 entries per update;
  • 256 running non-subagent helpers per chat;
  • 32 helpers per agent run from a terminal (Claude, Codex, the Claude background-task list, the sidebar projection), and the dashboard rejected a card with more than 100;
  • inside the agent integrations: Codex remembered 128 helpers, 128 helper details, 16 open tool calls per helper and 256 active turns, and capped live command bookkeeping at 16 MB; Claude remembered 256 finished tasks and tracked 256 background tasks; ACP remembered 2,048 subagents and 128 task details; Muse 64 child sessions; Pi posted at most 32.

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:

  • Limits that only remember a helper's old run ids (32 past runs per helper, Codex's finished-turn memory, Claude's ended-task id memory in the tracker): they never drop a current helper, and changing them changes how a reused id is matched, which is a separate problem.
  • Limits on chat transcript content, on single field lengths, and on transport frames (the phone's frame size budget, the hook request body, the websocket payload).
  • Bounded memory of finished ACP task details, so a late completion still finds its label.
  • The "some tasks aren't listed" note and Stop all's fallback: the store can still turn a record away for a broken identity (an id that matches two records, an invalid record), and the phone's frame budget can still leave older rows out.

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.

main branch
Task strip main roster branch task strip
Sidebar main sidebar branch sidebar
Agent Dashboard main dashboard branch dashboard

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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Memory: each list now grows only for its owner's lifetime. One very long chat with thousands of helpers keeps them until your next message (finished) or the session's end (running), the same lifetime as before, just without a cut-off.
  • The store's commit no longer serialises every touched record to measure the byte budget, so each status update does less work.
  • SSH and WSL: the execution host owns the store, as before; the WSL guest store and relay use the same shared code and the same lifetime removal.

Author: @BrennanKB5

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.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 18, 2026 20:36
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 405b409b-5c37-4c26-b348-12a7cdcd6e4b
📥 Commits

Reviewing files that changed from the base of the PR and between 9a6b2d7 and dfe9884.

📒 Files selected for processing: 5
  • src/main/pi/agent-status-subagent-roster-source.ts
  • src/shared/agent-status-subagent-snapshot.ts
  • src/shared/agent-status-transport-envelope.ts
  • src/shared/agent-status-types.ts
  • src/shared/program-status/agent-status-projector.ts
💤 Files with no reviewable changes: 2
  • src/shared/agent-status-types.ts
  • src/shared/agent-status-subagent-snapshot.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The changes remove several count-based and serialized-byte limits from background-task tracking, subagent rosters, Codex tracking, and agent-status storage. Some bounds remain, including settled-history limits, the agent-status tombstone limit, and evictable stream-state limits. Pi subagent payload generation uses a byte budget for non-final posts. Tests cover larger rosters and tracking sets, along with child-work refusal and recovery.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to dfe98

The reviewed changes address the two previously tracked concerns: envelope parsing no longer retains the former practical token cap, and oversized Pi roster rows do not prevent later helpers from being included. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 40 functions across 52 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preventing running helpers from being dropped because of capacity limits.
Description check Passed The description is comprehensive and covers the change, rationale, linked issue context, visual proof, testing, review notes, scope boundaries, and known limitations. It omits the explicit Checklist s…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is comprehensive and covers the change, rationale, linked issue context, visual proof, testing, review notes, scope boundaries, and known limitations. It omits the explicit Checklist section and AI Disclosure section, but these omissions are non-critical for an otherwise complete description.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 15e00f9e-eb8e-4f03-a782-6636feb494ab
📥 Commits

Reviewing files that changed from the base of the PR and between eaa1ee1 and 967645f.

📒 Files selected for processing: 70
  • src/main/acp/acp-background-task-timeline.ts
  • src/main/acp/acp-subagents.ts
  • src/main/acp/acp-timeline-background-tasks.test.ts
  • src/main/agent-hooks/server-claude-child-permission-lifecycle.test.ts
  • src/main/agent-hooks/server-nested-agent-roster.test.ts
  • src/main/claude/claude-background-task-roster-merge.ts
  • src/main/claude/claude-background-task-tracker.test.ts
  • src/main/claude/claude-background-task-tracker.ts
  • src/main/claude/claude-child-work-decoder.test.ts
  • src/main/claude/claude-child-work-decoder.ts
  • src/main/codex/codex-background-command-tracker.test.ts
  • src/main/codex/codex-background-command-tracker.ts
  • src/main/codex/codex-background-task-tracker.ts
  • src/main/codex/codex-child-work-evidence.test.ts
  • src/main/codex/codex-child-work-evidence.ts
  • src/main/codex/codex-item-stream-retention.ts
  • src/main/codex/codex-persistent-command-retention.test.ts
  • src/main/codex/codex-structured-item-stream-contracts.ts
  • src/main/codex/codex-structured-item-streams.ts
  • src/main/codex/codex-structured-journal-items.ts
  • src/main/codex/codex-structured-journal-translation-turn-boundaries.ts
  • src/main/codex/codex-structured-journal-translation-turn-state.test.ts
  • src/main/codex/codex-structured-journal-translation-turn-state.ts
  • src/main/codex/codex-structured-journal-translation.test.ts
  • src/main/codex/codex-structured-session-adapter.ts
  • src/main/codex/codex-structured-session-background-tasks.test.ts
  • src/main/codex/codex-subagent-executions.test.ts
  • src/main/codex/codex-subagent-executions.ts
  • src/main/ipc/dashboard-payload-validation.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-background-task-channel.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-claude-subagent-row.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed-children.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-ownership.test.ts
  • src/main/pi/agent-status-extension-async-subagents.test.ts
  • src/main/pi/agent-status-extension-source.ts
  • src/main/pi/agent-status-subagent-roster-source.ts
  • src/shared/agent-hook-listener-claude-subagents.test.ts
  • src/shared/agent-hook-listener-startless-child-lifecycle.test.ts
  • src/shared/agent-hook-listener/providers/muse-events.ts
  • src/shared/agent-session-background-task-wire.ts
  • src/shared/agent-status-child-work-evidence-admission.ts
  • src/shared/agent-status-child-work-projection.test.ts
  • src/shared/agent-status-child-work-projection.ts
  • src/shared/agent-status-child-work-reconciliation.test.ts
  • src/shared/agent-status-run-alias-index.test.ts
  • src/shared/agent-status-run-alias-index.ts
  • src/shared/agent-status-store-bounds.test.ts
  • src/shared/agent-status-store-byte-budget.test.ts
  • src/shared/agent-status-store-byte-budget.ts
  • src/shared/agent-status-store-codec.ts
  • src/shared/agent-status-store-commit.ts
  • src/shared/agent-status-store-contract.ts
  • src/shared/agent-status-store-in-place.test.ts
  • src/shared/agent-status-store-indexes.ts
  • src/shared/agent-status-store-mutation.ts
  • src/shared/agent-status-store-persistence.ts
  • src/shared/agent-status-store-state.ts
  • src/shared/agent-status-store-status-codec.ts
  • src/shared/agent-status-store.test.ts
  • src/shared/agent-status-subagent-snapshot.ts
  • src/shared/agent-status-transport-envelope.test.ts
  • src/shared/agent-status-transport-envelope.ts
  • src/shared/agent-status-types.test.ts
  • src/shared/agent-status-types.ts
  • src/shared/claude-background-task-inventory.ts
  • src/shared/claude-background-task-status.test.ts
  • src/shared/claude-subagent-roster.test.ts
  • src/shared/claude-subagent-roster.ts
  • src/shared/codex-subagent-roster.test.ts
  • src/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.
@brennanb2025

brennanb2025 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author

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 9a6b2d7, before the final main merge and two small review fixes) and CI done; CI green on head dfe98843d4789e731f9207dcc885543d33cfced4.

Fixed during review (two findings, each rechecked by the same reviewer):

  • Pi/OMP shortens helper display text before fitting the request size, so a long description can't push helpers out of the posted list.
  • Targeted Codex Stop builds the descendant lookup once per lineage walk instead of rescanning history per descendant.
  • After QA, two automated-review points were fixed: Pi skips one oversized row instead of stopping the list, and the (currently unused) status transport reader accepts every size its writer produces. Neither touches a flow QA exercised.
  • At the final merge of main, a new 32-helper cut-off from feat(agent-status): read OSC 7501 program status beside hooks #30261 (terminal program status) was removed for the same reason; its protocol's own 256-record limit stays.

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 70d00aa vs branch 9a6b2d7, same prompt, model and fixture):

  • 40 helpers running at once: every one listed on both builds in the task strip, sidebar, chat roster and Agent Dashboard; no "some task details are unavailable" note on either. 40 is under main's per-chat limit, so this shows no regression rather than reproducing the old cut-off.
  • Ordinary message/command/helper, folder workspace, close and reopen: pass on both.
  • Same on both builds (not caused by this PR): Codex removes finished helpers on its own, so the next-message cleanup path wasn't exercised (it's covered by the whole-flow test with 2,049 finished helpers); and after Stop on the parent, the chat reads Interrupted while the tab and sidebar keep reading Working while one helper is still alive.
  • Not covered: the terminal-agent roster (no Claude sign-in on the QA machine), SSH and Windows. Fresh test profiles had Chat UI and Agent Dashboard off; both were turned on through Settings identically on each build.
  • Real config on the QA machine: Claude and Codex settings and auth files unchanged. ~/.codex/config.toml gained a trust entry for the QA worktree itself (written by the QA lead's own Codex session); ~/.claude.json is the Claude CLI's own state file, rewritten by other sessions on that shared machine.

For Brennan's review

main branch
Task strip, 40 helpers main roster branch task strip
Sidebar main sidebar branch sidebar
Agent Dashboard main dashboard branch dashboard

Where judgment matters:

  1. Status size check skips the helper list: the 256 KB limit on a pane's status still guards every other field.
  2. Pi fits its posted list to the request size instead of a count; installed extensions keep sending at most 32 until regenerated.
  3. Store commit keeps only validity checks: records can still be turned away for broken identity, which is why the "some tasks aren't listed" note stays.

…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.
@brennanb2025
brennanb2025 merged commit 978b207 into main Oct 19, 2026
40 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/status-store-uncapped branch October 19, 2026 07:32
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.

1 participant