Repository navigation
fix(cli): TTS --output writes WAV audio into .mp3 files - #175615
Conversation
infer tts convert --output copied the provider audio to the requested path verbatim, so Google's WAV landed in a .mp3 file. Route it through the shared media output writer that image and video generation already use, which keeps a matching extension and replaces a mismatched one.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d5d639877
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const written = await writeOutputAsset({ | ||
| buffer: await fs.readFile(result.audioPath), | ||
| outputPath: params.output, | ||
| outputIndex: 0, | ||
| outputCount: 1, |
There was a problem hiding this comment.
Preserve non-sniffable TTS formats when choosing the extension
When DeepInfra or OpenRouter is configured with responseFormat: "pcm" and the user requests an output such as speech.mp3, this call passes neither result.outputFormat nor the .pcm source filename to writeOutputAsset. Raw PCM has no signature that detectMime can sniff, so the shared writer falls back to the requested .mp3 suffix and the original extension/content mismatch remains. Feed the provider format or source-path extension into the output-extension decision so non-self-identifying formats are renamed too.
Useful? React with 👍 / 👎.
|
Codex review: needs maintainer review before merge. What this changesThis PR routes TTS output through the shared media writer so recognizable audio receives a matching filename extension. Example: Google returns WAV audio for an invocation requesting --output speech.mp3.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes the reported WAV filename mismatch, which remains on current main, without introducing a verified defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe inference CLI receives a provider-generated audio file locally or through a loopback Gateway, publishes the requested output, and returns its path and format. flowchart LR
A[Inference CLI] --> B[TTS conversion]
B --> C[Provider audio file]
C --> D[Shared media writer]
D --> E[Atomic file publication]
E --> F[Output path and JSON result]
Technical reviewBest possible solution: Use the existing media-output owner to correct recognizable TTS formats while preserving atomic writes and reporting the actual final path. Do we have a high-confidence way to reproduce the issue? Current-main source directly establishes the mismatch when WAV audio is copied to speech.mp3; the PR also reports that exact pre-fix provider result, but no target code was executed during this review. Is this the best way to solve the issue? Reusing the shared media writer is a focused repair that preserves atomic publication; raw PCM remains a pre-existing limitation outside the stated WAV case. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8cfa2ec42441. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +2, Tests +26. Total +28 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed October 17, 2026, 11:04 AM ET / 15:04 UTC. |
|
Merged via squash.
|
…claw#175615) infer tts convert --output copied the provider audio to the requested path verbatim, so Google's WAV landed in a .mp3 file. Route it through the shared media output writer that image and video generation already use, which keeps a matching extension and replaces a mismatched one.
What Problem This Solves
Fixes:
openclaw infer tts convert --output speech.mp3writes WAV data into a.mp3file when the provider returns WAV (Google does).User Impact
User impact: TTS output files get an extension that matches the audio actually returned, the same way
infer image generateandinfer video generatealready behave. The JSONpathreports the final file. When the requested extension already matches, nothing changes.Why This Change Was Made
The TTS command copied the provider's audio to the requested path verbatim. It now goes through the shared media output writer that image and video generation already use. That writer sniffs the audio, keeps a matching extension or replaces a mismatched one, and publishes atomically.
Evidence
RIFF ... WAVE audiototts-google.mp3while the JSON saidformat: "wav". The other providers returned real MP3.speech.mp3publishes asspeech.wav. The existing atomic-failure test (existing output preserved) was adapted to the shared writer. The fullsrc/cli/capability-cli.test.tspasses (97 tests).