fix(gateway): skip the auto-TTS voice reply for the desktop platform - #91249
Open
liuhao1024 wants to merge 2 commits into
Open
liuhao1024 wants to merge 2 commits into
liuhao1024 wants to merge 2 commits into
Conversation
With voice.auto_tts on, the gateway and the desktop's useAutoSpeakReplies hook each synthesize and play the same reply — two TTS generations per message. The desktop hook is the authoritative speaker for that surface; the gateway now steps out for platform 'desktop'. Fixes NousResearch#90297
Contributor
Correct fix for the double-speak (#90297): the guard sits after the mode/auto-TTS gate and before any
No blocking issues found. |
Contributor
Author
|
Thanks — addressed in d1e9047:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Stops the double auto-TTS playback on the desktop surface. When
voice.auto_ttsis enabled, two independent paths synthesize and play the same reply on the desktop: the gateway's_send_voice_reply(callingtext_to_speech_tooland delivering viaadapter.send_voice) and the desktop app'suseAutoSpeakReplieshook (calling/api/audio/speak→playSpeechText). Neither knows about the other, so every desktop reply plays twice — logs show one "Generating speech" but two "TTS audio saved" entries per reply from two different PIDs (#90297)._should_send_voice_replynow returns False for the desktop platform, deferring to the desktop's own hook (the authoritative speaker for that surface — it fires on every reply regardless of mode, and the gateway has no way to know whether the client spoke). This is the issue's first suggested fix; the alternative (teaching the hook to detect an already-spoken gateway message) adds cross-process coordination the simple skip avoids. Every other platform keeps its gateway voice reply unchanged.Related Issue
Fixes #90297
Type of Change
Changes Made
gateway/run.py—_should_send_voice_replyskipsevent.source.platform.value == "desktop"right after the mode check, with the double-synthesis mechanism documented inline (auto_tts plays audio twice on desktop — gateway _send_voice_reply and useAutoSpeakReplies both fire #90297)tests/gateway/test_desktop_no_gateway_reply.py— three regressions: desktop is skipped even when global auto_tts would qualify; desktop is skipped even with an explicitallmode for the chat (the hook fires regardless); and Telegram with auto_tts on still gets its gateway voice reply (the skip is desktop-only)How to Test
.venv/bin/python -m pytest tests/gateway/test_desktop_no_gateway_voice_reply.py -q— should pass (3 passed)git stashcontrol), both desktop tests fail —_should_send_voice_replyreturns True for the desktop platform and the gateway sends a voice reply the desktop hook will speak again; with this fix both shapes return Falsetests/gateway/test_auto_voice_reply_format.py+tests/gateway/test_voice_mode_platform_isolation.py— 10 passed (voice-reply format selection and per-platform mode isolation unchanged)Checklist