Repository navigation
fix(cli): preserve TTS output after accepted interruption - #191635
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 changesThis PR prevents local and loopback-Gateway TTS output publication after the CLI has accepted interruption. Example: Run
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current TTS output cancellation defect with a focused change, convincing built-CLI proof, and no actionable review findings; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe TTS CLI obtains synthesized audio locally or through a loopback Gateway, reads its source file, and publishes an explicitly requested destination through the shared atomic media writer. flowchart TD
A[TTS CLI command] --> B[Local synthesis or loopback Gateway]
B --> C[Read synthesized audio]
D[Invocation interruption signal] --> E[Check before publication]
C --> E
E --> F[Shared atomic media writer]
F --> G[Destination audio file]
Technical reviewBest possible solution: Land the existing signal check at the shared TTS publication boundary once required checks pass. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the unchecked publication path, and the independently posted built-CLI comparison reproduces the destination changes after acknowledged signals; this read-only review ran no reproduction. Is this the best way to solve the issue? The patch is the smallest complete repair: reuse the invocation signal in the existing shared TTS copy owner while retaining source custody, format correction, and atomic publication. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cde38490e291. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +4, Tests -4, Docs +1. Total +1 across 3 files. Added test files: 0. View PR surface stats
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 (1 earlier review cycle)
Reviewed November 2, 2026, 11:26 PM ET / November 3, 2026, 04:26 UTC (Revision 2). |
Independent built-CLI TTS interruption proofFinal head: Real shipped command and accepted-signal barrierIndependently built runtime artifacts in secretless Linux arm64 Node v24.22.1 Docker, fresh task-owned home/profile/config/state/workspace and a unique local HTTP TTS fixture for each case. The bundled OpenAI speech provider receives a synthetic key and explicit local base URL; no real credential or paid service. The fixture fully receives the real POST Actual acknowledgement strings: Observed outcomes
Every SIGINT case exits naturally with 130, every SIGTERM case with 143, no terminating exit signal, and empty stdout. Every control exits 0 with success JSON. Each case reaches exactly one real speech request; no watchdog fires. The returned WAV has RIFF/WAVE framing, PCM format 1, mono 16 kHz / 16-bit audio, and a correctly sized 2,000-byte data chunk. All four uninterrupted outputs are byte-identical. Both candidate SIGINT outputs retain the original bytes; both SIGTERM outputs are still absent after the delayed response and CLI exit. Focused regression and simplification
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in b655b24. Thanks @zhangguiping-xydt. Interrupted TTS commands no longer write the output file. |
…91635) fix(cli): don't write TTS output after the command is interrupted After a TTS command acknowledged SIGINT or SIGTERM, late audio from the provider was still written to `--output`, overwriting an existing file or creating a new one. The command now checks the existing cancellation signal after reading the audio and before the atomic write, so an interrupted run leaves the destination unchanged. Exit codes stay 130 and 143, and normal runs write as before. Evidence: built CLI in secretless Node 24.22.1 Docker with a TTS endpoint that responded only after the signal was acknowledged. Main overwrote an existing file after SIGINT and created a missing file after SIGTERM, twice; with this change the original hash, or the absence of a file, was kept twice. All normal controls wrote identical valid WAV bytes. Details: openclaw#191635 (comment). Thanks @zhangguiping-xydt. Co-authored-by: Ayaan Zaidi <[email protected]>
Backport #191635 from b655b24. Keep the existing CLI fixtures and add bounded interruption regressions. Co-authored-by: xingzhou <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]> Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
openclaw infer tts convert --output speech.wavcan create or overwrite the requested file after acknowledging SIGINT/SIGTERM. The CLI exits with the interrupt status and suppresses JSON, but still publishes the late audio copy.User Impact
Interruption accepted before output copying begins now preserves an existing destination or leaves an absent destination absent. Normal conversion still writes the synthesized audio. Completed synthesis retains its existing media-store lifetime; already-started atomic output writes are unchanged.
Why This Change Was Made
The shared local/loopback-Gateway copy owner captures the existing invocation signal and checks it after reading source audio, immediately before entering the existing atomic writer. No provider-wide cancellation, new lifecycle machinery, public API/configuration, retention policy or writer change.
Original fix/report by @zhangguiping-xydt; their commit is retained. Same output-publication boundary as the image cancellation repair in #191176.
Evidence
Independently built main
7e005b019a532981e0102ace3cc6be0478fb2266and unchanged contributor production in secretless Linux arm64 Node 24.22.1 Docker, with fresh isolated profiles/state and a local HTTP TTS fixture./v1/audio/speechresponse is held until the CLI acknowledges the signal, then releases a valid 2,044-byte PCM WAV.Detailed captured signal ordering, hashes and outcomes: independent proof comment.
Merge Danger
Two-way door: reverting restores the previous late-copy behavior; no persisted-state migration. Blast radius is local or loopback-Gateway TTS
--outputpublication after accepted interruption. Synthesis retention and already-started atomic writes retain their existing behavior.