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: add defensive guard to wake-word mic-level route + honest test
Ruben Lütkebcede116a486
diff --git a/jarvis/ui/web/settings_routes.py b/jarvis/ui/web/settings_routes.pyindex 4e88c7a0f3..6519212403 100644--- a/jarvis/ui/web/settings_routes.py+++ b/jarvis/ui/web/settings_routes.py@@ -703,7 +703,10 @@ async def wake_mic_level() -> dict[str, object]:"""from jarvis.speech.diagnose import measure_mic_dbfs- max_dbfs = await measure_mic_dbfs(duration_s=3.0)+ try:+ max_dbfs = await measure_mic_dbfs(duration_s=3.0)+ except Exception: # noqa: BLE001 — defensive guard: if measurement fails, treat as no device+ max_dbfs = -120.0return {"max_dbfs": max_dbfs,"no_device": max_dbfs <= -119.9,diff --git a/tests/unit/web/test_mic_level_route.py b/tests/unit/web/test_mic_level_route.pyindex 26ae5ab58b..b798cda59a 100644--- a/tests/unit/web/test_mic_level_route.py+++ b/tests/unit/web/test_mic_level_route.py@@ -69,12 +69,11 @@ def test_mic_level_reports_good_level(monkeypatch):def test_mic_level_never_500s_on_helper_error(monkeypatch):"""Even if the underlying measurement blows up, the route stays honest --- though measure_mic_dbfs itself never raises, this guards the route- contract independently in case that invariant is ever broken upstream."""+ the route's defensive guard catches any exception and treats it as no device."""import jarvis.speech.diagnose as dasync def fake_measure(duration_s=3.0):- return -120.0 # the real helper's own honest floor on any error+ raise RuntimeError("mic measurement failed")monkeypatch.setattr(d, "measure_mic_dbfs", fake_measure)app = FastAPI()@@ -83,3 +82,6 @@ def test_mic_level_never_500s_on_helper_error(monkeypatch):r = client.get("/api/settings/wake-word/mic-level")assert r.status_code == 200+ b = r.json()+ assert b["no_device"] is True+ assert b["too_quiet"] is False