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): provider-declared delegate-readback budget — the silent-answer bug
rubenluetke10-beepc6a68c509331
diff --git a/jarvis/plugins/realtime/openai_realtime.py b/jarvis/plugins/realtime/openai_realtime.pyindex 196bc53ab3..e5554d5377 100644--- a/jarvis/plugins/realtime/openai_realtime.py+++ b/jarvis/plugins/realtime/openai_realtime.py@@ -1395,6 +1395,15 @@ class LocalRealtimeProvider:# with the distilled persona and a prefix-cache-friendly static-first# ordering (AP-21: a declared capability, never a provider-name check).prefers_compact_instructions = True+ # A delegate readback on this card is rendered by the server's own LLM ++ # TTS (4-8 s live on the dev box), not by a hosted realtime model that+ # starts audio in under a second. The shared 2.5 s readback window+ # guaranteed the surface fallback fired first — and this card has no+ # realtime-scoped surface TTS, so that fallback is TEXT-ONLY and then+ # withheld the real audio answer arriving seconds later: the user heard+ # nothing at all (live 2026-08-08 15:24). Declared budget, same AP-21+ # doctrine as handshake_budget_s.+ readback_render_budget_s = 12.0input_sample_rate = _INPUT_RATEoutput_sample_rate = _OUTPUT_RATE# EMPTY, not absent. The keyless path is chosen by this tuple being emptydiff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.pyindex fa9a5cff8a..b72a2403d8 100644--- a/jarvis/realtime/session.py+++ b/jarvis/realtime/session.py@@ -6671,7 +6671,7 @@ class RealtimeVoiceSession:# delegate reply natively, and the surface TTS speaks only when the# provider stays mute past the wait window. Do not re-add an# immediate surface claim keyed on a provider capability flag.- deadline = time.monotonic() + _DELEGATE_READBACK_WAIT_S+ deadline = time.monotonic() + self._delegate_readback_budget_s()while True:if (self._ended@@ -6702,10 +6702,27 @@ class RealtimeVoiceSession:"delegate result within %.1fs; speaking it through the ""surface TTS fallback",self.session_id,- _DELEGATE_READBACK_WAIT_S,+ self._delegate_readback_budget_s(),)await self._send_json(self._surface_speech_message(reply))+ def _delegate_readback_budget_s(self) -> float:+ """How long a delivered delegate result may wait for provider audio.++ The 2.5 s floor was measured against hosted providers that start+ readback audio well under one second. A SELF-HOSTED server renders+ the readback through its own LLM + TTS (4-8 s live on the dev box),+ so 2.5 s guaranteed the fallback fired first — and for a card with+ no realtime-scoped surface TTS that fallback is text-only, which+ then WITHHELD the real audio answer arriving seconds later: the+ user heard nothing at all (live 2026-08-08 15:24). A declared+ capability, never a provider-name check (AP-21).+ """+ declared = float(+ getattr(self._provider, "readback_render_budget_s", 0.0) or 0.0+ )+ return max(_DELEGATE_READBACK_WAIT_S, declared)+def _start_delegate(self,turn_id: str,diff --git a/tests/unit/realtime/test_delegate_readback_budget.py b/tests/unit/realtime/test_delegate_readback_budget.pynew file mode 100644index 0000000000..acd859d36f--- /dev/null+++ b/tests/unit/realtime/test_delegate_readback_budget.py@@ -0,0 +1,62 @@+"""The provider-declared delegate-readback budget (AP-21 capability).++Live 2026-08-08 15:24: the self-hosted card renders a delegate readback+through its own LLM + TTS (4-8 s), the shared 2.5 s window fired the surface+fallback first, that fallback is TEXT-ONLY on a card without a+realtime-scoped surface TTS — and the provider's real audio answer arriving+seconds later was then withheld as already-spoken. The user heard nothing.+"""++from __future__ import annotations++import asyncio++import pytest++from jarvis.realtime.session import _DELEGATE_READBACK_WAIT_S, RealtimeVoiceSession++from .test_session import FakeProvider, _cfg+++class _SlowReadbackProvider(FakeProvider):+ name = "slow-readback-family"+ readback_render_budget_s = 12.0+++def _session(provider: FakeProvider) -> RealtimeVoiceSession:+ return RealtimeVoiceSession(+ session_id="readback-budget",+ send_binary=lambda _data: asyncio.sleep(0),+ send_json=lambda _message: asyncio.sleep(0),+ providers=[provider],+ config=_cfg(),+ bus=None,+ )+++async def test_declared_budget_wins_over_the_hosted_floor():+ provider = _SlowReadbackProvider([])+ sess = _session(provider)+ await sess.handle_control({"type": "audio_start", "sample_rate": 16_000})+ try:+ assert sess._delegate_readback_budget_s() == 12.0+ finally:+ await sess.end(reason="test")+++async def test_hosted_providers_keep_the_measured_floor():+ provider = FakeProvider([])+ sess = _session(provider)+ await sess.handle_control({"type": "audio_start", "sample_rate": 16_000})+ try:+ assert sess._delegate_readback_budget_s() == _DELEGATE_READBACK_WAIT_S+ finally:+ await sess.end(reason="test")+++def test_local_card_declares_a_realistic_readback_budget() -> None:+ from jarvis.plugins.realtime.openai_realtime import LocalRealtimeProvider++ assert LocalRealtimeProvider.readback_render_budget_s > _DELEGATE_READBACK_WAIT_S