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): revert the BUG-086 surface-TTS escalation — the ONE session voice is the NATIVE realtime voice

Personal Jarvis Maintainer47d282e7aceb
diff --git a/jarvis/plugins/realtime/gemini_live.py b/jarvis/plugins/realtime/gemini_live.py
index 2538197031..8e224030fe 100644
--- a/jarvis/plugins/realtime/gemini_live.py
+++ b/jarvis/plugins/realtime/gemini_live.py
@@ -61,10 +61,14 @@ class _GeminiLiveSession:
# synthesizer: the pinned prebuilt voice is a starting point the model
# can audibly drift from when the spoken content reads as a performance
# cue — observed live as gender flips between turns of one call
- # (BUG-086). Declaring this lets the orchestrator speak trusted delegate
- # replies through the deterministic same-family surface TTS instead of a
- # native readback, keeping one voice for the whole call.
- renders_pinned_voice = False
+ # (BUG-086). A former ``renders_pinned_voice = False`` capability made
+ # the orchestrator claim every delegate reply for the same-family
+ # surface TTS; that escalation was REVERTED (maintainer live verdict
+ # 2026-07-21: the flash-TTS rendering of the pinned voice is audibly a
+ # DIFFERENT voice from the live model's native one, i.e. a guaranteed
+ # voice flip on every tool-model turn). Native readback is primary
+ # again; the identity clauses in the injected prompts remain the drift
+ # mitigation.
def __init__(
self,
diff --git a/jarvis/realtime/protocol.py b/jarvis/realtime/protocol.py
index 2e51556213..740c718b2e 100644
--- a/jarvis/realtime/protocol.py
+++ b/jarvis/realtime/protocol.py
@@ -93,13 +93,11 @@ 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 voice-identity capability (probed with ``getattr``, default
- True when absent): ``renders_pinned_voice: bool``. A session whose
- native audio generation is a fixed-voice synthesizer that reliably
- speaks the requested voice keeps the default. A GENERATIVE renderer
- that can audibly drift from the pinned voice mid-call (BUG-086)
- declares False; the orchestrator then renders trusted delegate replies
- through the deterministic surface TTS instead of a native readback.
+ 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
+ tool-model turn. Delegate replies render natively; the surface TTS is
+ only the provider-mute fallback.
"""
session_id: str
diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.py
index cc847a1a9e..5d3bfd07b8 100644
--- a/jarvis/realtime/session.py
+++ b/jarvis/realtime/session.py
@@ -2225,6 +2225,12 @@ class RealtimeVoiceSession:
# provider failed a second time while rendering it. Hand
# the already-computed text to the surface's independent
# TTS path; never rerun the user request or its tools.
+ # Unlike the hold branch above, this one needs no
+ # readback_verification_active check: it fires only on
+ # a provider turn_complete with ZERO audio for a
+ # delivered reply, and shares the surface_fallback_spoken
+ # flag (set with no await in between) with the readback
+ # watchdog, so both nets can never speak the same reply.
fallback_text = (
"".join(self._output_transcript).strip()
or self._scrubbed_trusted_reply(delegate_state)
@@ -4373,22 +4379,18 @@ class RealtimeVoiceSession:
answer twice.
"""
turn_state.readback_verification_active = True
- # Voice-identity escalation (BUG-086): a provider session whose native
- # audio is a GENERATIVE renderer (renders_pinned_voice=False) can
- # audibly drift from the pinned session voice exactly on these
- # injected readbacks — the longest, most performance-cue-laden texts
- # of a call. On the desktop surface the same-family surface TTS speaks
- # the trusted reply deterministically instead, so every deep reply
- # keeps the one configured voice for the whole call. The browser
- # surface keeps the native readback: it has no server-side rendering
- # for ``error_spoken``, and its Web-Speech fallback would introduce a
- # THIRD voice — the exact defect this path exists to prevent.
- surface_owns_readback = self._surface == "desktop" and not bool(
- getattr(self._session, "renders_pinned_voice", True)
- )
- deadline = time.monotonic() + (
- 0.0 if surface_owns_readback else _DELEGATE_READBACK_WAIT_S
- )
+ # BUG-086 escalation REVERTED (maintainer live verdict 2026-07-21):
+ # claiming every delegate reply for the same-family surface TTS made
+ # EVERY delegated turn speak in an audibly different voice — the
+ # flash-TTS rendering of the pinned voice does not sound like the
+ # live model's native rendering of that same voice, so the "fix"
+ # was a deterministic voice flip on every tool-model turn, worse
+ # than the occasional native drift it prevented. The native realtime
+ # voice is the session's ONE voice: the provider renders the
+ # 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
while True:
if (
self._ended
@@ -4413,21 +4415,13 @@ class RealtimeVoiceSession:
return
turn_state.surface_fallback_spoken = True
self._drop_provider_output_until_user_turn = True
- if surface_owns_readback:
- log.info(
- "realtime[%s] voice identity: speaking the delegate reply "
- "through the surface TTS because the provider's native "
- "renderer does not hold the pinned voice (BUG-086)",
- self.session_id,
- )
- else:
- log.warning(
- "realtime[%s] provider rendered no readback for a delivered "
- "delegate result within %.1fs; speaking it through the "
- "surface TTS fallback",
- self.session_id,
- _DELEGATE_READBACK_WAIT_S,
- )
+ log.warning(
+ "realtime[%s] provider rendered no readback for a delivered "
+ "delegate result within %.1fs; speaking it through the "
+ "surface TTS fallback",
+ self.session_id,
+ _DELEGATE_READBACK_WAIT_S,
+ )
await self._send_json(self._surface_speech_message(reply))
def _start_delegate(
diff --git a/tests/unit/realtime/test_session.py b/tests/unit/realtime/test_session.py
index 4bc6759815..0348b26c01 100644
--- a/tests/unit/realtime/test_session.py
+++ b/tests/unit/realtime/test_session.py
@@ -2212,10 +2212,11 @@ async def test_scrub_trip_during_delegate_readback_speaks_trusted_reply():
class _GenerativeVoiceSession(FakeSession):
- """A provider session whose native audio renderer cannot hold a pinned
- voice (BUG-086: Gemini Live's generative audio drifts on readbacks)."""
-
- renders_pinned_voice = False
+ """A provider session whose native audio renderer is generative (BUG-086:
+ Gemini Live's audio can drift on readbacks). The former
+ ``renders_pinned_voice = False`` escalation flag is gone: the surface-TTS
+ claim it triggered spoke every delegate reply in an audibly different
+ voice and was reverted (maintainer live verdict 2026-07-21)."""
def __init__(self, events):
super().__init__(events)
@@ -2248,18 +2249,68 @@ class _GenerativeVoiceProvider(FakeProvider):
@pytest.mark.asyncio
-async def test_generative_voice_provider_delegate_reply_is_spoken_by_the_surface():
- """Voice identity (BUG-086 escalation): with renders_pinned_voice=False
- the desktop surface speaks the delegate reply itself, immediately —
- never waiting out the no-readback window and never letting the
- provider's generative renderer re-voice the deep answer.
+async def test_generative_voice_provider_delegate_reply_renders_natively_on_desktop():
+ """One voice = the NATIVE realtime voice (BUG-086 escalation reverted):
+ when the provider renders the injected trusted result inside the
+ readback window, the desktop surface must NOT speak it through the
+ surface TTS — the flash-TTS rendering of the pinned voice is audibly a
+ different voice than the live model's, so an immediate surface claim
+ was a guaranteed voice flip on every tool-model turn (maintainer live
+ verdict 2026-07-21).
"""
- reply = "The deep answer that must keep the pinned voice."
+ reply = "The deep answer that must keep the native voice."
+ spoken_audio = AudioChunk(
+ pcm=b"\x01\x02" * 8, sample_rate=24_000, timestamp_ns=0
+ )
+ jsons: list[dict] = []
+ binaries: list[bytes] = []
+ provider = _GenerativeVoiceProvider(
+ [
+ RealtimeEvent(
+ type="output_transcript_delta", text=reply, is_final=True
+ ),
+ RealtimeEvent(type="audio_delta", audio=spoken_audio),
+ RealtimeEvent(type="turn_complete"),
+ ]
+ )
+ sess = RealtimeVoiceSession(
+ session_id="generative-voice-native-readback",
+ send_binary=lambda data: binaries.append(data) or asyncio.sleep(0),
+ send_json=lambda m: jsons.append(m) or asyncio.sleep(0),
+ provider=provider,
+ config=_delegate_cfg("delegate"),
+ brain=FakeBrain(replies=(reply,)),
+ surface="desktop",
+ )
+
+ await sess.handle_control({"type": "audio_start", "sample_rate": 16_000})
+
+ async def _played():
+ while not binaries:
+ await asyncio.sleep(0.01)
+
+ await asyncio.wait_for(_played(), timeout=5)
+ # Give a wrong surface rendering time to appear before asserting.
+ await asyncio.sleep(0.3)
+ assert binaries == [spoken_audio.pcm]
+ assert not any(m.get("type") == "error_spoken" for m in jsons)
+ # The provider received the trusted result to render.
+ assert provider.session.text_inputs, "trusted result was never injected"
+ provider.session.release.set()
+ await sess.end(reason="test")
+
+
+async def test_generative_voice_provider_mute_still_falls_back_to_surface_tts():
+ """The revert must not lose the mute net: a provider that never renders
+ the injected result still gets the reply spoken via the surface TTS
+ after the readback wait window."""
+ reply = "The answer a mute provider never rendered."
jsons: list[dict] = []
binaries: list[bytes] = []
provider = _GenerativeVoiceProvider([])
sess = RealtimeVoiceSession(
- session_id="generative-voice-surface-readback",
+ session_id="generative-voice-mute-fallback",
send_binary=lambda data: binaries.append(data) or asyncio.sleep(0),
send_json=lambda m: jsons.append(m) or asyncio.sleep(0),
provider=provider,
@@ -2274,14 +2325,14 @@ async def test_generative_voice_provider_delegate_reply_is_spoken_by_the_surface
while not any(m.get("type") == "error_spoken" for m in jsons):
await asyncio.sleep(0.01)
- # Well inside _DELEGATE_READBACK_WAIT_S (2.5 s): this is the immediate
- # voice-identity path, not the old provider-mute timeout fallback.
- await asyncio.wait_for(_spoken(), timeout=1.5)
+ # Must take at least the readback wait window (2.5 s) — an immediate
+ # surface claim would be the reverted escalation sneaking back in.
+ start = asyncio.get_event_loop().time()
+ await asyncio.wait_for(_spoken(), timeout=8)
+ elapsed = asyncio.get_event_loop().time() - start
+ assert elapsed >= 2.0, "surface TTS claimed the reply before the wait window"
spoken = [m for m in jsons if m.get("type") == "error_spoken"]
assert [m["text"] for m in spoken] == [reply]
- # The provider still received the trusted result as conversation context.
- assert provider.session.text_inputs, "trusted result was never injected"
- # No native readback audio reached the speakers.
assert binaries == []
provider.session.release.set()
await sess.end(reason="test")
@@ -2330,13 +2381,12 @@ async def test_generative_voice_provider_keeps_native_readback_on_the_browser_su
@pytest.mark.asyncio
async def test_generative_voice_readback_race_never_speaks_twice():
- """Pin the ordering invariant of the immediate surface claim: when the
- provider starts a native readback in the same instant the surface takes
- the reply, exactly ONE rendering reaches the user — the surface
- error_spoken or the native audio, never both. The claim's flag-set has
- no await between check and set, and _emit_audio re-checks the withhold
- flags right before send; a refactor inserting an await there would
- break this test.
+ """Pin the one-rendering invariant: when the provider starts a native
+ readback around the same instant the surface fallback takes the reply,
+ exactly ONE rendering reaches the user — the surface error_spoken or
+ the native audio, never both. The claim's flag-set has no await between
+ check and set, and _emit_audio re-checks the withhold flags right
+ before send; a refactor inserting an await there would break this test.
"""
reply = "One answer, one voice."
spoken_audio = AudioChunk(