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
refactor(wake): thread isolation bounds, pin rescue path, log BUG-127
rubenluetke10-beepc81663b2d021
diff --git a/docs/BUGS.md b/docs/BUGS.mdindex 8b34f835b1..30282254c7 100644--- a/docs/BUGS.md+++ b/docs/BUGS.md@@ -8782,3 +8782,43 @@ account failures never retried, per-mission transient budget, learnedheadroom), `tests/unit/trigger/test_hotkey_registry_mutation_guard.py` (the`FakeGlobalHotkeys.strict_poller` knob reproduces the live thread death — theguard test fails without `_registry_mutation`).++## BUG-127: three false wakes in 94 seconds — flowing dictation walked through every verify gate (HIGH, FIXED 2026-08-10)++**Symptoms (2026-08-10 19:57–19:59).** While the user dictated German to a+coding agent, the Vosk KWS engine fired 'Hey George' three times in 94 s;+each phantom session had to be killed by hotkey. The log shows all three+verify paths leaking in one window: `verify OK (undecided)` with the free+ear hearing unrelated German at the span (twice, de model, competition kept+the phrase at conf 1.0), and `verify OK (spelled)` where the EN model+spelled a literal 'hey george' out of German flow.++**Root.** The verify asked every question about what was said AT the+candidate span, and none about what was said immediately BEFORE it. The+grammar stage happily forces flowing speech onto the phrase; mid-stream, the+acoustic competition measurably does not discriminate (the forced grammar+keeps the phrase at conf 1.0 inside continuous speech), and the spelling+path is accept-only by design — so once dictation supplies enough sound+material, some window eventually satisfies one of the routes. No per-path+tightening can close a class that leaks through ALL paths at once.++**Fix.** A fourth HARD check in `_verify_window` (leading isolation): a wake+call STANDS ALONE. If the free decode carries more than 0.25 s of voiced+lead-in inside the 0.6 s window before the span, the candidate is rejected+ahead of BOTH confirm paths. Word-agnostic and durational (AP-27-safe: word+timings only, never text); mid-speech no-fire is the accepted product+trade-off, and only the LEADING side is gated so the wake+command breath+(2026-07-25) stays intact. Bounds are `__init__`-threaded like every sibling+threshold; a new `suppressed_lead_speech` stat surfaces in the+wake-detectors heartbeat.++**Guards:** `tests/unit/plugins/wake/test_vosk_wake_word_agnostic.py`+("stands alone" section: both live fire classes pinned as rejections, the+isolated call / natural pause / trailing-command breaths pinned as fires,+and the sibling-rescue path pinned as unable to bypass the gate).++**OPEN follow-up.** `jarvis/speech/rolling_whisper_wake.py` (the stt_match+wake path) verifies via a transcript too and has NO equivalent+before-the-phrase isolation gate — the identical false-wake class is+plausibly still open there whenever that engine is active. Port the same+word-agnostic lead-in check to its match site, calibrated on real windows.diff --git a/jarvis/plugins/wake/vosk_kws_provider.py b/jarvis/plugins/wake/vosk_kws_provider.pyindex 4756f2a677..da6d5d0c52 100644--- a/jarvis/plugins/wake/vosk_kws_provider.py+++ b/jarvis/plugins/wake/vosk_kws_provider.py@@ -602,6 +602,8 @@ class VoskKwsProvider:cooldown_s: float = _COOLDOWN_S,rejected_candidate_backoff_s: float = _REJECTED_CANDIDATE_BACKOFF_S,confirm_tail_s: float = _CONFIRM_TAIL_S,+ isolation_lead_s: float = _ISOLATION_LEAD_S,+ isolation_max_lead_voiced_s: float = _ISOLATION_MAX_LEAD_VOICED_S,# Production poll-loop parity: peak-normalize the confirm window to# -3 dBFS (gain capped at 40 dB) exactly like the other wake paths.target_peak: float = 0.7079,@@ -644,6 +646,8 @@ class VoskKwsProvider:0.0, float(rejected_candidate_backoff_s))self._confirm_tail_bytes = int(float(confirm_tail_s) * sample_rate) * 2+ self._isolation_lead_s = float(isolation_lead_s)+ self._isolation_max_lead_voiced_s = float(isolation_max_lead_voiced_s)self._target_peak = float(target_peak)self._max_gain = float(max_gain)self._models: dict[str, Any] = {}@@ -1112,7 +1116,7 @@ class VoskKwsProvider:fail_open: bool,model_path: str | None = None,) -> bool:- """Three checks over the given window; ALL must pass before a fire.+ """Four checks over the given window; ALL must pass before a fire.Why this shape (live forensic 2026-07-06, "Hey Ruben" fired on plainroom speech every few minutes): the streaming PARTIAL that makes the@@ -1133,6 +1137,10 @@ class VoskKwsProvider:OVERLAPPING the span (±0.3 s) — the permissive sound match thenjudges what was said AT the candidate's position instead offishing the best pair out of three seconds of conversation.+ 4. **Leading isolation**: a wake call STANDS ALONE — voiced free-decode+ words immediately BEFORE the span reject the candidate outright,+ ahead of both confirm paths (see the ``_ISOLATION_*`` note; live+ forensic 2026-08-10, three mid-dictation fires in 94 s).On infrastructure errors the ``fail_open`` polarity decides: theauthoritative confirm accepts (a broken confirm must never eat a real@@ -1242,7 +1250,7 @@ class VoskKwsProvider:# path leaked too (live 2026-08-10: the en model spelled# 'hey george' out of flowing German dictation). Reads only word# TIMINGS, never text (AP-27).- lead_a = span_a - _ISOLATION_LEAD_S+ lead_a = span_a - self._isolation_lead_slead_voiced = 0.0for w in fres.get("result", []):if float(w.get("end", 0.0)) >= span_a:@@ -1252,13 +1260,13 @@ class VoskKwsProvider:min(float(w.get("end", 0.0)), span_a)- max(float(w.get("start", 0.0)), lead_a),)- if lead_voiced > _ISOLATION_MAX_LEAD_VOICED_S:+ if lead_voiced > self._isolation_max_lead_voiced_s:self._stat_suppressed_lead_speech += 1self._log_suppression("lead-in speech %.2fs in the %.1fs before the span — ""a wake call stands alone, this was mid-speech",lead_voiced,- _ISOLATION_LEAD_S,+ self._isolation_lead_s,)return False# OPEN (2026-07-25, measured): a wake spoken in ONE breath with thediff --git a/tests/unit/plugins/wake/test_vosk_wake_word_agnostic.py b/tests/unit/plugins/wake/test_vosk_wake_word_agnostic.pyindex ded303640e..525374d301 100644--- a/tests/unit/plugins/wake/test_vosk_wake_word_agnostic.py+++ b/tests/unit/plugins/wake/test_vosk_wake_word_agnostic.py@@ -699,6 +699,31 @@ def test_trailing_command_speech_is_never_lead_in(monkeypatch) -> None:assert p._verify_window(_loud_window(3.0), fail_open=True) is True+def test_the_sibling_rescue_cannot_bypass_the_isolation_gate(monkeypatch) -> None:+ """The sibling rescue verifies through the SAME window check (the+ fail-closed ``_early_check``): a sibling model whose free ear also heard+ flowing speech right up to the span must not resurrect a mid-speech+ candidate the primary model already rejected. Secondary rescue paths are+ exactly where earlier gates in this file leaked, so this is pinned."""+ p = VoskKwsProvider(+ "Hey George",+ model_path="primary",+ model_paths=["primary", "sibling"],+ keyword="george",+ )+ free = {+ "text": "und dann machen wir aufbürdet", # i18n-allow+ "result": [*_GEORGE_LEAD_IN, _w("aufbürdet", 1.45, 2.20, conf=1.0)], # i18n-allow+ }++ def _take(model_path, kind): # noqa: ANN001+ assert model_path == "sibling", "the rescue must verify on the sibling"+ return _StubRec(free if kind == "free" else _GEORGE_GRAMMAR)++ monkeypatch.setattr(p, "_take_verify_rec", _take)+ assert p._early_check(_loud_window(3.0), "sibling") is False++# --- diagnosability: a suppressed wake must leave a trace (2026-07-25) --------