Repository navigation
fix(subagents): stop requester wakes retrying changed owners - #186443
Conversation
Separate terminal wake bookkeeping from child execution custody while retaining requester and cohort identity. Record a deduplicated failure notice for a rejected dispatch, preserve newer quiet-completion progress, and let retained wakes converge on their next evaluation.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9eb12154c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs changes before merge. What this changesThis PR lets requester wakes finish terminal bookkeeping after child ownership changes and records a notice when dispatch is rejected. Example: Child run completion-a changes lifecycle generation after its requester wake is admitted.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep this PR open: it addresses a source-backed settlement loop, but the new notice key suppresses notifications for distinct rejected completion waves. Priority: P2 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherThe subagent lifecycle controller evaluates durable requester wakes, dispatches parent continuations, and commits their delivery outcomes through the existing SQLite completion owner. flowchart TD
A[Terminal child run] --> B[Requester wake controller]
B --> C[Strict dispatch admission]
C --> D[Requester continuation]
D --> E[Completion settlement]
C --> F[Rejection notice]
F --> E
E --> G[SQLite registry]
Technical reviewBest possible solution: Keep the existing settlement owner and give each rejection notice a stable identity for its affected run or frozen wave. Do we have a high-confidence way to reproduce the issue? Source shows both the original strict-custody settlement rejection and the introduced notice-key collision; the PR reports red-on-base lifecycle regressions, but this read-only review ran no target code. Is this the best way to solve the issue? Separating terminal facts from dispatch custody is appropriate and reuses existing owners; the notice needs wave-specific persistent identity rather than the broader scheduling scope. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 97a5eb7189f0. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +95, Tests -6, Docs +8. Total +97 across 5 files. Added test files: 0. View PR surface stats
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 Reviewed October 27, 2026, 10:45 PM ET / October 28, 2026, 02:45 UTC. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b573ee16ba
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Merged via squash.
|
…w#186443) * fix(subagents): stop requester wakes retrying changed owners Separate terminal wake bookkeeping from child execution custody while retaining requester and cohort identity. Record a deduplicated failure notice for a rejected dispatch, preserve newer quiet-completion progress, and let retained wakes converge on their next evaluation. * fix(subagents): retain cancellation and delivery settlement ownership * fix(subagents): distinguish rejected requester wake notices * fix(subagents): reconcile committed requester wake receipts
… line caps U9 brought subagent-registry-queries.ts to 698 counted lines (openclaw#186389) and subagent-registry-lifecycle-wake.ts to 700 (openclaw#186443). The fork's additions pushed them to 738 and 703, past the 700 cap. - The continuation-only reads (child-run liveness for orphan reap, requester ancestry) move to subagent-registry-queries.continuation.ts; subagent-registry-read and work-dispatch-execution import them there. - The requester-turn binding folds into upstream's existing window predicate as one ternary: a child bound to the requester turn matches by id, otherwise upstream's window applies. Bounds exist only for a requester run, so the result equals the fork's former filter. - The spawn-custody guard joins upstream's owner early-return; `entry` is computed first and has no side effects, so behaviour is unchanged. RED at 3178f4f: check:line-cap-ratchet, lifecycle-wake 700 -> 703, queries 700 -> 738. GREEN: ratchet bare and --base 8ea3ef8 0 (both files at 700); tsgo:core 0; oxlint clean; queries (incl. requester-window, raw-owner), registry-read, run-liveness, lifecycle-wake retry and work-dispatch suites green. Refs karmaterminal/openclaw-bootstrap#1727
…rejection-write mock Upstream openclaw#186443 made the requester settle wake classify SubagentCompletionSourceChangedError and SubagentRequesterWakeProgressChangedError in its catch path. The fork's rejection-write suite mocked the completion-admission store with only its two write functions, so the strict mock threw on the missing classes inside that catch and the wake never reported "requester settle wake failed". The mock now forwards the real module and overrides only the two writes. RED at e5c7bb0 (and the merge): 1/1 failed, expected warnings to include "requester settle wake failed". GREEN: rejection-write 1/1 plus lifecycle-wake retry, 19/19. Refs karmaterminal/openclaw-bootstrap#1727
What Problem This Solves
Fixes requester subagent completions retrying forever when cleanup or recovery changes the child's completion owner between wake admission and settlement.
User Impact
An already delivered result can finish its bookkeeping after child cleanup. A wake refused before dispatch records failed delivery and attempts one deduplicated notice in the requester transcript. Distinct ordinary failed waves receive distinct notices; retries and batched delivery retain their shared notice identity. Retained wakes converge on their next evaluation without manual database edits or a migration.
If the requester transcript is unavailable, the notice failure is logged and settlement still finishes. Notice append and settlement are deliberately separate: a crash between them may leave a failure notice followed by a later successful delivery.
Why This Change Was Made
Dispatch and terminal bookkeeping previously shared the child's strict execution-custody check. After custody changed, both the original write and its failure settlement rejected the same captured row; retained callbacks and the durable wake kept the loop alive.
Terminal bookkeeping now resolves the current row while preserving the run, requester, cancellation ownership, delivery generation, wake generation, frozen cohort, pause notice, and delivery policy. Dispatch keeps strict authority checks. Quiet completion also checks observed progress, and stale quiet decisions release their pending receipt instead of consuming newer work. Permanent owner rejection no longer retains a dispatch replay. If settlement commits but publication fails, its retained receipt reconciles through the existing transaction owner against acknowledged postimages, instead of comparing against the obsolete pre-turnover child snapshot.
The change reuses the existing settlement, cancellation comparison, transcript idempotency, and persisted wake owners. There is no new state store, schema, configuration, or retry mechanism. Production code grows by 95 lines for the explicit settlement boundary and failure notice; test lines stay flat, replacing obsolete custody-rejection assertions with behavior proof. The lifecycle owner remains at its existing 700-line cap.
Evidence
7c0f75ece787e7be7248ea712b9c1df3aacfa814, reproducing both the wake failure and the repeated failure-settlement rejection. They pass with the fix, including database reopen, a second sweep, and no duplicate dispatch.git diff --checkpassed.The first CI run caught two expiry-receipt regressions: accepting an old receipt after cancellation or a delivery-generation change. Both reproduced locally and were fixed by retaining the existing cancellation/generation checks; the six focused lifecycle/progress/expiry cases passed afterward. No CI rerun or baseline exception was used to hide these failures. Subsequent CI runs 40621198053 and 40624609743 passed for their respective preceding heads; the final-head CI run passed for
5d554f966a9ae857921e8df2b180820bb22e8296(41 successful jobs, 28 skipped). Both requiredopenclaw/ci-gatecontexts passed, and the exact-head native watcher returned GREEN.The supplied incident logs establish the repeated rejection but do not identify the exact production field that changed. The regression proves the lifecycle-turnover mechanism; deployment verification remains separate.