Repository navigation
fix: subagent results delivered after a blocked handoff are no longer reported as lost - #201613
Anurag-5ingh wants to merge 1 commit into
Conversation
A completion blocked after its requester finished keeps its separately owned yield batch. When that batch later hands the result to the requester, the settlement cleared the wake but left the run marked permanent_failure, so `subagents list` and monitors reported a lost completion that was delivered. Mark that completion delivered when its owning yield batch settles successfully. Other permanently suspended completions keep their block. Fixes openclaw#201339
|
🦞👀 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: needs real behavior proof before merge. What this changesRecords successful requester-batch delivery for completions previously blocked by a completed requester. Example: A completion suspended with visible_reply_missing retains its yield batch, which successfully settles at timestamp 95.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this PR makes a focused repair to a current delivery-state bug, with no actionable code findings. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe completion mutation kernel receives requester-batch outcomes and updates canonical SQLite subagent records consumed by status readers. flowchart TD
A[Child completion] --> B[Requester yield batch]
B --> C[Requester handoff outcome]
C --> D[Completion mutation kernel]
D --> E[SQLite delivery record]
E --> F[Subagent status readers]
Technical reviewBest possible solution: Use the existing settlement mutation to record confirmed yield-batch delivery before clearing its wake while preserving unrelated permanent suspensions. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically skips delivery reconciliation for the reported suspended yield-batch shape and then removes its wake; this read-only review executed no target code. Is this the best way to solve the issue? The change is the smallest complete repair for successful late settlement: it reuses the existing classifier, delivery transition, transaction, and wake owner, with one distinct regression and no added machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 37e7af19884b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +4, Tests +40. Total +44 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 19, 2026, 12:44 AM ET / 05:44 UTC (Revision 2). |
|
@clawsweeper re-review Added a cross-version check to the PR body. A blocked row written by the v2026.11.5 release loads unchanged on this branch and settles to delivered (current main leaves it suspended). The body also says why I could not get a live Gateway run. |
|
🦞👀 Re-review progress:
|
|
Thanks @Anurag-5ingh. The condition is nicely narrow, but we're holding this for now: the block in #201339 came from a path that #185730 removed in 2026.11.5, and on current code we couldn't reach the "blocked, then delivered by the yield batch" state through any real flow (wait, yield, and the |
|
Thanks @obviyus, that makes sense. I checked and agree: I'll leave this parked. If the reporter's retest on a current release still shows a delivered result marked |
Related #201339
What Problem This Solves
A subagent can finish while its requester is still working. If the requester's turn ends before the result is handed over, the completion is blocked as
permanent_failure. A few seconds later the requester's pending batch does hand the result over, but the run keeps thepermanent_failurerecord.subagents listand any monitor then report a lost completion that actually reached the requester.User Impact
When the requester's batch delivers a completion that was blocked this way, the run is now recorded as delivered. Completions that were blocked for other reasons keep their block.
Why This Change Was Made
Blocking a completion after its requester finished keeps the requester's separately owned yield batch, because that batch still carries the result. When the batch settled successfully, the settlement mutation cleared the wake but only updated delivery for pending, retryable or expired completions, so the permanently suspended record was never corrected.
The settlement now also marks delivery when the completion is blocked as a completed-requester failure and its wake is that yield batch. The existing contract from #176145, that a successful receipt does not recover an ordinary
permanent_failuresuspension, is unchanged and its test still passes.Evidence
Owner-level regression. New test in
subagent-requester-delivery.test.ts: a completion suspended aspermanent_failure(visible_reply_missing), with its yield-batch wake retained, settles with a delivered outcome. It fails on currentmain(delivery stayssuspended) and passes with this change (delivery isdelivered, the suspended fields are cleared, and the wake is removed).Existing data from the latest stable release (v2026.11.5). No schema or serialization change. To check stored rows from a released build:
bindSubagentRunRecord+writeSubagentRunValuesInDatabase) and schema (user_version 36) stored a blocked completion with its yield-batch wake.So rows that are already blocked on an upgraded install load normally and are corrected the next time their yield batch settles. Rows that are blocked for other reasons are untouched (the #176145 contract test still passes).
Related suites. Requester delivery, registry lifecycle, requester-wake e2e, sweeper recovery, persistence, steer-restart, the registry suite and all subagent completion admission tests pass (545 tests).
pnpm tsgo:core,pnpm tsgo:core:test, oxlint, oxfmt andgit diff --checkare clean.Not covered: a live Gateway run. The reported state only appears when a requester turn ends during restart recovery without visible-reply evidence (the report saw it with CLI-backed runtimes), and then its yield batch settles seconds later. I can't reproduce that race against a live model from my setup, and the mock provider lanes have no scenario that drives restart recovery into this state. If a maintainer can run it against a live runtime, the check is: after the late settle,
subagents listshould show the run as delivered instead ofpermanent_failure.