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(stt): remove fictional CT2_FORCE_CPU_THREADS env variable

Ruben Lütked30095e4eb7f
diff --git a/jarvis/plugins/stt/fwhisper.py b/jarvis/plugins/stt/fwhisper.py
index ab53aec40a..c69813df1f 100644
--- a/jarvis/plugins/stt/fwhisper.py
+++ b/jarvis/plugins/stt/fwhisper.py
@@ -76,9 +76,8 @@ def _bound_ct2_threads(default: int = 2) -> None:
Defensive hardening for the CPU stt_match wake path (AP-24/AP-25/BUG-036):
ctranslate2's auto thread-pool can deadlock against another OpenMP consumer
sharing the process (see ``_new_whisper_model`` / ``cpu_threads``). Setting
- ``OMP_NUM_THREADS`` and ``CT2_FORCE_CPU_THREADS`` caps that pool at the
- environment level, one layer below the per-instance ``cpu_threads=2``
- constructor pin already in place.
+ ``OMP_NUM_THREADS`` caps that pool at the environment level, one layer below
+ the per-instance ``cpu_threads=2`` constructor pin already in place.
Uses ``os.environ.setdefault`` so an operator's own explicit setting is
NEVER clobbered. This is DEFENSIVE ONLY: it does not claim to cure the
@@ -94,8 +93,7 @@ def _bound_ct2_threads(default: int = 2) -> None:
"""
import os
- for var in ("OMP_NUM_THREADS", "CT2_FORCE_CPU_THREADS"):
- os.environ.setdefault(var, str(default))
+ os.environ.setdefault("OMP_NUM_THREADS", str(default))
def _normalize_model_name(model: str) -> str:
diff --git a/tests/unit/stt/test_ct2_thread_env.py b/tests/unit/stt/test_ct2_thread_env.py
index 3f9ba44be0..5c65b54f55 100644
--- a/tests/unit/stt/test_ct2_thread_env.py
+++ b/tests/unit/stt/test_ct2_thread_env.py
@@ -12,23 +12,19 @@ import os
def test_bound_ct2_threads_sets_env_when_unset(monkeypatch):
monkeypatch.delenv("OMP_NUM_THREADS", raising=False)
- monkeypatch.delenv("CT2_FORCE_CPU_THREADS", raising=False)
from jarvis.plugins.stt.fwhisper import _bound_ct2_threads
_bound_ct2_threads(default=2)
assert os.environ["OMP_NUM_THREADS"] == "2"
- assert os.environ["CT2_FORCE_CPU_THREADS"] == "2"
def test_bound_ct2_threads_respects_user_override(monkeypatch):
monkeypatch.setenv("OMP_NUM_THREADS", "8")
- monkeypatch.delenv("CT2_FORCE_CPU_THREADS", raising=False)
from jarvis.plugins.stt.fwhisper import _bound_ct2_threads
_bound_ct2_threads(default=2)
assert os.environ["OMP_NUM_THREADS"] == "8" # never clobber an explicit setting
- assert os.environ["CT2_FORCE_CPU_THREADS"] == "2"