Repository navigation
fix(subagents): preserve completion handoff across overlapping waves - #136390
Conversation
The stale-settle deferral cap counted live descendants and terminalized completed siblings during valid long-running waves. Keep active overlap pending, reserve the cap for ended-but-unsettled blockers, and enforce the persisted retry deadline in both deferral paths.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 3, 2026, 2:50 AM ET / 06:50 UTC. ClawSweeper reviewWhat this changesThe PR distinguishes active same-agent descendant work from stale unsettled work when delaying a requester’s consolidated subagent completion wake. Regression provenancePossible regression — probable (reviewed change; reproduction). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: current main still consumes the stale-deferral budget for active overlap, while this focused owner-scoped repair preserves the bounded stale outcome and has no blocking correctness finding. Priority: P1 Review scores
Verification
How this fits togetherThe subagent registry tracks descendant execution and delivery state. When a requester yields, the settle-wake lifecycle consults that state to either defer a consolidated completion wake or record a bounded failed delivery outcome. flowchart LR
A[Subagent completion] --> B[Registry snapshot]
B --> C[Requester settle-wake]
C --> D{Same-agent work active?}
D -->|Yes| E[Keep batch pending]
D -->|No, stale blocker| F[Count bounded deferrals]
E --> G[One requester completion wake]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +24, Tests +145. Total +169 across 6 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: Retain the owner-scoped active-overlap distinction and deadline guard, then merge only once the normal exact-head checks confirm that both active handoff and stale bounded-failure paths remain intact. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: current main increments the stale budget whenever descendants remain unsettled, while the supplied isolated Gateway trace reports the same active-overlap failure. This read-only review did not execute the harness. Is this the best way to solve the issue? Yes: the settle-wake decision owns both the durable retry deadline and the stale-versus-active distinction, and sharing the existing requester-agent filter with the active query avoids a parallel policy path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 543eeba1d87f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
Isolated Gateway/lifecycle proof for exact head
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer CI rerun requested for exact head The only failing test shard is unrelated to this six-file subagent diff:
A targeted local rerun of |
|
Thanks @aldiz1711! Proof: A real isolated Gateway fanout run passed on Blacksmith Testbox, and exact-head CI passed on run 33724496015.
Source head: 5a4668186a5 Landed as: f5e6bd872c9 |
…penclaw#136390) ## What Problem This Solves A completed child could lose its requester completion handoff when a valid descendant wave from the same requester agent stayed active across the stale settle-wake deferral cap. Repeated lifecycle callbacks could also consume the stale budget before the persisted retry deadline. ## Why This Change Was Made The requester-settle lifecycle now applies the stale cap only when no live descendant belongs to the same requester agent. The registry query uses the same direct-root ownership boundary as the existing unsettled-descendant query, so unrelated agents in a global session do not reset the stale budget. The deferral owner checks `nextAttemptAt` before changing durable state on both deferral paths. The bounded ten-deferral terminal outcome for genuinely ended-but-unsettled blockers remains unchanged. Current main's sibling model-route aggregation remains intact. ## User Impact Long-running same-requester descendant waves stay pending until they drain, then deliver one synthesized requester wake. Stale ended-but-unsettled batches still produce their bounded terminal outcome. Foreign agent work in a global session cannot keep another agent's stale batch alive. ## Evidence - Red baseline: current main `b3841af9b841`, using the requester-settle regression scenario, terminalized the frozen child after the active-overlap loop consumed the stale cap. - Green exact head: `5a4668186a5e`, with 43 requester-settle tests, 4 registry-scope tests, and 3 requester-wake product-flow tests passing. - Real Gateway proof: Blacksmith Testbox run [33723908881](https://github.com/openclaw/openclaw/actions/runs/33723908881) passed the isolated mock-provider subagent fanout lifecycle with a separate Gateway state directory and port. - Exact-head CI: watcher run [33724496015](https://github.com/openclaw/openclaw/actions/runs/33724496015) is green. - Focused checks: formatting, Oxlint, and `git diff --check` pass. The host does not run OpenClaw typecheck or build lanes; exact-head CI owns those checks. Contributor intent and the original Han-authored commits are preserved. Co-authored-by: Han <han@localhost> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
A completed child could lose its requester completion handoff when a valid descendant wave from the same requester agent stayed active across the stale settle-wake deferral cap. Repeated lifecycle callbacks could also consume the stale budget before the persisted retry deadline.
Why This Change Was Made
The requester-settle lifecycle now applies the stale cap only when no live descendant belongs to the same requester agent. The registry query uses the same direct-root ownership boundary as the existing unsettled-descendant query, so unrelated agents in a global session do not reset the stale budget. The deferral owner checks
nextAttemptAtbefore changing durable state on both deferral paths.The bounded ten-deferral terminal outcome for genuinely ended-but-unsettled blockers remains unchanged. Current main's sibling model-route aggregation remains intact.
User Impact
Long-running same-requester descendant waves stay pending until they drain, then deliver one synthesized requester wake. Stale ended-but-unsettled batches still produce their bounded terminal outcome. Foreign agent work in a global session cannot keep another agent's stale batch alive.
Evidence
644e14a6ab75, using the requester-settle regression scenario, terminalized the frozen child after the active-overlap loop consumed the stale cap.5a4668186a5e, with 43 requester-settle tests, 4 registry-scope tests, and 3 requester-wake product-flow tests passing.git diff --checkpass. The host does not run OpenClaw typecheck or build lanes; exact-head CI owns those checks.Contributor intent and the original Han-authored commits are preserved.