Repository navigation
fix(cron): stop waiting for run completion when interrupted - #186750
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 changesInterrupting a cron completion wait stops local polling and returns through the CLI’s existing cleanup owner. Example: Send SIGINT after
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current-main cancellation defect with a focused change and no identified correctness findings; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe cron CLI enqueues a Gateway job, polls history for its runId, and prints completion JSON; the root command owns interruption, cleanup, and exit status. flowchart TD
A[CLI cron or automations run] --> B[Gateway enqueue]
B --> C[Completion waiter]
C --> D[Gateway run history]
E[Root cancellation signal] --> C
C --> F[Output and root cleanup]
Technical reviewBest possible solution: Merge the focused waiter repair after the existing exact-head CI gates pass. Do we have a high-confidence way to reproduce the issue? Current-main source shows the uncancelable polling path, and the supplied built-CLI comparison reproduces continued polling after SIGINT/SIGTERM on pinned main; no target code was executed during this review. Is this the best way to solve the issue? The smallest complete fix is to make the existing waiter consume root cancellation throughout RPC, delay, and result publication while preserving the root’s exit status; this diff does that without another lifecycle owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a1859e5195f6. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +14, Tests -2, Docs +2. Total +14 across 3 files. Added test files: 0. View PR surface stats
Review metrics
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 October 28, 2026, 12:33 PM ET / 16:33 UTC (Revision 3). |
|
CI fixture repair at @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Node 24 built-CLI signal proofCurrent main node openclaw.mjs cron run fixture-job --wait --wait-timeout 30s --poll-interval 100ms --json --url "$OWNED_LOOPBACK_WS" --token "$SYNTHETIC_TOKEN"The same matrix also runs the automations alias. Main twice and candidate twice, both aliases, each with SIGINT, SIGTERM, completed, deadline, zero-duration wait and ordinary no-wait controls: 48 real CLI processes. The fixture is only the remote Gateway WebSocket protocol boundary; parser, root command cleanup/work scope, RPC facade/client, native timer and waiter are real. Independently reopened disk recorder logs received
No job-cancel RPC occurs; only connect, enqueue and history methods are received. This is local waiter cancellation, not cancellation of the queued job. No real scheduler/model/provider executes, and actual job continuation is not claimed from a protocol fixture. Native Windows/macOS, release upgrades and interruption during enqueue are not claimed. Like landed policy watch #186562 and voicecall tail #186691, waits consume one cancellation signal and check again before publishing results. This core CLI already has a root signal/work-scope owner: the patch reuses it instead of adding competing process listeners or changing a shared supervisor. Production remains the contributor's original correction. Candidate signal exits are 20–32ms after delivery across all 8 interrupted processes; main remains alive 5481–5675ms and records 201 later history requests in aggregate before harness-only SIGKILL cleanup. Candidate records zero later requests. Focused suite: 62/62 passed, final 1.87s; scoped lint and repository formatter parity pass. Sleep-cancellation regression on pinned main: 1 intended failure, 61 unselected, 3.69s, because the waiter does not settle after abort. Its inputs/logic are unchanged by the final type/table-only cleanup. Simplification removes the over-configurable run-and-capture fixture and its derived metadata, using a queued-history fixture plus a concrete exit capture. All 62 cases remain, including clock rollback/deadline, stored failed completion and sleep/request/late-completion cancellation. Synthetic global Final head |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @obviyus for reviewing and merging this. Much appreciated! |
…#186750) fix(cron): stop cron run --wait on Ctrl-C and SIGTERM cron run --wait (and the automations alias) ignored SIGINT and SIGTERM while it polled for the job result, so it kept polling after Ctrl-C or a service stop. It now stops on the first signal, exits with the conventional status and prints no final result. It doesn't cancel the job itself, matching policy watch (openclaw#186562) and voicecall tail (openclaw#186691). Evidence: built CLI on Node 24.22.1 with both aliases (48 real processes). On main the waiter stayed alive more than 5 s after each signal and made 201 more polls in total (twice each); with this change it exited with 130 or 143 in 20 to 32 ms, with no later polls, no final-result output and no cancel RPC (twice each). Completed, deadline, no-wait and zero-wait controls behave the same on both refs. The Gateway side was a recorded WebSocket fixture. Details: openclaw#186750 (comment). Thanks @Alix-007. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
After
cron run --waitqueues a job, Ctrl-C or SIGTERM leaves local history polling alive until the deadline and blocks root cleanup.User Impact
Interrupting stops the local wait, without sending a cancellation request for the queued Gateway job. Completion, wait deadlines and output flushing retain their contracts. Both
cronandautomationsaliases share the fix.Why This Change Was Made
The waiter consumes the existing root command's cancellation signal for history RPCs, native interval delays and the final result check. Canceled waits return through normal root cleanup, preserving its 130/143 exit status. Like policy watch #186562 and voicecall tail #186691, waits and readback respect signal custody; this core command already has a root work-scope owner, so no competing listener or shared-supervisor change is added.
Evidence
#186750 (comment)
Normal built
node openclaw.mjsCLI, secretless Linux Docker, Node 24.22.1, pinned main89dd4bdf57e7fbed417762f786a75b4110eb3845versus contributor product headf865181fc1aa78420a6987c82c5c33a8f43224f5. Main twice and candidate twice, both command aliases, with SIGINT/SIGTERM and completed/deadline/zero-duration/no-wait controls: 48 actual CLI processes. The owned loopback WebSocket fixture replaces only the remote service; parser, root cleanup, work scope, RPC client and waiter remain real. Requests are recorded to disk and independently reopened.f8208cc2d0c70f9416533c065da753aab0e176afretains both contributor commits and only simplifies test fixtures; measured product code is unchanged. Removed over-configurable fixture/derived metadata, retained all 62 cases and owned drain. Actual signal exit-code ownership is proved in real processes instead of mutating a synthetic global code in unit tests. Production +14, tests −2, docs +2, no baseline change.No real scheduler/model/provider executes; queued-job continuation is a product contract, not a live-job observation from this protocol fixture. Native Windows/macOS, interruption during enqueue, remote production Gateway and released upgrades are not claimed.
Merge Danger
Two-way door: revert restores prior local wait behavior without changing stored jobs, scheduling, RPC schemas or configuration. Blast radius is interrupted CLI completion waits; the queued Gateway job is not canceled, and existing completion/deadline/output behavior remains with its current owners.