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.

chore: auto-save WIP via Claude stop-hook safety net (2026-07-11 11:38)

Ruben Lütkec501b22259d8
diff --git a/jarvis/core/config.py b/jarvis/core/config.py
index c52ff93348..83fcb136b0 100644
--- a/jarvis/core/config.py
+++ b/jarvis/core/config.py
@@ -1925,11 +1925,14 @@ class VoiceConfig(BaseModel):
# Master switch for the completion classifier + waiting state. When false
# the pipeline behaves exactly as before this feature landed.
completion_detection_enabled: bool = True
- # Voice engine selector. "pipeline" = the classic STT->brain->TTS chain
- # (default, unchanged). "realtime" = the full-duplex speech-to-speech engine
- # (browser, OpenAI Realtime; opt-in). Read once per voice session; a live
- # change lands on the next session.
- mode: str = "pipeline"
+ # Voice engine selector. "realtime" (default) = the full-duplex
+ # speech-to-speech engine — the recommended mode. "pipeline" = the classic
+ # STT->brain->TTS chain. Read once per voice session; a live change lands
+ # on the next session. When no realtime-capable key exists, the session
+ # falls back to the pipeline; the spoken "realtime unavailable" notice is
+ # reserved for an EXPLICIT user pick (mode present in the TOML), so a
+ # fresh keyless install degrades silently instead of nagging every call.
+ mode: str = "realtime"
# Realtime tool exposure. "delegate" (default) declares ONE action function
# (jarvis_action) that hands the user's spoken request to the classic
# router brain — full ToolExecutor safety path, two-turn voice confirm,
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.py
index 89b831f2db..03056a2b98 100644
--- a/jarvis/speech/pipeline.py
+++ b/jarvis/speech/pipeline.py
@@ -5098,7 +5098,17 @@ class SpeechPipeline:
realtime_reason = await self._active_realtime_session()
if realtime_reason is not None:
return realtime_reason
- await self._speak_realtime_unavailable()
+ # Speak the "realtime unavailable" notice only when the user
+ # EXPLICITLY picked realtime ([voice].mode present in the TOML).
+ # Since "realtime" became the product default, a fresh keyless
+ # install lands here on every call and must degrade silently
+ # instead of nagging before each pipeline session.
+ voice_cfg = getattr(self._config, "voice", None)
+ explicitly_chosen = "mode" in (
+ getattr(voice_cfg, "model_fields_set", None) or ()
+ )
+ if explicitly_chosen:
+ await self._speak_realtime_unavailable()
self._active_voice_mode = "pipeline"
self._active_realtime_provider = ""
self._active_realtime_model = ""
diff --git a/tests/unit/core/test_voice_mode_config.py b/tests/unit/core/test_voice_mode_config.py
index 969e5c3daa..eec998d65f 100644
--- a/tests/unit/core/test_voice_mode_config.py
+++ b/tests/unit/core/test_voice_mode_config.py
@@ -4,12 +4,22 @@ from jarvis.core import config as cfg_mod
from jarvis.core import config_writer
-def test_voice_mode_defaults_to_pipeline():
+def test_voice_mode_defaults_to_realtime():
+ """Realtime is the recommended product default (2026-07-11); a keyless
+ install degrades silently to the pipeline at session time."""
cfg = cfg_mod.JarvisConfig()
- assert cfg.voice.mode == "pipeline"
+ assert cfg.voice.mode == "realtime"
assert cfg.brain.realtime is None
+def test_default_voice_mode_is_not_marked_explicit():
+ """The silent keyless fallback keys off model_fields_set: the default must
+ NOT count as an explicit user pick, while a TOML-provided mode must."""
+ assert "mode" not in cfg_mod.JarvisConfig().voice.model_fields_set
+ explicit = cfg_mod.JarvisConfig.model_validate({"voice": {"mode": "realtime"}})
+ assert "mode" in explicit.voice.model_fields_set
+
+
def test_dead_realtime_smalltalk_flag_is_removed():
# The abandoned Phase-1 flag must be gone (retired, not repurposed).
assert not hasattr(cfg_mod.BrainPolicyConfig(), "use_realtime_for_smalltalk")
diff --git a/tests/unit/speech/test_realtime_mode.py b/tests/unit/speech/test_realtime_mode.py
index 07e5d01c6f..7ad0d47421 100644
--- a/tests/unit/speech/test_realtime_mode.py
+++ b/tests/unit/speech/test_realtime_mode.py
@@ -89,7 +89,9 @@ class _FakeRealtimeSession:
def _pipe(mode: str = "realtime") -> SpeechPipeline:
pipe = SpeechPipeline.__new__(SpeechPipeline)
pipe._config = SimpleNamespace(
- voice=SimpleNamespace(mode=mode),
+ # model_fields_set mirrors an EXPLICIT user pick (mode in the TOML);
+ # the silent-default fallback test overrides it with an empty set.
+ voice=SimpleNamespace(mode=mode, model_fields_set={"mode"}),
brain=SimpleNamespace(reply_language="en"),
)
pipe._player = _FakePlayer()
@@ -205,6 +207,35 @@ async def test_failed_realtime_session_explains_and_falls_back_in_same_call(
assert notices == 1
+async def test_default_realtime_mode_falls_back_silently_without_notice(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """Realtime is the product DEFAULT now: a keyless install must fall back
+ to the pipeline without speaking the unavailable notice every call."""
+ pipe = _pipe()
+ pipe._config.voice.model_fields_set = set()
+ notices = 0
+
+ async def _failed_realtime():
+ return None
+
+ async def _notice():
+ nonlocal notices
+ notices += 1
+
+ pipe._active_realtime_session = _failed_realtime # type: ignore[method-assign]
+ pipe._speak_realtime_unavailable = _notice # type: ignore[method-assign]
+ monkeypatch.setattr(
+ pipeline_mod, "MicrophoneCapture", lambda **_kwargs: _SilentMic()
+ )
+
+ reason = await asyncio.wait_for(pipe._active_session(), timeout=2.0)
+
+ assert reason == HANGUP_SHUTDOWN
+ assert notices == 0
+
+
@pytest.mark.asyncio
async def test_pipeline_mode_never_enters_realtime_branch(
monkeypatch: pytest.MonkeyPatch,