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(stt): coerce CPU device to a CPU-safe compute type at construction
Ruben Lütke2b46590a40be
diff --git a/jarvis/plugins/stt/fwhisper.py b/jarvis/plugins/stt/fwhisper.pyindex 5fa5ff9eee..aa4ccd9a5d 100644--- a/jarvis/plugins/stt/fwhisper.py+++ b/jarvis/plugins/stt/fwhisper.py@@ -268,6 +268,22 @@ class FasterWhisperProvider:self._model_name = modelself._device = deviceself._compute_type = compute_type+ # CPU + a CUDA-only compute type is a guaranteed construction error, not a+ # silent downgrade: CTranslate2 RAISES ``ValueError("Requested int8_float16+ # compute type, but the target device or backend do not support efficient+ # int8_float16 computation")`` — it does not fall back on its own (verified+ # 2026-07-04 against ctranslate2 on a CPU device). The shipped cloud-first+ # default pairs ``device="cpu"`` with ``compute_type="int8_float16"`` (the+ # value the maintainer's CUDA box needs), so EVERY fresh CPU/VPS install+ # otherwise hits that ValueError on the first model build — twice (boot+ # prefetch + the first real ``_ensure_model``) — before ``_ensure_model``'s+ # retry recovers it to ``int8``. Pre-coercing here when the device is CPU+ # skips the doomed attempt and its scary WARNING while landing on the exact+ # same engine the fallback already produces. Only fires for ``device="cpu"``+ # (case-insensitive), so a ``cuda`` / ``auto`` device is untouched — the GPU+ # path keeps int8_float16 verbatim.+ if self._device.lower() == "cpu":+ self._compute_type = _cpu_safe_compute_type(self._compute_type)self._language = language if language and language != "auto" else None# Defense-in-depth (forensic 2026-06-28): an English-only model fed# non-English audio mangles it into English words. Unless the user hasdiff --git a/tests/unit/plugins/stt/test_fwhisper_cpu_compute_type.py b/tests/unit/plugins/stt/test_fwhisper_cpu_compute_type.pynew file mode 100644index 0000000000..a5bb4a0c0e--- /dev/null+++ b/tests/unit/plugins/stt/test_fwhisper_cpu_compute_type.py@@ -0,0 +1,38 @@+"""Regression: a CPU device must never carry a CUDA-only compute type.++CTranslate2 does NOT silently downgrade an unsupported compute type on a CPU+device — it RAISES ``ValueError`` at model construction. The shipped cloud-first+default pairs ``device="cpu"`` with ``compute_type="int8_float16"`` (the value a+CUDA box needs), so without a construction-time coercion every fresh CPU/VPS+install hits that error on its first model build before ``_ensure_model``'s retry+recovers it. These tests pin the coercion so a GPU/``auto`` device keeps its exact+compute type while a CPU device is normalised up-front to the CPU-safe equivalent.+"""+from __future__ import annotations++import pytest++from jarvis.plugins.stt.fwhisper import FasterWhisperProvider+++ ("device", "compute_in", "compute_expected"),+ [+ ("cpu", "int8_float16", "int8"), # the shipped cloud-first default combo+ ("cpu", "float16", "int8"), # any CUDA-only type -> CPU-safe int8+ ("CPU", "int8_float16", "int8"), # case-insensitive device match+ ("cpu", "int8", "int8"), # already CPU-safe -> unchanged+ ],+)+def test_cpu_device_coerces_cuda_only_compute_type(device, compute_in, compute_expected):+ prov = FasterWhisperProvider(model="tiny", device=device, compute_type=compute_in)+ assert prov._compute_type == compute_expected++[email protected]("device", ["cuda", "auto"])+def test_non_cpu_device_keeps_compute_type_verbatim(device):+ # The maintainer's CUDA path (and a device="auto" host that may resolve to a+ # GPU) must keep int8_float16 exactly — the coercion is CPU-only.+ prov = FasterWhisperProvider(model="tiny", device=device, compute_type="int8_float16")+ assert prov._device == device+ assert prov._compute_type == "int8_float16"