Repository navigation
fix(cli): stop pending cron inventory reads on interrupt - #187726
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 changesConnect cron inventory and job lookup reads to invocation cancellation while preserving ordinary errors and accepted mutation outcomes. Example: Press Ctrl-C while
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR: it fixes a demonstrated cancellation bug still present on current main, preserves mutation receipts, and has no actionable findings; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCron CLI commands use a shared inventory and lookup owner to issue Gateway RPCs and render results; the existing invocation work scope supplies cancellation and root cleanup owns interrupt exit status. flowchart LR
A[Cron CLI command] --> B[Inventory and lookup owner]
C[Invocation work scope] --> B
B --> D[Gateway RPC client]
D --> E[WebSocket Gateway]
B --> F[Cron output and error owner]
C --> G[Root cleanup and exit status]
Technical reviewBest possible solution: Land the focused cancellation wiring through the existing read and error owners once ordinary exact-head gates pass. Do we have a high-confidence way to reproduce the issue? Published built-CLI baseline/candidate evidence demonstrates the failure and recovery with both signals, and fetched main retains the same unsignalled read paths; this read-only review executed no target code. Is this the best way to solve the issue? The patch is the smallest complete repair: pending reads consume the existing invocation signal, pagination checks cancellation, and the shared error owner suppresses cancellation without hiding ordinary mutation failures. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b2c22d4f023a. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +16, Tests -2, Docs +5. Total +19 across 4 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 HistoryReview history (4 earlier review cycles)
Reviewed October 29, 2026, 1:40 PM ET / 17:40 UTC (Revision 5). |
`openclaw cron list` read `cron.list` pages without the command's interrupt signal: after Ctrl-C the accepted request stayed pending until its RPC timeout, then a late "outcome unknown" error printed and the command exited 1 instead of 130. The pager also kept requesting further pages and snapshot restarts, so the uninterruptible window grew with inventory size. Thread the CLI work signal through the inventory pager and the exact-ID/name lookup, check it between pages, and let an interrupted cron read stay with the root signal owner instead of rendering a command failure. Read-only reads stop quietly; mutations keep their existing lifetime, so a rejection that settles after Ctrl-C still reports itself. `cron show` reads through the same lookup and now uses that handler too. The process test covers an inventory read, a cancelled lookup, and a rejected mutation, and is registered in the isolated CLI process lane.
c969368 to
4d0cac0
Compare
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review. |
|
🦞👀 Re-review progress:
|
Built cron CLI interruption proofCandidate Shipped entry point and fault boundaryEach case launches the built The CLI uses its real command registration, invocation signal owner, Gateway client and WebSocket transport. A loopback Gateway-compatible peer completes the real protocol handshake, records the requested method, then deliberately withholds the accepted read's response. SIGINT or SIGTERM is sent only after that request is observed on the wire. No production module is mocked or preloaded and no real Gateway, credentials or user state is used. For each signal, The ranges combine both signal groups for each command. Main waits out the configured 8000ms RPC timeout and emits a late Normal completion and accepted-mutation controls
That is 40 completed built-CLI cases across the two artifacts, in addition to the initial main reproduction. The peer is synthetic specifically to control accepted-but-pending RPC timing; this proves CLI cancellation, output and write-receipt custody, not scheduler execution or automation storage durability. Focused checks and simplification
Exact-head final dispositionFor
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 8b8c33e. Thanks @SunnyShu0925. cron list and show now stop promptly on Ctrl-C or a service stop. |
…7726) fix(cli): stop cron list and show on Ctrl-C and SIGTERM openclaw cron list and cron show ignored SIGINT and SIGTERM while waiting for the Gateway, so they kept waiting about 8 s and then printed a late failure. Pending list and show reads now cancel on the first signal, print nothing late and exit with 130 or 143. An add or edit already sent to the Gateway still waits for its receipt and reports any failure; an interrupt doesn't undo it. The cron CLI docs describe this. Evidence: built CLI on Node 24.22.1 (40 cases). Interrupting list and show with SIGINT or SIGTERM, main waited 8.0 to 8.2 s and printed late failures (twice each); with this change the CLI exited 130 or 143 in 24 to 47 ms with empty stdout (twice each). Normal output is byte-identical, and accepted and rejected mutation receipts are still shown. Details: openclaw#187726 (comment). Thanks @SunnyShu0925. Co-authored-by: SunnyShu <0668000539@local> Co-authored-by: Ayaan Zaidi <[email protected]>
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 #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: #197315 (comment) and #197315 (comment). Thanks @Alix-007. Co-authored-by: Ayaan Zaidi <[email protected]>
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:
cron listandcron showcould keep waiting after Ctrl-C or SIGTERM, then print a late Gateway timeout/failure document for the cancelled read. The root signal owner already preserved the interrupt exit code, but the inventory and lookup RPCs did not share its cancellation signal.Why This Change Was Made
The existing inventory/lookup owner now passes the invocation signal to read RPCs and checks it between pages. The existing cron error owner leaves an invocation-cancelled AbortError to root cleanup while still reporting ordinary failures. There is no separate forwarding error handler, new signal option or caller-specific cancellation policy.
Mutating RPCs are unchanged and receive no cancellation signal. An accepted mutation still waits for its receipt; a rejection after interruption remains visible. Completed exit outcomes keep their existing identity. Pagination, snapshot consistency, legacy Gateway compatibility and scheduler execution policy are unchanged.
Preserves @SunnyShu0925's original contributor commit and implementation intent. AI-assisted repair, simplification and validation.
User Impact
Interrupting pending list/show reads promptly returns the shell with status 130 for SIGINT or 143 for SIGTERM, without a late table or failure document. Root interrupt notices remain on stderr. Interrupting an already-sent
addoreditdoes not undo the mutation or hide its eventual failure.Evidence
Captured shipped-CLI main/candidate proof and controls on exact head
bc1043097874f946aff1c7cd953897d2b86b30ab:node:24.22.1Docker using the repository's supported runtime build. Real CLI registration, signal cleanup, Gateway client and WebSocket transport; a loopback peer completes authentication and withholds accepted replies. No production module interception or real credentials/state.listandshow, SIGINT and SIGTERM, twice per signal per artifact: main takes 8.01–8.18s and prints a latecli_error; candidate takes 24–47ms, exits 130/143, and keeps stdout empty.cron addcontrols run twice per signal per artifact. Connections stay open until the delayed receipt; accepted results and real rejection diagnostics remain visible before exit 130/143. 40 completed built-CLI cases total.Simplification reuses the existing cancellation table and removes the duplicate new process suite, its fixture/registry scaffolding, unused signal-option surface and parallel error handler. Existing run-wait phases remain covered. Whole PR: production +16 lines, tests −2 lines, docs +5 lines; no increased ratchet or allocation exemption.
The synthetic peer controls pending-RPC and receipt timing. This proves the shipped CLI's cancellation, output and accepted-write custody, not scheduler execution or persistent automation storage durability.
Merge danger
Two-way door: reverting restores the prior cancellation behavior; no config or state migration is introduced. Blast radius is Gateway-backed cron inventory/lookup reads and their existing error renderer during invocation cancellation. Accepted mutations, ordinary errors, pagination semantics and scheduler state are unchanged.