From c3dc4448bf2bb9fb5e07c3c7f54c3ba763e4d30c Mon Sep 17 00:00:00 2001 From: 0xbyt4 <35742124+0xbyt4@users.noreply.github.com> Date: Tue, 10 Mar 2026 14:56:46 +0300 Subject: [PATCH] fix: disable STT retries and stop continuous mode after 3 silent cycles - Set max_retries=0 on the STT OpenAI client. The SDK default (2) honors Groq's retry-after header (often 53s), blocking the thread for up to ~106s on rate limits. Voice STT should fail fast, not retry silently. - Stop continuous recording mode after 3 consecutive no-speech cycles to prevent infinite restart loops when nobody is talking. --- cli.py | 11 +++++++++++ tools/transcription_tools.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cli.py b/cli.py index f874448f1..1f1a134f0 100755 --- a/cli.py +++ b/cli.py @@ -3688,6 +3688,17 @@ class HermesCLI: except Exception: pass + # Track consecutive no-speech cycles to avoid infinite restart loops. + 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 + else: + self._no_speech_count = 0 + # If no transcript was submitted but continuous mode is active, # restart recording so the user can keep talking. # (When transcript IS submitted, process_loop handles restart diff --git a/tools/transcription_tools.py b/tools/transcription_tools.py index d7c0a84bb..6b9c4b5f6 100644 --- a/tools/transcription_tools.py +++ b/tools/transcription_tools.py @@ -150,7 +150,7 @@ def transcribe_audio(file_path: str, model: Optional[str] = None) -> Dict[str, A try: from openai import OpenAI, APIError, APIConnectionError, APITimeoutError - client = OpenAI(api_key=api_key, base_url=base_url, timeout=30) + client = OpenAI(api_key=api_key, base_url=base_url, timeout=30, max_retries=0) with open(file_path, "rb") as audio_file: transcription = client.audio.transcriptions.create(