Repository navigation
fix(agents): record partial subagent completion delivery as incomplete - #159185
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 26, 2026, 5:29 PM ET / 21:29 UTC. ClawSweeper reviewWhat this changesThe branch changes subagent direct-message completion delivery to record later chunk errors as incomplete, replaces delivery tests, and documents the recovery behavior. Merge readiness⛔ Blocked before merge - 3 items remain The reported silent truncation remains possible on current main, and this PR fixes the rejected and aborted second-chunk cases. Its new completion signal still cannot establish that every chunk was delivered, so the PR needs a focused repair. Priority: P1 Review scores
Verification
How this fits togetherA subagent sends its completed result through OpenClaw’s outbound message pipeline when direct-message fallback is needed. Delivery results then update the subagent registry, which controls recovery and retry. flowchart LR
A[Subagent result] --> B[Direct message fallback]
B --> C[Outbound chunk sends]
C --> D[Delivery evidence]
D --> E{Complete result?}
E -->|Yes| F[Registry records delivered]
E -->|No| G[Registry retains incomplete result]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +17, Tests +90, Docs +5. Total +112 across 4 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Settle direct completion from evidence for every planned chunk, retaining the child result and preventing automatic replay whenever only part of it was sent. Do we have a high-confidence way to reproduce the issue? Yes, from source: give the first chunk an identified receipt and have the second return not_sent with no message ID. The outbound observer still reports payload delivery; I did not execute the path in this read-only review. Is this the best way to solve the issue? No. The observer fixes thrown and aborted sends, but it fires with only one identified chunk; the completion decision needs per-chunk accounting. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 841f6f78e5f6. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What 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
|
Direct text completion previously committed delivery on the first chunk receipt, so later transport failures appeared successful. Settle the single payload after its fanout completes, preserve successful delivery through bookkeeping failures, and retain partial sends for recovery without automatically duplicating confirmed chunks. Replace callback-scripted bookkeeping tests with real outbound and dispatch coverage in a focused sibling suite. On Blacksmith Testbox, both second-chunk regressions fail on base 9883b72; the candidate passes 323 tests across six suites, check-changed, and independent Codex review.
050ac02 to
28c7b7f
Compare
|
Merged via squash.
|
Direct text completion previously committed delivery on the first chunk receipt, so later transport failures appeared successful. Settle the single payload after its fanout completes, preserve successful delivery through bookkeeping failures, and retain partial sends for recovery without automatically duplicating confirmed chunks. Replace callback-scripted bookkeeping tests with real outbound and dispatch coverage in a focused sibling suite. On Blacksmith Testbox, both second-chunk regressions fail on base 73cbb5d; the candidate passes 323 tests across six suites, check-changed, and independent Codex review. Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
When a subagent's completion result is delivered through the direct-message text fallback, a long result is sent as several chunks. If the first chunk was sent and a later chunk failed or was aborted, OpenClaw recorded the completion as delivered: the registry persisted delivery complete and cleared pending delivery, while the recipient received a truncated result. Nothing told the operator or the requester that the rest was missing.
Why This Change Was Made
deliverCompletionDirect(src/agents/subagents/announce/subagent-announce-completion-delivery.ts) committed{ delivered: true }from the per-chunk delivery-result callback, and itscatchreturned that committed success whenever it existed. The first chunk's receipt therefore stood in for the whole payload. Existing tests covered one identified send followed by a bookkeeping failure, never chunk one succeeding and chunk two failing. The sibling ordinary delivery path already distinguishes partial failures.Success is now settled from the outbound pipeline's existing per-payload observer (
onDeliveredPayload, fired bysrc/infra/outbound/deliver-core.tsafter the payload's sends are recorded), so the announcement is only marked delivered once every chunk went out. When a later chunk fails after earlier chunks were sent (hasAnnounceSendEvidence), delivery is recorded as a terminal, incompletepermanent_failurewith the error, instead of success or a retryable failure: an automatic retry would resend chunks the recipient already has. A successful child's result stays available for recovery. The existing behavior that a fully sent result stays delivered even if transcript mirroring or bookkeeping fails is preserved.docs/tools/subagents/announce.mddocuments the incomplete-delivery outcome.User Impact
A subagent result that only partly reaches a direct-message recipient is now recorded as an incomplete delivery with its error, rather than silently reported as delivered.
Evidence
subagent-announce-text-delivery.test.ts: new cases for a rejected and an aborted second chunk returndelivered: trueonmainand fail; they pass with the fix and show no automatic replay.node scripts/check-changed.mjspassed.Production LOC: +21 / −4. Tests: +152 / −62. Docs: +5 / −0.