Skip to content

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.

fix(realtime): speak the answer when a call performs a Jarvis action

Ruben Lütke932bc59d2498
diff --git a/jarvis/realtime/protocol.py b/jarvis/realtime/protocol.py
index da9bda0128..1a0eeecc65 100644
--- a/jarvis/realtime/protocol.py
+++ b/jarvis/realtime/protocol.py
@@ -108,6 +108,16 @@ class RealtimeSession(Protocol):
every completed turn so a provider-internal transport rebuild (e.g. the
openai_realtime BUG-064 stack) can restore context without a wire call.
+ Optional capability (probed with ``getattr``, never required): a session
+ whose direct-speech channel renders text VERBATIM may expose
+ ``direct_speech_is_authoritative = True``. The orchestrator then clears
+ the scrub hold for that audio, because the text it renders was scrubbed
+ by Jarvis before it was sent (ADR-0010) and carries no model transcript
+ for the gate to vet — without it the whole delegate answer is dropped at
+ the turn boundary as "output transcript missing". Providers that do not
+ declare it keep failing closed, which is the correct default for anything
+ the model itself generates.
+
A former optional ``renders_pinned_voice`` voice-identity capability
(BUG-086 escalation) was removed 2026-07-21: routing delegate replies
to the surface TTS produced an audibly different voice on every
diff --git a/jarvis/realtime/scrub_gate.py b/jarvis/realtime/scrub_gate.py
index 1ae3c084d5..adea376d19 100644
--- a/jarvis/realtime/scrub_gate.py
+++ b/jarvis/realtime/scrub_gate.py
@@ -239,6 +239,25 @@ class ScrubHoldGate:
self._consume_hold_clock()
return out
+ def trust_direct_speech(self) -> None:
+ """Clear the gate for audio rendering text Jarvis itself scrubbed.
+
+ A delegate readback is injected through the provider's direct-speech
+ channel, so its audio has no MODEL transcript to vet — the opening
+ hold can never clear, and ``fail_closed`` then drops the whole answer
+ at the turn boundary. Measured live 2026-08-02: the action ran, the
+ reply existed, and the user heard nothing but "keeping the turn
+ text-only".
+
+ Re-gating this audio protects nothing: the text passed
+ ``scrub_for_voice`` before it was ever sent (ADR-0010). The trailing
+ kill switch is untouched — a later transcript that does leak still
+ sets ``_hard_leak`` and drops everything unplayed.
+ """
+ self._transcript_seen = True
+ self._coverage_active = True
+ self._cleared = True
+
def fail_closed(self) -> bool:
"""Drop a completed response that never produced any transcript."""
if self._hard_leak or not self._pending or self._transcript_seen:
diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.py
index d90074d538..68ac68d112 100644
--- a/jarvis/realtime/session.py
+++ b/jarvis/realtime/session.py
@@ -5191,6 +5191,17 @@ class RealtimeVoiceSession:
send_speech = getattr(self._session, "send_speech", None)
if callable(send_speech):
await send_speech(trusted_reply)
+ if getattr(
+ self._session, "direct_speech_is_authoritative", False
+ ):
+ # This audio renders text Jarvis already scrubbed, so
+ # it carries no model transcript for the gate to vet.
+ # Without this the whole answer is dropped at the turn
+ # boundary as "output transcript missing" — the action
+ # ran and the user heard nothing.
+ self._gate.trust_direct_speech()
+ for chunk in self._gate.release_available():
+ await self._emit_audio(chunk)
else:
await self._session.send_text(
_delegate_result_prompt(
diff --git a/tests/unit/realtime/test_scrub_gate.py b/tests/unit/realtime/test_scrub_gate.py
index 88ed5751ab..1b61732bd7 100644
--- a/tests/unit/realtime/test_scrub_gate.py
+++ b/tests/unit/realtime/test_scrub_gate.py
@@ -426,3 +426,40 @@ async def test_repeated_pushes_before_any_transcript_stay_closed():
assert await gate.push_audio(_chunk(9_600)) == []
assert await gate.push_audio(_chunk(9_600)) == []
assert gate.fail_closed() is True
+
+
+async def test_trust_direct_speech_releases_audio_that_has_no_transcript():
+ """A delegate readback renders text Jarvis itself scrubbed.
+
+ Its audio carries no MODEL transcript, so the opening hold could never
+ clear and the turn boundary dropped the whole answer as "no_transcript".
+ Measured live 2026-08-02: the action ran, the reply existed, the user
+ heard nothing.
+ """
+ gate = ScrubHoldGate(language="en")
+ assert await gate.push_audio(_chunk(4)) == [] # held, as before
+
+ gate.trust_direct_speech()
+
+ assert gate.release_available()
+ assert gate.fail_closed() is False
+ assert gate.hard_leak_pending() is False
+
+
+async def test_trust_direct_speech_keeps_the_trailing_kill_switch():
+ """The relaxation is bounded: it clears the OPENING hold, nothing else.
+
+ Anything that leaks in a later transcript must still drop every unplayed
+ chunk, exactly as it would without the trust call.
+ """
+ gate = ScrubHoldGate(language="en")
+ gate.trust_direct_speech()
+ assert await gate.push_audio(_chunk(4))
+
+ await gate.feed_transcript(
+ "Traceback (most recent call last):\n File x\nValueError: y\n\n"
+ )
+ assert gate.hard_leak_pending() is True
+ assert await gate.push_audio(_chunk(4)) == []