Repository navigation
fix(channels): cancel pending status reads on Ctrl+C - #196976
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 changesPass the invocation cancellation signal through channel-status readiness, Gateway reads, and fallback rendering. Example: Press Ctrl+C during
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a verified cancellation bug still present on current main. The prior mock-export finding is resolved, and no new correctness or security findings remain; current-head CI is still running. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe channels-status command turns CLI options into a read-only Gateway request, then renders status or a local config-only fallback; invocation cancellation must stop the read and prevent subsequent status publication. flowchart TD
A[CLI invocation] --> B[Channels status command]
A --> C[Invocation cancellation signal]
C --> B
B --> D[Gateway readiness]
B --> E[Gateway status read]
E --> F[Status output]
E --> G[Config-only fallback]
C --> G
Technical reviewBest possible solution: Land the focused signal propagation and publication checks after the existing current-head CI gates pass. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the missing signal propagation, and inspected BASE/HEAD CLI receipts plus collaborator Gateway logs demonstrate the failure and repair; no target code was executed during this review. Is this the best way to solve the issue? This is the smallest complete repair: reuse invocation cancellation, readiness, and transport owners, and prevent late publication without changing generic RPC cancellation or normal fallback behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4b8fbc72a8b3. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +18, Tests -4, Other -1. Total +13 across 4 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. 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 November 10, 2026, 10:10 PM ET / November 11, 2026, 03:10 UTC (Revision 3). |
|
@clawsweeper re-review Removed the extra test allocation by consolidating the owner tests. Focused tests, types, lint and the test-line guard pass; the body links fresh native proof for |
|
🦞👀 Re-review progress:
|
|
Maintainer proof for the production change at Setup: node 24.22.1 in a secretless container, built CLI (
After Ctrl+C, this PR prints only the existing The new fallback cancellation test passes with this PR. On main's production code it fails ( Event log excerpts |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @obviyus for the real-Gateway checks, the mock-export fix, and landing this! |
fix(channels): stop channels status --probe promptly on Ctrl+C Pressing Ctrl+C during openclaw channels status --probe while the Gateway connection or status read was pending did not stop the command: it kept the Gateway socket open until it was force-killed about 2 seconds later, and could still print the status JSON. The command now forwards its existing abort signal into the existing readiness wait and status request. No text changes. Evidence: the built CLI on node:24.22.1 in a real PTY against a real built Gateway with a local Telegram API stand-in that never answers the status probe. During the status read, main was killed after about 2.17 s with the socket open until then; with this change it exits 130 in 37-42 ms and the socket closes 3 ms after Ctrl+C. While the Gateway was still starting, main was killed after 2.07-2.19 s and once printed the full status JSON 1.8 s after Ctrl+C; this change exits 130 in 37 ms with no JSON. Uninterrupted --probe --json, an unreachable Gateway and channels status without --probe give the same JSON on both. The test mock now keeps the real module exports, so one stale entry leaves config/test-mock-exports-baseline.txt. Details: openclaw#196976 (comment). Thanks @Alix-007. Co-authored-by: Ayaan Zaidi <[email protected]>
…197815) fix(channels): stop the Gateway status read when channels list is interrupted openclaw channels list did not pass its abort signal to the Gateway channel status read, so Ctrl-C or SIGTERM left the request running until the CLI's cleanup deadline force-killed the process, or until the read timed out and the fallback account list printed anyway. The status read now takes the command's abort signal, matching the channels status fix in #196976. Uninterrupted listings, the fallback list for an unreachable Gateway and channels status are unchanged. No new text. Evidence: the built CLI in a secretless node:24.22.1 container against a real built Gateway with one Telegram account on a local fake Bot API, through a relay that holds the channels.status reply for 8 s. On main, SIGINT and SIGTERM during the status read were not cancelled and the cleanup deadline killed the process after about 2.2 s. With this change it exits 130 or 143 in about 0.13 s with no late list. Uninterrupted runs and an unreachable Gateway print the same accounts on both. The folded regression is at net 0 test lines. Details: #197815 (comment). Thanks @wangmiao0668000666. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#197815) fix(channels): stop the Gateway status read when channels list is interrupted openclaw channels list did not pass its abort signal to the Gateway channel status read, so Ctrl-C or SIGTERM left the request running until the CLI's cleanup deadline force-killed the process, or until the read timed out and the fallback account list printed anyway. The status read now takes the command's abort signal, matching the channels status fix in openclaw#196976. Uninterrupted listings, the fallback list for an unreachable Gateway and channels status are unchanged. No new text. Evidence: the built CLI in a secretless node:24.22.1 container against a real built Gateway with one Telegram account on a local fake Bot API, through a relay that holds the channels.status reply for 8 s. On main, SIGINT and SIGTERM during the status read were not cancelled and the cleanup deadline killed the process after about 2.2 s. With this change it exits 130 or 143 in about 0.13 s with no late list. Uninterrupted runs and an unreachable Gateway print the same accounts on both. The folded regression is at net 0 test lines. Details: openclaw#197815 (comment). Thanks @wangmiao0668000666. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes
channels status --probebeing forcibly killed after an accepted Ctrl+C while its Gateway connection or status response is pending.User Impact
Operators can interrupt the diagnostic promptly and get exit code 130, with its client connection closed and no late status JSON. Normal connection/authentication failures still show config-only status.
Why This Change Was Made
Carry the existing invocation cancellation signal through readiness and the read-only status RPC, then check it before publishing status or continuing fallback output. No config/default, protocol/schema, permission, migration or write-RPC policy changes.
Evidence
Product head:
b19cbda9c01278b35058792153f160b028d2ea25.The same normal-built
openclaw.mjs channels status --probe --timeout 30000 --json 2>diagnostics.logcommand ran on BASE and HEAD with a controlling PTY, actual Ctrl+C and a compatible synthetic loopback WebSocket Gateway peer:Frozen collector, stdout/stderr, peer events and replay instructions · HEAD receipt.
Focused validation: 14 tests across three affected suites; the unique fallback regression fails on BASE with nine controls passing. Scoped types, typed lint, normal commit hooks and the canonical test-line guard passed. Production +20/−2 lines; tests net −5 lines, with all original assertions retained and no budget allocation.
Scope, cleanup and inherited check limitation
The recorder boundary is the real CLI/client/socket against a synthetic peer, covering connect and pending
channels.status. This does not claim a real Gateway service, hosted channel/provider, Windows/macOS or full repository CI. Secret/plugin work without an abort seam retains its own execution; final status publication is checked after it returns. All owned CLI/peer processes and threads exited; production configuration, sessions and channels were untouched.BASE already exceeds the shared test-line ceiling by 7 LF (6,643,133 vs 6,643,126). This PR reduces test lines by five and removes its initial allocation; the canonical non-pruning guard passes without changing the shared scalar or granting unrelated debt credit. Cold compiled-worker attempts and their qualified identical-source replays are retained in the linked checks summary; final owner-worker preparation runs before test watchdogs, and no timeout or assertion was weakened.