The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(voice): early-exit sliding window on match, clear barge phase in finally, fix test helper
kshitij20e01f935b13
diff --git a/cli.py b/cli.pyindex c72aef01ae6..541d112a527 100644--- a/cli.py+++ b/cli.py@@ -12764,6 +12764,7 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin):except OSError:passself._voice_barge_capture.clear()+ self._voice_barge_phase = None# No usable transcript: hand the mic back to the normal loop.if not submitted and self._voice_mode and self._voice_continuous and not self._voice_recording:self._voice_restart_recording_async()diff --git a/tests/tools/test_voice_cli_integration.py b/tests/tools/test_voice_cli_integration.pyindex 389419cc10b..e8c04cedbad 100644--- a/tests/tools/test_voice_cli_integration.py+++ b/tests/tools/test_voice_cli_integration.py@@ -30,6 +30,8 @@ def _make_voice_cli(**overrides):cli._voice_tts_done.set()cli._voice_tts_stop = Nonecli._voice_barge_capture = threading.Event()+ cli._voice_last_tts_text = ""+ cli._voice_barge_phase = Nonecli._pending_input = queue.Queue()cli._app = Nonecli._attached_images = []diff --git a/tools/voice_mode.py b/tools/voice_mode.pyindex ec1e49703a6..aef09fdafcf 100644--- a/tools/voice_mode.py+++ b/tools/voice_mode.py@@ -1374,13 +1374,11 @@ def is_tts_echo(return Trueif len(a) < MIN_FRAGMENT_LENGTH_FOR_ECHO or len(a) >= len(b):return False- best_ratio = 0.0for start in range(0, len(b) - len(a) + 1):window = b[start : start + len(a)]- ratio = difflib.SequenceMatcher(None, a, window).ratio()- if ratio > best_ratio:- best_ratio = ratio- return best_ratio >= threshold+ if difflib.SequenceMatcher(None, a, window).ratio() >= threshold:+ return True+ return Falsedef voice_stop_hint() -> str: