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.

test(brain): pin NVIDIA NIM slow-TTFB timeout regression

Ruben Lütked185f8673184
diff --git a/tests/unit/brain/test_nvidia_provider_wiring.py b/tests/unit/brain/test_nvidia_provider_wiring.py
index fca9a31d25..8a890cd70c 100644
--- a/tests/unit/brain/test_nvidia_provider_wiring.py
+++ b/tests/unit/brain/test_nvidia_provider_wiring.py
@@ -101,3 +101,18 @@ def test_nvidia_is_a_selectable_subagent_mapping() -> None:
# (its worker_slug is a placeholder — it runs via ApiAgentWorker, not the CLI).
assert to_worker_slug("nvidia") == "nvidia"
assert env_vars_for("nvidia") == ("NVIDIA_API_KEY",)
+
+
+# ── Regression: the provider-test must tolerate NIM's slow time-to-first-byte ──
+def test_provider_test_default_timeout_clears_nim_ttfb() -> None:
+ """The 'Test' button + section-health run through run_provider_test. Its
+ timeout ceiling must clear a slow-but-healthy provider's TTFB — NIM's free
+ dev tier was measured at 13-30s+ (live 2026-07-08). At the old 25s default a
+ legit NIM call timed out and was shown as an 'API Integration Error'; the
+ connect timeout (~5s) still catches a genuinely dead endpoint fast."""
+ import inspect
+
+ from jarvis.brain.provider_test import run_provider_test
+
+ default = inspect.signature(run_provider_test).parameters["timeout_s"].default
+ assert default >= 45.0, f"provider-test timeout {default}s too tight for NIM TTFB"
diff --git a/tests/unit/plugins/brain/test_provider_base_url.py b/tests/unit/plugins/brain/test_provider_base_url.py
index 8814c8fe76..78b5cfa27b 100644
--- a/tests/unit/plugins/brain/test_provider_base_url.py
+++ b/tests/unit/plugins/brain/test_provider_base_url.py
@@ -29,7 +29,9 @@ class _FakeGenaiClient:
def _override(provider_id: str, url: str, monkeypatch) -> None:
- conf = JarvisConfig(brain=BrainConfig(providers={provider_id: BrainProviderConfig(base_url=url)}))
+ conf = JarvisConfig(
+ brain=BrainConfig(providers={provider_id: BrainProviderConfig(base_url=url)})
+ )
monkeypatch.setattr(cfg, "load_config", lambda: conf)
monkeypatch.setattr(cfg, "get_provider_secret", lambda pid: "sk-test")
@@ -88,6 +90,27 @@ def test_nvidia_default_without_override(monkeypatch):
assert _FakeOpenAI.last_kwargs["base_url"] == "https://integrate.api.nvidia.com/v1"
+def test_nvidia_uses_a_generous_read_timeout_not_the_voice_path_one(monkeypatch):
+ """NIM's free dev tier has a 13-30s+ time-to-first-byte (queue/cold-start,
+ measured live 2026-07-08). The brain must NOT inherit the shared 30s
+ voice-path read timeout — that killed a slow-but-healthy call with an
+ APITimeoutError which the provider test mislabelled as an integration error.
+ ``connect`` stays short so a genuinely dead host still fast-fails."""
+ import openai
+
+ from jarvis.plugins.brain._openai_base import CLIENT_TIMEOUT as SHARED
+
+ monkeypatch.setattr(openai, "AsyncOpenAI", _FakeOpenAI)
+ _no_override(monkeypatch)
+ from jarvis.plugins.brain.nvidia import NvidiaBrain
+
+ NvidiaBrain()._ensure_client()
+ timeout = _FakeOpenAI.last_kwargs["timeout"]
+ assert timeout.read >= 90.0, f"nvidia read timeout {timeout.read}s too tight for NIM"
+ assert timeout.read > SHARED.read # generous vs the shared voice-path ceiling
+ assert timeout.connect <= 10.0 # dead host still fast-fails
+
+
# ── OpenAI ────────────────────────────────────────────────────────────────
def test_openai_uses_override(monkeypatch):
import openai