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.

fix(wake): hide unverified Vosk candidates

Ruben Lütke3594b7c13402
diff --git a/jarvis/plugins/wake/vosk_kws_provider.py b/jarvis/plugins/wake/vosk_kws_provider.py
index 19c5ecde6e..51349db280 100644
--- a/jarvis/plugins/wake/vosk_kws_provider.py
+++ b/jarvis/plugins/wake/vosk_kws_provider.py
@@ -40,7 +40,7 @@ import json
import logging
import time
from collections import deque
-from collections.abc import AsyncIterator, Awaitable, Callable
+from collections.abc import AsyncIterator
from concurrent.futures import ThreadPoolExecutor
from difflib import SequenceMatcher
from typing import Any
@@ -93,16 +93,6 @@ _COOLDOWN_S = 5.0
# passed).
_CONFIRM_TAIL_S = 0.6
-# How much of the RECENT ring to check for the optimistic candidate signal's
-# cheap pre-gate (spawn-latency mission 2026-07-10). This is deliberately a
-# SEPARATE, cheaper check from the authoritative span-localised RMS gate in
-# ``_verify_candidate`` — it only exists to stop the optimistic, visual-only
-# ``on_candidate(True)`` from firing on a grammar hit pulled onto near-silence
-# (word-agnostic, AP-27-conform: energy only, never transcript content). The
-# authoritative confirm below is unchanged and remains the real gate.
-_CANDIDATE_RMS_TAIL_S = 0.4
-
-
def _folded(text: str) -> str:
return " ".join(sound_fold(t) for t in normalize_phrase_for_match(text))
@@ -155,18 +145,6 @@ class VoskKwsProvider:
# -3 dBFS (gain capped at 40 dB) exactly like the other wake paths.
target_peak: float = 0.7079,
max_gain: float = 100.0,
- # Optimistic, visual-only candidate signal (spawn-latency mission
- # 2026-07-10): awaited with True the moment a grammar candidate
- # passes the cheap RMS pre-gate — BEFORE the confirm_tail_s wait and
- # the (now-parallelised, but still real) verify pass — and with
- # False if that candidate is later rejected. Mirrors the OWW
- # candidate/retract semantics the pipeline already publishes as
- # ``WakeCandidateDetected``, just sourced from inside this provider
- # (unlike OWW, this provider's own ``detect()`` does not yield until
- # AFTER its full internal confirm, so the pipeline has no other way
- # to learn about a candidate this early). None = no signal (tests /
- # callers that do not care).
- on_candidate: Callable[[bool], Awaitable[None]] | None = None,
) -> None:
self._phrase = phrase.strip()
self._keyword = keyword or "_".join(normalize_phrase_for_match(phrase)) or "wake"
@@ -190,7 +168,6 @@ class VoskKwsProvider:
self._confirm_ratio = max(self._confirm_ratio, 0.62)
self._target_peak = float(target_peak)
self._max_gain = float(max_gain)
- self._on_candidate = on_candidate
self._model: Any = None
self._grammar_words = [w for w in self._phrase.lower().split() if w]
# Duck-typing parity with OpenWakeWordProvider: the pipeline's ready
@@ -295,23 +272,6 @@ class VoskKwsProvider:
raw = b"".join(self._ring)
return np.frombuffer(raw, dtype=np.int16).astype(np.float32) / 32768.0
- def _recent_rms(self, tail_s: float) -> float:
- """Cheap RMS over the last ``tail_s`` seconds of ring audio.
-
- Used ONLY as the fast pre-gate for the optimistic ``on_candidate``
- signal (word-agnostic, AP-27-conform) — the authoritative,
- span-localised RMS check in ``_verify_candidate`` is unchanged and
- stays the real gate for whether the wake actually fires.
- """
- if not self._ring:
- return 0.0
- n_bytes = int(tail_s * self._sample_rate) * 2
- raw = b"".join(self._ring)[-n_bytes:] if n_bytes > 0 else b""
- if not raw:
- return 0.0
- arr = np.frombuffer(raw, dtype=np.int16).astype(np.float32) / 32768.0
- return float(np.sqrt(np.mean(arr * arr) + 1e-12)) if len(arr) else 0.0
-
def _grammar_hit(self, rec: Any, pcm: bytes) -> tuple[bool, float] | None:
"""Feed one chunk; return (is_final, min_conf) on a phrase hit else None."""
if rec.AcceptWaveform(pcm):
@@ -465,17 +425,6 @@ class VoskKwsProvider:
# -- detection loop --------------------------------------------------------
- async def _signal_candidate(self, active: bool) -> None:
- """Best-effort ``on_candidate`` notification — a broken/absent hook
- must never break wake detection itself (fail-open, matches every
- other callback boundary in this provider)."""
- if self._on_candidate is None:
- return
- try:
- await self._on_candidate(active)
- except Exception: # noqa: BLE001
- log.debug("vosk-kws on_candidate(%s) callback failed", active, exc_info=True)
-
async def detect(self, chunks: AsyncIterator[AudioChunk]) -> AsyncIterator[str]:
"""Consume audio chunks, yield the keyword on a confirmed hit.
@@ -483,17 +432,10 @@ class VoskKwsProvider:
realtime — a 100 ms chunk costs ~2 ms, safe inline). The confirm pass
(~0.1-0.2 s) runs in a worker thread only on candidates.
- Spawn-latency mission (2026-07-10): this loop's own confirm_tail_s
- wait + verify pass is the dominant cost between "the user finishes
- the phrase" and "the wake is authoritatively confirmed" — deliberately
- NOT shortened here (recall-calibrated, see the constants above). What
- CAN move earlier is the visual-only bar reveal: ``on_candidate(True)``
- fires the moment a grammar hit clears cooldown + the cheap RMS
- pre-gate, i.e. BEFORE confirm_tail_s and the verify pass, so the UI
- can react in roughly one poll cadence. ``on_candidate(False)`` fires
- if that same candidate is later rejected, so a false grammar hit only
- costs a brief visual flash, never a phantom session (the actual
- session only ever opens on a real ``yield`` below).
+ The stage-one grammar is intentionally noisy (it forces speech onto
+ the configured phrase), so candidates remain private to this method.
+ Only the keyword yielded after the full verify pass may cross into the
+ pipeline or become visible in the overlay.
"""
await asyncio.to_thread(self._ensure_model)
rec = self._new_grammar_rec()
@@ -504,10 +446,6 @@ class VoskKwsProvider:
# the wait — their endpoint already passed.
pending: tuple[bool, float] | None = None
pending_tail = 0
- # True while an optimistic on_candidate(True) is outstanding for the
- # candidate currently being confirmed — tracks whether a matching
- # on_candidate(False) retraction is owed on rejection.
- signalled_candidate = False
async for chunk in chunks:
self._stat_chunks += 1
pcm = chunk.pcm
@@ -532,13 +470,6 @@ class VoskKwsProvider:
if is_final and conf < self._min_final_conf:
rec = self._new_grammar_rec()
continue
- # Optimistic, visual-only reveal (see the docstring above).
- # Gated on raw RMS over the recent ring — word-agnostic,
- # AP-27-conform — so a grammar hit pulled onto near-silence
- # never pops the bar.
- if self._recent_rms(_CANDIDATE_RMS_TAIL_S) >= self._match_min_rms:
- signalled_candidate = True
- await self._signal_candidate(True)
if not is_final and self._confirm_tail_bytes > 0:
pending = (is_final, conf)
pending_tail = 0
@@ -548,14 +479,10 @@ class VoskKwsProvider:
confirmed = await asyncio.to_thread(self._verify_candidate, window)
if not confirmed:
self._stat_suppressed_confirm += 1
- if signalled_candidate:
- await self._signal_candidate(False)
- signalled_candidate = False
rec = self._new_grammar_rec()
continue
self._stat_fired += 1
last_fire_t = now
- signalled_candidate = False
log.info(
"vosk-kws: WAKE fired for %r (%s candidate)",
self._phrase,
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.py
index b587d91ab6..4a626a588a 100644
--- a/jarvis/speech/pipeline.py
+++ b/jarvis/speech/pipeline.py
@@ -1140,7 +1140,6 @@ class SpeechPipeline:
phrase=wake_plan.phrase,
model_path=wake_plan.vosk_model_path or "",
keyword=wake_plan.oww_keyword,
- on_candidate=self._on_vosk_wake_candidate,
)
elif wake_plan is not None:
self._wake = OpenWakeWordProvider(
@@ -1840,7 +1839,6 @@ class SpeechPipeline:
phrase=plan.phrase,
model_path=getattr(plan, "vosk_model_path", None) or "",
keyword=plan.oww_keyword,
- on_candidate=self._on_vosk_wake_candidate,
)
self._openwakeword_enabled = True
if self._whisper_wake is not None and self._wake_matcher is not None:
@@ -4288,57 +4286,21 @@ class SpeechPipeline:
log.exception("Wake-Loop Fehler: %s", exc)
await asyncio.sleep(0.5)
- async def _on_vosk_wake_candidate(self, active: bool) -> None:
- """Optimistic, visual-only bar reveal for the vosk_kws engine
- (spawn-latency mission 2026-07-10).
-
- Unlike OpenWakeWord, ``VoskKwsProvider.detect()`` does not yield
- anything until AFTER its own internal confirm (grammar re-score +
- energy gate + free-decode sound confirm) already completed — so the
- OWW-result-timed optimistic publish further down in
- ``_run_parallel_wake`` runs too late to help this engine (it would
- fire right before the authoritative ``WakeWordDetected`` anyway).
- The provider instead calls back HERE the moment a grammar candidate
- clears its own cheap RMS pre-gate — well before its confirm_tail_s
- wait and verify pass — so the visual reveal lands in roughly one
- poll cadence. ``active=False`` retracts if that candidate is later
- rejected. Visual only: never opens a session, mirrors
- ``_on_wake_candidate`` on the orb-bridge side (ui/orb/bus_bridge.py).
-
- The ``active=True`` publish is gated on the SAME
- ``_should_show_optimistic_candidate()`` check the OWW branch uses —
- chiefly its ``PipelineState.IDLE`` guard, since ``detect()`` can in
- principle still be mid-candidate when a hotkey/PTT session starts the
- state elsewhere. ``active=False`` is published unconditionally: the
- bridge's retract handler is idempotent/no-op-safe against a retract
- with no matching prior show (``ui/orb/bus_bridge.py::_on_wake_candidate``
- — a real active session is left alone, an idle bar is simply
- re-asserted idle), so it does not need the same gate.
- """
- if active and not self._should_show_optimistic_candidate():
- return
- try:
- await self._publish_event(
- WakeCandidateDetected(source_layer="speech", active=active)
- )
- except Exception as exc: # noqa: BLE001 — a broken publish must not kill wake
- log.warning("vosk wake-candidate publish failed: %s", exc)
-
def _should_show_optimistic_candidate(self) -> bool:
"""Whether an unverified OWW hit may pop the overlay bar immediately.
The optimistic reveal exists so a genuine "Hey Jarvis" feels instant on
the precise pretrained model, where false candidates are rare and a
- reject costs one brief bar flash. A user-trained custom_onnx model
- fires on breath/ambient speech many times a minute (user GIF
- 2026-07-02: the bar popped open/closed on auto-repeat), so for that
- engine the bar appears only AFTER the STT verify confirms the wake —
- a ~1 s later reveal instead of a constant flicker.
+ reject costs one brief bar flash. Custom ONNX and Vosk grammar stage-one
+ candidates both match ordinary speech frequently, so those engines wait
+ for the authoritative ``WakeWordDetected`` event after full verification.
"""
if self._state != PipelineState.IDLE:
return False
plan = getattr(self, "_wake_plan", None)
- return not (plan is not None and getattr(plan, "engine", "") == "custom_onnx")
+ if plan is None:
+ return True
+ return getattr(plan, "engine", "") == "openwakeword"
async def _verify_oww_hit(self, pcm_snapshot: bytes) -> bool:
"""Second-stage gate: ask the utterance STT whether the few seconds
@@ -4649,23 +4611,7 @@ class SpeechPipeline:
# Custom-model candidates never reveal optimistically
# (constant flicker, see the helper's docstring).
show_candidate = self._should_show_optimistic_candidate()
- # vosk_kws already published its OWN, earlier
- # candidate signal directly from the provider
- # (see _on_vosk_wake_candidate) — timed BEFORE its
- # internal confirm_tail_s wait, unlike this
- # OWW-result-timed publish which only runs AFTER
- # vosk's full internal verify already completed.
- # Publishing True again here would be a redundant,
- # mistimed duplicate landing almost simultaneously
- # with WakeWordDetected. `show_candidate` itself
- # stays UNCHANGED so the lock/not-activatable
- # retract path further below still correctly
- # retracts the EARLIER provider-side show if this
- # wake gets discarded.
- engine = getattr(
- getattr(self, "_wake_plan", None), "engine", ""
- )
- if show_candidate and engine != "vosk_kws":
+ if show_candidate:
await self._publish_event(
WakeCandidateDetected(
source_layer="speech", active=True
diff --git a/tests/unit/plugins/wake/test_vosk_kws_provider.py b/tests/unit/plugins/wake/test_vosk_kws_provider.py
index cea8d5ac7b..936b0d4e65 100644
--- a/tests/unit/plugins/wake/test_vosk_kws_provider.py
+++ b/tests/unit/plugins/wake/test_vosk_kws_provider.py
@@ -8,6 +8,7 @@ up. What is pinned here:
room" for "Hey Ruben") passes, unrelated speech ("vielen dank") and an
empty free transcript are rejected. # i18n-allow: German utterance under test
- A grammar partial hit fires the keyword only after the free-decode confirm.
+- Unverified grammar candidates stay internal and have no UI callback.
- Near-silent candidates are rejected on raw ENERGY (never transcript).
- A confirm infrastructure error fails OPEN (never eats a real wake).
- The wake detector yields the canonical keyword, never transcript text.
@@ -206,107 +207,19 @@ async def test_near_silent_candidate_is_gated_on_energy(fake_vosk) -> None:
assert p.stats()["gated_rms"] >= 1
-# --- optimistic on_candidate signal (spawn-latency mission 2026-07-10) ---------
+# --- unverified-candidate boundary -------------------------------------------
-async def test_on_candidate_fires_true_before_confirm_and_is_not_retracted_on_success(
- fake_vosk,
-) -> None:
- """The optimistic candidate fires BEFORE the confirm_tail_s wait + verify
- pass, and is never retracted when that same candidate goes on to confirm
- -- only a REJECTED candidate gets a matching ``False`` (see the next
- test)."""
- events: list[bool] = []
+def test_provider_has_no_unverified_candidate_callback() -> None:
+ """Stage-one grammar hits are intentionally noisy and must remain internal.
- async def _on_candidate(active: bool) -> None:
- events.append(active)
-
- p = VoskKwsProvider(
- "Hey Nova", model_path="fake", keyword="nova", on_candidate=_on_candidate
- )
- fired = await _run_detect(p, [_chunk() for _ in range(12)])
- assert fired == ["nova"]
- assert events == [True]
-
-
-async def test_on_candidate_retracts_on_confirm_rejection(fake_vosk) -> None:
- events: list[bool] = []
-
- async def _on_candidate(active: bool) -> None:
- events.append(active)
-
- p = VoskKwsProvider(
- "Hey Nova", model_path="fake", keyword="nova", on_candidate=_on_candidate
- )
- fake_vosk_model_free_text = "das ist etwas ganz anderes" # i18n-allow: utterance under test
- fired: list[str] = []
-
- async def _late_set() -> None:
- for _ in range(50):
- if fake_vosk["model"] is not None:
- fake_vosk["model"].free_text = fake_vosk_model_free_text
- return
- await asyncio.sleep(0.01)
-
- async def _drive() -> None:
- async def _iter() -> AsyncIterator[AudioChunk]:
- for _ in range(12):
- await asyncio.sleep(0.005)
- yield _chunk()
-
- async for kw in p.detect(_iter()):
- fired.append(kw)
-
- await asyncio.wait_for(asyncio.gather(_late_set(), _drive()), timeout=5.0)
- assert fired == []
- # Optimistic reveal, then a matching retraction once the confirm rejects.
- # A third dangling True follows: the fake grammar re-fires exactly at the
- # chunk stream's end (fire_after=3 chunks after the re-armed recognizer,
- # which lines up with this test's chunk count) — a candidate whose
- # tail-wait never completes because the stream simply ends, same as a
- # real mic stream closing mid-candidate. That is expected, not a bug:
- # there is no matching False because verify_candidate never runs.
- assert events == [True, False, True]
-
-
-async def test_on_candidate_never_fires_on_near_silent_audio(fake_vosk) -> None:
- """AP-27: the optimistic pre-gate is raw ENERGY over the actual ring
- audio, never transcript content -- even though the fake grammar "hears"
- the phrase regardless of loudness, near-silent real PCM must never pop
- the bar."""
- events: list[bool] = []
-
- async def _on_candidate(active: bool) -> None:
- events.append(active)
-
- p = VoskKwsProvider(
- "Hey Nova", model_path="fake", keyword="nova", on_candidate=_on_candidate
- )
- fired = await _run_detect(p, [_silent_chunk() for _ in range(12)])
- assert fired == []
- assert events == []
-
-
-async def test_on_candidate_none_hook_is_a_safe_no_op(fake_vosk) -> None:
- """The default ``on_candidate=None`` must not raise or change behaviour
- (every existing test above already relies on this implicitly)."""
- p = VoskKwsProvider("Hey Nova", model_path="fake", keyword="nova")
- fired = await _run_detect(p, [_chunk() for _ in range(12)])
- assert fired == ["nova"]
-
-
-async def test_on_candidate_broken_hook_does_not_break_detection(fake_vosk) -> None:
- """A raising ``on_candidate`` hook must fail open — never eat a real
- wake (mirrors every other callback boundary in this provider)."""
-
- async def _boom(active: bool) -> None: # noqa: ARG001
- raise RuntimeError("UI hook exploded")
+ Only the confirmed keyword yielded by ``detect`` may cross into the speech
+ pipeline. Exposing a pre-confirm callback previously made the JarvisBar
+ flash for ordinary speech even though the verifier rejected every hit.
+ """
+ import inspect
- p = VoskKwsProvider(
- "Hey Nova", model_path="fake", keyword="nova", on_candidate=_boom
- )
- fired = await _run_detect(p, [_chunk() for _ in range(12)])
- assert fired == ["nova"]
+ assert "on_candidate" not in inspect.signature(VoskKwsProvider).parameters
def test_confirm_infrastructure_error_fails_open(fake_vosk, monkeypatch) -> None:
diff --git a/tests/unit/speech/test_wake_plan_vosk.py b/tests/unit/speech/test_wake_plan_vosk.py
index 6a44d52010..cc2576f6fd 100644
--- a/tests/unit/speech/test_wake_plan_vosk.py
+++ b/tests/unit/speech/test_wake_plan_vosk.py
@@ -147,13 +147,10 @@ def test_no_vosk_no_whisper_is_honest_wake_off(vosk_model_dir) -> None:
# --------------------------------------------------------------------------
-def test_set_wake_plan_vosk_wires_the_optimistic_candidate_callback(
+def test_set_wake_plan_vosk_keeps_unverified_candidates_internal(
vosk_model_dir,
) -> None:
- """Spawn-latency mission 2026-07-10: VoskKwsProvider gets a callback that
- lets it publish an optimistic WakeCandidateDetected from INSIDE its own
- detect loop, well before its confirm_tail_s wait + verify pass complete
- -- this is the lever that beats that wait without shortening it."""
+ """Live-apply must not expose noisy grammar hits to the visible overlay."""
from jarvis.core.bus import EventBus
from jarvis.plugins.wake.vosk_kws_provider import VoskKwsProvider
from jarvis.speech.pipeline import SpeechPipeline
@@ -170,17 +167,13 @@ def test_set_wake_plan_vosk_wires_the_optimistic_candidate_callback(
pipe.set_wake_plan(plan)
assert isinstance(pipe._wake, VoskKwsProvider)
- # Bound methods compare equal (same __self__/__func__) even though two
- # separate attribute reads create distinct bound-method objects (`is`
- # would flake here).
- assert pipe._wake._on_candidate == pipe._on_vosk_wake_candidate # noqa: SLF001
+ assert not hasattr(pipe._wake, "_on_candidate")
-def test_constructor_wake_plan_also_wires_the_candidate_callback(
+def test_constructor_wake_plan_keeps_unverified_candidates_internal(
vosk_model_dir,
) -> None:
- """Same wiring, but through the INITIAL constructor path (a wake_plan
- passed at construction) rather than the live-apply ``set_wake_plan``."""
+ """The initial construction path has the same confirmed-wake boundary."""
from jarvis.core.bus import EventBus
from jarvis.plugins.wake.vosk_kws_provider import VoskKwsProvider
from jarvis.speech.pipeline import SpeechPipeline
@@ -198,69 +191,7 @@ def test_constructor_wake_plan_also_wires_the_candidate_callback(
)
assert isinstance(pipe._wake, VoskKwsProvider)
- assert pipe._wake._on_candidate == pipe._on_vosk_wake_candidate # noqa: SLF001
-
-
-async def test_on_vosk_wake_candidate_publishes_active_true_and_false(
- vosk_model_dir,
-) -> None:
- from jarvis.core.bus import EventBus
- from jarvis.core.events import WakeCandidateDetected
- from jarvis.speech.pipeline import SpeechPipeline
-
- bus = EventBus()
- received: list[WakeCandidateDetected] = []
-
- async def _collect(event: WakeCandidateDetected) -> None:
- received.append(event)
-
- bus.subscribe(WakeCandidateDetected, _collect)
-
- pipe = SpeechPipeline(
- tts=_FakeTTS(), bus=bus,
- enable_openwakeword=False, enable_whisper_wake=False,
- enable_local_whisper=False, config=None,
- )
-
- await pipe._on_vosk_wake_candidate(True) # noqa: SLF001
- await pipe._on_vosk_wake_candidate(False) # noqa: SLF001
-
- assert [e.active for e in received] == [True, False]
- assert all(e.source_layer == "speech" for e in received)
-
-
-async def test_on_vosk_wake_candidate_true_is_suppressed_when_not_idle(
- vosk_model_dir,
-) -> None:
- """The ``active=True`` publish shares ``_should_show_optimistic_candidate``
- with the OWW branch — chiefly its PipelineState.IDLE guard, since
- ``detect()`` can in principle still be mid-candidate right as a
- hotkey/PTT session starts elsewhere. ``active=False`` stays unconditional
- (the bridge's retract handler is safely idempotent against an unmatched
- retract)."""
- from jarvis.core.bus import EventBus
- from jarvis.core.events import WakeCandidateDetected
- from jarvis.speech.pipeline import PipelineState, SpeechPipeline
-
- bus = EventBus()
- received: list[WakeCandidateDetected] = []
-
- async def _collect(event: WakeCandidateDetected) -> None:
- received.append(event)
-
- bus.subscribe(WakeCandidateDetected, _collect)
-
- pipe = SpeechPipeline(
- tts=_FakeTTS(), bus=bus,
- enable_openwakeword=False, enable_whisper_wake=False,
- enable_local_whisper=False, config=None,
- )
- pipe._state = PipelineState.ACTIVE
-
- await pipe._on_vosk_wake_candidate(True) # noqa: SLF001
- await pipe._on_vosk_wake_candidate(False) # noqa: SLF001
-
- assert [e.active for e in received] == [False]
+ assert not hasattr(pipe._wake, "_on_candidate")
def test_set_wake_plan_vosk_arms_the_provider(vosk_model_dir) -> None:
diff --git a/tests/unit/speech/test_wake_prefix_gating.py b/tests/unit/speech/test_wake_prefix_gating.py
index b2645916bb..d72e7a2f3c 100644
--- a/tests/unit/speech/test_wake_prefix_gating.py
+++ b/tests/unit/speech/test_wake_prefix_gating.py
@@ -320,13 +320,14 @@ async def test_gate_custom_model_fails_closed_on_stt_outage(monkeypatch) -> None
# ---------------------------------------------------------------------------
-# Optimistic overlay reveal: suppressed for custom_onnx candidates.
+# Optimistic overlay reveal: only safe for precise pretrained candidates.
#
# The optimistic bar exists so a genuine "Hey Jarvis" feels instant on the
# precise pretrained model (false candidates are rare — a reject costs one
# brief flash). A custom model fires many times a minute, so the same
# optimism made the bar pop open/closed on auto-repeat (user GIF 2026-07-02).
-# For custom_onnx the bar appears only AFTER the verify confirms the wake.
+# Custom ONNX and Vosk grammar candidates can be noisy, so their bar appears
+# only AFTER verification confirms the full configured wake phrase.
# ---------------------------------------------------------------------------
@@ -354,18 +355,8 @@ def test_optimistic_candidate_hidden_when_not_idle() -> None:
assert pipe._should_show_optimistic_candidate() is False
-def test_optimistic_candidate_still_true_for_vosk_kws_when_idle() -> None:
- """Spawn-latency mission 2026-07-10: ``_should_show_optimistic_candidate``
- itself stays UNCHANGED for vosk_kws (still True) — the lock/not-activatable
- retract safety-net in ``_run_parallel_wake`` reads this SAME flag to decide
- whether to retract the EARLIER, provider-sourced candidate signal (see
- ``VoskKwsProvider.on_candidate`` / ``_on_vosk_wake_candidate``) if a
- confirmed vosk wake later gets discarded. Only the REDUNDANT duplicate
- "active=True" publish at the OWW-result site is skipped for this engine
- (that publish now runs too late to help — vosk's own confirm already
- completed by the time this OWW-result path even sees the result), not
- this gate itself.
- """
+def test_optimistic_candidate_hidden_for_vosk_kws_when_idle() -> None:
+ """Vosk stage-one grammar hits are unverified and frequently match speech."""
from jarvis.speech.pipeline import PipelineState
pipe = _bare_pipeline(
@@ -374,7 +365,7 @@ def test_optimistic_candidate_still_true_for_vosk_kws_when_idle() -> None:
wake_plan=SimpleNamespace(engine="vosk_kws", verify_prefix=False),
)
pipe._state = PipelineState.IDLE
- assert pipe._should_show_optimistic_candidate() is True
+ assert pipe._should_show_optimistic_candidate() is False
# ---------------------------------------------------------------------------