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(voice): make the pipeline's default TTS key-aware, not hard-pinned to Gemini
Ruben Lütke89ab44436127
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.pyindex bb3f6a507f..2e24b0d635 100644--- a/jarvis/speech/pipeline.py+++ b/jarvis/speech/pipeline.py@@ -870,6 +870,29 @@ async def _queue_iter(q: asyncio.Queue) -> AsyncIterator[AudioChunk]:yield chunk+def _default_tts_for_pipeline(config: Any) -> Any:+ """The default TTS when the caller supplies none — key-aware (AP-22).++ Mirrors the STT default a few lines into ``__init__``: build through the same+ key-aware ``build_tts_from_config`` the real construction paths use, so a+ single-key user's spoken output — INCLUDING the deterministic "couldn't+ understand you" readback — crosses to whatever TTS family the user actually+ has a key for instead of being hard-pinned to a keyless Gemini default that+ goes silently mute (AP-22/AP-6). Degrades to a bare ``GeminiFlashTTS`` only+ when there is no config or the factory itself fails, so voice boot is never+ broken. (In practice every real caller passes a TTS built this way already;+ this closes the latent ``tts=None`` fallback that ignored the user's key.)+ """+ if config is not None and getattr(config, "tts", None) is not None:+ try:+ from jarvis.plugins.tts import build_tts_from_config++ return build_tts_from_config(config.tts)+ except Exception as exc: # noqa: BLE001 — a TTS build must never break voice boot+ log.warning("TTS factory failed (%s); using the default Gemini voice.", exc)+ return GeminiFlashTTS()++class SpeechPipeline:"""End-to-End Pipeline mit Call/Hangup-Lifecycle + Parallel-Wake."""@@ -1060,7 +1083,7 @@ class SpeechPipeline:self._probe_stt = wrap_stt_with_dictionary(self._probe_stt)except Exception as exc: # noqa: BLE001 — corrections must never break voice bootlog.warning("STT dictionary wrapper unavailable: %s", exc)- self._tts = tts or GeminiFlashTTS()+ self._tts = tts or _default_tts_for_pipeline(config)self._openwakeword_enabled = enable_openwakeword# Custom-wake-word plan (jarvis.speech.wake_phrase.WakeWordPlan) or None.# When None, the wake path is byte-identical to the legacy "Hey Jarvis"diff --git a/tests/unit/speech/test_pipeline_default_tts_keyaware.py b/tests/unit/speech/test_pipeline_default_tts_keyaware.pynew file mode 100644index 0000000000..16e8848278--- /dev/null+++ b/tests/unit/speech/test_pipeline_default_tts_keyaware.py@@ -0,0 +1,44 @@+"""The pipeline's default TTS (when none is supplied) is key-aware, not hard Gemini.++Regression guard: SpeechPipeline fell back to a bare GeminiFlashTTS when built with+tts=None, ignoring the user's actual key — so a single-key user without a Gemini+key would get MUTE spoken output, INCLUDING the honest "couldn't understand you"+readback. The default must route through the key-aware build_tts_from_config+(AP-22), degrading to Gemini only when there is no config or the factory fails.+"""+from __future__ import annotations++from types import SimpleNamespace++import jarvis.plugins.tts as tts_pkg+from jarvis.plugins.tts.gemini_flash_tts import GeminiFlashTTS+from jarvis.speech.pipeline import _default_tts_for_pipeline+++def test_default_tts_uses_the_key_aware_factory(monkeypatch):+ sentinel = object()+ seen: dict[str, object] = {}++ def _fake_build(tts_cfg):+ seen["cfg"] = tts_cfg+ return sentinel++ monkeypatch.setattr(tts_pkg, "build_tts_from_config", _fake_build)+ cfg = SimpleNamespace(tts=SimpleNamespace(provider="gemini-flash-tts"))++ assert _default_tts_for_pipeline(cfg) is sentinel+ assert seen["cfg"] is cfg.tts+++def test_default_tts_falls_back_to_gemini_without_config():+ assert isinstance(_default_tts_for_pipeline(None), GeminiFlashTTS)+++def test_default_tts_falls_back_to_gemini_when_factory_fails(monkeypatch):+ def _boom(tts_cfg):+ raise RuntimeError("no provider buildable")++ monkeypatch.setattr(tts_pkg, "build_tts_from_config", _boom)+ cfg = SimpleNamespace(tts=SimpleNamespace(provider="gemini-flash-tts"))++ assert isinstance(_default_tts_for_pipeline(cfg), GeminiFlashTTS)