Repository navigation
fix: retire stopped command continuations - #166775
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: needs maintainer review before merge. Reviewed October 8, 2026, 1:56 AM ET / 05:56 UTC (Revision 8). ClawSweeper reviewWhat this changesThe branch carries command request ownership through completion events so Stop retires queued or running follow-ups while preserving unrelated work and existing delivery custody. Example: Click Stop while an ordinary command’s completion reply is running.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR remains necessary and has convincing behavior proof. The previous delivery-custody concern is corrected, the wake failure is independently resolved, and this review found no actionable introduced defect. Priority: P2 Before mergeNone. FindingsNone. Provenance
Agent review detailsHow this fits togetherCommands that finish after their initial model turn enqueue completion events, which the background wake runner turns into follow-up replies. This change connects those events and replies to the original request’s cancellation owner. flowchart TD
A[Ordinary command finishes] --> B[Completion event with request owner]
B --> C[Background wake selects events]
C --> D[Follow-up execution]
E[User presses Stop] --> F[Cancel selected request owner]
F --> B
F --> D
D --> G[Reply delivery and settlement]
G --> H[Preserve unrelated work and delivery custody]
Technical reviewBest possible solution: Extend the existing request and delivery owners through completion settlement, preserving independent services, unrelated events, and irreversible send outcomes. Do we have a high-confidence way to reproduce the issue? Yes: current-main completion production drops request ownership, leaving queued work undiscoverable after process-record eviction; the supplied Gateway comparison demonstrates the corresponding before-and-after behavior. Is this the best way to solve the issue? Yes: the patch extends existing ownership and settlement boundaries instead of introducing another cancellation or retry manager. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b271dcd23352. Provenance checked
TestingProof path: shipped entry point. Added test files: 7. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +192, Tests +1111, Docs +1, Other -1. Total +1303 across 20 files. 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 HistoryReview history (7 earlier review cycles)
|
9e006fd to
1b79448
Compare
17f964a to
5323982
Compare
82b4f28 to
9945186
Compare
9945186 to
71e3277
Compare
|
Fixed: Stop now retires ordinary command continuations while preserving unrelated events and later instructions. |
Retire queued and running ordinary command continuations when their request is stopped, preserving unrelated events and existing delivery custody.
Conflicts: system-events (openclaw#166775 exec-request owners now wrap both the append event and our keyed replaceSystemEventEntry replacement), session-system-events (onEventsAdmitted carried onto prepareFormattedSystemEvents, fed the consumed set as upstream does), config baseline (regenerated). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jhynq2GVpzuVQQieebEubg
What Problem This Solves
An ordinary command can finish after its model turn and queue a completion turn. Stopping the request must also retire that continuation. The completion event currently loses the command's request owner, so removing the retained process output can leave Stop unable to find the queued work. A completion that has already started can also retain an event eligible for another wake.
This change uses the request-owned command cancellation landed in #166753 and follows that ownership through the completion queue, reply execution, and delivery.
User Impact
Stop retires the selected ordinary command's queued or running continuation, prevents its late final reply, and rejects another completion occurrence from the stopped owner. This remains effective when the process output record has already expired. Other queued events keep their order and remain available, and a later human instruction receives a fresh request owner.
Deliberate
background: trueservices, retained command output, completed model receipts, and managed-worker behavior retain their existing contracts. No configuration or migration is required. An obsolete exact run ID does not gain cancellation authority after all of that request's active and queued custody has retired.Why This Change Was Made
The exec completion producer now attaches its existing process-local request owner to the queued occurrence. Queue copies preserve that metadata, and heartbeat dispatch passes only its selected event owners into reply execution. The same cancellation signal then protects admission, execution, and final delivery. The metadata does not enter JSON or persistent storage.
Ordinary system events sharing a command continuation are temporarily retained until its outcome is known. The actual prompt-admission owner records which occurrences were admitted: normal and error exits keep their prior consumption behavior, while cancellation before a send preserves those unrelated events and later arrivals. Confirmed and unresolved sends retain the existing delivery owner; Stop cannot make the same result eligible for another generated reply. An unbound heartbeat retains the original request's actor and hidden/side-turn protections; a genuinely actor-bound current turn retains its own authority.
Live request ancestry also records continuation run IDs for same-controller descendant selection. Native child termination and routed destination-controller adaptation remain separate work; a run-ID list alone does not establish authority over another controller's children.
Evidence
The original producer regression fails before the fix when a completed command's output record has expired. Focused proof covers 85 cases across event/delivery custody, Gateway cascade/error handling, publication and wake-handler replacement. The 18-case delivery file passes in 93.26 seconds with one worker; the six-case full-reply file passes in 55.24 seconds, including worker preparation. Restoring the prior settlement behavior fails the sent/uncertain-delivery cases while no-send controls pass.
A confirmed or unresolved send never obtains a second send owner. Native recovery without a reconciler settles the unknown send without blindly replaying it. Cancellation before publication or dispatch leaves unrelated events available. The actual channel abort entry additionally passes denied/stale-target controls, retires a completed command after its process record is gone, preserves generic-event order, and admits a later human reply with a fresh owner.
At
9945186, all 53 static groups, 33 type graphs, package-boundary checks, the full private-QA build, 3,961 Node tests, 78 UI tests, and browser-extension checks passed; one Node test was skipped. The sole failing Node case was the existing direct-RPC Stop followed by a wake: its exact baseline reproduced the same stale command-source claim, independently repaired in #166968. The final prepared composition now passes that unchanged case in CI: one test passed in 15.32 seconds at merge treea62c681, combining published71e3277with targetc531ab2. These historical results retain their tested source identities.Independent engineering review and the required P0 review qualify the final correction. The two contribution commits replay unchanged to
71e3277; review of the relevant target changes preserves the existing proof. Current-head hosted checks and ClawSweeper remain final landing gates. The five failed type lanes all report the same undefinedresetProgressStatein the unchanged Discord draft-preview owner. Each matching lane reproduced that diagnostic on exact targetc531ab2in scheduled CI; the aggregate gate reflects those failures. All 47 other executed PR jobs passed. The source file, relevant compiler inputs and dependencies match the target, so these are independently evidenced baseline failures.The real Gateway/browser comparison below passes: Stop acknowledges cancellation in both variants, but only the fixed variant removes the selected completion. A later human instruction completes. The separate uncanceled control delivers exactly once, preserves that final after reload, and accepts the next instruction; it ran on the explicitly identified macOS composition. Only the loopback model response is scripted.
Visual evidence
Command completion, Stop, then a new instruction
after-stop.mp4
Visual verification
71e32777fbc1e6e376957db380289203561d2a47