Repository navigation
fix(channels): cancel pending status read in channels list on Ctrl+C - #197815
Conversation
`channels list` issues the same `channels.status` RPC as `channels status`, but never passed an AbortSignal. A Ctrl+C during the pending gateway read left the request running until its 5s timeout, delaying exit and printing a late command-local fallback list. Thread `getAsyncWorkSignal()` through the read and surface the cancellation instead of the fallback. Precedent: openclaw#196976 (same RPC fixed for `channels status`). Co-Authored-By: nebulacoder-v8.0 <[email protected]>
|
🦞👀 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 changesPasses invocation cancellation into channel-list status reads and propagates interruption instead of continuing to fallback output. Example: Press Ctrl+C while openclaw channels list awaits a delayed channels.status response.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current-main cancellation gap with a focused patch and convincing built-CLI proof; no actionable defects were found, and CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe channel-list CLI combines plugin metadata and local configuration with Gateway account snapshots, then renders text or a local JSON inventory. flowchart LR
A[CLI invocation] --> B[Channel list command]
C[Invocation cancellation] --> B
B --> D[Gateway RPC client]
D --> E[Gateway channel status]
B --> F[Local account inventory]
E --> G[Terminal output]
F --> G
Technical reviewBest possible solution: Land the existing signal propagation and cancellation regression once the required exact-head checks pass. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the missing signal, and supplied base-versus-head built-CLI logs demonstrate the interruption failure; no target code was executed during this review. Is this the best way to solve the issue? The patch repairs the missing call-site connection to existing cancellation ownership while retaining normal Gateway fallback and JSON behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 808c53a7a763. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +8, Tests 0. Total +8 across 2 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:
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 12, 2026, 12:48 PM ET / 17:48 UTC (Revision 3). |
|
Body updated with the inspectable peer-transcript capture (base: held -> released + marker printed after SIGINT; head: held only, no late output). @clawsweeper re-review |
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Maintainer proof at Setup: node 24.22.1 in a secretless container, built CLI (
Neither build prints an account list after the signal. On main the interrupted command never finishes on its own: it waits on the status read and is killed. With this PR the read is aborted and the command exits with the normal signal code. Only the random tagline differs between outputs. The folded cancellation test passes with this PR. With main's Event log excerpts |
|
Landed in c7a4976. Thanks @wangmiao0668000666. |
…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]>
|
Thanks for merging this! Appreciate the review and the help landing it. |
What Problem This Solves
openclaw channels listissues the samechannels.statusRPC thatchannels statususes, but never passes an AbortSignal. When the user presses Ctrl+C while the gateway status read is pending, the RPC keeps running until its 5s timeout, delaying process exit and then printing a late command-local fallback account list on top of the cancelled output.Why
channels statuswas already hardened for this in #196976 (threadgetAsyncWorkSignal()through the RPC and re-raise cancellation).channels listcalls the same RPC but was missed — a same-source call-site neighbor. Without a signal,callGatewayhas no abort handler, so the pending request is not cancelled and the CLI waits out the full timeout on Ctrl+C.Solution
Thread the work-scope signal through the read, and re-raise the cancellation when the RPC settles after abort, instead of falling back to the command-local account list:
channelsListCommandcapturesgetAsyncWorkSignal()and re-checkssignal?.throwIfAborted()at the entry and after the gateway read.readGatewayChannelStatus(signal)passessignaltocallGateway, and on a caught error callssignal?.throwIfAborted()so a Ctrl+C surfaces as the canonical abort instead of an "unreachable gateway" fallback.Evidence
Shipped CLI proof — real
openclaw channels listexecuted from source trees (/ws-basevs/ws-head-channels-list) inside an isolated container, driven against a synthetic loopback WebSocket gateway peer speaking the real OpenClaw wire protocol. SIGINT is delivered to the PTY while thechannels.statusrequest is held pending (peer delays its response past the interrupt). Capture below is the machine-readable peer transcript produced by the harness (ws-peer-harness/drive.mjs), redacted (token shown as***).base (before) — late fallback printed after Ctrl+C
head (fix) — no late output; cancelled promptly
The decisive difference: base shows
held -> released {socketOpen:true}and prints the marker list after SIGINT; head stops atheldand prints nothing — the pending read is cancelled and the cancellation propagates instead of the late fallback.Discriminative unit test added (
propagates cancellation during a pending gateway status read): red on base (promise resolves instead of rejecting with the cancel reason), green on head.Precedent: #196976
Maintainer proof: #197815 (comment)