Repository navigation
fix(agents): settle yielded CLI session spawns - #134974
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
39c629f to
e1758c2
Compare
|
Verification update for exact head
Live Telegram Test Server proof remains unavailable on this host: the |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 10:59 AM ET / 14:59 UTC. ClawSweeper reviewWhat this changesThe branch captures accepted subagent spawns from CLI tool execution and settles yielded requester turns so completed child work can be scheduled for requester delivery. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessThe PR remains necessary: current main still lacks CLI accepted-spawn capture and post-placement settlement. The patch follows the existing registry-owned settlement path with targeted boundary coverage; it should receive designated owner review before merge. Priority: P1 Review scores
Verification
How this fits togetherCLI and Copilot agent turns can spawn visible subagents whose completed work is handed back through the subagent registry to the requester session. This change records accepted spawn receipts at the tool boundary and uses them after a yielded turn releases placement. flowchart LR
A[CLI or Copilot turn] --> B[Session spawn tool]
B --> C[Accepted spawn receipt]
C --> D[Turn settlement]
D --> E[Subagent registry]
E --> F[Requester wake]
F --> G[Completion delivery]
Decision needed
Why: The change alters durable session settlement and final-delivery scheduling across execution surfaces, requiring designated owner merge judgment. Before merge
Agent review detailsSecurityNone. PR surfaceSource +79, Tests +156. Total +235 across 21 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Have the designated owner confirm supported CLI settlement and requester-wake semantics, then merge the registry-based repair. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main lacks CLI accepted-spawn receipt propagation and post-placement settlement; the linked issue also provides a live gateway reproduction, though this read-only review did not rerun it. Is this the best way to solve the issue? Yes: the branch captures authoritative accepted receipts at the CLI loopback boundary and delegates settlement to the existing registry owner, matching the embedded-run path instead of adding a fallback delivery path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ae24725490ee. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
|
Final exact-head verification for
VACInc remains the intended assignee/co-author. This PR is ready for maintainer review; it has not been merged and automerge remains disabled. |
Co-authored-by: Vito Cappello <[email protected]>
e1758c2 to
37ab2e5
Compare
|
Follow-up for VACInc’s 2026-09-01 regression-coverage request, on exact head
Proof:
The clean one-commit rebase did not conflict or change the task patch. A local post-rebase E2E attempt did not reach Vitest because this linked worktree resolves another checkout’s stale |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: Vito Cappello <[email protected]>
What Problem This Solves
Fixes #124343.
A CLI requester can accept a completion-required child through
sessions_spawn, callsessions_yield, and release its turn without carrying the accepted spawn receipt into requester settlement. The child can then complete successfully while direct delivery and wake scheduling both defer forever to settlement state that was never armed.Why This Change Was Made
The repair carries verified accepted spawn receipts through CLI and Copilot harness results, then settles yielded CLI requester ownership only after the placement claim releases. Existing embedded/native continuation policy remains unchanged. A small forced-terminal context split keeps the placement owner registry-agnostic and removes the resulting runtime import cycle.
The final regression pass also found the matching pre-delivery race: when the child already delivered the requester-visible final before parent settlement, its provisional settle wake remained armed. The registry owner now clears that wake only when the exact delivered-final receipt proves the yielded batch already completed, preventing replay while preserving incomplete and mismatched wakes.
This reuses the canonical
settleRequesterAfterSessionSpawnsowner instead of adding a second delivery path. No config, protocol, database schema, migration, or fallback is added.Production delta: +122/-43 (net +79). The growth adds the missing accepted-spawn capability across CLI/Copilot result boundaries, placement-release settlement, the cycle-safe forced-terminal context split, and the owner-side stale-wake cleanup. Tests are +256/-100 (net +156).
User Impact
Requester turns that yield after spawning completion-required children now arm the existing durable settle-wake flow instead of leaving completed child results parked with
completion_handoff_pendingand no retry. A child that already delivered through the requester turn is not replayed after that turn settles.Evidence
node scripts/run-vitest.mjs src/agents/cli-runner.reliability.test.ts src/agents/subagents/registry/subagent-registry-requester-yield.test.ts— 123 tests passed after the clean rebase, including accepted/rejected/malformed CLI receipt cases and owner stale-wake cleanup.node scripts/run-vitest.mjs src/agents/subagents/registry/subagent-registry.lifecycle-retry-grace.e2e.test.ts— 14 tests passed across yielded delivery, pre-delivered no-replay, sibling-race settlement, retry grace, and completion freezing; lease stopped afterward.node scripts/check-changed.mjs -- src/agents/subagents/registry/subagent-registry-requester-yield.ts src/agents/subagents/registry/subagent-registry-requester-yield.test.ts src/agents/subagents/registry/subagent-registry.lifecycle-retry-grace.e2e.test.ts— green, including core/test typecheck, lint, dead-code, database guards, and zero runtime import cycles.Telegram Test Server proof remains unavailable because this host has neither an authenticated Convex CLI nor the CI broker environment pair; no credentials were requested or bypassed. The isolated production-composition E2E above supplies the requested settlement-to-delivery boundary trace.
ClawSweeper exact-head review was requested three times after the final push. Each fresh lease failed in ClawSweeper’s internal Codex execution layer before publishing a verdict or technical finding; runs 33512292248, 33512885800, and 33513430055. The earlier reviewed head had no code findings and requested the boundary trace now supplied above.
This PR must not be merged or placed on automerge by this session.