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(realtime): route the blocked-output language retry through send_text on the self-hosted card
rubenluetke10-beep6584277fe31d
diff --git a/jarvis/plugins/realtime/openai_realtime.py b/jarvis/plugins/realtime/openai_realtime.pyindex 2a954527d2..2ed6996578 100644--- a/jarvis/plugins/realtime/openai_realtime.py+++ b/jarvis/plugins/realtime/openai_realtime.py@@ -316,6 +316,7 @@ class _OpenAIRealtimeSession:disconnect_before_rebuild: bool = False,rebuild_retry_window_s: float = 0.0,rebuild_retry_step_s: float = 1.0,+ prompted_response_retry: bool = False,owns_client: bool = True,) -> None:self._conn = connection@@ -352,6 +353,16 @@ class _OpenAIRealtimeSession:self._disconnect_before_rebuild = bool(disconnect_before_rebuild)self._rebuild_retry_window_s = max(0.0, float(rebuild_retry_window_s))self._rebuild_retry_step_s = max(0.0, float(rebuild_retry_step_s))+ # Retry contract for an answer blocked at the speech boundary. This+ # transport keeps the cancelled response's text in the server-side+ # conversation, so a bare response.create regenerates against a+ # history that already contains the blocked answer — a small+ # self-hosted brain then reads the turn as answered and returns an+ # empty completion (live 2026-08-10 17:08: the one language retry+ # came back as a single token and the call went silent). Opting in+ # routes the retry through send_text(), which appends the explicit+ # retry request as a fresh user item the model must actually answer.+ self.supports_prompted_response_retry = bool(prompted_response_retry)self._connection_is_open = Trueself._events = connection.__aiter__()self.session_id = session_id@@ -1270,6 +1281,7 @@ async def _open_realtime_session(disconnect_before_rebuild: bool = False,rebuild_retry_window_s: float = 0.0,rebuild_retry_step_s: float = 1.0,+ prompted_response_retry: bool = False,owns_client: bool = True,) -> _OpenAIRealtimeSession:"""Open, configure and hand back a live session on ``client``.@@ -1318,6 +1330,7 @@ async def _open_realtime_session(disconnect_before_rebuild=disconnect_before_rebuild,rebuild_retry_window_s=rebuild_retry_window_s,rebuild_retry_step_s=rebuild_retry_step_s,+ prompted_response_retry=prompted_response_retry,owns_client=owns_client,)try:@@ -2127,6 +2140,11 @@ class LocalRealtimeProvider:disconnect_before_rebuild=True,rebuild_retry_window_s=self._connect_retry_window_s(),rebuild_retry_step_s=_LOCAL_CONNECT_RETRY_STEP_S,+ # The scrub-gate language retry must arrive as a fresh user item:+ # this server keeps the cancelled answer in its conversation, and+ # a bare response.create makes a small brain answer with an empty+ # completion (live 2026-08-10 — the retry returned one token).+ prompted_response_retry=True,# The client above is cached across sessions; closing this# session must not tear it down.owns_client=False,diff --git a/tests/unit/realtime/test_local_realtime.py b/tests/unit/realtime/test_local_realtime.pyindex 3817690b12..7511e4cb85 100644--- a/tests/unit/realtime/test_local_realtime.py+++ b/tests/unit/realtime/test_local_realtime.py@@ -521,6 +521,20 @@ def test_transport_rebuild_is_opt_in_and_off_by_default() -> None:assert opted_in.rebuild_on_transport_death is True+def test_prompted_response_retry_is_opt_in_and_off_by_default() -> None:+ """Hosted cards keep the bare response.create retry; only a transport+ that keeps the cancelled answer in its conversation opts into the+ send_text retry (2026-08-10: the local retry returned one empty token)."""+ from jarvis.plugins.realtime.openai_realtime import _OpenAIRealtimeSession++ session = _OpenAIRealtimeSession(**_session_kwargs())+ assert session.supports_prompted_response_retry is False+ opted_in = _OpenAIRealtimeSession(+ **_session_kwargs(prompted_response_retry=True)+ )+ assert opted_in.supports_prompted_response_retry is True++async def test_local_sessions_opt_into_transport_rebuild(monkeypatch) -> None:"""The self-hosted card asks for the in-place rebuild: its server cancrash and come back, and the call must survive that."""@@ -541,6 +555,7 @@ async def test_local_sessions_opt_into_transport_rebuild(monkeypatch) -> None:assert captured["response_start_timeout_s"] > module._RESPONSE_STALL_Sassert captured["disconnect_before_rebuild"] is Trueassert captured["rebuild_retry_window_s"] > 0.0+ assert captured["prompted_response_retry"] is Trueasync def test_connect_retries_until_the_server_is_back(monkeypatch) -> None:diff --git a/tests/unit/realtime/test_session.py b/tests/unit/realtime/test_session.pyindex 22f8336d8d..869b228165 100644--- a/tests/unit/realtime/test_session.py+++ b/tests/unit/realtime/test_session.py@@ -2032,6 +2032,96 @@ async def test_wrong_output_language_retries_once_before_releasing_pcm(assert sess._output_language_failures == 0 # noqa: SLF001+async def test_prompted_retry_capability_routes_language_retry_via_send_text():+ """A transport that keeps the cancelled answer in its conversation (the+ self-hosted card) advertises ``supports_prompted_response_retry``; the one+ language retry must then arrive as an explicit ``send_text`` request, not+ a bare ``response.create`` against a history that already contains the+ blocked answer (live 2026-08-10: that regenerated as one empty token and+ the call went silent)."""+ user_text = "What is kindness?"+ wrong_text = (+ "这是一个完整的中文回答,包含足够多的文字来可靠地识别语言。"+ )+ correct_text = (+ "Kindness is the practice of treating other people with care "+ "and respect."+ )+ wrong_pcm = b"\x02\x03" * 32+ correct_pcm = b"\x10\x20" * 32++ class _PromptedRetrySession(FakeSession):+ supports_prompted_response_retry = True++ async def receive(self):+ yield RealtimeEvent(+ type="input_transcript",+ text=user_text,+ is_final=True,+ )+ yield RealtimeEvent(+ type="audio_delta",+ audio=AudioChunk(+ pcm=wrong_pcm,+ sample_rate=24_000,+ timestamp_ns=0,+ ),+ )+ yield RealtimeEvent(+ type="output_transcript_delta",+ text=wrong_text,+ )+ for _ in range(100):+ if self.text_inputs:+ break+ await asyncio.sleep(0.01)+ yield RealtimeEvent(+ type="output_transcript_delta",+ text=correct_text,+ )+ yield RealtimeEvent(+ type="audio_delta",+ audio=AudioChunk(+ pcm=correct_pcm,+ sample_rate=24_000,+ timestamp_ns=0,+ ),+ )+ yield RealtimeEvent(type="turn_complete")++ class _PromptedRetryProvider(FakeProvider):+ async def open_session(self, cfg):+ self.opened_with = cfg+ self.session = _PromptedRetrySession([])+ return self.session++ provider = _PromptedRetryProvider([])+ jsons: list[dict] = []+ binaries: list[bytes] = []+ sess = RealtimeVoiceSession(+ session_id="language-retry-prompted",+ send_binary=lambda data: binaries.append(data) or asyncio.sleep(0),+ send_json=lambda message: jsons.append(message) or asyncio.sleep(0),+ provider=provider,+ config=_cfg(reply_language="en"),+ bus=None,+ )++ await sess.handle_control({"type": "audio_start", "sample_rate": 16_000})+ await sess.wait_finished()+ await sess.end(reason="test")++ # The original turn is the only bare response request; the retry itself+ # travels as one explicit prompted request in the pinned language.+ assert provider.session.response_requests == 1+ assert len(provider.session.text_inputs) == 1+ assert "English" in provider.session.text_inputs[0]+ assert binaries == [correct_pcm]+ assert sess._output_language_retries == 1 # noqa: SLF001+ assert sess._output_language_failures == 0 # noqa: SLF001++@pytest.mark.asyncioasync def test_language_switch_mistranscript_reaches_realtime_provider():"""The live ``auf jetzt`` false positive must not end the session."""