Repository navigation
fix(agents): omit settled failed deliveries from parent context - #155019
Conversation
…as outstanding A subagent whose required delivery exhausts its retries lands at delivery.status="failed" via finalizeResumedAnnounceGiveUp, which then calls completeCleanupBookkeeping and stamps cleanupCompletedAt. That row is terminal: resumeSubagentRun hard-stops on cleanupCompletedAt, so it is never redriven, announced, or delivered again. hasOutstandingCompletion still counted every "failed" delivery as outstanding, so the same dead result was re-rendered into the "## Child results awaiting delivery" block of the requester runtime context on every LLM boundary and survived gateway restarts. Exclude only the drained give-up row (failed + cleanupCompletedAt). Delivery still owned by a pending requester settle wake short-circuits earlier; a failed row still between retries has no cleanupCompletedAt yet; suspended/pending/in_progress are unaffected. The admission-store failed writes already set suppressCompletionDelivery or intentional_non_delivery and were already excluded, so no change is needed there. Fixes openclaw#154834
|
Codex review: needs maintainer review before merge. What this changesExclude permanently failed, cleanup-complete child deliveries from outstanding parent context while preserving recoverable deliveries and requester continuations. Example: Child run 361cc79c-081a-4d20-85c7-b4e24bc006e4 has delivery=failed, cleanupCompletedAt=1791931060104, and no requester continuation.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current-main bug with a focused, correct change; the newly captured Gateway output satisfies the prior proof request. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe subagent registry supplies retained lifecycle facts to the runtime-context projection, which adds bounded child status and outstanding results to parent model requests. flowchart TD
A[Child execution] --> B[Delivery lifecycle]
B --> C[Subagent registry]
C --> D[Outstanding result projection]
D --> E[Parent runtime context]
E --> F[Parent model request]
Technical reviewBest possible solution: Land this focused projection correction through the normal maintainer workflow. Do we have a high-confidence way to reproduce the issue? Current-main source admits the reported failed, cleanup-complete record, and supplied baseline Gateway captures show its recurrence in the parent request; no target code was executed during this review. Is this the best way to solve the issue? The existing projection owner is the correct repair boundary because lifecycle state is already terminal; excluding this settled shape preserves outstanding retries, continuations, and recent-history visibility without changing persistence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 31e361573b4d. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +4, Tests +40. Total +44 across 2 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel 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 HistoryReviewed October 13, 2026, 6:56 PM ET / 22:56 UTC (Revision 3). |
…-context fix Adds an end-to-end regression that drives the real SubagentLifecycleController give-up path (finalizeResumedAnnounceGiveUp -> completeCleanupBookkeeping) so it stamps a real cleanupCompletedAt, registers the resulting record in the live subagent registry, then renders the actual requester runtime-context through buildActiveSubagentRuntimeContext. This is real behavior, not a seeded assertion: cleanupCompletedAt is produced by the production give-up flow, never hand-set. The test asserts the abandoned failed child is omitted from "## Child results awaiting delivery" while a genuinely pending sibling is retained, and logs the rendered block as quotable evidence. Reverting the hasOutstandingCompletion guard makes it fail at the leak assertion. Refs openclaw#154834
|
Addressed the sole Added Also attributed the first head's three New head @clawsweeper please re-review. |
…ive-up proof (openclaw#155019) - Adapt subagent-active-context tests to main's async buildActiveSubagentRuntimeContext (await). - Rewrite give-up integration test as a real SQLite persist->reload->render proof: drained failed+cleanupCompletedAt row drops out of awaiting-delivery after registry restart, retrying failed row (no cleanupCompletedAt) stays visible.
|
@clawsweeper re-review: rebased/merged to latest main (buildActiveSubagentRuntimeContext is now async — all tests await it), added a real SQLite persist->reload->render integration proof (drained failed+cleanupCompletedAt drops out of awaiting-delivery after restart; retrying failed row stays visible) and a guard-off ablation. Head 2eb547e. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Added captured baseline/candidate parent-model context, durable failed/cleaned records, recoverable-control context, and the baseline-negative test output to the PR body. No source changes; exact head remains 92f78c4. |
|
🦞👀 Re-review progress:
|
|
Landed in 2b03e91. Thanks @linhongyu510! I narrowed it to the projection check. Verified on a built Gateway: a permanently failed, cleaned-up subagent delivery no longer shows as outstanding on the parent's next turn. |
…claw#155019) fix(subagents): stop listing finished failed deliveries as outstanding When a subagent's result delivery failed permanently and its cleanup had completed, the parent's next turn still listed that child as an outstanding result, so the model kept waiting on work that would never arrive. The active-child projection now skips failed deliveries whose cleanup is complete. Stored records are unchanged, and a failed delivery whose cleanup is still open stays listed. Proof: built Gateway with a real parent spawn, a child failure and a permanent Telegram delivery rejection. On main, the next model request listed the child as outstanding; with this change it is omitted, while the recoverable failed-attempt control stays visible. Fixes openclaw#154834. Thanks @linhongyu510, and @xydigitLybnnnn for the parallel fix in openclaw#155320. Co-authored-by: linhongyu510 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
|
Production impact note + release ask (from a stable-track user) Environment: OpenClaw 2026.10.2 (npm, Linux x64, node v24), Feishu channel, long-running multi-subagent workflows. Since this fix is merged but not yet in any tag, sharing how the pre-fix behavior plays out in production — it is currently the most user-visible defect we have on stable:
Example from 2026-10-16: five subagent completions between 15:19–16:34, all aborted at dispatch; a mid-task review announcement at 16:37:09 landed in the transcript and never reached Feishu. Release status: this fix (92f78c4) merged to main on Oct 13, but as of Oct 18 it is not in any published tag — compare diverges against v2026.10.4, v2026.10.5-beta.4 and v2026.10.10-beta.1. So every stable and beta user still has the broken behavior above. Any chance this could make the next patch release (or the next 10.10 beta)? We'd upgrade the day a tag ships and report back against a fixed checklist: journal no longer shows the aborted dispatch errors, outbound delivery appears after announce, and a measured delivery rate for multi-round subagent tasks. [Edit 2026-10-19 — SHA correction] The landed commit is |
|
Correction first: my compare evidence in the previous comment used the PR head SHA ( Corrected containment, verified via compare against
So the ask narrows to the stable channel: users on the default install (10.4 stable) still hit this every day. Is there a timeline for a stable release from the 10.10 line, or could this be backported into a 10.4.x patch? The user-experience argument stands unchanged: when these announce deliveries silently fail, non-expert users just see the assistant go quiet mid-task — no progress, no completion notice — and cannot tell "still working" from "crashed" from "ignoring me". From their side it's simply "the bot randomly stopped replying", which is exactly what makes people furious and erodes trust in the product, while the transcript on the operator side shows the turn finishing fine, so nothing gets investigated. Happy to upgrade on stable-tag day (or to 10.10-beta.1 sooner if useful) and report back with the checklist: journal signature gone, outbound delivery after announce, multi-round subagent delivery rate. |
|
Now that That means the next patch-line stable (10.6) would ship without this fix, and stable-channel users would keep silently losing subagent completion receipts until the 10.10 train goes stable. For a bug whose whole damage is silent loss of agent-to-user deliveries, that is a long exposure window on the stable channel. Would you consider cherry-picking Standing offer from our earlier comments: on the day any tag containing this fix ships, we will upgrade and report back with the receipt checklist (single-send plus multi-turn live subagent runs; three signatures — delivery, non-truncation, cross-restart survival). |
|
Adding a concrete user-impact dimension from our deployment (observed on the stable channel before the fix): We routinely run multi-hour overnight subagent chains — report drafting with literature ingestion, batch document processing. On the affected build, those runs produced zero outbound feedback: no interim progress, no completion notice on the chat channel. The first reliable information arrived when the human opened the chat the next morning and asked "how did it go?" — by then the work had finished (or failed) hours earlier, invisibly. (Worst observed day: 5/5 subagent completions aborted their announce dispatch; 8 queued announces, 0 delivered.) For a heavy user this flips the operating model from "assistant that reports back" to "batch system you must poll by hand". The cost is not a missing status line — it is that the user's morning planning depends on facts the gateway knew hours earlier but never delivered. That is why we would appreciate the fix riding the next patch-line stable (cherry-pick |
…claw#155019) fix(subagents): stop listing finished failed deliveries as outstanding When a subagent's result delivery failed permanently and its cleanup had completed, the parent's next turn still listed that child as an outstanding result, so the model kept waiting on work that would never arrive. The active-child projection now skips failed deliveries whose cleanup is complete. Stored records are unchanged, and a failed delivery whose cleanup is still open stays listed. Proof: built Gateway with a real parent spawn, a child failure and a permanent Telegram delivery rejection. On main, the next model request listed the child as outstanding; with this change it is omitted, while the recoverable failed-attempt control stays visible. Fixes openclaw#154834. Thanks @linhongyu510, and @xydigitLybnnnn for the parallel fix in openclaw#155320. Co-authored-by: linhongyu510 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 2b03e91) Co-authored-by: RomneyDa <[email protected]>
|
Confirmed working in production on 2026.10.6 stable. We upgraded our daily-driver deployment from 2026.10.5 to 2026.10.6 today (thanks for cherry-picking this onto the 10.6 line — that was the backport we asked for upthread). Post-upgrade verification, the three signatures we had been tracking:
Watching the 10.10 train for the remaining related work. Thanks @RomneyDa @obviyus for the fix and the backport. |
Closes #154834
What Problem This Solves
Fixes: a child result whose delivery failed permanently keeps appearing as awaiting delivery on later parent turns, even after its cleanup finished.
User Impact
User impact: parents stop receiving stale outstanding-result instructions for settled delivery failures. Failed attempts that still need delivery, and pending requester continuations, remain visible.
Why This Change Was Made
The prompt projection now excludes failed deliveries with completed cleanup, after preserving the requester-continuation exception. No stored records, schemas, delivery scheduling, or recovery behavior change.
This retains @linhongyu510's original fix and replaces duplicated persistence/projection coverage with one small table in the existing suite. Thanks to @jerryliang122 for the report. Related alternative: #155320. The scheduling changes in #165957 do not change this projection predicate.
No overlap with Pash/Sarah changes.
Evidence
sessions_spawn, child model failure, and a rejected Telegram delivery using a synthetic invalid token.delivery.status=failed, completed cleanup, and no requester continuation; the next parent model request still included itsChild results awaiting deliveryrow.failedwith cleanup unset.openai/gpt-5.4-mini: returnedLIVE_GATE_OK.Captured Gateway/model-request evidence
Baseline
40fabad6db1608700507c2dccfd95271af1ec3c3, actual spawned child3e556bfb-e159-4b6f-9197-0ada2156e17a. After the rejected delivery, the retained registry row contained:{ "delivery": { "status": "failed", "attemptCount": 1, "lastAttemptAt": 1791930689025 }, "cleanupCompletedAt": 1791930689025 }The next parent model request still contained this separate runtime-context section (JSON string decoded for readability):
Candidate
92f78c4c066528987ebee6c526d45a7f52dfb45c, actual spawned child361cc79c-081a-4d20-85c7-b4e24bc006e4, immediately before the next parent turn:{ "delivery": { "status": "failed", "attemptCount": 1, "lastAttemptAt": 1791931060104 }, "cleanupCompletedAt": 1791931060104, "requesterSettleWake": null }Its next parent model request contained bounded recent history, but no outstanding-result section (JSON strings decoded for readability):
Recorded run summaries:
The recoverable control made the same parent/spawn/child-error journey but lacked a usable delivery credential. Its failed attempt stayed pending with cleanup open; the next model request retained the outstanding child. No registry rows were seeded or edited for these Gateway runs.
Captured next-turn control section (decoded):
The permanent-failure runs used a synthetic invalid Telegram token; the actual adapter reported HTTP 401 Unauthorized. Diagnostic
lastErrorwas:text completion direct delivery was incomplete; automatic retry would duplicate sent chunks: Call to 'sendMessage' failed! (401: Unauthorized). No real channel credential or user destination was used.Focused regression negative control
Running the candidate test table with the baseline projection source failed only the targeted case:
With the candidate projection:
The
failed/ cleanup-unset and requester-continuation controls passed on both sources.Two-way door: reverting restores only the old prompt projection. Blast radius is parent-agent context for permanently failed, cleaned-up subagent deliveries; no state migration or channel behavior changes.