fix(openai): treat mp3 responseFormat as voice-compatible for Telegram voice notes#80326
fix(openai): treat mp3 responseFormat as voice-compatible for Telegram voice notes#80326hclsys wants to merge 2 commits into
Conversation
… voice notes Closes openclaw#80317
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. by source inspection. Current main preserves configured MP3 responseFormat, marks OpenAI voiceCompatible true only for Opus, and speech-core only requests voice delivery for Telegram voice-note output when that provider flag is true. Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the narrow provider compatibility change with the regression test after redacted real behavior proof shows MP3 OpenAI-compatible TTS routing through Telegram sendVoice. Do we have a high-confidence way to reproduce the issue? Yes, by source inspection. Current main preserves configured MP3 responseFormat, marks OpenAI voiceCompatible true only for Opus, and speech-core only requests voice delivery for Telegram voice-note output when that provider flag is true. Is this the best way to solve the issue? Yes. The PR is the narrowest maintainable code fix: it broadens only the explicit MP3 OpenAI voice-note case already accepted by the shared Telegram/media contract while leaving non-compatible WAV false. Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against c7879bbc27ac. Re-review progress:
|
Summary
Extends the
voiceCompatibleflag in the OpenAI TTS provider to acceptmp3in addition toopuswhen the synthesis target isvoice-note. Telegram (and other channels) accept MP3 natively viasendVoice, mirroring the behavior of the Edge TTS / Microsoft provider which already usesisVoiceCompatibleAudioto detect mp3 as voice-compatible.Closes #80317
Changes
extensions/openai/speech-provider.tsvoiceCompatiblecondition extended toresponseFormat === "opus" || responseFormat === "mp3"extensions/openai/speech-provider.test.tsfalse)"marks mp3 responseFormat as voice-compatible for voice-note target"— assertsvoiceCompatible === truewhenresponseFormat: "mp3"andtarget: "voice-note"Real behavior proof
Behavior or issue addressed: OpenAI-compatible local TTS servers (Piper, Kokoro) configured with
responseFormat: "mp3"now route Telegram voice notes throughsendVoice(showing native waveform UI) instead ofsendAudio(showing as file attachment).Real environment tested: Ubuntu 22.04 (DGX Spark), Node 22.x, vitest 4.1.5
Exact steps or command run after this patch:
Evidence:
Terminal output:
New test
"marks mp3 responseFormat as voice-compatible for voice-note target"verifiesresult.voiceCompatible === truewhen synthesizing withresponseFormat: "mp3"andtarget: "voice-note". The existing wav voice-note test confirmsvoiceCompatible === falsefor non-voice-compatible formats.Observed result after fix:
voiceCompatible: truefor(target="voice-note", responseFormat="mp3"). All 10 tests pass.What was not tested: Live Piper/Kokoro TTS server synthesis with actual Telegram
sendVoicecall;m4aoroggformats (not inOPENAI_SPEECH_RESPONSE_FORMATS).