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(local-realtime): stop pinning transcription to the CPU on every machine

rubenluetke10-beep86db68848059
diff --git a/jarvis/realtime/local_server/install.py b/jarvis/realtime/local_server/install.py
index 6ed50cfeed..6488caf5ae 100644
--- a/jarvis/realtime/local_server/install.py
+++ b/jarvis/realtime/local_server/install.py
@@ -357,7 +357,9 @@ def derive_launch_command(brain: BrainResolution, *, memory_source: str) -> str:
Derived, never hand-authored: flags follow the probed hardware and the
resolved brain. The TTS device maps NVIDIA → cuda and Apple unified
- memory → mps; a machine with neither never passes preflight.
+ memory → mps; a machine with neither never passes preflight. The STT
+ device is left at the handler's own ``auto``, which resolves the same
+ way — pinning it cost 8.5 s per sentence on a box whose GPU was idle.
Secrets never enter the command (they would land in jarvis.toml): the
Ollama path uses the literal placeholder token Ollama expects, and the
@@ -374,7 +376,17 @@ def derive_launch_command(brain: BrainResolution, *, memory_source: str) -> str:
"--qwen3_tts_dtype bfloat16",
"--qwen3_tts_backend torch",
"--qwen3_tts_speaker Aiden",
- "--parakeet_tdt_device cpu",
+ # "auto", not "cpu": the handler already resolves MPS on Apple Silicon,
+ # CUDA on an NVIDIA box and CPU where there is neither, so this follows
+ # the machine instead of pinning every user to the slowest option.
+ # Live 2026-08-27 on an RTX 5070 Ti, transcribing a 2.7 s sentence on
+ # the CPU took 8.46 s and held the pipeline's compute lock for all of
+ # it, while the GPU sat at 13 % — the single largest item in a turn
+ # that is supposed to feel live. Earlier the same stack answered in
+ # 0.6-1.2 s, so the CPU path is not even reliably slow, it is
+ # unpredictable. A machine with no accelerator still lands on CPU,
+ # which is the honest floor there.
+ "--parakeet_tdt_device auto",
# Jarvis consumes only final input transcripts. Progressive Parakeet
# passes therefore contend with the final pass without improving the
# product surface. A short acoustic silence gate removes breath-sized
diff --git a/jarvis/realtime/local_server/supervisor.py b/jarvis/realtime/local_server/supervisor.py
index fb714c8252..9a0ffa70fc 100644
--- a/jarvis/realtime/local_server/supervisor.py
+++ b/jarvis/realtime/local_server/supervisor.py
@@ -1012,6 +1012,10 @@ _SMART_TURN_INCOMPLETE_DELAY_FLAG = re.compile(
r"(?:\s+|=)(?:\"[^\"]*\"|'[^']*'|\S+)",
re.IGNORECASE,
)
+_PARAKEET_DEVICE_FLAG = re.compile(
+ r"(?<!\S)--parakeet(?:_|-)tdt(?:_|-)device(?:\s+|=)(?:\"[^\"]*\"|'[^']*'|\S+)",
+ re.IGNORECASE,
+)
_UNANSWERED_REOPEN_FLAG = re.compile(
r"(?<!\S)--unanswered(?:_|-)reopen(?:_|-)ms(?:\s+|=)"
r"(?:\"[^\"]*\"|'[^']*'|\S+)",
@@ -1128,6 +1132,31 @@ def _force_stable_turn_detection(command: str) -> str:
return f"{without_live_transcription} --no_enable_live_transcription"
+def _needs_gpu_stt_migration(command: str) -> bool:
+ """Whether this command still pins transcription to the CPU.
+
+ Installs written before 2026-08-27 carry ``--parakeet_tdt_device cpu``,
+ which Jarvis hardcoded while the handler's own default already resolved
+ the right device per platform. On an idle RTX 5070 Ti that pin cost 8.46 s
+ to transcribe a 2.7 s sentence — held under the pipeline's compute lock,
+ so it was the whole turn's floor — against 0.6-1.2 s previously observed.
+ """
+ return (_cli_flag_value(command, "--parakeet_tdt_device") or "").lower() == "cpu"
+
+
+def _force_hardware_stt_device(command: str) -> str:
+ """Hand transcription back to the handler's own device resolution.
+
+ ``auto`` is MPS on Apple Silicon, CUDA on an NVIDIA box and CPU where
+ there is neither — so a machine without an accelerator keeps exactly the
+ behaviour it has today, and every other machine stops paying for a device
+ it does not have to use.
+ """
+ if not _needs_gpu_stt_migration(command):
+ return command
+ return _replace_cli_flag(command, _PARAKEET_DEVICE_FLAG, "--parakeet_tdt_device auto")
+
+
def _uses_loopback_bind(command: str) -> bool:
"""Whether the effective managed-server bind is explicitly loopback-only."""
try:
@@ -1189,6 +1218,7 @@ def ensure_running(
command = _force_loopback_bind(command)
command = _force_low_latency_ollama_backend(command)
command = _force_stable_turn_detection(command)
+ command = _force_hardware_stt_device(command)
try:
from jarvis.realtime.local_server import install # lazy (AP-26)
@@ -1210,7 +1240,10 @@ def ensure_running(
unstable_turn_detection = bool(
owned_command and _needs_stable_turn_detection_migration(owned_command)
)
- latency_migration = slow_ollama_backend or unstable_turn_detection
+ cpu_pinned_stt = bool(owned_command and _needs_gpu_stt_migration(owned_command))
+ latency_migration = (
+ slow_ollama_backend or unstable_turn_detection or cpu_pinned_stt
+ )
if (
latency_migration
and not unsafe_bind
@@ -1413,6 +1446,7 @@ def replace_idle_managed_runtime(
command = _force_loopback_bind(command)
command = _force_low_latency_ollama_backend(command)
command = _force_stable_turn_detection(command)
+ command = _force_hardware_stt_device(command)
try:
command = prepare_voice_brain_command(command)
except RuntimeError as exc:
diff --git a/tests/unit/realtime/local_server/test_supervisor.py b/tests/unit/realtime/local_server/test_supervisor.py
index 31731b97de..2487329ca7 100644
--- a/tests/unit/realtime/local_server/test_supervisor.py
+++ b/tests/unit/realtime/local_server/test_supervisor.py
@@ -1766,6 +1766,74 @@ def test_a_command_without_a_brain_declares_no_budget() -> None:
assert supervisor.voice_brain_declaration_budget_tokens("serve --mode realtime") == 0
+def test_a_cpu_pinned_transcriber_is_handed_back_to_the_machine() -> None:
+ """Live 2026-08-27: transcribing a 2.7 s sentence on the CPU took 8.46 s
+ and held the pipeline's compute lock for all of it, while the GPU idled at
+ 13 %. The handler resolves its own device per platform; Jarvis pinned it."""
+ command = (
+ '"s.exe" --mode realtime --parakeet_tdt_device cpu --num_pipelines 1'
+ )
+ assert supervisor._needs_gpu_stt_migration(command) is True
+ migrated = supervisor._force_hardware_stt_device(command)
+ assert "--parakeet_tdt_device auto" in migrated
+ assert "--parakeet_tdt_device cpu" not in migrated
+ # Everything else about the command is left exactly as it was.
+ assert "--num_pipelines 1" in migrated and "--mode realtime" in migrated
+
+
+def test_a_transcriber_already_following_the_machine_is_left_alone() -> None:
+ for device in ("auto", "cuda", "mps"):
+ command = f'"s.exe" --mode realtime --parakeet_tdt_device {device}'
+ assert supervisor._needs_gpu_stt_migration(command) is False
+ assert supervisor._force_hardware_stt_device(command) == command
+
+
+def test_the_stt_device_reaches_popen_on_the_spawn_path(monkeypatch, tmp_path) -> None:
+ """A migration nobody applies is not a fix — prove it reaches the child."""
+ from jarvis.realtime.local_server import install
+
+ supervisor._reset_for_tests()
+ monkeypatch.setenv("JARVIS_DATA_DIR", str(tmp_path))
+ entrypoint = install.install_root() / "venv" / "server.exe"
+ command = (
+ f'"{entrypoint}" --mode realtime --ws_host 127.0.0.1 '
+ "--parakeet_tdt_device cpu --model_name qwen3.5:4b"
+ )
+ monkeypatch.setattr(supervisor, "probe_runtime", lambda *a, **k: None)
+ monkeypatch.setattr(supervisor, "_port_open", lambda *a, **k: False)
+ monkeypatch.setattr(supervisor, "_owned_process", lambda: (None, False))
+ monkeypatch.setattr(supervisor, "_kill_by_install_root", lambda root: (0, 0))
+ monkeypatch.setattr(supervisor, "prepare_voice_brain_command", lambda c: c)
+ monkeypatch.setattr(supervisor, "anchor_brain_load", lambda **k: True)
+ monkeypatch.setattr(supervisor, "_write_pidfile", lambda *args: True)
+ spawned: list[str] = []
+ monkeypatch.setattr(
+ supervisor, "_spawn", lambda c, **k: spawned.append(c) or 7331
+ )
+
+ assert (
+ supervisor.ensure_running(
+ launch_command=command, base_url="http://127.0.0.1:8765", reason="test"
+ )
+ == "spawned"
+ )
+ assert "--parakeet_tdt_device auto" in spawned[0]
+
+
+def test_a_fresh_install_never_pins_the_transcriber_to_the_cpu() -> None:
+ """The command the installer writes must be right from the start, not only
+ after a migration — a new user gets no migration."""
+ from jarvis.realtime.local_server import install
+ from jarvis.realtime.local_server.brain_link import BrainResolution
+
+ command = install.derive_launch_command(
+ BrainResolution(kind="ollama", model="qwen3.5:4b", base_url="http://127.0.0.1:11434/v1"),
+ memory_source="nvidia-smi",
+ )
+ assert "--parakeet_tdt_device auto" in command
+ assert "--parakeet_tdt_device cpu" not in command
+
+
def test_anchor_brain_load_outlives_the_caller(monkeypatch) -> None:
"""Ollama drops a model load the moment its LAST client hangs up, so the
request that carries a cold load must not be one the spawn path waits on