From aac753dd05eed00c7e25ff9146e3447ef8477160 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 28 Jul 2026 23:44:06 -0700 Subject: [PATCH] fix: barge-in stop-check tolerates stubbed voice_mode (test fixtures stub the module without is_voice_stop_phrase) --- tui_gateway/server.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tui_gateway/server.py b/tui_gateway/server.py index aa9b1caaebb6..18cb5f35e302 100644 --- a/tui_gateway/server.py +++ b/tui_gateway/server.py @@ -17803,9 +17803,16 @@ def _tts_stream_barge_in_monitor(stop: threading.Event, done: threading.Event) - result = transcribe_recording(wav_path) text = (result.get("transcript") or "").strip() if result.get("success") else "" if text: - from tools.voice_mode import is_voice_stop_phrase + # Stop-check must never break transcript delivery — if the + # helper is unavailable (stubbed voice_mode in tests, partial + # installs), treat as not-a-stop-phrase. + try: + from tools.voice_mode import is_voice_stop_phrase + _is_stop = is_voice_stop_phrase(text) + except Exception: + _is_stop = False - if is_voice_stop_phrase(text): + if _is_stop: # Barge-in with a bare stop phrase — the user talked over # the agent's speech to END the voice chat. Same explicit # stop signal as the continuous loop: flip mode off, halt