Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(voice): prevent language requests from triggering hangup
Ruben Lütke61cd070392bf
diff --git a/jarvis/speech/hangup.py b/jarvis/speech/hangup.pyindex 49a39a5ead..7b0158e64f 100644--- a/jarvis/speech/hangup.py+++ b/jarvis/speech/hangup.py@@ -46,7 +46,12 @@ _HANGUP_PATTERNS: Final[tuple[str, ...]] = (r"\baufleg\w*\b",r"\bauf\s+leg\w*\b", # "auf leg", "auf lege" — Whisper splits "auflegen"r"\bauf\s+legt\b",- r"\bauf\s+jetzt\b", # Whisper mis-hearing of "auflegen"+ # This lossy STT alias is safe only as the complete utterance. Keeping it+ # unanchored caused a live language-switch request containing "auf jetzt"+ # to terminate before the brain ran (2026-07-12). Optional discourse+ # fillers preserve the original one-word-command recovery without matching+ # the same words inside ordinary speech.+ r"^\s*(?:(?:okay|ok|bitte)[\s,]+)*auf\s+jetzt[\s.!?]*$", # i18n-allow: STT inputr"\bleg(e|t|en)?\s+auf\b",r"\blegs?\s+auf\b",r"\blegen sie auf\b",diff --git a/tests/unit/brain/test_voice_command_gate.py b/tests/unit/brain/test_voice_command_gate.pyindex d620a211ff..c10feea9bb 100644--- a/tests/unit/brain/test_voice_command_gate.py+++ b/tests/unit/brain/test_voice_command_gate.py@@ -185,3 +185,11 @@ def test_language_switch_single_language_unaffected() -> None:m = match_voice_command("antworte auf englisch")assert m is not None and m.kind == "language_switch"assert m.target == "en"+++def test_language_switch_survives_live_stt_mistranscript() -> None:+ m = match_voice_command(+ "Antworte auf jetzt nur noch auf Englisch." # i18n-allow: bug transcript+ )+ assert m is not None and m.kind == "language_switch"+ assert m.target == "en"diff --git a/tests/unit/realtime/test_session.py b/tests/unit/realtime/test_session.pyindex 848ca31616..1579b34187 100644--- a/tests/unit/realtime/test_session.py+++ b/tests/unit/realtime/test_session.py@@ -1051,6 +1051,40 @@ async def test_ordinary_speech_does_not_hang_up():assert provider.session.response_requests == 1+async def test_language_switch_mistranscript_reaches_realtime_provider():+ """The live ``auf jetzt`` false positive must not end the session."""+ provider = FakeProvider(+ [+ RealtimeEvent(+ type="input_transcript",+ text=(+ "Antworte auf jetzt nur noch auf Englisch." # i18n-allow: bug transcript+ ),+ is_final=True,+ ),+ RealtimeEvent(type="turn_complete"),+ ]+ )+ jsons = []+ sess = RealtimeVoiceSession(+ session_id="language-switch-hangup-guard",+ send_binary=lambda _data: asyncio.sleep(0),+ send_json=lambda m: jsons.append(m) or asyncio.sleep(0),+ provider=provider,+ config=_cfg(),+ bus=None,+ )++ await sess.handle_control({"type": "audio_start", "sample_rate": 16_000})+ await sess.wait_finished()+ await sess.end(reason="test")++ assert sess.hangup_reason == ""+ assert _hangup_jsons(jsons) == []+ assert provider.session.response_requests == 1++# --- Tool-role directive in session instructions ----------------------------diff --git a/tests/unit/speech/test_hangup.py b/tests/unit/speech/test_hangup.pyindex 27bb4fc309..872f523829 100644--- a/tests/unit/speech/test_hangup.py+++ b/tests/unit/speech/test_hangup.py@@ -68,6 +68,8 @@ def test_hangup_re_matches_explicit_commands(phrase: str) -> None:"aufflegen","Aufflegen","aufflegt",+ "auf jetzt",+ "Okay, auf jetzt.",],)def test_hangup_re_matches_auflegen_mishearings(phrase: str) -> None:@@ -100,6 +102,11 @@ def test_hangup_re_matches_auflegen_mishearings(phrase: str) -> None:"Let's get up!","let us get up","just get up",+ # Live 2026-07-12: OpenAI Realtime transcribed a language-switch+ # request with the words "auf jetzt". The former unanchored STT+ # mishearing alias treated those words inside ordinary speech as the+ # one-word closing command and killed the session before the brain ran.+ "Antworte auf jetzt nur noch auf Englisch.", # i18n-allow: bug transcript],)def test_hangup_re_ignores_ambiguous_and_normal_speech(phrase: str) -> None:diff --git a/tests/unit/speech/test_turn_taking.py b/tests/unit/speech/test_turn_taking.pyindex c7d9c2916b..0fc815a461 100644--- a/tests/unit/speech/test_turn_taking.py+++ b/tests/unit/speech/test_turn_taking.py@@ -336,6 +336,24 @@ async def test_lets_get_up_mistranscript_does_not_hang_up() -> None:assert keep_session is True+async def test_language_switch_mistranscript_does_not_hang_up() -> None:+ """Ordinary speech containing the ``auf jetzt`` mishearing stays live."""+ pipe = _make_pipeline(+ FakeSTT(+ text="Antworte auf jetzt nur noch auf Englisch." # i18n-allow: bug transcript+ ),+ brain_response="Certainly. I will answer in English.",+ continue_listening_after_response=True,+ )++ keep_session = await pipe._handle_utterance(b"\x01\x00" * 1024)++ assert keep_session is True+ assert pipe._spoken == [("Certainly. I will answer in English.", "de")]+ assert pipe._session_end_reason is None++@pytest.mark.xfail(reason=("Superseded by the user-approved 'incomplete-prompt completion buffer' "@@ -383,7 +401,8 @@ async def test_pending_buffer_discard_after_timeout_does_not_flush_to_brain() ->assert pipe._pending_user_context == []# … but the brain must NOT have been called with the half-command.assert brain_calls == [], (- f"Brain was called with {brain_calls!r} — the discard timer flushed a half-command to the brain"+ f"Brain was called with {brain_calls!r} — the discard timer flushed "+ "a half-command to the brain")diff --git a/tests/unit/telephony/test_session.py b/tests/unit/telephony/test_session.pyindex 3f2a27c345..c42bc5d735 100644--- a/tests/unit/telephony/test_session.py+++ b/tests/unit/telephony/test_session.py@@ -132,7 +132,15 @@ def test_hangup_regex_matches_closing_phrases(phrase):assert HANGUP_RE.search(phrase)[email protected]("phrase", ["wie geht es dir", "erzähl mir was", "danke schön"]) # i18n-allow+ "phrase",+ [+ "wie geht es dir", # i18n-allow: German speech-input fixture+ "erzähl mir was", # i18n-allow: German speech-input fixture+ "danke schön", # i18n-allow: German speech-input fixture+ "Antworte auf jetzt nur noch auf Englisch.", # i18n-allow: bug transcript+ ],+)def test_hangup_regex_ignores_normal_speech(phrase):assert HANGUP_RE.search(phrase) is None