Repository navigation
fix(cli): cancel interrupted tts gateway RPCs - #195206
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 changesForward the invocation’s abort signal to the remaining TTS Gateway RPC calls. Example: Press Ctrl+C while
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR completes a useful cancellation repair with convincing shipped-CLI proof and no identified defects; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherTTS command handlers send RPCs through callGateway; the invocation owns client cancellation, while the Gateway retains ownership of accepted preference writes. flowchart LR
A[CLI invocation] --> B[TTS command handlers]
A --> C[AsyncWorkScope signal]
C --> D[callGateway transport]
B --> D
D --> E[Gateway TTS handlers]
E --> F[TTS preference writer]
Technical reviewBest possible solution: Merge the existing signal-forwarding repair once the normal exact-head checks complete successfully. Do we have a high-confidence way to reproduce the issue? Current-main call sites and transport cancellation logic establish the failure path, corroborated by supplied main-versus-candidate Gateway/PTY traces; this review executed no target code. Is this the best way to solve the issue? The smallest complete fix is to pass the existing invocation signal at all four missing RPC boundaries, preserving output suppression and Gateway write ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 21e6fd7ee3e1. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +5, Tests -4. Total +1 across 3 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 HistoryReview history (4 earlier review cycles)
Reviewed November 8, 2026, 10:19 AM ET / 15:19 UTC (Revision 5). |
`capability tts convert` forwarded the invocation's cancel signal, but the other TTS Gateway paths called `callGateway` without it: `tts status`, `tts providers --gateway`, `tts personas --gateway`, and the Gateway branches of `tts enable`, `disable`, `set-provider`, and `set-persona`. `callGateway` only wires an abort handler when a signal is passed, so Ctrl+C left those RPCs open until the 30s timeout. Pass the existing ambient signal (`getAsyncWorkSignal()`) to every remaining TTS Gateway call. No new plumbing or behavior for uninterrupted runs.
6f077e7 to
fb00ca5
Compare
|
Shipped-CLI interruption proof for the four TTS Gateway RPC boundaries. MethodTwo independent lanes, each its own
Node v24.19.0, same binary in both lanes. Each lane starts one real Gateway
Per boundary there are two runs: Results
Base never returns on its own: the launcher's ~2 s interrupt grace expires and the child is What the terminal actually printed after ^CBase (70 bytes, then ~2 s of silence until SIGKILL): Head (131 bytes: same notice, then the terminal-mode restore, then immediate exit): No stale RPC payload is printed in either lane; the difference is that head finishes its Uninterrupted control runs returned the real Gateway envelope in both lanes, e.g.: { "transport": "gateway", "enabled": false, "auto": "off", "provider": "openai",
"persona": null, "personas": [], "fallbackProvider": null, "prefsPath": ".../state/settings/tts.json" }
|
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
|
Maintainer proof for Setup: built Main prints Interrupted Controls (no Ctrl+C), same output on main and candidate, exit 0: Unit: the existing cancellation table now also covers |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 2e0e3c5. Thanks @shuisadev and @SunnyShu0925. Ctrl+C now stops the TTS Gateway commands at once. |
fix(cli): cancel interrupted tts gateway RPCs openclaw capability tts status, providers --gateway, personas --gateway and the --gateway state changes (enable, disable, set-provider, set-persona) ignored Ctrl+C. The Gateway request got no abort signal, so the command waited until its 30-second timeout or a forced kill. The abort signal is now passed to these Gateway calls, as tts convert already does since openclaw#194128. The client stops waiting; the Gateway can still finish a write it already received. Evidence: built openclaw from main and from this change, each with a real Gateway, in Docker on node 24.22.1. A local relay held the tts replies for 25 s, and Ctrl+C was sent in a real terminal 1 s after the request reached the Gateway. tts status: main was force-killed after 2174 ms with the connection still open; this change exits with code 130 after 28 ms and closes the connection. set-provider: 2273 ms and killed on main, exit 130 after 22 ms with this change. In both builds the Gateway had already written the setting before Ctrl+C. Runs without Ctrl+C give the same output on both. Details: openclaw#195206 (comment). Thanks @shuisadev and @SunnyShu0925. Co-authored-by: SunnyShu <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
openclaw capability ttsGateway commands ignored Ctrl+C.callGatewayonly attaches an abort handler when it receives asignal, and these call sites passed none, so an interrupted command left its RPC open until the 30stimeoutMsexpired — the caller simply sat there until the launcher's ~2s grace SIGKILLed it:openclaw capability tts statusopenclaw capability tts providers --gatewayopenclaw capability tts personas --gatewayopenclaw capability tts enable|disable|set-provider|set-persona --gateway(one sharedrunTtsStateMutationcall site)openclaw capability tts convertwas already fixed this way in #194128; the other Gateway call sites in the same modules were missed.Why This Change Was Made
runCapabilityCommandalready creates the ambientAsyncWorkScopesignal and suppresses output once the invocation is cancelled, so the only missing piece was handing that signal to the Gateway transport. Each site now passessignal: getAsyncWorkSignal(), exactly likerunTtsConvert. Local (non-Gateway) paths are untouched: they perform no RPC, only config/prefs file access.Tests: the existing cancellation table in
src/cli/capability-cli.test.tsgainstts status,tts providers,tts personasandtts disableGateway cases (the image case was compacted so the file does not grow). No new test files and noconfig/test-lines-allocationsentry.User Impact
Ctrl+C now cancels these commands in ~100 ms instead of hanging until SIGKILL and up to 30 s of RPC timeout, no stale RPC output is printed (only the interrupt notice and the terminal-mode restore), and the terminal is left usable. Uninterrupted runs behave exactly as before. For an interrupted
set-provider/enable/disable/set-persona, the client only stops waiting: the Gateway can still finish a write it has already received.Evidence
Shipped CLI, real Gateway, real PTY, A/B on
b32f01abae8(base) vsfb00ca53b1b(this head). Each lane is its owngit worktree+pnpm install --frozen-lockfile+pnpm build:runtime, anddist/build-info.jsonreports the lane commit. A passive WebSocket observer relays the upgrade handshake and every frame unchanged, withholding only the armedresframe; the CLI runs underpty.forkand receives a real VINTR once the observer sees its request reach the Gateway.Control runs (2500 ms hold, no interrupt) exit 0 in both lanes and print the real Gateway envelope. Base prints
Command interrupted by SIGINT. Waiting for cleanup before exiting.and then stays silent until SIGKILL; head prints the same line, restores the terminal, and exits 130.Cancellation covers the caller's RPC, not the mutation. The signal stops the client from waiting; it does not cancel or roll back the Gateway's write. A write the Gateway has received can still finish after the client exits (the maintainer proof below shows
settings/tts.jsonwritten in both lanes for an interruptedset-provider).Maintainer proof on the current head (real Gateway, real PTY, main vs candidate, controls, interrupted
set-provider): #195206 (comment)Unit RED on
mainwith production unchanged (current table):GREEN with the fix:
src/cli/capability-cli.test.ts118/118.