Repository navigation
fix(subagents): grow safe concurrency and support useful delegation - #12203
Conversation
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — ✅ human override accepted@bolichen97 overrode this lane for |
c72bebb to
276b877
Compare
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the now-enforced spawn admission floor on a real macOS host; the PR's cited verification runs cover Windows and Linux only. [DESIGN-REVIEWED] b6e60cb |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
self-added: no
|
|
self-added: no
|
276b877 to
7069db2
Compare
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
7069db2 to
8c13b97
Compare
GPT 5.6 Review —
|
|
/ai-review override first-principles 8c13b97: Maintainer decision (bolichen97), recorded on the agent's behalf with explicit authorization. All three default changes ship as-is: slow start default-on (x2 per clear 5s window until first corroborated pressure), the exec bar at |
|
AI-review override not recorded: keep the reason to 500 characters or fewer. |
|
self-added: yes
|
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
…efault in the prompts Users report frequent single-child spawn_run calls. The solo-spawn gate (#11710, widened in #12203) validates reason shape, not value, so the model always has a passing token. A local spawn.solo audit (2026-09-22 to 2026-09-24) showed 33 of 34 one-task calls allowed. - Gate removed: solo_spawn.py, the MCP tool half and the api_spawn roster check/audit are gone. The parent_work_supported receipt check moves to parent_work.py, unchanged. - Compat: solo_reason / solo_details are no longer advertised. Validation still accepts and ignores them so old skills are not refused as unknown fields. - prompt.md / prompt-orchestrator.md: a concrete one-task default; the numbered dispatch -> END YOUR TURN -> wait-for-batch steps are back. - Member protocol (context.py): the front-desk rule does focused work inline; escalation drafts are self-reviewed. - subagent.md: delegation policy is prompt guidance only. - Tests rewritten for the new default. The RFC supersede decision is a separate doc-only PR (#13511) so the First Principles lane reads it off the base branch first.
Problem / Motivation
A configured limit of 64 can spend a long time at a handful of subagents, or remain near one after pressure. Recovery required twenty completed runs at each step, even when the current cap was one. The model-facing instructions also disagreed with the solo gate: they suggested context isolation as a general excuse, yet could not express useful parent-plus-child work. A 100-tool-call default can cut off a longer assignment before its three-hour execution deadline.
Why it matters
Independent work should begin promptly when the machine can support it. Raising the limit must not spend memory already promised to cold processes, and delegation should reduce useful work time rather than add a worker that merely relays the answer.
What changed (motivation → approach → change)
adaptive/policy.pykeeps the configured limit as a ceiling. Successful execution earns startup doubling every clear five-second window. After pressure, one-slot recovery needs min(20, current capacity) successful completions. A long task can open one trial slot when it shows fresh progress, work is queued, memory is available and the clear window has no throttling. Stale activity earns nothing; the initialization threshold stays unchanged. Spawn spacing defaults to 0.25 seconds. Disablingadaptive_slow_startdisables doubling, not the shorter recovery threshold.config/loader.py,config-baseline.json, owning specs andsrc/kiro_crew/docs/dynamic-subagent-sizing.mddescribe these choices.resource_status.py,dashboard/server.pyandcontext.pydistinguish effective capacity from the configured ceiling.constants.pygives config, loader, manager and tool descriptions one 1000-call default; the existing three-hour deadline stays. Missing turn-budget keys adopt it automatically.config/superseded_defaults.pyreports stored 100 values without guessing whether they were explicit choices.subagent.pyandsubagent_manager/admission/gate.pyaccount for resident workers before combining remaining memory slots with total CPU capacity. A configured limit such as 64 is no longer clipped to the automatic-sizing maximum of 32. Admission reserves expected cold-process memory until RSS accounts for it. That reservation cannot be negative, even with a misconfigured cost. Windows/macOS use native readings; Linux respects process cgroups and visible ancestors. A finite container limit with unreadable usage establishes no spare capacity. Host-read failure retains a known container bound; absent bounds retain the existing fallback. Estimates cannot guarantee safety against arbitrary later allocations.config/prompt.md, the Autopilot prompt andmcp_tools/spawn.pyfavor focused direct work and bounded, ready delegation with clear ownership and verifiable output.solo_spawn.pyandvalidation.pyaddparent_parallel,specialistanduser_requested, requiring concretesolo_details.subagent_persistence.pyretains redacted model claims, not proof or authorization. Async spawn tells the parent when it may do one separate step of at most a minute, then yield. This applies only to dashboard-owned slots that can deliver child completion while the parent is busy. Blocking spawn rejects parent parallelism. Existing reasons and programmatic payloads, batch barriers, cancellation, retry/continuation and approval boundaries remain. Tests cover these contracts, early completion, startup memory and long-task recovery.eval/scenarios/subagent_policy.jsonsupplies eighteen decision cases without claiming executed children or measured speedup.Decision context: overload RFC, amended here to change the previously accepted defaults, and requester-authorized scope. The explicit policy decision accepts these RFC changes and run-local audit claims. The requester authorized the finite long-task default and conservative upgrade policy.
Backwards compatibility
Breaking: with the memory floor enabled, admission may now defer/refuse a start whose pending process memory would consume that floor; native Windows/macOS starts honor it too. A finite Linux container limit with unreadable usage defers starts while spare capacity is unknown. Setting
spawn_min_memory_gb=0disables both this floor and the cold-start reservation; the faster ramp can then commit memory before reactive pressure cuts catch it. The default keeps this guard enabled. Writer sweep on origin/main @2f11434bdccebd19e7d5020ca2bb19f731436f13: MCP spawn tools; dashboard spawn/retry/resume; messaging commands and gateway callers;spawn_warm; manager admission, continuation and cancellation; apps spawn SDK, Code Review Sage and Mochi; and workflow-memory tests. They retain the existing queue/refusal handling. No existing reason requires a new field;solo_detailsis required only for newly added reasons. Reason text never grants permission. The turn-budget default changes only for unset configurations: stored values, including 100, remain authoritative, and overlays/per-spawn overrides keep precedence. Older full-config saves erased default-versus-user provenance, so those ambiguous 100 values need explicit adoption through the existing defaults command. Historical timeout migrations are unchanged.Tests
Local validation and failure/recovery provenance account for the resolved 52-gate floor and all 2,194 related backend files. Complete affected-file reruns resolve the recorded fixture failures; affected-file recovery verification passed 1,212 Linux tests. Resource-floor regressions and related admission/controller tests pass 655 Linux tests. Base integration verification passed 549 backend and 104 frontend tests, plus Python and TypeScript checks. Frontend related tests passed 24,649 with two skipped; Electron passed 1,959 with three skipped. Static, type, documentation, build and bundle checks passed. The format gate prunes two clean files from
.github/black-baseline.txt.test/test_spawn_solo_gate.pyand related tests cover solo reasons and bounded parent work, metadata round trips, queue/early completion, delayed startup memory, native/cgroup admission and progress without completion. The finite-cgroup/unreadable-usage regression failed 32 cases before repair. Negative-cost regressions failed three cases before repair and preserve the floor even on an exhausted cgroup; the complete startup-memory file passes 33 Windows tests. Windows affected-file runs passed 245 tests; sizing/coverage passed 366 with five expected failures. The 101-tool manager regression fails on the old default and completes on the new budget; explicit stored caps and overlays survive load/save/reload. The defaults-focused Windows run passed 86 with three platform skips. Linux verification passed 1870 tests across the sixteen related files on this head; all forty Python/static/documentation gates passed, including mypy across 1654 source files. The frontend and Electron delta from the prior green head is empty. Full platform suites and actual remote review remain CI's authority.Manual verification
Real manager/pump/controller fault injection uses virtual time and delayed synthetic RSS, not large host allocations. With a post-sample memory shock, disabling the reservation exhausts memory after 18 starts; the repair stops after 10 and preserves 4 GB. An ample-host case still starts 18 workers quickly and leaves 16 GB. These results bound the tested cost estimate, not every possible workload.
Decision-only before/after traces and their limits were collected with tools disabled. They are not end-to-end child execution or performance measurements; served model and token counts are unverified/unknown. Repeat evaluation remains incomplete after the local CLI became unavailable. Local review used GPT 5.6 and a GPT-family fallback applying the Opus contract; the remote Opus lane remains required.
Related Issues
no linked issue: this PR completes the requester-authorized subagent follow-up and preserves the merged earned-success fix from #12167.
Pattern harvest
Rule candidate: review-prompt
Pattern: distinguish remaining headroom from total capacity, and account for admitted work before its resource use becomes observable.
Checklist