fix(gateway): require voice input for global auto-TTS fallback (#100431) - #100454
twotnguyen wants to merge 1 commit into
Conversation
Correctness bug fix for global auto-TTS voice replies The change in The regression test in Non-blocking: the test only asserts the text-input case; a symmetric positive assertion (voice input + global auto_tts still returns True) would guard against over-correction, but the existing Verdict: LGTM |
|
Exact-head KEEP on #100454 head 45bafa3. KEEP requiring voice input for the global auto-TTS fallback so CHECK: per-chat voice mode overrides still win. CHECK: Telegram path covered. Author twotnguyen not kvnloo. No competing PR. |
What does this PR do?
When
voice.auto_tts: trueis configured globally inconfig.yaml, the messaging gateway was incorrectly sending TTS voice replies for normal typedMessageType.TEXTmessages in chats that have no explicit per-chat/voicemode.The contract of global auto-TTS is voice-to-voice (voice input -> text + voice reply; text input -> text reply only), while
/voice tts(voice_mode == "all") remains the explicit mode that speaks replies to all messages.This PR fixes the fallback condition in
GatewayRunner._should_send_voice_reply()by requiringis_voice_inputwhen relying on the globaladapter_auto_ttsfallback for chats with default voice mode (voice_mode is None).Related Issue
Fixes #100431
Type of Change
Changes Made
gateway/run.py: In_should_send_voice_reply(), addand is_voice_inputto thevoice_mode is None and adapter_auto_ttsfallback check so typed text messages do not trigger unsolicited TTS voice replies.tests/gateway/test_auto_voice_reply_format.py: Added regression testtest_should_send_voice_reply_global_auto_tts_ignores_text_inputasserting that text messages with global auto-TTS and default voice mode returnFalse.How to Test
python -m pytest tests/gateway/test_auto_voice_reply_format.py -k test_should_send_voice_reply_global_auto_tts_ignores_text_inputpython -m pytest tests/gateway/test_auto_voice_reply_format.pyChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/gateway/test_auto_voice_reply_format.pyand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A