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(tts): keep the session voice profile when the realtime surface fallback substitutes a voice (BUG-089)

Ruben Lütke2188848c580b
diff --git a/jarvis/plugins/tts/__init__.py b/jarvis/plugins/tts/__init__.py
index 8fd97e9e50..b6f37963b6 100644
--- a/jarvis/plugins/tts/__init__.py
+++ b/jarvis/plugins/tts/__init__.py
@@ -316,9 +316,25 @@ def build_realtime_surface_tts(cfg: Any, realtime_provider: str) -> Any | None:
from jarvis.plugins.tts.gemini_flash_tts import GeminiFlashTTS
# The Live API and Gemini Flash TTS share one prebuilt-voice
- # catalog, so the session voice usually carries over verbatim;
- # an unknown voice falls back to the plugin default.
- voice = session_voice if session_voice in _GEMINI_VOICES else "Charon"
+ # catalog, so the session voice usually carries over verbatim.
+ # An unknown voice keeps the session's VOICE PROFILE instead of
+ # hard-flipping to the plugin default: a feminine live voice
+ # re-rendered as masculine "Charon" reads as a second assistant
+ # joining the call (BUG-089, Mac live test 2026-07-18).
+ if session_voice in _GEMINI_VOICES:
+ voice = session_voice
+ else:
+ from jarvis.plugins.tts.curated_catalog import (
+ continuity_voice,
+ voice_gender,
+ )
+
+ profile_gender = voice_gender(session_voice)
+ voice = (
+ continuity_voice(family, profile_gender)
+ if profile_gender
+ else None
+ ) or "Charon"
surface: Any = GeminiFlashTTS(
default_voice=voice,
language_code=getattr(tts_cfg, "language_code", None) or "de-DE",
diff --git a/tests/unit/plugins/tts/test_realtime_surface_tts.py b/tests/unit/plugins/tts/test_realtime_surface_tts.py
index a043dc6e2e..351a8902d1 100644
--- a/tests/unit/plugins/tts/test_realtime_surface_tts.py
+++ b/tests/unit/plugins/tts/test_realtime_surface_tts.py
@@ -63,12 +63,41 @@ def test_gemini_live_builds_same_family_tts_with_session_voice() -> None:
def test_unknown_session_voice_falls_back_to_family_default() -> None:
+ # "cedar" is not a Gemini voice but carries a curated MASCULINE profile,
+ # and Charon is the family's first curated masculine voice — the
+ # continuity pick and the historical default coincide here.
with override_provider_secrets({"gemini-live": "rt-scoped-key"}):
tts = build_realtime_surface_tts(_cfg(voice="cedar"), "gemini-live")
assert isinstance(tts, GeminiFlashTTS)
assert tts._default_voice == "Charon"
+def test_feminine_session_voice_keeps_a_feminine_fallback() -> None:
+ """BUG-089: the surface fallback keeps the session's voice PROFILE.
+
+ A feminine live voice hard-flipping to masculine Charon reads as a
+ second assistant joining the call (Mac live test 2026-07-18). Pinned via
+ the curated gender register, never a hardcoded voice id.
+ """
+ from jarvis.plugins.tts import _GEMINI_VOICES
+ from jarvis.plugins.tts.curated_catalog import FEMININE, voice_gender
+
+ with override_provider_secrets({"gemini-live": "rt-scoped-key"}):
+ tts = build_realtime_surface_tts(_cfg(voice="marin"), "gemini-live")
+ assert isinstance(tts, GeminiFlashTTS)
+ assert tts._default_voice in _GEMINI_VOICES
+ assert voice_gender(tts._default_voice) == FEMININE
+
+
+def test_untagged_unknown_voice_still_falls_back_to_charon() -> None:
+ with override_provider_secrets({"gemini-live": "rt-scoped-key"}):
+ tts = build_realtime_surface_tts(
+ _cfg(voice="definitely-not-a-voice"), "gemini-live"
+ )
+ assert isinstance(tts, GeminiFlashTTS)
+ assert tts._default_voice == "Charon"
+
+
def test_keyless_realtime_provider_yields_no_surface_tts() -> None:
with override_provider_secrets({"gemini-live": None}):
assert build_realtime_surface_tts(_cfg(), "gemini-live") is None