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(wake): restore recognition — revert echo-confirm corroboration, keep only the silence energy gate
Ruben Lütke7201fc0bee89
diff --git a/jarvis/speech/rolling_whisper_wake.py b/jarvis/speech/rolling_whisper_wake.pyindex 52437c8093..b07f35d990 100644--- a/jarvis/speech/rolling_whisper_wake.py+++ b/jarvis/speech/rolling_whisper_wake.py@@ -283,10 +283,6 @@ class RollingWhisperWake:self._max_no_speech_prob = max_no_speech_probself._transcribe_timeout_s = float(transcribe_timeout_s)self._match_min_rms = float(match_min_rms)- # Cache of prefix-relaxed core matchers, keyed by the phrase core, used- # by the bias-echo confirm to check whether the UNBIASED pass also heard- # the wake (built lazily so no import cost on the hot path).- self._core_matchers: dict[tuple[str, ...], Any] = {}# Statistics for the heartbeatself._chunks_seen = 0self._total_bytes = 0@@ -351,18 +347,20 @@ class RollingWhisperWake:The tell-tale is the ECHO SIGNATURE (the transcript consists of thephrase and NOTHING else) — genuine speech usually carries context.- Such candidates get ONE unbiased second pass over the SAME window and- must be CORROBORATED: the unprimed ear has to independently hear the- wake's core word. Merely producing *some* text is NOT evidence — the- base model ALSO hallucinates unrelated words on the same boosted noise- ('Ja.', 'Das ist ein Problem.' — live ghost activations 2026-07-02 that- the old "heard anything non-boilerplate → genuine" rule let through).- The corroboration reuses the primary matcher's length-aware fuzzy +- sound-fold logic (prefix-relaxed), so a garbled genuine wake- ('Hey Fabel', 'Ist er niko da') still passes while an unrelated- hallucination does not. Costs one extra local transcribe only on- exact-phrase candidates. Fail-CLOSED on infrastructure errors (an- unconfirmable exact-phrase candidate is suppressed, not accepted).+ Such candidates get ONE unbiased second pass over the SAME window: an+ unprimed ear hears *something* wherever real speech exists (even a+ mis-hearing), but hears nothing — or a known hallucination+ boilerplate — on the noise the primed model echoed over. Costs one+ extra local transcribe only on exact-phrase candidates. Fail-open on+ infrastructure errors: a broken confirm must never eat a real wake.++ CRITICAL — this must NEVER require the unbiased pass to reproduce the+ wake WORD. The whole reason for the bias prompt is that the unprimed+ base model cannot transcribe a hard proper-noun wake ('Mythos' ->+ 'Mütos'/'Mut', 'Fable' -> 'Farbe'); demanding it there rejects EVERY+ genuine wake (live recall-kill 2026-07-02). "Heard any real speech" is+ the only safe test here; the word-agnostic SILENCE guard is the raw+ energy gate at the match site (``_match_min_rms``), not this transcript."""bias = getattr(self._stt, "bias_prompt", None)if not bias:@@ -388,62 +386,25 @@ class RollingWhisperWake:)except TypeError:return False # provider has no unbiased pass -> legacy behaviour- except Exception as exc: # noqa: BLE001 — fail-CLOSED, never ghost-fire- # We reached this confirm only because the biased transcript was- # EXACTLY the primed phrase — the ghost-activation signature. If the- # unbiased pass cannot run (timeout / busy / provider error) we- # cannot rule out an echo, so we must SUPPRESS, not accept. Failing- # open here was a live silence-activation ('unbiased pass failed ()- # — accepting the wake', 2026-07-02). The mandate is zero- # activations on silence; a dropped borderline wake is repeatable,- # a ghost is not. A genuine wake carrying surrounding speech never- # reaches this branch (the token-count guard above returns early).- log.info(- "echo-confirm: unbiased pass failed (%s) — suppressing "- "(fail-closed: cannot confirm an exact-phrase candidate)",+ except Exception as exc: # noqa: BLE001 — fail-open, never eat a wake+ log.warning(+ "echo-confirm: unbiased pass failed (%s) — accepting the wake",exc,)- return True+ return Falseunbiased = (transcript.text or "").strip()- if unbiased and self._unbiased_corroborates(match.group(0), unbiased):+ if unbiased and STT_HALLUCINATION_RE.search(unbiased) is None:log.info(- "echo-confirm: unprimed ear corroborated the wake (heard %r) "- "— genuine",- unbiased[:60],+ "echo-confirm: unprimed ear heard %r — genuine wake", unbiased[:60])return Falselog.info("echo-confirm: SUPPRESSED prompt echo — biased transcript was "- "exactly the phrase but the unprimed ear did not corroborate the "- "wake (heard %r)",+ "exactly the phrase but the unprimed ear heard %r",unbiased[:60],)return True- def _unbiased_corroborates(self, matched_phrase: str, unbiased_text: str) -> bool:- """True if the unbiased transcript independently contains the wake core.-- Builds (once, cached) a PREFIX-RELAXED matcher for the core of the- just-matched phrase and runs it over the unprimed transcript, reusing- the primary matcher's length-aware fuzzy + sound-fold logic. So a- garbled genuine wake ('Hey Fabel', 'niko') still corroborates, while an- unrelated silence/noise hallucination ('Ja.', 'Das ist ein Problem.')- does not. An empty core (nothing to check) does not suppress.- """- core = tuple(phrase_core_for_match(matched_phrase))- if not core:- return True # nothing to corroborate against -> do not suppress- matcher = self._core_matchers.get(core)- if matcher is None:- from jarvis.speech.wake_phrase import compile_wake_matcher-- # Match on the CORE alone -> compile_wake_matcher does not require a- # wake prefix, so the unprimed ear may drop the 'Hey' and still- # corroborate the name.- matcher = compile_wake_matcher(" ".join(core))- self._core_matchers[core] = matcher- return matcher.search(unbiased_text) is not None-async def detect(self, chunks: AsyncIterator[AudioChunk]) -> AsyncIterator[str]:diff --git a/tests/unit/speech/test_rolling_whisper_wake_silence_ghost.py b/tests/unit/speech/test_rolling_whisper_wake_silence_ghost.pyindex 138b2c3e69..3986f64ffd 100644--- a/tests/unit/speech/test_rolling_whisper_wake_silence_ghost.py+++ b/tests/unit/speech/test_rolling_whisper_wake_silence_ghost.py@@ -89,17 +89,19 @@ class _BiasedSTT:async def _first_yield(- stt: _BiasedSTT, chunk: AudioChunk, *, wait_s: float = 1.5+ stt: _BiasedSTT, chunk: AudioChunk, *, phrase: str = "Hey Nico", wait_s: float = 1.5) -> str | None:"""Drive ``RollingWhisperWake`` over ``chunk`` and return the first wakekeyword it yields within ``wait_s`` (or ``None`` if it stays silent).- Pre-transcription gates are opened (min_rms/min_peak = 0) so the ONLY thing- under test is what happens once a window has been transcribed and matched.+ ``phrase`` is the configured wake word; the matcher is built from it exactly+ as the pipeline does, so the biased transcript must contain that phrase to+ match. Pre-transcription gates are opened (min_rms/min_peak = 0) so the ONLY+ thing under test is what happens once a window is transcribed and matched."""wake = RollingWhisperWake(stt,- pattern=compile_wake_matcher("Hey Nico"),+ pattern=compile_wake_matcher(phrase),poll_interval_s=0.02,cooldown_s=0.0,min_rms=0.0,@@ -159,35 +161,28 @@ async def test_phrase_with_hallucinated_context_on_silence_is_suppressed() -> Noassert await _first_yield(stt, _SILENT) is None-async def test_confirm_error_on_quiet_window_fails_closed() -> None:- """Hole B: when the bias-echo confirm's second STT pass errors, the gate- must fail CLOSED (suppress), not open — the live 'unbiased pass failed ()- — accepting the wake' ghost."""- stt = _BiasedSTT(biased="Hey Nico", unbiased_raises=True)- # Loud enough to clear the energy gate so the confirm actually runs; the- # confirm then errors and must suppress rather than accept.- assert await _first_yield(stt, _chunk(12000)) is None- assert stt.unbiased_calls >= 1, "confirm never ran — test does not cover Hole B"---async def test_unbiased_pass_hallucinating_unrelated_words_is_suppressed() -> None:- """The base model hallucinates on boosted noise too: the biased pass says- the exact phrase and the UNBIASED pass says an unrelated word ('Das ist ein- Problem.'). 'Heard something' is NOT corroboration — the unprimed ear must- hear the wake CORE. Live 2026-07-02 ghosts: 'Ja.', 'Das ist ein Problem.',- 'Ich will nicht.' all wrongly accepted as genuine. Loud audio so the energy- gate passes and the corroboration check is what must reject it."""- stt = _BiasedSTT(biased="Hey Nico", unbiased="Das ist ein Problem.")- assert await _first_yield(stt, _chunk(12000)) is None- assert stt.unbiased_calls >= 1, "confirm never ran — corroboration untested"---async def test_unbiased_pass_hearing_the_garbled_core_still_fires() -> None:- """Recall guard for the corroboration rule: a genuine wake the unprimed- model garbles to a sound-alike of the core ('niko' for 'Nico') must still- be accepted — corroboration is fuzzy + prefix-relaxed, not exact."""- stt = _BiasedSTT(biased="Hey Nico", unbiased="niko")- assert await _first_yield(stt, _chunk(12000)) is not None+async def test_loud_wake_fires_even_when_unbiased_pass_garbles_the_hard_word() -> None:+ """RECALL REGRESSION GUARD (live 2026-07-02, the reason the wake 'stopped+ working entirely' after a fix): the whole reason for the bias prompt is+ that the UNPRIMED base model cannot transcribe a hard proper-noun wake —+ 'Mythos' comes back as 'Mütos'/'Hey, Mut!', 'Fable' as 'Farbe'. A LOUD,+ genuine wake must fire on that garble. The bias-echo confirm must therefore+ accept 'heard real speech', and must NEVER require the unbiased pass to+ reproduce the wake word."""+ for garble in ("Mütos", "Hey, Mut!", "Mythe"):+ stt = _BiasedSTT(biased="Hey Mythos", unbiased=garble)+ assert await _first_yield(stt, _chunk(12000), phrase="Hey Mythos") is not None, (+ f"genuine loud wake dropped when the unbiased ear heard {garble!r}"+ )+++async def test_confirm_error_does_not_drop_a_loud_wake() -> None:+ """A confirm that errors (STT timeout under boot load) on a LOUD window must+ fail OPEN — dropping a genuine wake because the second pass hiccuped is the+ recall-kill the user hit. Silence is already handled by the energy gate+ before the confirm, so failing open here cannot ghost-fire on silence."""+ stt = _BiasedSTT(biased="Hey Mythos", unbiased_raises=True)+ assert await _first_yield(stt, _chunk(12000), phrase="Hey Mythos") is not Noneasync def test_genuine_quiet_wake_still_fires() -> None: