Skip to content

The agent that grows with you

fix: barge-in stop-check tolerates stubbed voice_mode (test fixtures stub the module without is_voice_stop_phrase)

Tekniumaac753dd05ee
diff --git a/tui_gateway/server.py b/tui_gateway/server.py
index aa9b1caaebb..18cb5f35e30 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