fix(gateway): request ogg for telegram auto tts - #57192
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for tracing the adapter-level path; the missing context after the runner returns is real. However, the proposed filename change is not sufficient for conversion-backed providers.
Problems
gateway/platforms/base.py:4978passes a.oggpath totext_to_speech_tool, but Edge writes MP3 output (tools/tts_tool.py:947-971). Opus conversion only runs whenwant_opusis true and the produced path is not already.ogg(tools/tts_tool.py:2562-2570). The adapter call occurs afterGatewayRunnerclears the session context (gateway/run.py:12448-12450), so this path haswant_opus == false; the result can be MP3 bytes under an.oggname.- The test only checks the mocked requested suffix, so it cannot prove conversion or valid Opus delivery.
gateway/run.py:13302-13310has the same output-path pattern and should be handled with the same corrected mechanism.
Suggested changes
- Carry explicit Telegram/Opus intent into the TTS layer and preserve a real conversion input for Edge/WAV-backed providers; cover the converted result, not only the requested filename.
- Apply that mechanism to both auto-TTS call paths.
Automated hermes-sweeper review.
| text_to_speech_tool, text=speech_text | ||
| text_to_speech_tool, | ||
| text=speech_text, | ||
| output_path=audio_path, |
There was a problem hiding this comment.
A .ogg suffix alone is not an Opus payload. Edge writes MP3 output, and text_to_speech_tool only calls _convert_to_opus when want_opus is true and the generated path does not already end in .ogg (tools/tts_tool.py:2562-2570). Here the runner has already cleared the session context, so this can send MP3 bytes under an .ogg name. Please pass explicit delivery intent into TTS and preserve a real conversion input instead.
e2873c3 to
750e1f7
Compare
750e1f7 to
1da0580
Compare
|
The root cause here (gateway auto-TTS choosing MP3 vs Ogg/Opus via the cleared (Landed via #73508, merge |
Summary
.oggfrom delivery intent rather than relying on a caller-provided suffixVerification
pytest -q tests/tools/test_tts_*.py tests/gateway/test_auto_voice_reply_format.py tests/gateway/test_base_topic_sessions.py(262 passed)