Repository navigation
fix(subagents): bound settle-wake deferrals to prevent indefinite parking - #124408
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 27, 2026, 12:49 PM ET / 16:49 UTC. ClawSweeper reviewWhat this changesThe PR adds a persisted cap to requester settle-wake deferrals, records failure when the cap is reached, and prevents stale descendant cleanup from re-opening closed delivery. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain Keep open: the PR remains the active candidate fix for the linked completed-subagent delivery bug, but it still needs after-fix production-boundary behavior proof before merge. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherSubagent completion cleanup passes completion results to the requester through a durable settle-wake batch. This path either wakes the requester after descendants settle or records a terminal delivery outcome for the task lifecycle. flowchart LR
A[Subagent completes] --> B[Completion cleanup]
B --> C[Requester settle-wake batch]
C --> D{Descendants pending?}
D -->|yes| E[Persist deferred wake]
E --> F{Deferral cap reached?}
F -->|yes| G[Record blocked delivery]
F -->|no| C
D -->|no| H[Wake requester]
H --> I[Visible final or durable outcome]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +47, Tests +89. Total +136 across 8 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: Keep the cap in the settle-wake lifecycle owner and add a redacted after-fix gateway or production-boundary trace showing the capped batch becomes durably blocked while descendants can still settle normally. Do we have a high-confidence way to reproduce the issue? Yes for the pre-fix defect: the linked report supplies a live gateway sequence, and current main has an unbounded defer path. The after-fix outcome has not yet been demonstrated through the production boundary. Is this the best way to solve the issue? Yes, as an acceptable lifecycle-owner mitigation: it replaces an indefinitely pending handoff with a recorded terminal failure. A boundary trace is still needed to verify that the complete cleanup sequence preserves this invariant. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against aa0647d06d27. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
7686712 to
8e1990e
Compare
4a099ad to
960cd1b
Compare
…king When a requester yields after spawning subagents, the settle-wake batch can be deferred indefinitely if new work keeps getting spawned. This leaves completed subagents with no delivery, no retry, and no recorded reason. Add a maximum deferral count (10) to the settle-wake batch. When reached, the batch completes with a recorded error instead of parking forever. Fixes openclaw#124343
readSharedBatchState omitted deferralCount, so the deferral bound was unreachable — every batch reconstruction reset the counter to undefined. Use Math.max across all batch states to preserve the highest deferral count, matching the pattern used for attemptCount. Addresses ClawSweeper review finding P1 on PR openclaw#124408.
960cd1b to
e679c7a
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
8703282 to
0b5be69
Compare
|
Thanks @synthalorian! Proof: Exact-head CI run
Example
|
Prevent yielded requesters from waiting forever when a completed child retains active descendants. The settle-wake lifecycle now records one blocked delivery at the deferral cap and fences late descendant cleanup from overwriting it. Co-authored-by: synthclaw <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
A requester can yield after spawning a subagent. If that subagent finishes while one of its descendants stays active, the requester settle wake can defer forever. The user gets no final result and the task records no terminal delivery reason.
Root Cause
The durable requester settle-wake batch had no deferral bound. The submitted cap wrote another pending state instead of using the lifecycle completion owner. A late descendant wake could also replace the already blocked parent run and overwrite its delivery result.
Fix
User Impact
The requester now gets a bounded, visible blocked task result instead of waiting forever. Late descendant completion cannot overwrite or duplicate that result.
Evidence
Live red on current main
On
5090935817e3, a real Telegram requester spawned a subagent and yielded. The subagent finished while its non-announcing descendant stayed active. After ten settle intervals,/tasksstill showed pending delivery with no error or terminal outcome. The durable settle wake remained pending with another future deadline. Releasing the descendant later proved the held work was real.Live green on final head
Hosted CI built merge candidate
5593dc27a9b2from current main608e365ce485with exact PR head0b5be69dc866as its second parent. The same Telegram flow showed this result after ten settle intervals:The durable task recorded failed delivery, terminal outcome
blocked, and one error reason. Requester settle-wake state was absent. After the descendant was released, the task stayed failed and blocked, cleanup completed, and no replacement wake or duplicate requester result appeared.Regression tests
Fixes #124343