Skip to content

The agent that grows with you

fix(voice): prevent restart race when continuous mode stops after 3 no-speech cycles

brunopirzee5f20bdf236
diff --git a/cli.py b/cli.py
index 3ed1b73a28c..899b1f5f656 100644
--- a/cli.py
+++ b/cli.py
@@ -11913,13 +11913,14 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin):
pass
# Track consecutive no-speech cycles to avoid infinite restart loops.
+ stop_continuous_restart = False
if not submitted:
self._no_speech_count = getattr(self, '_no_speech_count', 0) + 1
if self._no_speech_count >= 3:
self._voice_continuous = False
self._no_speech_count = 0
_cprint(f"{_DIM}No speech detected 3 times, continuous mode stopped.{_RST}")
- return
+ stop_continuous_restart = True
else:
self._no_speech_count = 0
@@ -11927,7 +11928,12 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin):
# restart recording so the user can keep talking.
# (When transcript IS submitted, process_loop handles restart
# after chat() completes.)
- if self._voice_continuous and not submitted and not self._voice_recording:
+ if (
+ self._voice_continuous
+ and not submitted
+ and not self._voice_recording
+ and not stop_continuous_restart
+ ):
self._voice_restart_recording_async()
def _voice_speak_response_async(self, text: str) -> None: