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.

chore: auto-save WIP via Claude stop-hook safety net (2026-07-08 20:41)

Ruben Lütkecd748db57fc4
diff --git a/jarvis/brain/provider_test.py b/jarvis/brain/provider_test.py
index 3602ac3a6d..2353e39897 100644
--- a/jarvis/brain/provider_test.py
+++ b/jarvis/brain/provider_test.py
@@ -255,13 +255,20 @@ async def run_provider_test(
make_stt: Callable[[Any, str], Any] | None = None,
codex_status: Callable[[], Any] | None = None,
antigravity_status: Callable[[], Any] | None = None,
- timeout_s: float = 25.0,
+ timeout_s: float = 60.0,
) -> ProviderTestResult:
"""Run a REAL minimal call against ``spec``'s provider and classify it.
The network-touching seams (``brain_probe`` / ``make_tts`` / ``make_stt`` /
``codex_status``) default to the production wiring and are injectable so the
dispatch logic is unit-testable without hitting a live provider.
+
+ ``timeout_s`` bounds the wait for the FIRST byte/delta, not a dead endpoint
+ (the SDK ``connect`` timeout, ~5s, catches those). It must clear the slowest
+ LEGITIMATE provider's time-to-first-byte, else a slow-but-healthy provider is
+ mislabelled ``unreachable``/integration-error: NVIDIA NIM's free dev tier was
+ measured at 13-30s+ TTFB (queue/cold-start), far above OpenAI/OpenRouter's
+ ~2s, so the ceiling is generous rather than voice-path-tight.
"""
provider = spec.id
diff --git a/jarvis/plugins/brain/nvidia.py b/jarvis/plugins/brain/nvidia.py
index c0df836788..34bc7516fb 100644
--- a/jarvis/plugins/brain/nvidia.py
+++ b/jarvis/plugins/brain/nvidia.py
@@ -16,10 +16,12 @@ from __future__ import annotations
from collections.abc import AsyncIterator
from typing import Any
+import httpx
+
from jarvis.core import config as cfg
from jarvis.core.protocols import BrainDelta, BrainRequest
-from ._openai_base import CLIENT_TIMEOUT, stream_complete
+from ._openai_base import stream_complete
# NVIDIA NIM's OpenAI-compatible endpoint. Only the ``nvapi-`` key from
# build.nvidia.com works here (NOT the legacy NGC key). Passed as the vendor
@@ -27,6 +29,19 @@ from ._openai_base import CLIENT_TIMEOUT, stream_complete
# team proxy can still redirect it (resolve_provider_endpoint).
BASE_URL = "https://integrate.api.nvidia.com/v1"
+# NIM-specific HTTP timeout. NVIDIA's hosted dev tier (build.nvidia.com) has a
+# high, variable time-to-first-byte — measured 13-30s+ on a cold/queued model
+# ("hi" @ max_tokens=8), well above the 2s TTFB of OpenAI/OpenRouter. The shared
+# ``_openai_base.CLIENT_TIMEOUT`` (read=30s, tuned for the voice fast-fail path)
+# therefore kills legitimate NIM calls with an APITimeoutError, which the
+# provider test then mislabels as an integration error / "unreachable". A NIM
+# call that connects but streams slowly is NOT a dead endpoint, so ``read`` is
+# widened to tolerate the queue/cold-start latency while ``connect`` stays at 5s
+# so a genuinely unreachable host still fast-fails and the fallback chain moves
+# on. On the voice hot path the brain-tier stall guard still bounds the turn and
+# crosses to a faster provider; this only lets the text/worker path finish.
+CLIENT_TIMEOUT = httpx.Timeout(connect=5.0, read=120.0, write=30.0, pool=30.0)
+
# Last-resort default when the brain is built with NO model. A widely-hosted,
# tool-capable NIM model so a model-less construction still answers and can call
# tools; the manager passes the user's PICK in almost every path, so this only