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(audio): address device-picker review findings

Ruben Lütke08575eb04da2
diff --git a/jarvis/audio/devices.py b/jarvis/audio/devices.py
index 8b0fb09cb5..053cb7422b 100644
--- a/jarvis/audio/devices.py
+++ b/jarvis/audio/devices.py
@@ -47,11 +47,15 @@ else:
# inside their resolvers, so there is no import cycle.)
from jarvis.audio.capture import (
_HOSTAPI_BLOCKLIST as _INPUT_FORBIDDEN_HOSTAPIS,
+)
+from jarvis.audio.capture import (
_HOSTAPI_PREFERENCE as _INPUT_HOSTAPI_PREFERENCE,
)
from jarvis.audio.device_select import is_legacy_primary_mapper
from jarvis.audio.player import (
_FORBIDDEN_OUTPUT_HOSTAPIS as _OUTPUT_FORBIDDEN_HOSTAPIS,
+)
+from jarvis.audio.player import (
_HOSTAPI_PREFERENCE as _OUTPUT_HOSTAPI_PREFERENCE,
)
diff --git a/tests/unit/audio/test_devices.py b/tests/unit/audio/test_devices.py
index 6d1c108ffe..80699b7871 100644
--- a/tests/unit/audio/test_devices.py
+++ b/tests/unit/audio/test_devices.py
@@ -115,6 +115,28 @@ def test_os_default_is_flagged_and_sorts_first(monkeypatch) -> None:
assert all(not d.is_default for d in out[1:])
+def test_short_generic_default_does_not_flag_prefix_extensions(monkeypatch) -> None:
+ """A default mic named just "Microphone" must NOT also flag the distinct
+ "Microphone Array (...)" device — only a >=30-char prefix relation can be
+ an MME-truncation twin of the same endpoint (review finding 2026-07-06)."""
+ hostapis = [{"name": "Windows WASAPI", "devices": [0, 1]}]
+ devices = [
+ {"name": "Microphone", "hostapi": 0,
+ "max_output_channels": 0, "max_input_channels": 1},
+ {"name": "Microphone Array (Realtek(R) Audio)", "hostapi": 0,
+ "max_output_channels": 0, "max_input_channels": 2},
+ ]
+ _patch_tables(monkeypatch, hostapis, devices, default=(0, -1))
+
+ entries = dv.list_devices(output=False)
+
+ flags = {e.name: e.is_default for e in entries}
+ assert flags == {
+ "Microphone": True,
+ "Microphone Array (Realtek(R) Audio)": False,
+ }
+
+
def test_list_devices_headless_returns_empty(monkeypatch) -> None:
def fail_query():
raise RuntimeError("portaudio unavailable")