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
feat(voice): wire WebRTC VAD fallback tier; honest capability model report
Joana Lütke96a929cc78f6
diff --git a/jarvis/audio/vad.py b/jarvis/audio/vad.pyindex 242dd64e44..f0a2e17b33 100644--- a/jarvis/audio/vad.py+++ b/jarvis/audio/vad.py@@ -1,9 +1,17 @@-"""Voice Activity Detection via Silero-VAD.+"""Voice Activity Detection via Silero-VAD with a three-tier fallback chain.Silero-VAD is a ~2 MB PyTorch model that operates on 16 kHz audio frames ofexactly 512 samples (32 ms) and delivers a speech probability (0.0-1.0) perframe. Significantly more precise than WebRTC-VAD in noisy/music environments.+The per-frame speech score degrades through three tiers so voice capture never+bricks on a platform without a working native runtime:++ 1. Silero ONNX (bundled model on base CPU onnxruntime) — the default.+ 2. WebRTC VAD (``webrtcvad``, ships in ``[local-voice]``/``[full]``) when+ the ONNX runtime cannot load or execute.+ 3. Portable RMS energy endpointing when neither engine is available.+Used in "endpointing" mode: once a silence phase of `silence_ms` duration isdetected after active speech, the utterance is considered complete and thepipeline sends the audio to Whisper.@@ -29,6 +37,13 @@ from jarvis.core.protocols import AudioChunkVAD_SAMPLE_RATE = 16_000VAD_FRAME_SAMPLES = 512 # fixed requirement from Silero+# WebRTC VAD middle tier: aggressiveness 0 (permissive) .. 3 (strict). 2 keeps+# recall high enough for endpointing while filtering steady ambient noise.+_WEBRTC_AGGRESSIVENESS = 2+# webrtcvad accepts only 10/20/30 ms frames at 16 kHz; 480 samples (30 ms) is+# the largest slice that fits inside every 512-sample Silero frame.+_WEBRTC_FRAME_SAMPLES = 480+# Upper bound on the adaptive patience grant, expressed as a multiple of the# user-configured base silence window. A long dictation / delegation widens the# silence window so a thinking pause is not cut, but the grant must never stretch@@ -98,12 +113,15 @@ class SileroEndpointer:self._cancel_hysteresis_frames = max(1, cancel_hysteresis_ms // 32)# Torch-free Silero VAD: when ONNX Runtime is available, the bundled# model runs on its CPU provider with numpy-managed recurrent state.- # Platforms without a compatible ONNX Runtime wheel keep working via- # portable RMS-based endpointing instead of losing the whole voice- # path. Lazy: the preferred model is created on first use.+ # Platforms without a compatible ONNX Runtime wheel degrade through a+ # three-tier chain instead of losing the whole voice path: WebRTC VAD+ # (when the [local-voice]/[full] extra ships it), then portable+ # RMS-based energy endpointing as the floor. Lazy: the preferred+ # engine is created on first use.self._session = Noneself._vad_state = None # np.ndarray [2,1,128] float32, carried per frameself._vad_context = None # np.ndarray [1,64] float32, carried per frame+ self._webrtc = None # webrtcvad.Vad instance for the middle tierself._energy_only = Falseself._min_speech_rms = min_speech_rms@@ -194,7 +212,11 @@ class SileroEndpointer:return self._silence_frames + self._extra_silence_framesdef _ensure_model(self) -> None:- if self._session is not None or getattr(self, "_energy_only", False):+ if (+ self._session is not None+ or getattr(self, "_webrtc", None) is not None+ or getattr(self, "_energy_only", False)+ ):returntry:import os@@ -233,17 +255,36 @@ class SileroEndpointer:self._vad_state = np.zeros((2, 1, 128), dtype=np.float32)self._vad_context = np.zeros((1, 64), dtype=np.float32)except Exception as exc:+ self._enable_degraded_fallback(exc)++ def _enable_degraded_fallback(self, exc: Exception) -> None:+ """Drop from Silero to the best remaining tier (WebRTC, then energy)."""+ self._session = None+ self._vad_state = None+ self._vad_context = None+ try:+ import webrtcvad++ self._webrtc = webrtcvad.Vad(_WEBRTC_AGGRESSIVENESS)+ log.warning(+ "Silero ONNX VAD is unavailable; using WebRTC VAD endpointing "+ "for this session (%s: %s)",+ type(exc).__name__,+ exc,+ )+ except Exception:self._enable_energy_fallback(exc)def _enable_energy_fallback(self, exc: Exception) -> None:- """Keep endpointing available when the optional native engine fails."""+ """Keep endpointing available when every optional native engine fails."""self._session = Noneself._vad_state = Noneself._vad_context = None+ self._webrtc = Noneself._energy_only = Truelog.warning(- "Silero ONNX VAD is unavailable; using portable CPU energy "- "endpointing for this session (%s: %s)",+ "Silero ONNX VAD and WebRTC VAD are unavailable; using portable "+ "CPU energy endpointing for this session (%s: %s)",type(exc).__name__,exc,)@@ -254,16 +295,29 @@ class SileroEndpointer:minimum = float(getattr(self, "_min_speech_rms", 0.002))return 1.0 if rms >= minimum else 0.0+ def _webrtc_prob(self, frame: np.ndarray) -> float:+ """Binary speech score from the WebRTC VAD middle tier."""+ try:+ samples = np.asarray(frame, dtype=np.float32).reshape(-1)+ buf = _float32_to_int16_bytes(samples[:_WEBRTC_FRAME_SAMPLES])+ return 1.0 if self._webrtc.is_speech(buf, VAD_SAMPLE_RATE) else 0.0+ except Exception as exc:+ self._enable_energy_fallback(exc)+ return self._energy_prob(frame)+def _prob(self, frame: np.ndarray) -> float:"""Per-frame speech probability (must be exactly 512 float32 samples).Prefer the bundled Silero ONNX model on the CPU. If its optional native- runtime cannot load or execute on this platform, fall back to a portable- RMS score. The surrounding state machine still supplies relative-noise- calibration, hysteresis, silence timing, and the maximum-duration cap.+ runtime cannot load or execute on this platform, fall back to WebRTC+ VAD when available, and finally to a portable RMS score. The+ surrounding state machine still supplies relative-noise calibration,+ hysteresis, silence timing, and the maximum-duration cap."""self._ensure_model()x = np.ascontiguousarray(frame, dtype=np.float32).reshape(1, -1) # [1,512]+ if getattr(self, "_webrtc", None) is not None:+ return self._webrtc_prob(x)if getattr(self, "_energy_only", False):return self._energy_prob(x)assert self._session is not None@@ -281,7 +335,9 @@ class SileroEndpointer:self._vad_context = x_full[:, -64:]return float(np.asarray(out).reshape(-1)[0])except Exception as exc:- self._enable_energy_fallback(exc)+ self._enable_degraded_fallback(exc)+ if getattr(self, "_webrtc", None) is not None:+ return self._webrtc_prob(x)return self._energy_prob(x)async def utterances(diff --git a/jarvis/setup/model_report.py b/jarvis/setup/model_report.pyindex e9844da75f..3bf524db8a 100644--- a/jarvis/setup/model_report.py+++ b/jarvis/setup/model_report.py@@ -83,6 +83,24 @@ def _faster_whisper_available() -> bool:return importlib.util.find_spec("faster_whisper") is not None+def _neural_wake_runtime_available() -> bool:+ """True when the neural wake path (openWakeWord on onnxruntime) can run here."""+ return (+ importlib.util.find_spec("onnxruntime") is not None+ and importlib.util.find_spec("openwakeword") is not None+ )+++def _silero_runtime_available() -> bool:+ """True when onnxruntime is importable, i.e. the Silero VAD model can run here."""+ return importlib.util.find_spec("onnxruntime") is not None+++def _webrtc_vad_available() -> bool:+ """True when the webrtcvad fallback tier is importable."""+ return importlib.util.find_spec("webrtcvad") is not None++def _whisper_cached(name: str) -> bool:"""True when faster-whisper model ``name`` is already in the local HF cache.@@ -131,30 +149,44 @@ def voice_model_report(cfg: Any | None = None, *, data_dir: str | None = None) -items: list[ModelStatus] = []# 1. Neural wake-word backbone — bundled in-repo, core path.+ # Decision matrix: a required item FAILS only when the platform COULD run+ # the neural path but the asset file is missing (partial download); a+ # platform that cannot run it degrades to the vosk_kws tier — an honest+ # PASS, never an install failure.wake_ok = bool(_safe(_wake_backbone_present, False))- items.append(- ModelStatus(- "wake word (neural)",- wake_ok,+ wake_runtime = bool(_safe(_neural_wake_runtime_available, False))+ if wake_runtime:+ wake_present = wake_ok+ wake_detail = ("bundled with the app"if wake_ok- else "MISSING from the package - partial download? re-run the installer",- required=True,+ else "MISSING from the package - partial download? re-run the installer")- )+ else:+ wake_present = True+ wake_detail = "vosk_kws keyword spotting (neural wake runtime unavailable on this platform)"+ items.append(ModelStatus("wake word (neural)", wake_present, wake_detail, required=True))# 2. End-of-speech detection (Silero VAD) — bundled in-repo, core path.+ # Same matrix: without onnxruntime the runtime falls back to WebRTC VAD or+ # the portable energy endpointer (jarvis/audio/vad.py tiers) — a PASS.vad_ok = bool(_safe(_vad_present, False))- items.append(- ModelStatus(- "end-of-speech detection",- vad_ok,+ silero_runtime = bool(_safe(_silero_runtime_available, False))+ if silero_runtime:+ vad_present = vad_ok+ vad_detail = ("bundled with the app"if vad_ok- else "MISSING from the package - partial download? re-run the installer",- required=True,+ else "MISSING from the package - partial download? re-run the installer")- )+ else:+ vad_present = True+ vad_detail = (+ "WebRTC VAD (neural runtime unavailable on this platform)"+ if bool(_safe(_webrtc_vad_available, False))+ else "portable energy endpointing (neural runtime unavailable on this platform)"+ )+ items.append(ModelStatus("end-of-speech detection", vad_present, vad_detail, required=True))# 3. Custom-wake model (Vosk, per language) — downloaded once, optional.lang = _safe(lambda: _wake_language(cfg), None) if cfg is not None else Nonediff --git a/tests/unit/audio/test_vad_bundled_model.py b/tests/unit/audio/test_vad_bundled_model.pyindex 2a85d1a45c..c7a3ca3650 100644--- a/tests/unit/audio/test_vad_bundled_model.py+++ b/tests/unit/audio/test_vad_bundled_model.py@@ -161,8 +161,14 @@ def test_ensure_model_loads_from_bundle_without_the_package(monkeypatch) -> Nonedef test_missing_onnxruntime_uses_portable_energy_endpointing(monkeypatch) -> None:- """An unsupported native runtime must not disable voice capture."""+ """An unsupported native runtime must not disable voice capture.++ ``webrtcvad`` is blocked too: the middle tier ships in ``[local-voice]`` /+ ``[full]``, so whether it is importable here is environment-dependent, and+ this test pins the bare-base energy floor.+ """monkeypatch.setitem(sys.modules, "onnxruntime", None)+ monkeypatch.setitem(sys.modules, "webrtcvad", None)ep = SileroEndpointer(min_speech_rms=0.002)ep._ensure_model()@@ -173,8 +179,13 @@ def test_missing_onnxruntime_uses_portable_energy_endpointing(monkeypatch) -> Noassert ep._prob(np.full(512, 0.01, dtype=np.float32)) == 1.0-def test_failed_native_inference_switches_to_energy_endpointing() -> None:- """A runtime that loads but fails later must degrade in the same turn."""+def test_failed_native_inference_switches_to_energy_endpointing(monkeypatch) -> None:+ """A runtime that loads but fails later must degrade in the same turn.++ ``webrtcvad`` is blocked so the degrade chain lands on the energy floor+ regardless of whether the optional middle tier is installed here.+ """+ monkeypatch.setitem(sys.modules, "webrtcvad", None)class _BrokenSession:def run(self, *_args, **_kwargs):@@ -194,6 +205,7 @@ def test_failed_native_inference_switches_to_energy_endpointing() -> None:async def test_energy_fallback_captures_and_ends_an_utterance(monkeypatch) -> None:"""The fallback must drive the complete endpoint state machine."""monkeypatch.setitem(sys.modules, "onnxruntime", None)+ monkeypatch.setitem(sys.modules, "webrtcvad", None)ep = SileroEndpointer(silence_ms=96,min_speech_ms=64,diff --git a/tests/unit/audio/test_vad_webrtc_fallback.py b/tests/unit/audio/test_vad_webrtc_fallback.pynew file mode 100644index 0000000000..2f6346870b--- /dev/null+++ b/tests/unit/audio/test_vad_webrtc_fallback.py@@ -0,0 +1,192 @@+"""WebRTC VAD is the middle tier of the endpointing fallback chain.++End-of-speech detection degrades Silero ONNX -> WebRTC VAD -> energy floor+(``jarvis/audio/vad.py``). These tests pin the middle tier: when the ONNX+runtime is unavailable but ``webrtcvad`` (ships in ``[local-voice]``/``[full]``)+is importable, the endpointer must use it instead of dropping straight to the+portable energy floor — and every degrade step must happen mid-run without an+exception ever escaping the frame loop (a frozen voice loop is the bug class+this guards against).++``webrtcvad`` is always FAKED here: whether the real wheel is installed is+environment-dependent, and the fake also records the exact buffers handed to+the engine (webrtcvad accepts only 10/20/30 ms int16 frames at the given rate,+so a wrong slice would raise inside the C extension at runtime only).+"""+from __future__ import annotations++import sys+from types import ModuleType++import numpy as np+import pytest++from jarvis.audio.vad import (+ _WEBRTC_AGGRESSIVENESS,+ _WEBRTC_FRAME_SAMPLES,+ SileroEndpointer,+)+from jarvis.core.protocols import AudioChunk++_EXPECTED_BUF_BYTES = _WEBRTC_FRAME_SAMPLES * 2 # int16 mono -> 960 bytes+++def _make_fake_webrtcvad(is_speech=None) -> ModuleType:+ """Build a fake ``webrtcvad`` module recording ctor args and calls.++ ``is_speech`` is an optional ``(buf, rate) -> bool`` behavior; it may also+ raise to script an engine failure. Defaults to always-speech.+ """+ module = ModuleType("webrtcvad")+ module.ctor_args = []+ module.calls = []++ class Vad:+ def __init__(self, aggressiveness) -> None:+ module.ctor_args.append(aggressiveness)++ def is_speech(self, buf, sample_rate):+ module.calls.append((buf, sample_rate))+ if is_speech is None:+ return True+ return is_speech(buf, sample_rate)++ module.Vad = Vad+ return module+++def _buf_has_energy(buf: bytes, _rate: int) -> bool:+ """Energy-shaped fake verdict: any non-silent int16 sample counts."""+ return bool(np.any(np.frombuffer(buf, dtype=np.int16)))+++def test_missing_onnxruntime_selects_webrtc_tier(monkeypatch) -> None:+ """With ONNX blocked and webrtcvad importable, the middle tier wins."""+ fake = _make_fake_webrtcvad()+ monkeypatch.setitem(sys.modules, "onnxruntime", None)+ monkeypatch.setitem(sys.modules, "webrtcvad", fake)++ ep = SileroEndpointer(min_speech_rms=0.002)+ ep._ensure_model()++ assert ep._session is None+ assert ep._webrtc is not None+ assert ep._energy_only is False+ assert fake.ctor_args == [_WEBRTC_AGGRESSIVENESS]+++def test_webrtc_receives_exact_frame_and_rate(monkeypatch) -> None:+ """Every buffer must be exactly 960 bytes (30 ms int16) at 16 kHz.++ webrtcvad only accepts 10/20/30 ms frames; a full 512-sample Silero frame+ (1024 bytes) would raise inside the engine on every single frame.+ """+ fake = _make_fake_webrtcvad(is_speech=_buf_has_energy)+ monkeypatch.setitem(sys.modules, "onnxruntime", None)+ monkeypatch.setitem(sys.modules, "webrtcvad", fake)++ ep = SileroEndpointer(min_speech_rms=0.002)+ assert ep._prob(np.full(512, 0.01, dtype=np.float32)) == 1.0+ assert ep._prob(np.zeros(512, dtype=np.float32)) == 0.0++ assert len(fake.calls) == 2+ for buf, rate in fake.calls:+ assert len(buf) == _EXPECTED_BUF_BYTES+ assert rate == 16_000+++def test_both_engines_blocked_uses_energy_floor(monkeypatch) -> None:+ """Neither ONNX nor webrtcvad importable -> portable energy endpointing."""+ monkeypatch.setitem(sys.modules, "onnxruntime", None)+ monkeypatch.setitem(sys.modules, "webrtcvad", None)++ ep = SileroEndpointer(min_speech_rms=0.002)+ ep._ensure_model()++ assert ep._session is None+ assert ep._webrtc is None+ assert ep._energy_only is True+ assert ep._prob(np.full(512, 0.01, dtype=np.float32)) == 1.0+++def test_midrun_silero_failure_degrades_to_webrtc_same_frame(monkeypatch) -> None:+ """A Silero session that dies mid-run re-dispatches the CURRENT frame."""+ fake = _make_fake_webrtcvad()+ monkeypatch.setitem(sys.modules, "webrtcvad", fake)++ class _BrokenSession:+ def run(self, *_args, **_kwargs):+ raise RuntimeError("unsupported execution provider")++ ep = SileroEndpointer(min_speech_rms=0.002)+ ep._session = _BrokenSession()+ ep._vad_state = np.zeros((2, 1, 128), dtype=np.float32)+ ep._vad_context = np.zeros((1, 64), dtype=np.float32)++ assert ep._prob(np.full(512, 0.01, dtype=np.float32)) == 1.0+ assert ep._session is None+ assert ep._webrtc is not None+ assert ep._energy_only is False+ assert len(fake.calls) == 1++ # The next frame goes straight through the new tier.+ assert ep._prob(np.full(512, 0.01, dtype=np.float32)) == 1.0+ assert len(fake.calls) == 2+++def test_midrun_webrtc_failure_degrades_to_energy(monkeypatch) -> None:+ """A webrtcvad engine that raises drops to energy; nothing escapes."""++ def _boom(_buf, _rate):+ raise RuntimeError("corrupt frame")++ fake = _make_fake_webrtcvad(is_speech=_boom)+ monkeypatch.setitem(sys.modules, "onnxruntime", None)+ monkeypatch.setitem(sys.modules, "webrtcvad", fake)++ ep = SileroEndpointer(min_speech_rms=0.002)+ ep._ensure_model()+ assert ep._webrtc is not None++ # The failing frame still yields a verdict via the energy floor.+ assert ep._prob(np.full(512, 0.01, dtype=np.float32)) == 1.0+ assert ep._webrtc is None+ assert ep._energy_only is True+ assert ep._prob(np.zeros(512, dtype=np.float32)) == 0.0+++async def test_webrtc_fallback_captures_and_ends_an_utterance(monkeypatch) -> None:+ """The middle tier must drive the complete endpoint state machine."""+ fake = _make_fake_webrtcvad(is_speech=_buf_has_energy)+ monkeypatch.setitem(sys.modules, "onnxruntime", None)+ monkeypatch.setitem(sys.modules, "webrtcvad", fake)+ ep = SileroEndpointer(+ silence_ms=96,+ min_speech_ms=64,+ min_speech_rms=0.002,+ )++ loud = (np.full(512, 0.02) * 32767.0).astype(np.int16).tobytes()+ quiet = np.zeros(512, dtype=np.int16).tobytes()++ async def chunks():+ for index, pcm in enumerate([loud] * 4 + [quiet] * 4):+ yield AudioChunk(+ pcm=pcm,+ sample_rate=16_000,+ timestamp_ns=index,+ channels=1,+ )++ utterances = [utterance async for utterance in ep.utterances(chunks())]++ assert len(utterances) == 1+ assert utterances[0]+ assert ep._webrtc is not None+ assert ep._energy_only is False+ assert fake.calls, "the WebRTC engine must have scored the frames"+ assert all(+ len(buf) == _EXPECTED_BUF_BYTES and rate == 16_000+ for buf, rate in fake.calls+ )diff --git a/tests/unit/setup/test_model_report.py b/tests/unit/setup/test_model_report.pyindex 3a73fd7817..a87568820f 100644--- a/tests/unit/setup/test_model_report.py+++ b/tests/unit/setup/test_model_report.py@@ -18,9 +18,20 @@ class _Cfg:stt = _Stt()-def _patch_bundled(monkeypatch, *, wake: bool = True, vad: bool = True) -> None:+def _patch_bundled(+ monkeypatch,+ *,+ wake: bool = True,+ vad: bool = True,+ wake_runtime: bool = True,+ silero_runtime: bool = True,+ webrtc: bool = True,+) -> None:monkeypatch.setattr(mr, "_wake_backbone_present", lambda: wake)monkeypatch.setattr(mr, "_vad_present", lambda: vad)+ monkeypatch.setattr(mr, "_neural_wake_runtime_available", lambda: wake_runtime)+ monkeypatch.setattr(mr, "_silero_runtime_available", lambda: silero_runtime)+ monkeypatch.setattr(mr, "_webrtc_vad_available", lambda: webrtc)monkeypatch.setattr(mr, "_wake_language", lambda _cfg: "de")@@ -107,9 +118,8 @@ def test_probe_failure_reads_as_absent_never_raises(monkeypatch) -> None:def _boom() -> bool:raise RuntimeError("probe exploded")+ _patch_bundled(monkeypatch)monkeypatch.setattr(mr, "_wake_backbone_present", _boom)- monkeypatch.setattr(mr, "_vad_present", lambda: True)- monkeypatch.setattr(mr, "_wake_language", lambda _cfg: "de")monkeypatch.setattr(mr, "_vosk_present", lambda *_a, **_kw: True)monkeypatch.setattr(mr, "_faster_whisper_available", lambda: False)@@ -117,3 +127,81 @@ def test_probe_failure_reads_as_absent_never_raises(monkeypatch) -> None:wake = next(i for i in items if "wake word" in i.label)assert wake.present is False+++def test_intel_mac_degrade_is_complete_with_honest_details(monkeypatch) -> None:+ # Assets shipped but no neural runtimes (e.g. Intel Mac): the install is+ # COMPLETE — wake degrades to vosk_kws, VAD degrades to WebRTC VAD.+ _patch_bundled(monkeypatch, wake_runtime=False, silero_runtime=False, webrtc=True)+ monkeypatch.setattr(mr, "_vosk_present", lambda *_a, **_kw: True)+ monkeypatch.setattr(mr, "_faster_whisper_available", lambda: False)++ items = mr.voice_model_report(_Cfg())++ assert mr.report_complete(items) is True+ wake = next(i for i in items if "wake word" in i.label)+ vad = next(i for i in items if "end-of-speech" in i.label)+ assert wake.present is True and "vosk_kws" in wake.detail+ assert vad.present is True and "WebRTC VAD" in vad.detail+ text = "\n".join(mr.format_report(items))+ assert "✗" not in text # degraded tiers render check-marks, never crosses+++def test_no_neural_runtime_and_no_webrtc_degrades_to_energy(monkeypatch) -> None:+ _patch_bundled(monkeypatch, silero_runtime=False, webrtc=False)+ monkeypatch.setattr(mr, "_vosk_present", lambda *_a, **_kw: True)+ monkeypatch.setattr(mr, "_faster_whisper_available", lambda: False)++ items = mr.voice_model_report(_Cfg())++ vad = next(i for i in items if "end-of-speech" in i.label)+ assert vad.present is True and "energy" in vad.detail+ assert mr.report_complete(items) is True+++def test_asset_missing_with_runtime_available_stays_incomplete(monkeypatch) -> None:+ # Regression: a runnable platform with a dropped asset is a REAL failure.+ _patch_bundled(monkeypatch, wake=False, vad=False)+ monkeypatch.setattr(mr, "_vosk_present", lambda *_a, **_kw: True)+ monkeypatch.setattr(mr, "_faster_whisper_available", lambda: False)++ items = mr.voice_model_report(_Cfg())++ assert mr.report_complete(items) is False+ wake = next(i for i in items if "wake word" in i.label)+ vad = next(i for i in items if "end-of-speech" in i.label)+ assert wake.present is False and "MISSING" in wake.detail+ assert vad.present is False and "MISSING" in vad.detail+++def test_asset_missing_without_runtime_is_platform_degrade_not_failure(monkeypatch) -> None:+ # No runtime means the asset is unusable anyway — the degrade tier carries+ # the voice path, so the install must NOT read incomplete.+ _patch_bundled(monkeypatch, wake=False, vad=False, wake_runtime=False, silero_runtime=False)+ monkeypatch.setattr(mr, "_vosk_present", lambda *_a, **_kw: True)+ monkeypatch.setattr(mr, "_faster_whisper_available", lambda: False)++ items = mr.voice_model_report(_Cfg())++ assert mr.report_complete(items) is True+++def test_runtime_probe_failure_reads_as_degraded_never_raises(monkeypatch) -> None:+ # A crashing runtime probe reads as "runtime unavailable" -> honest degrade.+ def _boom() -> bool:+ raise RuntimeError("probe exploded")++ _patch_bundled(monkeypatch)+ monkeypatch.setattr(mr, "_neural_wake_runtime_available", _boom)+ monkeypatch.setattr(mr, "_silero_runtime_available", _boom)+ monkeypatch.setattr(mr, "_webrtc_vad_available", _boom)+ monkeypatch.setattr(mr, "_vosk_present", lambda *_a, **_kw: True)+ monkeypatch.setattr(mr, "_faster_whisper_available", lambda: False)++ items = mr.voice_model_report(_Cfg()) # must not raise++ wake = next(i for i in items if "wake word" in i.label)+ vad = next(i for i in items if "end-of-speech" in i.label)+ assert wake.present is True and "vosk_kws" in wake.detail+ assert vad.present is True and "energy" in vad.detail # webrtc probe crashed too+ assert mr.report_complete(items) is True