fix(tts): preserve Telegram Opus output for native providers - #36686
fix(tts): preserve Telegram Opus output for native providers#36686alauer wants to merge 1 commit into
Conversation
mxnstrexgl
left a comment
There was a problem hiding this comment.
🤖 Automated PR Review
Security Scan
- ✓ No hardcoded secrets, injection sinks, unsafe deserialization, or dependency red flags found by this automated scan.
Code Quality
- ✓ No blocking code-quality issues found by this automated scan.
Summary
Status: APPROVE — security findings: 0, quality suggestions: 0.
Automated review; raw diff content intentionally omitted.
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
✅ Looks Good
- Clean refactor: Extracts Opus-output detection into
_supports_opus_output()helper, reducing duplicated inline checks - Adds MiniMax support: MiniMax t2a_v2 API users now get native Opus/OGG output for Telegram voice bubbles
- Correct mapping: Gateway temp paths (
/tmp/*.mp3) are rewritten to.oggwhen the platform is Telegram and the provider supports Opus - Good test coverage: Tests for OGG suffix, explicit MP3 rewrite, and MiniMax t2a_v2 detection
- Documentation updated: TTS docs reflect the changes
Reviewed by Hermes Agent
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused MiniMax native-Opus work. The remaining MiniMax change is useful: current main’s tools/tts_tool.py:1368-1373 still hardcodes audio_setting.format to "mp3", while the live Telegram auto-reply path now supplies an .ogg destination (gateway/run.py:13153-13163).
Problems
- The new tests at
tests/tools/test_tts_speed.py:217and:250describe gateway-supplied.mp3paths, but current main changed that gateway contract inae82eed2b194a5708bfecbc153637e434fc15ddb;tests/gateway/test_auto_voice_reply_format.py:17-43already verifies the live path requests and delivers.ogg.
Suggested changes
- Re-scope the MiniMax regression test to the current gateway
.oggroute and assert itst2a_v2request usesaudio_setting.format == "opus". That directly protects the remaining defect without preserving the obsolete gateway premise.
Automated hermes-sweeper review.
|
|
||
|
|
||
| class TestMinimaxTelegramOutput: | ||
| def test_explicit_mp3_path_is_rewritten_to_native_ogg(self, tmp_path): |
There was a problem hiding this comment.
Current GatewayRunner._send_voice_reply() already supplies .ogg for Telegram (gateway/run.py:13155, introduced by ae82eed2b). Please re-scope this regression to the live OGG gateway path and assert the MiniMax request payload selects format: "opus"; this test currently exercises an obsolete gateway contract.
|
The root cause here (gateway auto-TTS choosing MP3 vs Ogg/Opus via the cleared (Landed via #73508, merge |
Summary
Fixes #36685.
Telegram gateway auto-replies pass an explicit
.mp3temporary output path intotext_to_speech_tool(). That path bypassed the existing Telegram-aware default.oggselection and forced Opus-capable providers such as ElevenLabs down their MP3 output path.Changes
.mp3destinations to.oggfor Opus-capable providers;t2a_v2when the output path ends in.ogg;t2a_v2native Opus behavior;.mp3paths with ElevenLabs and MiniMax.Validation
-o addopts=''is used because the shared local venv does not include the latest upstreampytest-timeoutplugin required by the repository default test options.