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-02 08:53)

Ruben Lütke642db16c8d85
diff --git a/jarvis/speech/rolling_whisper_wake.py b/jarvis/speech/rolling_whisper_wake.py
index 48bbde44b4..84e08fca81 100644
--- a/jarvis/speech/rolling_whisper_wake.py
+++ b/jarvis/speech/rolling_whisper_wake.py
@@ -367,44 +367,10 @@ class RollingWhisperWake:
# can never leave the wake permanently dead.
consecutive_fail = 0
- # --- Boot serialisation: poll only a WARM model -------------------
- # The pipeline's deferred loader owns the one-off model warm-up. Poking
- # ``transcribe_pcm`` while that load is in flight used to cascade
- # (timeout -> TranscribeBusy -> recover() threw the half-loaded model
- # away -> reload under the boot storm; 114.7 s instead of ~4 s, TTU
- # forensic 2026-07-02). Wait for ``is_warm``; if nobody warms the model
- # within the fallback window (unusual wiring), own the warm-up HERE —
- # exactly one loader either way. Providers without the flag (fakes,
- # cloud STT) report warm immediately. The audio consumer keeps filling
- # the rolling buffer during the wait, so no wake audio is lost.
+ # Boot serialisation state — see the warm gate inside the poll loop.
warm_wait_t0 = time.time()
warm_wait_logged = False
- while not stopped.is_set() and not getattr(self._stt, "is_warm", True):
- if time.time() - warm_wait_t0 > self._warm_wait_fallback_s:
- log.info(
- "rolling-whisper: wake model still cold after %.0f s — "
- "warming it from the poll loop (fallback owner).",
- self._warm_wait_fallback_s,
- )
- warm = getattr(self._stt, "warm_up", None)
- if callable(warm):
- try:
- await asyncio.to_thread(warm)
- except Exception as exc: # noqa: BLE001 — lazy load still works
- log.warning("rolling-whisper: fallback warm-up failed: %s", exc)
- break
- if not warm_wait_logged:
- log.info(
- "rolling-whisper: waiting for the wake model warm-up before "
- "polling (buffer keeps filling)."
- )
- warm_wait_logged = True
- await asyncio.sleep(0.25)
- if warm_wait_logged:
- log.info(
- "rolling-whisper: wake model warm — polling starts (waited %.1f s).",
- time.time() - warm_wait_t0,
- )
+ fallback_warmed = False
def _note_transcribe_fail() -> int:
nonlocal consecutive_fail
@@ -430,6 +396,54 @@ class RollingWhisperWake:
# and, crucially, of how long the previous transcription took.
await asyncio.sleep(self._poll_interval_s)
+ # --- Boot serialisation: poll only a WARM model -----------
+ # The pipeline's deferred loader owns the one-off model
+ # warm-up. Poking ``transcribe_pcm`` while that load is in
+ # flight used to cascade (8 s timeout -> TranscribeBusy ->
+ # recover() threw the half-loaded model away -> reload under
+ # the boot storm; 114.7 s instead of ~4 s, TTU forensic
+ # 2026-07-02). Skip the transcribe phase (and the self-heal
+ # fail counting) until ``is_warm``; if nobody warms the model
+ # within the fallback window (unusual wiring), warm it from
+ # HERE once — exactly one loader either way. Providers
+ # without the flag (fakes, cloud STT) count as warm. The
+ # audio consumer keeps the rolling buffer live throughout.
+ if not getattr(self._stt, "is_warm", True):
+ if (
+ not fallback_warmed
+ and time.time() - warm_wait_t0 > self._warm_wait_fallback_s
+ ):
+ fallback_warmed = True
+ log.info(
+ "rolling-whisper: wake model still cold after %.0f s "
+ "— warming it from the poll loop (fallback owner).",
+ self._warm_wait_fallback_s,
+ )
+ warm = getattr(self._stt, "warm_up", None)
+ if callable(warm):
+ try:
+ await asyncio.to_thread(warm)
+ except Exception as exc: # noqa: BLE001 — lazy load still works
+ log.warning(
+ "rolling-whisper: fallback warm-up failed: %s",
+ exc,
+ )
+ else:
+ if not warm_wait_logged:
+ warm_wait_logged = True
+ log.info(
+ "rolling-whisper: waiting for the wake model "
+ "warm-up before polling (buffer keeps filling)."
+ )
+ continue
+ if warm_wait_logged:
+ warm_wait_logged = False
+ log.info(
+ "rolling-whisper: wake model warm — polling starts "
+ "(waited %.1f s).",
+ time.time() - warm_wait_t0,
+ )
+
now = time.time()
# Cooldown after the last trigger
if now - last_trigger_t < self._cooldown_s:
diff --git a/scripts/wake_bench.py b/scripts/wake_bench.py
index c6ee365886..72a2179815 100644
--- a/scripts/wake_bench.py
+++ b/scripts/wake_bench.py
@@ -329,6 +329,16 @@ async def run_stream_mode(args: argparse.Namespace) -> dict:
stt = build_model(args, args.phrase)
lang = args.language if args.language not in ("", "auto", "none") else None
+ # Warm the model up front so the measured latency is the steady-state
+ # number (the poll loop now waits for ``is_warm`` before polling — boot
+ # serialisation 2026-07-02). Cold-start cost is reported separately by
+ # window mode's ``cold_first_transcribe_ms``.
+ warm = getattr(stt, "warm_up", None)
+ if callable(warm):
+ t_w = time.perf_counter()
+ await asyncio.to_thread(warm)
+ print(f"model warmed in {time.perf_counter() - t_w:.1f} s")
+
# Count recover() calls (wedge events) via a counting shim.
recover_calls = {"n": 0}
orig_recover = getattr(stt, "recover", None)
diff --git a/tests/unit/harness/test_action_registry.py b/tests/unit/harness/test_action_registry.py
index fc5b16f5be..92ea8eb87f 100644
--- a/tests/unit/harness/test_action_registry.py
+++ b/tests/unit/harness/test_action_registry.py
@@ -76,13 +76,13 @@ def test_actionspec_rejects_both_tool_and_composite() -> None:
name="x", tool_name="t", description="",
composite=lambda *a, **kw: None,
)
- with pytest.raises(ValueError, match="entweder tool_name ODER composite"):
+ with pytest.raises(ValueError, match="either tool_name OR composite"):
spec.validate()
def test_actionspec_rejects_neither_tool_nor_composite() -> None:
spec = ActionSpec(name="x", tool_name=None, description="")
- with pytest.raises(ValueError, match="entweder tool_name ODER composite"):
+ with pytest.raises(ValueError, match="either tool_name OR composite"):
spec.validate()
@@ -113,7 +113,7 @@ def test_transform_press_key_list_passthrough() -> None:
def test_transform_press_key_missing_arg_raises() -> None:
- with pytest.raises(ValueError, match="braucht 'key'"):
+ with pytest.raises(ValueError, match="needs 'key'"):
_transform_press_key({})
diff --git a/tests/unit/memory/test_curator_validator.py b/tests/unit/memory/test_curator_validator.py
index cca8eef3bc..417c589d38 100644
--- a/tests/unit/memory/test_curator_validator.py
+++ b/tests/unit/memory/test_curator_validator.py
@@ -155,7 +155,7 @@ class TestPronounRejection:
result = validator.validate([cand])
assert len(result.rejected) == 1
_, reason = result.rejected[0]
- assert "pronom" in reason.lower()
+ assert "pronoun" in reason.lower()
def test_rejects_sie_as_person_name(self, validator: Validator) -> None:
cand = _person_cand("sie", confidence=0.9)
@@ -179,7 +179,7 @@ class TestSubjectSanity:
result = validator.validate([cand])
assert len(result.rejected) == 1
_, reason = result.rejected[0]
- assert "kurz" in reason.lower() or "zu kurz" in reason.lower()
+ assert "too short" in reason.lower()
def test_rejects_empty_person_name(self, validator: Validator) -> None:
cand = _person_cand("", confidence=0.9)
diff --git a/tests/unit/memory/test_user_profile.py b/tests/unit/memory/test_user_profile.py
index 6a2e94a8a1..f690855c5e 100644
--- a/tests/unit/memory/test_user_profile.py
+++ b/tests/unit/memory/test_user_profile.py
@@ -235,7 +235,7 @@ class TestRenderForPrompt:
out = profile.render_for_prompt()
assert "Ruben" in out
# Header is still included
- assert "Ueber den User" in out # i18n-allow: matches the real (currently German) header rendered by UserProfile.render_for_prompt
+ assert "About the User" in out
def test_render_stays_within_budget(self, profile: UserProfile) -> None:
"""Even with a lot of content, rendering must not exceed the budget cap."""
@@ -265,7 +265,7 @@ class TestRenderForPrompt:
"""Template has name=null — rendering must not crash regardless."""
out = profile.render_for_prompt()
assert isinstance(out, str)
- assert "Ueber den User" in out # i18n-allow: matches the real (currently German) header rendered by UserProfile.render_for_prompt
+ assert "About the User" in out
# ======================================================================
diff --git a/tests/unit/plugins/tool/test_app_control_tools.py b/tests/unit/plugins/tool/test_app_control_tools.py
index 14fb9fd666..2d2a570505 100644
--- a/tests/unit/plugins/tool/test_app_control_tools.py
+++ b/tests/unit/plugins/tool/test_app_control_tools.py
@@ -264,7 +264,7 @@ async def test_switch_unknown_tier(configured_keys):
async def test_switch_stt_requires_restart(configured_keys):
from jarvis.brain.app_control import apply_provider_switch
- res = await apply_provider_switch("stt", "deepgram", cfg=make_cfg(), persist=False)
+ res = await apply_provider_switch("stt", "groq-api", cfg=make_cfg(), persist=False)
assert res["ok"] is True
assert res["applied_live"] is False
assert res["requires_restart"] is True
diff --git a/tests/unit/plugins/tool/test_hotkey_tool.py b/tests/unit/plugins/tool/test_hotkey_tool.py
index 90cb88e3b2..8161ce693f 100644
--- a/tests/unit/plugins/tool/test_hotkey_tool.py
+++ b/tests/unit/plugins/tool/test_hotkey_tool.py
@@ -87,6 +87,6 @@ async def test_unknown_combo_part_still_reports_clean_error(monkeypatch):
res = await HotkeyTool().execute({"keys": ["ctrl+nope"]}, _Ctx())
# Not all parts resolve -> keep the token verbatim and surface the
- # existing "Unbekannte Taste" error instead of a confusing split.
+ # existing "Unknown key" error instead of a confusing split.
assert res.success is False
- assert "Unbekannte Taste" in (res.error or "")
+ assert "Unknown key" in (res.error or "")
diff --git a/tests/unit/plugins/tool/test_switch_window.py b/tests/unit/plugins/tool/test_switch_window.py
index b9ed5b8db0..96a0cf703e 100644
--- a/tests/unit/plugins/tool/test_switch_window.py
+++ b/tests/unit/plugins/tool/test_switch_window.py
@@ -174,7 +174,7 @@ async def test_execute_headless_linux_degrades(monkeypatch):
async def test_execute_windows_path_unchanged(monkeypatch):
- # AD-7: the Windows readback stays exactly as before (German).
+ # AD-7: the Windows readback keeps its established wording.
monkeypatch.setattr("jarvis.plugins.tool.switch_window.detect_platform", lambda: "win32")
monkeypatch.setattr(
"jarvis.plugins.tool.switch_window._find_and_focus_windows",
@@ -182,4 +182,4 @@ async def test_execute_windows_path_unchanged(monkeypatch):
)
res = await SwitchWindowTool().execute({"title_contains": "Notepad"}, _ctx())
assert res.success is True
- assert res.output == "Fokus auf Fenster: Notepad"
+ assert res.output == "Focused window: Notepad"
diff --git a/tests/unit/self_mod/test_audit.py b/tests/unit/self_mod/test_audit.py
index 3ad4fc827e..fdaca9c0ae 100644
--- a/tests/unit/self_mod/test_audit.py
+++ b/tests/unit/self_mod/test_audit.py
@@ -277,7 +277,7 @@ class TestRobustness:
audit.record(sample_event)
assert any(
- "fehlgeschlagen" in rec.getMessage().lower() # i18n-allow: matches actual German text logged by jarvis/core/self_mod/audit.py
+ "failed" in rec.getMessage().lower()
for rec in caplog.records
), "expected warning log missing"
diff --git a/tests/unit/speech/test_zz_diag_bootwarm_scratch.py b/tests/unit/speech/test_zz_diag_bootwarm_scratch.py
index b23f95d5a1..b8ecd69cba 100644
--- a/tests/unit/speech/test_zz_diag_bootwarm_scratch.py
+++ b/tests/unit/speech/test_zz_diag_bootwarm_scratch.py
@@ -65,13 +65,26 @@ async def test_diag_bootwarm(capsys) -> None:
import time as _time
+ # Count warm-wait loop iterations by patching asyncio.sleep inside the
+ # rolling module for the 0.25 s cadence only.
+ import jarvis.speech.rolling_whisper_wake as rww
+ iter_counter = {"n": 0}
+ _orig_sleep = asyncio.sleep
+
+ async def _counting_sleep(delay, *a, **k): # noqa: ANN001, ANN002, ANN003
+ if abs(delay - 0.25) < 1e-9:
+ iter_counter["n"] += 1
+ return await _orig_sleep(delay, *a, **k)
+
+ rww.asyncio.sleep = _counting_sleep
+
f = asyncio.create_task(_feed())
d = asyncio.create_task(_drain())
_t0 = _time.perf_counter()
await asyncio.sleep(0.4)
_slept = _time.perf_counter() - _t0
with capsys.disabled():
- print(f"\nDIAG sleep(0.4) took {_slept:.3f}s real")
+ print(f"\nDIAG sleep(0.4) took {_slept:.3f}s real, warm-wait iters={iter_counter['n']}")
print(f"DIAG cold: calls={stt.calls} feeder_done={f.done()} driver_done={d.done()}")
if f.done():
print("feeder exc:", repr(f.exception()))
@@ -82,8 +95,9 @@ async def test_diag_bootwarm(capsys) -> None:
if stt.calls > 0:
break
await asyncio.sleep(0.01)
+ rww.asyncio.sleep = _orig_sleep
with capsys.disabled():
- print(f"DIAG warm: calls={stt.calls} feeder_done={f.done()} driver_done={d.done()}")
+ print(f"DIAG warm: calls={stt.calls} iters={iter_counter['n']} feeder_done={f.done()} driver_done={d.done()}")
if f.done() and f.exception() is not None:
print("feeder exc:", repr(f.exception()))
if d.done() and d.exception() is not None:
diff --git a/tests/unit/speech/test_zz_diag_minimal_scratch.py b/tests/unit/speech/test_zz_diag_minimal_scratch.py
new file mode 100644
index 0000000000..a73e44bd58
--- /dev/null
+++ b/tests/unit/speech/test_zz_diag_minimal_scratch.py
@@ -0,0 +1,41 @@
+"""Minimal repro: does an async generator waiting on a flag resume under pytest?"""
+from __future__ import annotations
+
+import asyncio
+
+
+class _Flag:
+ warm = False
+
+
+async def _gen(flag: _Flag):
+ while not flag.warm:
+ await asyncio.sleep(0.05)
+ while True:
+ await asyncio.sleep(0.01)
+ yield "tick"
+
+
+async def test_minimal_generator_resumes_after_flag_flip(capsys) -> None:
+ flag = _Flag()
+ ticks = []
+
+ async def _drain() -> None:
+ async for t in _gen(flag):
+ ticks.append(t)
+
+ d = asyncio.create_task(_drain())
+ await asyncio.sleep(0.3)
+ cold = len(ticks)
+ flag.warm = True
+ await asyncio.sleep(0.5)
+ warm = len(ticks)
+ d.cancel()
+ try:
+ await d
+ except asyncio.CancelledError:
+ pass
+ with capsys.disabled():
+ print(f"\nMINIMAL cold_ticks={cold} warm_ticks={warm}")
+ assert cold == 0
+ assert warm > 0, "generator never resumed after the flag flip"
diff --git a/tests/unit/ui/web/test_friends_routes.py b/tests/unit/ui/web/test_friends_routes.py
index c1f593ee48..2763403c13 100644
--- a/tests/unit/ui/web/test_friends_routes.py
+++ b/tests/unit/ui/web/test_friends_routes.py
@@ -236,7 +236,7 @@ def test_send_message_without_channel_400(app_with_registry: FastAPI) -> None:
fid = r.json()["id"]
r2 = client.post(f"/api/friends/{fid}/messages", json={"text": "hi"})
assert r2.status_code == 400
- assert "Channel" in r2.json()["detail"]
+ assert "no linked channel" in r2.json()["detail"]
def test_send_message_pubkey_persists_outbound(app_with_registry: FastAPI) -> None:
diff --git a/tests/unit/voice/test_contextual_readback.py b/tests/unit/voice/test_contextual_readback.py
index 261397df1f..b589dc9ec0 100644
--- a/tests/unit/voice/test_contextual_readback.py
+++ b/tests/unit/voice/test_contextual_readback.py
@@ -217,7 +217,10 @@ async def test_number_from_facts_allowed() -> None:
facts={"observation": "the browser is open with 3 tabs"},
)
assert out != CANNED
- assert "3" in out
+ # The voice pipeline spells digits out for TTS (number_speller), so the
+ # fact-backed number may surface verbatim or verbalized — both prove the
+ # anti-hallucination guard let it through.
+ assert "3" in out or "three" in out
@pytest.mark.asyncio