Repository navigation
fix(cron): cancel interrupted status and history reads - #197315
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 changesMake pending cron status, get, runs, and scratch reads consume the existing command cancellation signal. Example: Press Ctrl-C while
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current cron cancellation defect with a focused change, credible production-path proof, and no actionable findings; exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCron command registration sends read RPCs through the shared CLI Gateway transport; the command work scope supplies cancellation, and root cleanup owns interrupt exit status. flowchart TD
A[CLI interrupt] --> B[Command work scope]
B --> C[Cron read helper]
C --> D[Gateway RPC transport]
D --> E[Gateway connection closes]
D --> F[Cron error handler]
F --> G[Root cleanup and exit]
Technical reviewBest possible solution: Land the focused helper and read-call changes once the existing exact-head merge gates pass. Do we have a high-confidence way to reproduce the issue? Current-main source shows the missing signal on all four read paths, and supplied before/after built-CLI traces demonstrate the resulting forced termination; this read-only review did not execute a reproduction. Is this the best way to solve the issue? The change is the smallest complete repair: reuse command signal ownership, the existing Gateway abort implementation, and the existing cron error handler while leaving submitted writes uncancelled. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0e966cc6e092. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +16, Tests 0, Docs +1. Total +17 across 6 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. 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 HistoryReviewed November 11, 2026, 2:25 PM ET / 19:25 UTC (Revision 3). |
|
Thanks @clawsweeper for checking the cancellation and write-receipt boundaries. CI stopped in checkout with |
|
Thanks @Alix-007. I shrank the fix to what this bug needs. A new Proof: built CLI and built Gateway on node 24.22.1 in a secretless Docker container, CLI in a real PTY with
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Follow-up |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Exact-head re-proof on |
|
/refresh-security-review e7efd89 |
|
Thanks @obviyus for simplifying the Cron read handling and rechecking it against a real Gateway! |
fix(cron): stop pending cron reads promptly on Ctrl+C Pressing Ctrl+C or sending SIGTERM during openclaw cron status, get, runs or a scratch read did not reach the Gateway request, so the CLI kept the socket open until its cleanup force-killed it about 2 seconds later. These reads now go through one helper that passes the command's existing abort signal to the Gateway call, and the existing cron error handler already drops the resulting abort, so nothing prints afterwards. The scratch read before a set or unset is cancellable too, so Ctrl+C there stops before the write is sent. Mutations still wait for their receipt. This completes the cron read commands after openclaw#187726. No new text. Evidence: the built CLI in a real PTY with --json against a real built Gateway behind a WebSocket proxy holding the read replies, two runs each plus the exact head. On main every interrupted read kept the request open and was SIGKILLed about 2.1 s after Ctrl+C or SIGTERM; with this change the CLI exits 130 within 0.03-0.16 s with empty stdout, and SIGTERM exits 143. Uninterrupted reads return the same JSON on both, and an interrupted cron add whose receipt arrives still prints its confirmation on both. Net 0 test lines. Details: openclaw#197315 (comment) and openclaw#197315 (comment). Thanks @Alix-007. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: interrupting
cron status,get,runs, or a read-onlyscratchquery leaves the Gateway request running until the CLI launcher forcibly kills it about two seconds later.User Impact
These queries now stop promptly on Ctrl-C/SIGTERM and exit 130/143 without printing a late result or error. Interrupted write operations still report their receipts.
Why This Change Was Made
Finish the remaining Cron read commands using the existing command cancellation and Gateway transport owners. This follows the accepted list/show behavior from #187726 and preserves run-wait, mutation and scratch compare-and-swap custody. No configuration, protocol/schema, permission-policy or upgrade changes.
Evidence
Product head:
1ea4cc3557bb7022a2d6c6546264f1227e8dc862.BASE:
c324818cbf86074f34578d07f381b0d2835955a1.Proof command:
python3 cron-read-cancel-proof-v1.py CHECKOUT FRESH_OUTPUT NODE26 EXPECTATION(the same collector and scenarios on both heads).openclaw.mjsthrough a real PTY and compatible local WebSocket peer. Fourteen read interruptions change from launcher SIGKILL at about 2.05 seconds to natural 130/143 within 131 ms; correlated peer closure takes at most 44 ms.Production: +59/-27 lines across three registration files. Tests: +26/-7 lines in the existing command table, with a separate 19-LF allocation. No new RPC or cancellation policy; the preflight checked existing cancellation support and all Cron read/write siblings.
The peer uses synthetic data to verify actual CLI transport, output and lifecycle behavior. Not tested: real Gateway storage/scheduler effects, external providers, production channels, Windows/macOS or full repository CI. Peers were stopped after observation; only isolated evidence fixtures remain.