Repository navigation
fix(agents): cancel queued CLI work promptly - #169303
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. What this changesThis PR forwards the caller’s abort signal to the existing session queue so cancelled CLI turns reject promptly. Example: A turn for agent:main:fenced is queued behind an active turn and its caller cancels it.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a cancellation defect still present on current main, and no actionable patch defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherCLI run entry points pass session identity and cancellation into placement admission, which serializes turns through the shared command queue before acquiring placement ownership. flowchart TD
A[CLI run caller] --> B[Session placement admission]
B --> C[Shared session queue]
D[Caller abort signal] --> C
C --> E[Placement owner]
E --> F[CLI execution and settlement]
Technical reviewBest possible solution: Use the shared queue’s existing cancellation contract while preserving active-turn ownership and settlement. Do we have a high-confidence way to reproduce the issue? Current-main source shows cancellation is checked only when the queued task runs; the contributor reports a failing-before and passing-after regression, which was inspected but not executed during this read-only review. Is this the best way to solve the issue? Signal forwarding repairs the missing connection at the shared admission owner and reuses established queue cleanup instead of adding competing cancellation machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4e3818bab0fe. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests +11. Total +12 across 2 files. Added test files: 0. View PR surface stats
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 October 11, 2026, 3:29 PM ET / 19:29 UTC (Revision 2). |
|
Merged via squash.
|
Cancelling CLI work while it waits behind an active session turn previously left the caller blocked until the predecessor finished. Forward the caller's abort signal to the existing command queue so cancellation promptly removes and rejects the queued turn without executing it. Strengthen the existing regression to await rejection before releasing the predecessor. The regression fails before the fix; all 39 focused owner, caller-scope and queue cancellation tests pass afterward. Victor Jaepyo Jo (@changeroa) previously identified the same cancellation defect in #160804, which also contains distinct cron watchdog work. This narrow fix was independently reproduced. Co-authored-by: Victor Jaepyo Jo <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit 9607478)
Cancelling CLI work while it waits behind an active session turn previously left the caller blocked until the predecessor finished. Forward the caller's abort signal to the existing command queue so cancellation promptly removes and rejects the queued turn without executing it. Strengthen the existing regression to await rejection before releasing the predecessor. The regression fails before the fix; all 39 focused owner, caller-scope and queue cancellation tests pass afterward. Victor Jaepyo Jo (@changeroa) previously identified the same cancellation defect in openclaw#160804, which also contains distinct cron watchdog work. This narrow fix was independently reproduced. Co-authored-by: Victor Jaepyo Jo <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Cancelling CLI-backed work queued behind another turn now rejects promptly, while that earlier turn remains active.
User Impact
Cancelled work leaves the session queue immediately and never executes. Existing ordering and active-turn settlement stay intact; no configuration or migration is required.
Why This Change Was Made
The CLI admission owner checked cancellation at execution time but did not pass the caller's signal to the existing queue, so an aborted queued turn waited for its predecessor. Forward that signal instead of adding another cancellation mechanism.
Evidence
The strengthened existing queued-cancellation regression failed on the original code with one queued entry remaining after abort. After the one-line production repair, it verifies activeCount=1, queuedCount=0 and rejection before releasing the predecessor.
Focused admission, caller-scope and queue cancellation proof: 39/39 tests passed in 148.579 seconds wall time. The changed owner file took 27.70 seconds; the cancellation case took 7 milliseconds. Production delta: +1 line. Deslop retained only the necessary signal forwarding. Fresh independent Codex review through P2: scoped-clean. Hosted CI passed on this head, and the completed ClawSweeper review found no actionable defect. Exact-head CI run 38167004129 passed the source, production/test type, lint, guard and ratchet jobs and the enforced CI gate. The local changed check passed guards, ratchets, production types and twelve test type graphs, then was intentionally interrupted (exit 130, 1564.712 seconds wall) once the equivalent hosted gates completed; the full local command is not claimed as passed.
Related work
@changeroa previously identified the same queued-cancellation defect in #160804. This narrow prerequisite was independently reproduced and keeps the fix at the existing queue owner. That contributor PR also adds a distinct cron setup-watchdog lane-wait contract and remains relevant after this fix. Credit: Victor Jaepyo Jo.