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(clis): stop one wedged probe from blanking the whole CLI catalog

Ruben Lütke700143fd1dd5
diff --git a/jarvis/brain/model_catalog.py b/jarvis/brain/model_catalog.py
index 83748654a9..2348ba5cad 100644
--- a/jarvis/brain/model_catalog.py
+++ b/jarvis/brain/model_catalog.py
@@ -24,7 +24,6 @@ frontier resolver's 24 h — fresher is better for a list the user browses), wit
special case: its public catalog changes daily, so its cache lifetime is capped
at five minutes even when the general TTL is longer.
"""
-
from __future__ import annotations
import asyncio
@@ -50,13 +49,9 @@ DEFAULT_TTL_HOURS = 6
# immediate fetch, and an explicitly shorter global TTL continues to win.
_PROVIDER_TTL_CAP_SECONDS: dict[str, float] = {
"openrouter": 5 * 60,
- # Local servers: the installed model set changes with every `ollama pull` /
- # server restart, and the fetch is a LAN round-trip — keep it near-live.
- "ollama": 60,
- "local-openai": 60,
}
-# The brain providers whose catalogs we can enumerate. Codex is excluded
+# The API-key brain providers whose catalogs we can enumerate. Codex is excluded
# on purpose: it authenticates via the ChatGPT login / a generic OpenAI key and
# its model id is largely ignored by the ``codex exec`` CLI path — it has no own
# model picker in the UI (it renders the Codex login widget instead).
@@ -67,78 +62,30 @@ CATALOG_PROVIDERS: tuple[str, ...] = (
"openrouter",
"grok",
"nvidia",
- # Keyless local providers (2026-07-25): their "catalog" is the live list of
- # models the user's own server holds — ollama via the native /api/tags,
- # local-openai via the standard /v1/models.
- "ollama",
- "local-openai",
)
-
-@dataclass(frozen=True, slots=True)
-class _CatalogEndpoint:
- """Catalog wiring for one provider.
-
- ``vendor_base`` is the provider's default base in the SAME convention its
- brain plugin uses for ``[brain.providers.<id>].base_url`` overrides (with
- or without ``/v1``, or a bare server root for the local providers), so an
- override composes with ``path`` exactly like the vendor default does.
- ``None`` = no vendor default: without a configured override the fetch
- raises an honest error (local-openai) or resolves dynamically (ollama's
- OLLAMA_HOST handling). ``auth`` selects how the key is attached:
-
- "x-api-key" → Anthropic header pair (key required)
- "bearer" → Authorization: Bearer (key required)
- "query" → ?key= (Gemini; key required)
- "bearer_opt" → Authorization: Bearer if a key exists, else anonymous
- (public catalogs: OpenRouter, NVIDIA NIM)
- "none" → keyless local server; the optional ``secret_slot``
- (keyring name, ENV name) is attached as Bearer when set.
- """
-
- vendor_base: str | None
- path: str
- auth: str
- secret_slot: tuple[str, str] | None = None
-
-
-# Every fetch resolves the provider's EFFECTIVE base URL through
-# ``cfg.resolve_provider_endpoint`` (team proxy → base_url override → the
-# vendor default here) and appends ``path``. With no override configured the
-# resulting URLs are byte-identical to the former static table — pinned by
-# tests/unit/brain/test_model_catalog_local.py (S3a regression gate).
-_ENDPOINTS: dict[str, _CatalogEndpoint] = {
- # Anthropic SDK convention: override EXCLUDES /v1 (the SDK appends it).
- "claude-api": _CatalogEndpoint("https://api.anthropic.com", "/v1/models", "x-api-key"),
- # OpenAI-compatible convention: override INCLUDES /v1.
- "openai": _CatalogEndpoint("https://api.openai.com/v1", "/models", "bearer"),
- # google-genai convention: override is the raw host (SDK appends /v1beta).
- "gemini": _CatalogEndpoint(
- "https://generativelanguage.googleapis.com",
- "/v1beta/models",
+# Endpoint + auth shape per provider. ``auth`` selects how the key is attached:
+# "x-api-key" → Anthropic header pair
+# "bearer" → Authorization: Bearer (OpenAI-compatible: OpenAI, Grok)
+# "query" → ?key= (Gemini)
+# "bearer_opt" → Authorization: Bearer if a key exists, else anonymous
+# (OpenRouter's catalog is public)
+_ENDPOINTS: dict[str, tuple[str, str]] = {
+ "claude-api": ("https://api.anthropic.com/v1/models", "x-api-key"),
+ "openai": ("https://api.openai.com/v1/models", "bearer"),
+ "gemini": (
+ "https://generativelanguage.googleapis.com/v1beta/models",
"query",
),
- "openrouter": _CatalogEndpoint("https://openrouter.ai/api/v1", "/models", "bearer_opt"),
+ "openrouter": ("https://openrouter.ai/api/v1/models", "bearer_opt"),
# xAI uses the OpenAI-compatible ``data[].id`` model roster and requires
# the same bearer key used for Grok inference.
- "grok": _CatalogEndpoint("https://api.x.ai/v1", "/models", "bearer"),
+ "grok": ("https://api.x.ai/v1/models", "bearer"),
# NVIDIA NIM speaks the OpenAI-compatible ``data[].id`` shape. Its catalog is
# PUBLIC (verified 2026-07-08: an unauthenticated GET returns the full model
# list), so ``bearer_opt`` like OpenRouter — the picker fills in before a key
# is entered, and the key is attached when present.
- "nvidia": _CatalogEndpoint("https://integrate.api.nvidia.com/v1", "/models", "bearer_opt"),
- # Ollama: server-root convention (the plugin appends /v1 / /api itself);
- # vendor default resolves dynamically (OLLAMA_HOST → localhost:11434).
- "ollama": _CatalogEndpoint(None, "/api/tags", "none"),
- # Generic local OpenAI-compatible server: no default port is guessable
- # (transformers serve 8000, llama-server 8080, LM Studio 1234) — the user
- # sets the base URL on the card; without it the picker stays honestly empty.
- "local-openai": _CatalogEndpoint(
- None,
- "/v1/models",
- "none",
- secret_slot=("local_openai_api_key", "LOCAL_OPENAI_API_KEY"),
- ),
+ "nvidia": ("https://integrate.api.nvidia.com/v1/models", "bearer_opt"),
}
@@ -179,82 +126,70 @@ def _curated(pairs: list[tuple[str, str]]) -> list[ModelInfo]:
# offer a years-old model); when a valid key exists the live catalog supersedes
# this entirely, so a new release still shows up automatically there.
CURATED_MODELS: dict[str, list[ModelInfo]] = {
- "claude-api": _curated(
- [
- ("claude-fable-5", "Claude Fable 5"),
- ("claude-opus-4-8", "Claude Opus 4.8"),
- ("claude-sonnet-5", "Claude Sonnet 5"),
- ("claude-haiku-4-5-20251001", "Claude Haiku 4.5"),
- ]
- ),
- "openai": _curated(
- [
- ("gpt-5.6-sol", "GPT-5.6 Sol (preview)"),
- ("gpt-5.6-terra", "GPT-5.6 Terra (preview)"),
- ("gpt-5.6-luna", "GPT-5.6 Luna (preview)"),
- ("gpt-5.6", "GPT-5.6 (Sol alias, preview)"),
- ("gpt-5.5", "GPT-5.5"),
- ("gpt-5.5-pro", "GPT-5.5 Pro"),
- ("gpt-5.4", "GPT-5.4"),
- ("gpt-5.4-pro", "GPT-5.4 Pro"),
- ("gpt-5.4-mini", "GPT-5.4 Mini"),
- ("gpt-5.4-nano", "GPT-5.4 Nano"),
- ]
- ),
- "gemini": _curated(
- [
- ("gemini-3.5-flash", "Gemini 3.5 Flash"),
- ("gemini-3.1-pro-preview", "Gemini 3.1 Pro"),
- ("gemini-3-flash-preview", "Gemini 3 Flash"),
- ("gemini-3.1-flash-lite", "Gemini 3.1 Flash-Lite"),
- ("gemini-2.5-pro", "Gemini 2.5 Pro"),
- ("gemini-2.5-flash", "Gemini 2.5 Flash"),
- ("gemini-flash-lite-latest", "Gemini Flash Lite"),
- ]
- ),
- "openrouter": _curated(
- [
- ("anthropic/claude-fable-5", "Claude Fable 5"),
- ("anthropic/claude-opus-4.8", "Claude Opus 4.8"),
- ("anthropic/claude-sonnet-5", "Claude Sonnet 5"),
- ("anthropic/claude-haiku-4.5", "Claude Haiku 4.5"),
- ("openai/gpt-5.6-sol-pro", "GPT-5.6 Sol Pro"),
- ("openai/gpt-5.6-sol", "GPT-5.6 Sol"),
- ("openai/gpt-5.6-terra-pro", "GPT-5.6 Terra Pro"),
- ("openai/gpt-5.6-terra", "GPT-5.6 Terra"),
- ("openai/gpt-5.6-luna-pro", "GPT-5.6 Luna Pro"),
- ("openai/gpt-5.6-luna", "GPT-5.6 Luna"),
- ("google/gemini-3.5-flash", "Gemini 3.5 Flash"),
- ("google/gemini-3.1-pro-preview", "Gemini 3.1 Pro"),
- ("x-ai/grok-4.20", "Grok 4.20"),
- ("deepseek/deepseek-v4-pro", "DeepSeek V4 Pro"),
- ]
- ),
+ "claude-api": _curated([
+ ("claude-fable-5", "Claude Fable 5"),
+ ("claude-opus-4-8", "Claude Opus 4.8"),
+ ("claude-sonnet-5", "Claude Sonnet 5"),
+ ("claude-haiku-4-5-20251001", "Claude Haiku 4.5"),
+ ]),
+ "openai": _curated([
+ ("gpt-5.6-sol", "GPT-5.6 Sol (preview)"),
+ ("gpt-5.6-terra", "GPT-5.6 Terra (preview)"),
+ ("gpt-5.6-luna", "GPT-5.6 Luna (preview)"),
+ ("gpt-5.6", "GPT-5.6 (Sol alias, preview)"),
+ ("gpt-5.5", "GPT-5.5"),
+ ("gpt-5.5-pro", "GPT-5.5 Pro"),
+ ("gpt-5.4", "GPT-5.4"),
+ ("gpt-5.4-pro", "GPT-5.4 Pro"),
+ ("gpt-5.4-mini", "GPT-5.4 Mini"),
+ ("gpt-5.4-nano", "GPT-5.4 Nano"),
+ ]),
+ "gemini": _curated([
+ ("gemini-3.5-flash", "Gemini 3.5 Flash"),
+ ("gemini-3.1-pro-preview", "Gemini 3.1 Pro"),
+ ("gemini-3-flash-preview", "Gemini 3 Flash"),
+ ("gemini-3.1-flash-lite", "Gemini 3.1 Flash-Lite"),
+ ("gemini-2.5-pro", "Gemini 2.5 Pro"),
+ ("gemini-2.5-flash", "Gemini 2.5 Flash"),
+ ("gemini-flash-lite-latest", "Gemini Flash Lite"),
+ ]),
+ "openrouter": _curated([
+ ("anthropic/claude-fable-5", "Claude Fable 5"),
+ ("anthropic/claude-opus-4.8", "Claude Opus 4.8"),
+ ("anthropic/claude-sonnet-5", "Claude Sonnet 5"),
+ ("anthropic/claude-haiku-4.5", "Claude Haiku 4.5"),
+ ("openai/gpt-5.6-sol-pro", "GPT-5.6 Sol Pro"),
+ ("openai/gpt-5.6-sol", "GPT-5.6 Sol"),
+ ("openai/gpt-5.6-terra-pro", "GPT-5.6 Terra Pro"),
+ ("openai/gpt-5.6-terra", "GPT-5.6 Terra"),
+ ("openai/gpt-5.6-luna-pro", "GPT-5.6 Luna Pro"),
+ ("openai/gpt-5.6-luna", "GPT-5.6 Luna"),
+ ("google/gemini-3.5-flash", "Gemini 3.5 Flash"),
+ ("google/gemini-3.1-pro-preview", "Gemini 3.1 Pro"),
+ ("x-ai/grok-4.20", "Grok 4.20"),
+ ("deepseek/deepseek-v4-pro", "DeepSeek V4 Pro"),
+ ]),
# Grok 4.3 is the universal default because Grok 4.5 is not yet available
# in every region. The authenticated live catalog replaces this fallback.
- "grok": _curated(
- [
- ("grok-4.3", "Grok 4.3"),
- ("grok-4.5", "Grok 4.5"),
- ]
- ),
+ "grok": _curated([
+ ("grok-4.3", "Grok 4.3"),
+ ("grok-4.5", "Grok 4.5"),
+ ]),
# NVIDIA NIM — the offline fallback when the live /v1/models catalog is
# unreachable. NVIDIA-hosted current families (Nemotron leads: it is NVIDIA's
# own). A valid key supersedes this with the live list, so a newly hosted
# model still shows up automatically.
- "nvidia": _curated(
- [
- ("nvidia/llama-3.1-nemotron-ultra-253b-v1", "Nemotron Ultra 253B"),
- ("nvidia/llama-3.3-nemotron-super-49b-v1.5", "Nemotron Super 49B v1.5"),
- ("deepseek-ai/deepseek-v4-pro", "DeepSeek V4 Pro"),
- ("deepseek-ai/deepseek-v4-flash", "DeepSeek V4 Flash"),
- ("moonshotai/kimi-k2.6", "Kimi K2.6"),
- ("z-ai/glm-5.2", "GLM-5.2"),
- ("qwen/qwen3.5-397b-a17b", "Qwen3.5 397B A17B"),
- ("meta/llama-4-maverick-17b-128e-instruct", "Llama 4 Maverick"),
- ("mistralai/mistral-large-3-675b-instruct-2512", "Mistral Large 3"),
- ]
- ),
+ "nvidia": _curated([
+ ("nvidia/llama-3.1-nemotron-ultra-253b-v1", "Nemotron Ultra 253B"),
+ ("nvidia/llama-3.3-nemotron-super-49b-v1.5", "Nemotron Super 49B v1.5"),
+ ("deepseek-ai/deepseek-v4-pro", "DeepSeek V4 Pro"),
+ ("deepseek-ai/deepseek-v4-flash", "DeepSeek V4 Flash"),
+ ("moonshotai/kimi-k2.6", "Kimi K2.6"),
+ ("z-ai/glm-5.2", "GLM-5.2"),
+ ("qwen/qwen3.5-397b-a17b", "Qwen3.5 397B A17B"),
+ ("meta/llama-4-maverick-17b-128e-instruct", "Llama 4 Maverick"),
+ ("mistralai/mistral-large-3-675b-instruct-2512", "Mistral Large 3"),
+ ]),
}
@@ -287,146 +222,48 @@ TTS_CATALOG: dict[str, tuple[str, list[ModelInfo]]] = {
# Inworld — the new premium default (arena-#1 realtime, mid-2026). Voices are
# multilingual; these native masculine de/en/es voices are the curated pick,
# kept in sync with DEFAULT_VOICE_* in jarvis/plugins/tts/inworld_tts.py.
- "inworld": (
- "voice",
- _curated(
- [
- ("Josef", "Josef — German, calm assistant (default)"),
- ("Johanna", "Johanna — German, warm"),
- ("Dennis", "Dennis — English, deep narrator"),
- ("Ashley", "Ashley — English, bright"),
- ("Diego", "Diego — Spanish, formal"),
- ("Lupita", "Lupita — Spanish, warm"),
- ]
- ),
- ),
- "elevenlabs": (
- "voice",
- _curated(
- [
- ("onwK4e9ZLuTAKqWW03F9", "Daniel — British, authoritative (default)"),
- ("JBFqnCBsd6RMkjVDRZzb", "George — British, deep narrator"),
- ("IKne3meq5aSn9XLyUdCD", "Charlie — British, mature butler"),
- ("nPczCjzI2devNBz1zQrb", "Brian — American, deep narrator"),
- ("pNInz6obpgDQGcFmaJgB", "Adam — American, classic AI voice"),
- ]
- ),
- ),
- "gemini-flash-tts": (
- "voice",
- _ids(
- [
- "Charon",
- "Kore",
- "Orus",
- "Iapetus",
- "Rasalgethi",
- "Algenib",
- "Algieba",
- "Fenrir",
- "Aoede",
- "Zephyr",
- "Puck",
- "Leda",
- "Callirrhoe",
- "Autonoe",
- "Enceladus",
- "Umbriel",
- "Despina",
- "Erinome",
- "Laomedeia",
- "Achernar",
- "Alnilam",
- "Schedar",
- "Gacrux",
- "Pulcherrima",
- "Achird",
- "Zubenelgenubi",
- "Vindemiatrix",
- "Sadachbia",
- "Sadaltager",
- "Sulafat",
- ]
- ),
- ),
- "grok-voice": (
- "voice",
- _ids(
- [
- "leo",
- "rex",
- "sal",
- "ara",
- "eve",
- "carina",
- "zagan",
- "helix",
- "orion",
- "luna",
- "iris",
- "altair",
- "zenith",
- "perseus",
- "helios",
- "lux",
- "kepler",
- "rigel",
- "cosmo",
- "celeste",
- "ursa",
- "sirius",
- "lumen",
- "castor",
- "naksh",
- "atlas",
- ]
- ),
- ),
- "openai-tts": (
- "voice",
- _ids(
- [
- "alloy",
- "ash",
- "ballad",
- "coral",
- "echo",
- "fable",
- "onyx",
- "nova",
- "sage",
- "shimmer",
- "verse",
- "marin",
- "cedar",
- ]
- ),
- ),
- "google-neural2": (
- "voice",
- _ids(
- [
- "en-US-Neural2-A",
- "en-US-Neural2-C",
- "en-US-Neural2-D",
- "en-US-Neural2-F",
- "de-DE-Neural2-B",
- "de-DE-Neural2-C",
- "de-DE-Neural2-D",
- "de-DE-Neural2-F",
- ]
- ),
- ),
- "cartesia": (
- "model",
- _curated(
- [
- ("sonic-3.5", "Sonic 3.5 (stable)"),
- ("sonic-3", "Sonic 3"),
- ("sonic-3-latest", "Sonic 3 latest (preview track)"),
- ]
- ),
- ),
+ "inworld": ("voice", _curated([
+ ("Josef", "Josef — German, calm assistant (default)"),
+ ("Johanna", "Johanna — German, warm"),
+ ("Dennis", "Dennis — English, deep narrator"),
+ ("Ashley", "Ashley — English, bright"),
+ ("Diego", "Diego — Spanish, formal"),
+ ("Lupita", "Lupita — Spanish, warm"),
+ ])),
+ "elevenlabs": ("voice", _curated([
+ ("onwK4e9ZLuTAKqWW03F9", "Daniel — British, authoritative (default)"),
+ ("JBFqnCBsd6RMkjVDRZzb", "George — British, deep narrator"),
+ ("IKne3meq5aSn9XLyUdCD", "Charlie — British, mature butler"),
+ ("nPczCjzI2devNBz1zQrb", "Brian — American, deep narrator"),
+ ("pNInz6obpgDQGcFmaJgB", "Adam — American, classic AI voice"),
+ ])),
+ "gemini-flash-tts": ("voice", _ids([
+ "Charon", "Kore", "Orus", "Iapetus", "Rasalgethi", "Algenib",
+ "Algieba", "Fenrir", "Aoede", "Zephyr", "Puck", "Leda",
+ "Callirrhoe", "Autonoe", "Enceladus", "Umbriel", "Despina",
+ "Erinome", "Laomedeia", "Achernar", "Alnilam", "Schedar",
+ "Gacrux", "Pulcherrima", "Achird", "Zubenelgenubi", "Vindemiatrix",
+ "Sadachbia", "Sadaltager", "Sulafat",
+ ])),
+ "grok-voice": ("voice", _ids([
+ "leo", "rex", "sal", "ara", "eve", "carina", "zagan", "helix",
+ "orion", "luna", "iris", "altair", "zenith", "perseus", "helios",
+ "lux", "kepler", "rigel", "cosmo", "celeste", "ursa", "sirius",
+ "lumen", "castor", "naksh", "atlas",
+ ])),
+ "openai-tts": ("voice", _ids([
+ "alloy", "ash", "ballad", "coral", "echo",
+ "fable", "onyx", "nova", "sage", "shimmer", "verse", "marin", "cedar",
+ ])),
+ "google-neural2": ("voice", _ids([
+ "en-US-Neural2-A", "en-US-Neural2-C", "en-US-Neural2-D", "en-US-Neural2-F",
+ "de-DE-Neural2-B", "de-DE-Neural2-C", "de-DE-Neural2-D", "de-DE-Neural2-F",
+ ])),
+ "cartesia": ("model", _curated([
+ ("sonic-3.5", "Sonic 3.5 (stable)"),
+ ("sonic-3", "Sonic 3"),
+ ("sonic-3-latest", "Sonic 3 latest (preview track)"),
+ ])),
# OpenRouter TTS (the last-resort gateway) — the model picker offers ONLY the
# four allowlisted, production-grade speech models. The five open-source slop
# models (Kokoro, Orpheus, CSM-1B, both Zonos) are UNLISTED per the hard
@@ -434,17 +271,12 @@ TTS_CATALOG: dict[str, tuple[str, list[ModelInfo]]] = {
# multilingual bar on de/es coverage, beta stability, or GPU dependence. Every
# id here must satisfy curated_catalog.is_allowed("openrouter", id) — guarded
# by tests/unit/plugins/tts/test_openrouter_curation.py.
- "openrouter-tts": (
- "model",
- _ids(
- [
- "google/gemini-3.1-flash-tts-preview",
- "x-ai/grok-voice-tts-1.0",
- "microsoft/mai-voice-2",
- "mistralai/voxtral-mini-tts-2603",
- ]
- ),
- ),
+ "openrouter-tts": ("model", _ids([
+ "google/gemini-3.1-flash-tts-preview",
+ "x-ai/grok-voice-tts-1.0",
+ "microsoft/mai-voice-2",
+ "mistralai/voxtral-mini-tts-2603",
+ ])),
}
# Realtime catalogs — REALTIME_MODELS + REALTIME_VOICES, keyed by realtime
@@ -469,35 +301,31 @@ TTS_CATALOG: dict[str, tuple[str, list[ModelInfo]]] = {
# they target dedicated translation/transcription sessions, not the general
# duplex voice-agent protocol implemented by this adapter.
REALTIME_MODELS: dict[str, list[ModelInfo]] = {
- "openai-realtime": _curated(
- [
- ("gpt-realtime", "GPT Realtime (default)"),
- ("gpt-realtime-2.1", "GPT Realtime 2.1"),
- ("gpt-realtime-2.1-mini", "GPT Realtime 2.1 Mini"),
- ("gpt-realtime-2", "GPT Realtime 2"),
- ("gpt-realtime-1.5", "GPT Realtime 1.5"),
- ("gpt-realtime-mini", "GPT Realtime Mini"),
- ]
- ),
+ "openai-realtime": _curated([
+ ("gpt-realtime", "GPT Realtime (default)"),
+ ("gpt-realtime-2.1", "GPT Realtime 2.1"),
+ ("gpt-realtime-2.1-mini", "GPT Realtime 2.1 Mini"),
+ ("gpt-realtime-2", "GPT Realtime 2"),
+ ("gpt-realtime-1.5", "GPT Realtime 1.5"),
+ ("gpt-realtime-mini", "GPT Realtime Mini"),
+ ]),
# gemini-live — verified 2026-07-10 against ai.google.dev/gemini-api/docs/models
# (the Live API model list). ``gemini-3.1-flash-live-preview`` is the current
# flagship (matches ``_MODEL`` in ``jarvis/plugins/realtime/gemini_live.py``);
# ``gemini-2.5-flash-native-audio-preview-12-2025`` is the current 2.5-series
# native-audio sibling still listed on that page. The older
# ``gemini-2.0-flash-live-preview`` family is marked for shutdown — omitted.
- "gemini-live": _curated(
- [
- ("gemini-3.1-flash-live-preview", "Gemini 3.1 Flash Live (default)"),
- (
- "gemini-2.5-flash-native-audio-latest",
- "Gemini 2.5 Flash Native Audio (latest alias)",
- ),
- (
- "gemini-2.5-flash-native-audio-preview-12-2025",
- "Gemini 2.5 Flash Native Audio",
- ),
- ]
- ),
+ "gemini-live": _curated([
+ ("gemini-3.1-flash-live-preview", "Gemini 3.1 Flash Live (default)"),
+ (
+ "gemini-2.5-flash-native-audio-latest",
+ "Gemini 2.5 Flash Native Audio (latest alias)",
+ ),
+ (
+ "gemini-2.5-flash-native-audio-preview-12-2025",
+ "Gemini 2.5 Flash Native Audio",
+ ),
+ ]),
# grok-realtime (xAI Voice Agent API) was REMOVED 2026-07-16: the xAI
# server drops the session contract after any response cancel, ignores
# the configured VAD silence window, swallows response.done, and spams
@@ -511,54 +339,17 @@ REALTIME_MODELS: dict[str, list[ModelInfo]] = {
# gemini-live: verified 2026-07-10 against the Live API capabilities guide,
# which now permits the complete 30-voice Gemini prebuilt roster.
REALTIME_VOICES: dict[str, list[ModelInfo]] = {
- "openai-realtime": _ids(
- [
- "alloy",
- "ash",
- "ballad",
- "coral",
- "echo",
- "sage",
- "shimmer",
- "verse",
- "marin",
- "cedar",
- ]
- ),
- "gemini-live": _ids(
- [
- "Puck",
- "Charon",
- "Kore",
- "Fenrir",
- "Aoede",
- "Orus",
- "Leda",
- "Zephyr",
- "Callirrhoe",
- "Autonoe",
- "Enceladus",
- "Iapetus",
- "Umbriel",
- "Algieba",
- "Despina",
- "Erinome",
- "Algenib",
- "Rasalgethi",
- "Laomedeia",
- "Achernar",
- "Alnilam",
- "Schedar",
- "Gacrux",
- "Pulcherrima",
- "Achird",
- "Zubenelgenubi",
- "Vindemiatrix",
- "Sadachbia",
- "Sadaltager",
- "Sulafat",
- ]
- ),
+ "openai-realtime": _ids([
+ "alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse",
+ "marin", "cedar",
+ ]),
+ "gemini-live": _ids([
+ "Puck", "Charon", "Kore", "Fenrir", "Aoede", "Orus", "Leda", "Zephyr",
+ "Callirrhoe", "Autonoe", "Enceladus", "Iapetus", "Umbriel", "Algieba",
+ "Despina", "Erinome", "Algenib", "Rasalgethi", "Laomedeia", "Achernar",
+ "Alnilam", "Schedar", "Gacrux", "Pulcherrima", "Achird", "Zubenelgenubi",
+ "Vindemiatrix", "Sadachbia", "Sadaltager", "Sulafat",
+ ]),
# Live roster verified through xAI's authenticated /v1/tts/voices endpoint.
# Eve leads because it is xAI's current Voice Agent default.
}
@@ -571,34 +362,30 @@ STT_CATALOG: dict[str, list[ModelInfo]] = {
# v1.0.1 — see the note in provider_spec.py. The wake-word local Whisper and
# the key-free STT fallback do NOT use this catalog (they read [stt].wake_*
# / construct FasterWhisperProvider directly), so no wake/fallback breakage.
- "openai-api": _ids(
- [
- "gpt-4o-transcribe",
- "gpt-4o-mini-transcribe",
- "gpt-4o-mini-transcribe-2025-12-15",
- "gpt-4o-transcribe-diarize",
- "whisper-1",
- ]
- ),
+ "openai-api": _ids([
+ "gpt-4o-transcribe",
+ "gpt-4o-mini-transcribe",
+ "gpt-4o-mini-transcribe-2025-12-15",
+ "gpt-4o-transcribe-diarize",
+ "whisper-1",
+ ]),
"deepgram": _ids(["nova-3", "nova-2", "nova-2-general", "enhanced", "base"]),
# OpenRouter STT — the model picker offers ONLY transcription models. This
# curated snapshot mirrors the live `?output_modalities=transcription` list
# (verified 2026-07-02); audio-in chat models are excluded. The default
# model (openai/whisper-large-v3) is listed first.
- "openrouter-stt": _ids(
- [
- "openai/whisper-large-v3",
- "openai/gpt-4o-transcribe",
- "openai/gpt-4o-mini-transcribe",
- "openai/whisper-1",
- "openai/whisper-large-v3-turbo",
- "google/chirp-3",
- "mistralai/voxtral-mini-transcribe",
- "qwen/qwen3-asr-flash-2026-02-10",
- "nvidia/parakeet-tdt-0.6b-v3",
- "microsoft/mai-transcribe-1.5",
- ]
- ),
+ "openrouter-stt": _ids([
+ "openai/whisper-large-v3",
+ "openai/gpt-4o-transcribe",
+ "openai/gpt-4o-mini-transcribe",
+ "openai/whisper-1",
+ "openai/whisper-large-v3-turbo",
+ "google/chirp-3",
+ "mistralai/voxtral-mini-transcribe",
+ "qwen/qwen3-asr-flash-2026-02-10",
+ "nvidia/parakeet-tdt-0.6b-v3",
+ "microsoft/mai-transcribe-1.5",
+ ]),
}
@@ -607,8 +394,8 @@ class CatalogSpec:
"""Per-provider picker spec: which tier, what it selects, the curated list,
and whether a live ``/v1/models`` fetch is available (brain providers only)."""
- tier: str # "brain" | "tts" | "stt"
- selects: str # "model" | "voice"
+ tier: str # "brain" | "tts" | "stt"
+ selects: str # "model" | "voice"
curated: tuple[ModelInfo, ...]
live: bool
@@ -623,23 +410,14 @@ def _build_provider_catalog() -> dict[str, CatalogSpec]:
# /v1/models over OAuth, so curated only. The concrete GPT-5.6 choices are
# the current Codex lineup; the still-supported GPT-5.5/5.4 choices remain
# available for users who intentionally prefer their established behavior.
- cat["codex"] = CatalogSpec(
- "brain",
- "model",
- tuple(
- _curated(
- [
- ("gpt-5.6-sol", "GPT-5.6 Sol"),
- ("gpt-5.6-terra", "GPT-5.6 Terra"),
- ("gpt-5.6-luna", "GPT-5.6 Luna"),
- ("gpt-5.5", "GPT-5.5"),
- ("gpt-5.4", "GPT-5.4"),
- ("gpt-5.4-mini", "GPT-5.4 Mini"),
- ]
- )
- ),
- live=False,
- )
+ cat["codex"] = CatalogSpec("brain", "model", tuple(_curated([
+ ("gpt-5.6-sol", "GPT-5.6 Sol"),
+ ("gpt-5.6-terra", "GPT-5.6 Terra"),
+ ("gpt-5.6-luna", "GPT-5.6 Luna"),
+ ("gpt-5.5", "GPT-5.5"),
+ ("gpt-5.4", "GPT-5.4"),
+ ("gpt-5.4-mini", "GPT-5.4 Mini"),
+ ])), live=False)
# Antigravity — subagent model catalog for the official agy/gemini CLI
# (OAuth login); no /v1/models over OAuth, so curated only. Flash first =
# the fast default; Pro is the deep option. Both are valid gemini-CLI ids.
@@ -648,19 +426,10 @@ def _build_provider_catalog() -> dict[str, CatalogSpec]:
# (a bogus name still answers), so agy always runs its IDE-configured default.
# The selection here therefore only takes effect on the gemini-CLI fallback
# path (and any future agy that honors the flag); for agy it is informational.
- cat["antigravity"] = CatalogSpec(
- "brain",
- "model",
- tuple(
- _curated(
- [
- ("gemini-3.5-flash", "Gemini 3.5 Flash"),
- ("gemini-3.1-pro-preview", "Gemini 3.1 Pro"),
- ]
- )
- ),
- live=False,
- )
+ cat["antigravity"] = CatalogSpec("brain", "model", tuple(_curated([
+ ("gemini-3.5-flash", "Gemini 3.5 Flash"),
+ ("gemini-3.1-pro-preview", "Gemini 3.1 Pro"),
+ ])), live=False)
for p, (selects, opts) in TTS_CATALOG.items():
cat[p] = CatalogSpec("tts", selects, tuple(opts), live=False)
for p, opts in STT_CATALOG.items():
@@ -680,7 +449,6 @@ def catalog_spec(provider: str) -> CatalogSpec | None:
# Pure parsing + sorting (module-level for easy testing)
# ----------------------------------------------------------------------
-
def parse_models_response(provider: str, payload: dict) -> list[ModelInfo]:
"""Map a provider's ``/v1/models`` JSON to a flat ``list[ModelInfo]``.
@@ -691,16 +459,6 @@ def parse_models_response(provider: str, payload: dict) -> list[ModelInfo]:
Entries without a usable id are dropped.
"""
out: list[ModelInfo] = []
- if provider == "ollama":
- # Native /api/tags: {"models": [{"name": "qwen3.5:9b", ...}, ...]} —
- # the installed-model list of the user's own server.
- for m in payload.get("models", []) or []:
- raw = (m.get("name") or "").strip()
- if not raw:
- continue
- out.append(ModelInfo(id=raw, label=raw))
- return out
-
if provider == "gemini":
for m in payload.get("models", []) or []:
raw = (m.get("name") or "").removeprefix("models/").strip()
@@ -723,15 +481,13 @@ def parse_models_response(provider: str, payload: dict) -> list[ModelInfo]:
if not raw:
continue
label = (m.get("name") or "").strip() or raw # OpenRouter has a name
- out.append(
- ModelInfo(
- id=raw,
- label=label,
- output_modalities=_output_modalities(m),
- input_modalities=_input_modalities(m),
- supported_parameters=_supported_parameters(m),
- )
- )
+ out.append(ModelInfo(
+ id=raw,
+ label=label,
+ output_modalities=_output_modalities(m),
+ input_modalities=_input_modalities(m),
+ supported_parameters=_supported_parameters(m),
+ ))
return out
@@ -830,15 +586,13 @@ def pick_vision_model(provider: str) -> str | None:
continue
out_mods = m.get("output_modalities")
params = m.get("supported_parameters")
- candidates.append(
- ModelInfo(
- id=mid,
- label=str(m.get("label") or mid),
- output_modalities=tuple(out_mods) if isinstance(out_mods, list) else None,
- input_modalities=tuple(str(x) for x in inp),
- supported_parameters=tuple(params) if isinstance(params, list) else None,
- )
- )
+ candidates.append(ModelInfo(
+ id=mid,
+ label=str(m.get("label") or mid),
+ output_modalities=tuple(out_mods) if isinstance(out_mods, list) else None,
+ input_modalities=tuple(str(x) for x in inp),
+ supported_parameters=tuple(params) if isinstance(params, list) else None,
+ ))
usable = sort_models(provider, filter_brain_models(candidates))
return usable[0].id if usable else None
@@ -848,13 +602,7 @@ def pick_vision_model(provider: str) -> str | None:
#: dominates mission wall-clock (live forensic 2026-07-02: think=60.8s of a
#: 75.8s mission on a flagship model). Data, not logic; extend by adding a row.
_FAST_CLASS_MARKERS: tuple[str, ...] = (
- "flash",
- "haiku",
- "mini",
- "lite",
- "turbo",
- "air",
- "nano",
+ "flash", "haiku", "mini", "lite", "turbo", "air", "nano",
)
@@ -914,15 +662,13 @@ def pick_fast_vision_model(provider: str) -> str | None:
continue
out_mods = m.get("output_modalities")
params = m.get("supported_parameters")
- candidates.append(
- ModelInfo(
- id=mid,
- label=str(m.get("label") or mid),
- output_modalities=tuple(out_mods) if isinstance(out_mods, list) else None,
- input_modalities=tuple(str(x) for x in inp),
- supported_parameters=tuple(params) if isinstance(params, list) else None,
- )
- )
+ candidates.append(ModelInfo(
+ id=mid,
+ label=str(m.get("label") or mid),
+ output_modalities=tuple(out_mods) if isinstance(out_mods, list) else None,
+ input_modalities=tuple(str(x) for x in inp),
+ supported_parameters=tuple(params) if isinstance(params, list) else None,
+ ))
usable = sort_models(provider, filter_brain_models(candidates))
if not usable:
return None
@@ -957,26 +703,9 @@ def _output_modalities(entry: dict) -> tuple[str, ...] | None:
# Gemini catalog in particular front-loads Veo/Imagen/Lyria/Nano-Banana. A truly
# exotic model is still reachable via the free-text custom entry.
_NON_BRAIN_MARKERS: tuple[str, ...] = (
- "veo",
- "imagen",
- "lyria",
- "nano-banana",
- "dall-e",
- "dalle",
- "sora",
- "whisper",
- "transcrib",
- "speech",
- "tts",
- "-audio",
- "audio-",
- "embed",
- "image",
- "moderation",
- "rerank",
- "realtime",
- "-live",
- "guard",
+ "veo", "imagen", "lyria", "nano-banana", "dall-e", "dalle", "sora",
+ "whisper", "transcrib", "speech", "tts", "-audio", "audio-",
+ "embed", "image", "moderation", "rerank", "realtime", "-live", "guard",
)
@@ -985,15 +714,9 @@ _NON_BRAIN_MARKERS: tuple[str, ...] = (
# it is pure noise in the picker). NOTE: this is about OUTPUT only; a model that
# ACCEPTS image INPUT (vision) but outputs text is a valid — even required —
# brain (Computer-Use needs vision-input), so input modalities are NOT filtered.
-_GENERATION_OUTPUT_MODALITIES: frozenset[str] = frozenset(
- {
- "image",
- "audio",
- "video",
- "music",
- "speech",
- }
-)
+_GENERATION_OUTPUT_MODALITIES: frozenset[str] = frozenset({
+ "image", "audio", "video", "music", "speech",
+})
def filter_brain_models(models: list[ModelInfo]) -> list[ModelInfo]:
@@ -1064,34 +787,15 @@ def _is_stale(provider: str, model_id: str) -> bool:
# anything, so this is a sensible default order, not a hard curation.
_FAMILY_RANK: tuple[tuple[str, int], ...] = (
# Flagship frontier
- ("claude-opus", 39),
- ("claude-fable", 39),
- ("claude-sonnet", 38),
- ("gpt-5", 37),
- ("gemini-3", 36),
- ("grok-4", 35),
- ("claude-haiku", 33),
+ ("claude-opus", 39), ("claude-fable", 39), ("claude-sonnet", 38),
+ ("gpt-5", 37), ("gemini-3", 36), ("grok-4", 35), ("claude-haiku", 33),
# Popular / strong value
- ("deepseek", 29),
- ("kimi", 28),
- ("glm-5", 27),
- ("qwen3", 26),
- ("qwen-3", 26),
- ("glm-4", 25),
- ("llama-4", 24),
- ("mistral-large", 23),
- ("mistral-medium", 22),
- ("gpt-oss", 21),
- ("command-r", 20),
+ ("deepseek", 29), ("kimi", 28), ("glm-5", 27), ("qwen3", 26),
+ ("qwen-3", 26), ("glm-4", 25), ("llama-4", 24), ("mistral-large", 23),
+ ("mistral-medium", 22), ("gpt-oss", 21), ("command-r", 20),
# Older-but-mainstream
- ("gpt-4", 15),
- ("gemini-2", 14),
- ("grok-3", 13),
- ("llama-3", 12),
- ("mistral", 11),
- ("qwen", 10),
- ("glm", 10),
- ("command", 9),
+ ("gpt-4", 15), ("gemini-2", 14), ("grok-3", 13), ("llama-3", 12),
+ ("mistral", 11), ("qwen", 10), ("glm", 10), ("command", 9),
)
@@ -1143,18 +847,16 @@ def _squash(text: str) -> str:
# stripped) so the same pick is starred whether it comes from a direct provider
# (``claude-opus-4-8``) or OpenRouter (``anthropic/claude-opus-4.8``). Extend
# freely — this is a curated favourites list, presentation only.
-STARRED_MODELS: frozenset[str] = frozenset(
- {
- _squash("claude-opus-4.8"), # Opus 4.8
- _squash("claude-opus-4.8-fast"), # Opus 4.8 (Fast)
- _squash("gpt-5.6"), # GPT-5.6 alias (direct OpenAI)
- _squash("gpt-5.6-sol"), # GPT-5.6 flagship (OpenAI/OpenRouter)
- _squash("gpt-5.5"), # GPT-5.5
- _squash("gemini-3.5-flash"), # Gemini 3.5 Flash
- _squash("claude-fable-5"), # Fable 5
- _squash("glm-5.2"), # GLM-5.2
- }
-)
+STARRED_MODELS: frozenset[str] = frozenset({
+ _squash("claude-opus-4.8"), # Opus 4.8
+ _squash("claude-opus-4.8-fast"), # Opus 4.8 (Fast)
+ _squash("gpt-5.6"), # GPT-5.6 alias (direct OpenAI)
+ _squash("gpt-5.6-sol"), # GPT-5.6 flagship (OpenAI/OpenRouter)
+ _squash("gpt-5.5"), # GPT-5.5
+ _squash("gemini-3.5-flash"), # Gemini 3.5 Flash
+ _squash("claude-fable-5"), # Fable 5
+ _squash("glm-5.2"), # GLM-5.2
+})
def is_free_model(model_id: str, label: str = "") -> bool:
@@ -1201,21 +903,12 @@ def classify_model(model_id: str, label: str = "") -> ModelTags:
# special-purpose siblings rarely wanted as the default pick. The full flagship
# (incl. ``-pro``) is NOT demoted.
_SPECIALIZED_MARKERS: tuple[str, ...] = (
- "-mini",
- "-nano",
- "-lite",
- ":free",
- "-codex",
- "-chat",
- "-search",
- "-air",
- "-flash-lite",
+ "-mini", "-nano", "-lite", ":free", "-codex", "-chat",
+ "-search", "-air", "-flash-lite",
# Special-purpose siblings — not the default chat brain, so they rank below
# the plain model of the same family. (Image/audio variants are already
# dropped upstream by filter_brain_models, so they need no marker here.)
- "-deep-research",
- "-multi-agent",
- "-customtools",
+ "-deep-research", "-multi-agent", "-customtools",
)
@@ -1310,7 +1003,6 @@ def sort_models(provider: str, models: list[ModelInfo]) -> list[ModelInfo]:
# Catalog with cache + live fetch + static fallback
# ----------------------------------------------------------------------
-
class ModelCatalog:
"""Live model lists per provider with a TTL cache and honest fallbacks."""
@@ -1398,8 +1090,7 @@ class ModelCatalog:
for prov, (ts, models) in self._cache.items()
}
self._cache_path.write_text(
- json.dumps(data, indent=2),
- encoding="utf-8",
+ json.dumps(data, indent=2), encoding="utf-8",
)
def _is_fresh(self, provider: str, fetched_at: float) -> bool:
@@ -1416,7 +1107,9 @@ class ModelCatalog:
# -- public API ----------------------------------------------------
- async def list_models(self, provider: str, *, force_refresh: bool = False) -> CatalogResult:
+ async def list_models(
+ self, provider: str, *, force_refresh: bool = False
+ ) -> CatalogResult:
"""Return the catalog for ``provider`` with an honest ``source`` flag.
Brain providers with a live endpoint: fresh cache → ``cache`` (no
@@ -1445,11 +1138,7 @@ class ModelCatalog:
cached = self._cache.get(provider)
if cached and not force_refresh and self._is_fresh(provider, cached[0]):
return CatalogResult(
- provider,
- self._present(provider, cached[1]),
- "cache",
- cached[0],
- "model",
+ provider, self._present(provider, cached[1]), "cache", cached[0], "model",
)
try:
@@ -1458,30 +1147,18 @@ class ModelCatalog:
log.info("Model catalog fetch for %s failed: %s", provider, exc)
if cached:
return CatalogResult(
- provider,
- self._present(provider, cached[1]),
- "cache",
- cached[0],
- "model",
+ provider, self._present(provider, cached[1]), "cache", cached[0], "model",
)
static = self._static_fallback(provider)
return CatalogResult(
- provider,
- self._present(provider, static),
- "static",
- 0.0,
- "model",
+ provider, self._present(provider, static), "static", 0.0, "model",
)
now = time.time()
self._cache[provider] = (now, models)
self._save_cache()
return CatalogResult(
- provider,
- self._present(provider, models),
- "live",
- now,
- "model",
+ provider, self._present(provider, models), "live", now, "model",
)
# -- network -------------------------------------------------------
@@ -1491,49 +1168,15 @@ class ModelCatalog:
return self._client_factory() # type: ignore[operator]
return httpx.AsyncClient(timeout=12.0)
- @staticmethod
- def _resolve_catalog_url(provider: str, ep: _CatalogEndpoint) -> str:
- """The effective catalog URL: team proxy → base_url override → vendor
- default, composed with the provider's ``path``.
-
- Local providers store a bare SERVER ROOT (a pasted ``…/v1`` is
- normalized away, ollama honors OLLAMA_HOST); cloud providers compose
- exactly like the former static table with no override configured.
- """
- if provider in ("ollama", "local-openai"):
- # Lazy plugin import (pure helpers) — keeps module import light.
- from jarvis.plugins.brain.ollama import (
- default_server_root,
- normalize_server_root,
- )
-
- vendor_default = default_server_root() if provider == "ollama" else None
- resolved = cfg.resolve_provider_endpoint(
- provider, vendor_default_base_url=vendor_default
- )
- if not resolved.base_url:
- raise RuntimeError(
- "No server URL configured for the local OpenAI-compatible "
- "provider — set it on the provider card first."
- )
- return normalize_server_root(resolved.base_url) + ep.path
-
- resolved = cfg.resolve_provider_endpoint(provider, vendor_default_base_url=ep.vendor_base)
- base = (resolved.base_url or "").rstrip("/")
- return base + ep.path
-
async def _fetch_raw(self, provider: str) -> list[ModelInfo]:
"""Call ``provider``'s catalog endpoint and parse it. Raises on no key
- (public catalogs and keyless local providers excepted) or a
- transport/HTTP error."""
+ (except OpenRouter, whose catalog is public) or a transport/HTTP error."""
if provider not in _ENDPOINTS:
raise ValueError(f"Unsupported provider: {provider}")
- ep = _ENDPOINTS[provider]
- url = self._resolve_catalog_url(provider, ep)
+ url, auth = _ENDPOINTS[provider]
key = cfg.get_provider_secret(provider)
- if not key and ep.auth in ("x-api-key", "bearer", "query"):
+ if not key and auth != "bearer_opt":
raise RuntimeError(f"No API key configured for {provider}.")
- auth = ep.auth
headers: dict[str, str] = {}
params: dict[str, str] = {}
@@ -1546,12 +1189,6 @@ class ModelCatalog:
headers = {"Authorization": f"Bearer {key}"}
elif auth == "query":
params = {"key": key or ""}
- elif auth == "none" and ep.secret_slot is not None:
- # Keyless local server with an OPTIONAL stored key (e.g. vLLM
- # --api-key): attach it when present, stay anonymous otherwise.
- optional = cfg.get_secret(*ep.secret_slot)
- if optional:
- headers = {"Authorization": f"Bearer {optional}"}
client = await self._client()
async with client:
diff --git a/jarvis/clis/prober.py b/jarvis/clis/prober.py
index 6ff43e4309..e4ca1318c5 100644
--- a/jarvis/clis/prober.py
+++ b/jarvis/clis/prober.py
@@ -35,6 +35,16 @@ AUTH_TIMEOUT_S = 15.0
# bootstrap path that awaits it, see jarvis/clis/loader.py) forever. A leaked
# zombie process beats an infinite hang.
KILL_WAIT_TIMEOUT_S = 2.0
+# Budget for a WHOLE catalog sweep. Derived from the per-probe bounds above so
+# the two can never drift out of order: a single legitimate probe may spend
+# CHECK_TIMEOUT_S + KILL_WAIT_TIMEOUT_S on the binary and AUTH_TIMEOUT_S +
+# KILL_WAIT_TIMEOUT_S on the auth check (29s today) before it is anything but
+# healthy. The extra headroom covers OS scheduling when ~20 probes each spawn
+# their own subprocess at once — on Windows an AV scanner alone can add
+# seconds. A sweep budget BELOW the single-probe worst case would fire during
+# normal operation instead of acting as a backstop (see BUG: the 30s registry
+# ceiling blanked all 22 CLIs on 2026-07-25).
+PROBE_ALL_TIMEOUT_S = CHECK_TIMEOUT_S + AUTH_TIMEOUT_S + 2 * KILL_WAIT_TIMEOUT_S + 15.0
class CliStatusProber:
@@ -56,16 +66,66 @@ class CliStatusProber:
)
async def probe_all(self, specs: list[CliSpec]) -> dict[str, CliStatus]:
- results = await asyncio.gather(
- *(self.probe(spec) for spec in specs), return_exceptions=True
- )
+ """Probe every spec concurrently and ALWAYS return one row per spec.
+
+ Bounded per spec, not just in aggregate: probes that outlive
+ ``PROBE_ALL_TIMEOUT_S`` are cancelled individually and reported as
+ unknown, while every probe that finished keeps its real result. The
+ old ``wait_for(gather(...))`` shape cancelled the whole sweep, so a
+ few wedged Windows ``.cmd`` shims discarded the results of every
+ healthy CLI as well (0 tools exposed for the rest of the session).
+
+ A timed-out probe is ``CliStatus()`` — unknown, deliberately WITHOUT
+ ``error``: ``cli_routes._status_string`` renders any error as the red
+ "error" label, and "we could not finish checking" is not the same
+ claim as "this CLI is broken".
+ """
+ if not specs:
+ return {}
+ tasks = [asyncio.ensure_future(self.probe(spec)) for spec in specs]
+ await asyncio.wait(tasks, timeout=PROBE_ALL_TIMEOUT_S)
+
out: dict[str, CliStatus] = {}
- for spec, res in zip(specs, results, strict=False):
- if isinstance(res, BaseException):
- log.warning("probe(%s) exception: %s", spec.name, res)
- out[spec.name] = CliStatus(error=str(res))
+ wedged: list[asyncio.Future[CliStatus]] = []
+ for spec, task in zip(specs, tasks, strict=False):
+ if not task.done():
+ task.cancel()
+ wedged.append(task)
+ log.warning(
+ "probe(%s): still running after %.0fs — reporting it as "
+ "unknown so the rest of the catalog keeps its results.",
+ spec.name,
+ PROBE_ALL_TIMEOUT_S,
+ )
+ out[spec.name] = CliStatus()
+ continue
+ if task.cancelled():
+ out[spec.name] = CliStatus()
+ continue
+ exc = task.exception()
+ if exc is not None:
+ log.warning("probe(%s) exception: %s", spec.name, exc)
+ out[spec.name] = CliStatus(error=str(exc))
else:
- out[spec.name] = res
+ out[spec.name] = task.result()
+
+ if wedged:
+ # Let the cancellations settle so asyncio does not log "Task was
+ # destroyed but it is pending" — but bounded, because the whole
+ # point here is that these probes do not come back promptly. A
+ # leaked task (and its zombie subprocess) beats a hung sweep,
+ # exactly as in the kill()/wait() path above.
+ try:
+ await asyncio.wait_for(
+ asyncio.gather(*wedged, return_exceptions=True),
+ timeout=KILL_WAIT_TIMEOUT_S,
+ )
+ except TimeoutError:
+ log.warning(
+ "probe_all: %d probe(s) did not honour cancellation — "
+ "leaking them instead of blocking the sweep.",
+ len(wedged),
+ )
return out
async def _probe_binary(self, spec: CliSpec) -> tuple[bool, str | None, str | None]:
diff --git a/jarvis/clis/registry.py b/jarvis/clis/registry.py
index 413e285b47..78b6cd6575 100644
--- a/jarvis/clis/registry.py
+++ b/jarvis/clis/registry.py
@@ -9,20 +9,28 @@ from typing import Any
from jarvis.clis.auth import CliAuthManager
from jarvis.clis.catalog import CliCatalog
from jarvis.clis.installer import CliInstaller
-from jarvis.clis.prober import CliStatusProber
+from jarvis.clis.prober import PROBE_ALL_TIMEOUT_S, CliStatusProber
from jarvis.clis.spec import CliSpec, CliStatus
from jarvis.clis.tool import CliTool
from jarvis.clis.usage_log import UsageLog
log = logging.getLogger(__name__)
-# Defence-in-depth ceiling around ``probe_all`` (Prober already bounds each
-# individual probe, see jarvis/clis/prober.py CHECK_TIMEOUT_S/AUTH_TIMEOUT_S/
-# KILL_WAIT_TIMEOUT_S). This is a second, coarser backstop: bootstrap() is
-# awaited synchronously by the headless CLI path
+# Defence-in-depth ceiling around ``probe_all``. The prober bounds each
+# individual probe (CHECK_TIMEOUT_S/AUTH_TIMEOUT_S/KILL_WAIT_TIMEOUT_S) AND
+# the whole sweep (PROBE_ALL_TIMEOUT_S), returning partial results rather
+# than cancelling everything. This is the last resort for a prober that
+# wedges BEFORE its own budget applies (a code bug, not slow CLIs):
+# bootstrap() is awaited synchronously by the headless CLI path
# (``asyncio.run(registry.bootstrap())`` in jarvis/clis/loader.py) and must
-# never hang the whole process even if a probe somehow still wedges.
-_BOOTSTRAP_CEILING_S = 30.0
+# never hang the whole process.
+#
+# It is derived from the sweep budget so the two can never invert. When this
+# ceiling sat BELOW the prober's own worst case (30s vs. 29s per probe), it
+# fired during routine operation and replaced every probed result with an
+# error row — 22 red "error" CLIs and zero exposed tools, for the rest of
+# the session (observed 2026-07-25 09:06:10).
+_BOOTSTRAP_CEILING_S = PROBE_ALL_TIMEOUT_S + 15.0
class CliToolRegistry:
@@ -71,7 +79,7 @@ class CliToolRegistry:
self._bootstrapped = True
self._sync_capabilities()
log.info(
- "cli-registry: %d von %d CLIs als Tools exponiert",
+ "cli-registry: %d of %d CLIs exposed as tools",
len(self._tools),
len(specs),
)
diff --git a/jarvis/missions/kontrollierer/orchestrator.py b/jarvis/missions/kontrollierer/orchestrator.py
index 2bea6598f2..54876a6206 100644
--- a/jarvis/missions/kontrollierer/orchestrator.py
+++ b/jarvis/missions/kontrollierer/orchestrator.py
@@ -1438,9 +1438,8 @@ class Kontrollierer:
),
}
logger.error(
- "Task %s iter %d: refusing critic review after an "
- "integrity-compromised supervisor tool grant (a call was "
- "still running or its outcome is unknown): %s",
+ "Task %s iter %d: refusing critic review after an unclean "
+ "supervisor tool grant: %s",
step.task_id,
iteration,
error_detail,
@@ -1657,28 +1656,13 @@ class Kontrollierer:
if safety_kill_reason is not None:
return TaskOutcome.ERROR
- # Critic-Call. Honest supervisor-tool refusals (denied/timed-out/
- # errored calls the worker OBSERVED in-stream) did not abort the
- # iteration — only integrity failures do — but the critic must
- # judge the deliverable WITH the refusal list: "the task depended
- # on the denied call" is a reject, "the worker adapted" is not
- # (BUG-096: execution, artifact, approval, and outcome are four
- # separate facts). Appended to the critic's log view only, never
- # to the diff, and after the safety scan so the scanner never
- # reads our own note.
- critic_log = log_text
- if spawn_result.supervisor_tool_refusals:
- critic_log = (
- f"{log_text}\n\n"
- "# supervisor-tool refusals (observed by the worker)\n"
- f"{spawn_result.supervisor_tool_refusals}\n"
- )
+ # Critic-Call
env = self._env_builder(mission_dir)
try:
verdict = await self._runner.run(
mission_prompt=mission_prompt,
worker_diff=diff_text,
- worker_log=critic_log,
+ worker_log=log_text,
prior_reflections=prior_block,
iteration=iteration,
worktree=worktree,
@@ -1826,7 +1810,6 @@ class Kontrollierer:
worker_timed_out: bool = False,
supervisor_tool_failed: bool = False,
supervisor_tool_error: str | None = None,
- supervisor_tool_refusals: str | None = None,
) -> None:
self.worker_id = worker_id
self.cost_usd = cost_usd
@@ -1847,10 +1830,6 @@ class Kontrollierer:
self.worker_error = worker_error
self.supervisor_tool_failed = supervisor_tool_failed
self.supervisor_tool_error = supervisor_tool_error
- # Observed refusals (denied/timed_out/error/cancelled) — the
- # worker saw these in-stream and could adapt; they do NOT fail
- # the iteration, they inform the critic (BUG-096 four facts).
- self.supervisor_tool_refusals = supervisor_tool_refusals
async def _spawn_worker_collect(
self,
@@ -2058,12 +2037,8 @@ class Kontrollierer:
session_id=session_id,
worker_error=worker_error,
worker_timed_out=worker_timed_out,
- # Only INTEGRITY failures (outcome_unknown / still-active calls)
- # abort the iteration — an observed refusal keeps the work
- # reviewable and reaches the critic as context instead.
- supervisor_tool_failed=broker_summary.integrity_compromised,
+ supervisor_tool_failed=not broker_summary.clean,
supervisor_tool_error=broker_summary.failure_summary,
- supervisor_tool_refusals=broker_summary.refusal_summary,
)
# --- Phase-5 Safety -----------------------------------------------------
diff --git a/jarvis/missions/kontrollierer/worker_prompt.py b/jarvis/missions/kontrollierer/worker_prompt.py
index aa272406ca..b971889adf 100644
--- a/jarvis/missions/kontrollierer/worker_prompt.py
+++ b/jarvis/missions/kontrollierer/worker_prompt.py
@@ -80,9 +80,7 @@ SUPERVISOR_BOUNDARY_DIRECTIVE: Final[str] = (
"app; never operate the live desktop or Computer Use; never read control "
"credentials; and never change live configuration. For Wiki work, use only "
"the supervisor-granted wiki-list, wiki-recall, wiki-page-read, and "
- "wiki-ingest tools. A denied or failed supervisor tool call is a normal, "
- "recoverable event: adapt your approach, use an alternative, or deliver "
- "the remainder of the task and state the limitation in your summary."
+ "wiki-ingest tools."
)
diff --git a/jarvis/missions/workers/api_agent_worker.py b/jarvis/missions/workers/api_agent_worker.py
index b22cea94fb..ffaa8410c6 100644
--- a/jarvis/missions/workers/api_agent_worker.py
+++ b/jarvis/missions/workers/api_agent_worker.py
@@ -171,10 +171,7 @@ _SYSTEM_PROMPT = (
"workspace. Your ONLY way to deliver work is to call the provided tools — "
"Write, Edit, Read, RunCommand, Ls, plus any mission-scoped connected tools — "
"with file paths relative to the workspace root. Connected tools are "
- "executed by the supervisor and may honestly require human approval; a "
- "denied or failed connected-tool call is a normal, recoverable event - "
- "adapt, use an alternative, or deliver the remainder and state the "
- "limitation in your summary. "
+ "executed by the supervisor and may honestly require human approval. "
"Actually CREATE and EDIT the files the task needs; never just describe what "
"you would do (a text description is not a deliverable and will be rejected). "
"Work autonomously without asking questions: if a detail is unspecified, pick "
diff --git a/jarvis/missions/workers/worker_tool_broker.py b/jarvis/missions/workers/worker_tool_broker.py
index 1d72f55a65..c08a34c205 100644
--- a/jarvis/missions/workers/worker_tool_broker.py
+++ b/jarvis/missions/workers/worker_tool_broker.py
@@ -117,28 +117,6 @@ class WorkerToolCallOutcome:
error: str = ""
-# Statuses the worker OBSERVED as an in-stream error response (broker_stdio
-# returns isError=True; API workers get the error dict directly) — the worker
-# had the chance to adapt, so these are honest refusals, not integrity holes.
-_OBSERVED_REFUSAL_STATUSES: tuple[str, ...] = ("denied", "cancelled", "timed_out", "error")
-# Statuses where the supervisor cannot certify what actually happened: the
-# call was still running when the grant closed, or its outcome was rewritten
-# to unknown at revocation.
-_INTEGRITY_STATUSES: tuple[str, ...] = ("outcome_unknown", "active")
-
-
-def _outcome_preview(calls: list["WorkerToolCallOutcome"]) -> str | None:
- if not calls:
- return None
- preview = "; ".join(
- f"{call.tool_name}: {call.status}" + (f" ({call.error})" if call.error else "")
- for call in calls[:3]
- )
- if len(calls) > 3:
- preview += f"; +{len(calls) - 3} more"
- return safe_preview(preview, max_chars=300)
-
-
@dataclass(frozen=True, slots=True)
class WorkerToolExecutionSummary:
"""Completion certificate consumed by the mission controller."""
@@ -149,34 +127,23 @@ class WorkerToolExecutionSummary:
def clean(self) -> bool:
return all(call.status == "success" for call in self.calls)
- @property
- def integrity_compromised(self) -> bool:
- """True when the supervisor cannot certify what actually happened.
-
- Only these outcomes abort an iteration before critic review. Honest
- refusals (:data:`_OBSERVED_REFUSAL_STATUSES`) keep the iteration
- reviewable — per the BUG-096 class rule, worker execution and critic
- approval are separate facts, and the critic judges the deliverable
- WITH knowledge of the refusals (see ``refusal_summary``).
- """
- return any(call.status in _INTEGRITY_STATUSES for call in self.calls)
-
@property
def active_count(self) -> int:
return sum(call.status == "active" for call in self.calls)
@property
def failure_summary(self) -> str | None:
- return _outcome_preview(
- [call for call in self.calls if call.status != "success"]
- )
-
- @property
- def refusal_summary(self) -> str | None:
- """Bounded preview of the observed refusals, for the critic's context."""
- return _outcome_preview(
- [call for call in self.calls if call.status in _OBSERVED_REFUSAL_STATUSES]
+ failed = [call for call in self.calls if call.status != "success"]
+ if not failed:
+ return None
+ preview = "; ".join(
+ f"{call.tool_name}: {call.status}"
+ + (f" ({call.error})" if call.error else "")
+ for call in failed[:3]
)
+ if len(failed) > 3:
+ preview += f"; +{len(failed) - 3} more"
+ return safe_preview(preview, max_chars=300)
def worker_tool_name_allowed(name: str) -> bool:
diff --git a/jarvis/plugins/brain/local_openai.py b/jarvis/plugins/brain/local_openai.py
deleted file mode 100644
index ea2b76a83c..0000000000
--- a/jarvis/plugins/brain/local_openai.py
+++ /dev/null
@@ -1,139 +0,0 @@
-"""Generic local OpenAI-compatible brain (HuggingFace transformers serve & co).
-
-One card for every self-hosted server that speaks the OpenAI Chat-Completions
-format: HuggingFace ``transformers serve`` (port 8000), llama.cpp
-``llama-server`` (port 8080), vLLM, LM Studio (port 1234) — and TGI installs
-keep working, though TGI itself is in maintenance mode and never the
-recommendation. Ollama has its own dedicated provider; this is the
-bring-your-own-server slot.
-
-Unlike the cloud brains there is NO vendor default endpoint — a base URL is
-REQUIRED and its absence raises an honest, example-bearing error instead of
-guessing a port. The credential is OPTIONAL (``local_openai_api_key`` /
-``LOCAL_OPENAI_API_KEY``): most local servers ignore it, some (LM Studio
-behind a reverse proxy, vLLM with ``--api-key``) check it. Keyless by design
-(§3 / AP-22): ``local-openai`` stays ABSENT from
-``PROVIDER_SECRET_CANDIDATES`` so the key-aware resolver treats it as always
-reachable and a dead server just fast-fails across families.
-
-Vision is deliberately declared unsupported: whether a given local server
-accepts image content is unknowable here, and the shared streamer then DROPS
-images with a warning instead of letting a text-only server reject the whole
-turn. Vision users take the Ollama card (which negotiates real multimodal
-models) or a cloud brain.
-"""
-
-from __future__ import annotations
-
-import logging
-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 stream_complete
-from .ollama import normalize_server_root
-
-log = logging.getLogger(__name__)
-
-# Same shape as the Ollama timeout: a dead local server must fail fast so the
-# fallback chain crosses families; a slow CPU-bound generation may stream long.
-CLIENT_TIMEOUT = httpx.Timeout(connect=2.0, read=120.0, write=30.0, pool=30.0)
-
-_NO_BASE_URL_HELP = (
- "The local OpenAI-compatible provider needs a server URL — set it on the "
- 'provider card (or [brain.providers."local-openai"].base_url). Examples: '
- "HuggingFace transformers serve: http://localhost:8000 - "
- "llama.cpp llama-server: http://localhost:8080 - "
- "LM Studio: http://localhost:1234 - vLLM: http://localhost:8000."
-)
-
-
-class LocalOpenAIBrain:
- name: str = "local-openai"
- # Conservative floor — the real window depends on the served model; the
- # manager treats this as a budget hint, not a hard cap.
- context_window: int = 32_768
- supports_tools: bool = True
- supports_vision: bool = False
-
- def __init__(self, model: str | None = None) -> None:
- self._model = (model or "").strip()
- self._client: Any = None
- self._server_root: str | None = None
- self._credential: str | None = None
-
- def can_call_tools(self) -> bool:
- return self.supports_tools
-
- def _resolve_root(self) -> str:
- if self._server_root is None:
- ep = cfg.resolve_provider_endpoint("local-openai", vendor_default_base_url=None)
- if not ep.base_url:
- raise RuntimeError(_NO_BASE_URL_HELP)
- # Root convention (same as the Ollama card): the stored value is
- # the SERVER root; ``/v1`` is appended here, and a pasted ``…/v1``
- # is normalized away instead of doubling up.
- self._server_root = normalize_server_root(ep.base_url)
- # Optional key: a team-proxy token wins, else the user's optional
- # local key, else a placeholder the server ignores.
- self._credential = ep.credential or cfg.get_secret(
- "local_openai_api_key", "LOCAL_OPENAI_API_KEY"
- )
- return self._server_root
-
- def _ensure_client(self) -> Any:
- if self._client is None:
- root = self._resolve_root()
- from openai import AsyncOpenAI
-
- self._client = AsyncOpenAI(
- api_key=self._credential or "local",
- base_url=f"{root}/v1",
- timeout=CLIENT_TIMEOUT,
- )
- return self._client
-
- async def _resolve_model(self) -> str:
- """The configured model, else the first one the server lists (``/v1/models``)."""
- if self._model:
- return self._model
- root = self._resolve_root()
- headers = {}
- if self._credential:
- headers["Authorization"] = f"Bearer {self._credential}"
- try:
- async with httpx.AsyncClient(timeout=CLIENT_TIMEOUT) as client:
- resp = await client.get(f"{root}/v1/models", headers=headers)
- resp.raise_for_status()
- data = resp.json().get("data") or []
- except Exception as exc:
- raise RuntimeError(
- f"Local OpenAI-compatible server not reachable at {root} — is it "
- "running? (transformers serve / llama-server / LM Studio / vLLM)"
- ) from exc
- names = [str(m.get("id") or "").strip() for m in data]
- names = [n for n in names if n]
- if not names:
- raise RuntimeError(
- f"The server at {root} lists no models (/v1/models is empty) — "
- "load a model in the server, or set one explicitly on the card."
- )
- self._model = names[0]
- log.info("local-openai: no model configured — using first served: %s", self._model)
- return self._model
-
- async def complete(self, req: BrainRequest) -> AsyncIterator[BrainDelta]:
- client = self._ensure_client()
- model = await self._resolve_model()
- async for delta in stream_complete(
- client, model, req, supports_vision=self.supports_vision
- ):
- yield delta
-
- def estimate_cost(self, req: BrainRequest) -> float:
- # Local inference has no per-token bill.
- return 0.0
diff --git a/jarvis/setup/wizard.py b/jarvis/setup/wizard.py
index 8dbcacdc97..1d1abb6c87 100644
--- a/jarvis/setup/wizard.py
+++ b/jarvis/setup/wizard.py
@@ -173,17 +173,6 @@ SECRETS: list[SecretSpec] = [
required_for="Grok Brain and xAI TTS",
section="brain",
),
- # Optional key for the generic local OpenAI-compatible provider (vLLM
- # --api-key, proxied LM Studio, ...). App-only: local servers usually need
- # no key, so it must not lengthen first-run onboarding.
- SecretSpec(
- key="local_openai_api_key",
- env_fallback="LOCAL_OPENAI_API_KEY",
- label="Local OpenAI-compatible server key (optional)",
- help_url="https://huggingface.co/docs/transformers/main/serving",
- required_for="Local server brain (only if your server enforces a key)",
- prompt=False,
- ),
# Scoped Realtime credentials. They are app-only fields in the Realtime tab,
# not extra first-run questions. Generic credentials remain compatibility
# fallbacks for existing installations.
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
index cd831ef55c..1363f37444 100644
--- a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
@@ -1740,26 +1740,9 @@ function AuthWidget({
<div className="space-y-2">
<ProviderBillingBadge billing={descriptor.billing} />
{descriptor.auth_mode === "none" && (
- <>
- <p className="text-xs text-muted-foreground">
- {descriptor.secret_keys.length > 0
- ? "Local provider — runs without credentials. The key below is optional, only for servers that enforce one (e.g. vLLM --api-key)."
- : "Local provider — no credentials needed."}
- </p>
- {descriptor.secret_keys.map((k) => (
- <ApiKeyForm
- key={k}
- secretKey={k}
- dashboardUrl={descriptor.dashboard_url}
- configured={Boolean(descriptor.secrets_set[k])}
- effectiveConfigured={Boolean(descriptor.secrets_effective?.[k])}
- sharedWith={descriptor.secret_shared_with?.[k] ?? []}
- credentialHelp={descriptor.credential_help}
- onChanged={onChanged}
- onSavedActivate={onSavedActivate}
- />
- ))}
- </>
+ <p className="text-xs text-muted-foreground">
+ Local provider — no credentials needed.
+ </p>
)}
{descriptor.auth_mode === "codex" && (
<CodexAuthWidget descriptor={descriptor} onChanged={onChanged} />
diff --git a/jarvis/ui/web/provider_spec.py b/jarvis/ui/web/provider_spec.py
index 3eddc4227c..20dd486d37 100644
--- a/jarvis/ui/web/provider_spec.py
+++ b/jarvis/ui/web/provider_spec.py
@@ -284,23 +284,6 @@ PROVIDERS: tuple[ProviderSpec, ...] = (
"the server URL at another machine to share one Ollama box."
),
),
- ProviderSpec(
- id="local-openai",
- label="Local server (OpenAI-compatible)",
- tier="brain",
- auth_mode="none",
- secret_keys=("local_openai_api_key",),
- dashboard_url=None,
- signup_url="https://huggingface.co/docs/transformers/main/serving",
- credential_help=(
- "Any self-hosted server that speaks the OpenAI chat format: "
- "HuggingFace transformers serve (http://localhost:8000), llama.cpp "
- "llama-server (http://localhost:8080), LM Studio "
- "(http://localhost:1234), vLLM, or an existing TGI. Set the server "
- "URL on this card — no cloud account, nothing leaves your network. "
- "The API key is optional; most local servers ignore it."
- ),
- ),
# ── TTS ───────────────────────────────────────────────────────────────
# Voice-Output cards render in this tuple order. OpenRouter leads (one key
# reaches many vetted speech models); Inworld sits last as a premium
diff --git a/pyproject.toml b/pyproject.toml
index bff6b34107..4768b03d53 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -459,6 +459,13 @@ gmail = "jarvis.plugins.tool.gmail_rest:GmailRestTool"
# router-tier, risk_tier "monitor" (read-only). A direct gated action, never a
# spawn (AP-5/AP-14). See docs/superpowers/plans/2026-06-07-plugin-skill-pairing-reachability.md.
vercel = "jarvis.plugins.tool.vercel_rest:VercelRestTool"
+# Home Assistant (marketplace plugin, 2026-07-25) — list/read entities and call
+# services over the documented REST API. Native rather than MCP on purpose:
+# Home Assistant declined dynamic client registration and its MCP server is
+# scoped to its own Assist pipeline, so it exposes conversation instead of the
+# entity/service surface a voice assistant needs. risk_tier "ask" because a
+# service call physically changes something in the user's home.
+home_assistant = "jarvis.plugins.tool.home_assistant_rest:HomeAssistantRestTool"
# Google Calendar (marketplace plugin, 2026-06-27) — read/create/update/delete
# calendar events. The bot logic is a dependency-free Node script
# (calendar_bot.mjs); this Python entry point is the OAuth bridge that reuses
diff --git a/tests/contract/test_brain_protocol.py b/tests/contract/test_brain_protocol.py
index 29788ec9e0..acff352f8a 100644
--- a/tests/contract/test_brain_protocol.py
+++ b/tests/contract/test_brain_protocol.py
@@ -21,9 +21,8 @@ BRAIN_PROVIDERS = [
"openrouter",
"openai",
"gemini",
- # Keyless local providers, added 2026-07-25 (local-first mandate).
+ # Keyless local provider, re-added 2026-07-25 (local-first mandate).
"ollama",
- "local-openai",
]
diff --git a/tests/missions/kontrollierer/test_supervisor_tool_completion_gate.py b/tests/missions/kontrollierer/test_supervisor_tool_completion_gate.py
index 007e410ec6..d1b8b47738 100644
--- a/tests/missions/kontrollierer/test_supervisor_tool_completion_gate.py
+++ b/tests/missions/kontrollierer/test_supervisor_tool_completion_gate.py
@@ -1,14 +1,4 @@
-"""Supervisor-tool completion certificate: integrity gates, refusals inform.
-
-Two failure classes, two different consequences (BUG-096 four-facts rule):
-
-* INTEGRITY failures (a call still running when the grant closed /
- ``outcome_unknown``) — the supervisor cannot certify what happened, so the
- iteration is aborted and the critic never runs.
-* OBSERVED refusals (denied / timed-out / errored calls) — the worker saw the
- error in-stream and could adapt, so the iteration stays reviewable and the
- critic receives the refusal list as context.
-"""
+"""The critic cannot approve past an unclean supervisor-tool grant."""
from __future__ import annotations
@@ -136,12 +126,10 @@ def _clean_runtime_refs() -> Any:
@pytest.mark.asyncio
-async def test_observed_tool_error_reaches_critic_with_refusal_note(
+async def test_worker_cannot_hide_failed_tool_call_from_approving_critic(
manager: MissionManager,
tmp_path: Path,
) -> None:
- """A tool ERROR the worker observed in-stream no longer kills the
- iteration — the critic reviews the work WITH the refusal as context."""
gateway = _Gateway(
ToolResult(success=False, output=None, error="connector unavailable")
)
@@ -158,74 +146,14 @@ async def test_observed_tool_error_reaches_critic_with_refusal_note(
state = await kontrollierer.run_mission(mission_id)
- assert state == MissionState.APPROVED
+ assert state == MissionState.FAILED
+ assert critic.calls == []
assert gateway.calls == 1
- assert len(critic.calls) == 1
- critic_log = critic.calls[0]["worker_log"]
- assert "supervisor-tool refusals" in critic_log
- assert "external-action" in critic_log
- assert "connector unavailable" in critic_log
-
-
-async def test_denied_tool_call_reaches_critic_and_is_named(
- manager: MissionManager,
- tmp_path: Path,
-) -> None:
- """An approval denial (e.g. the unattended 60 s timeout) is an observed
- refusal: the mission is graded, not auto-failed as supervisor_tool_failed."""
- gateway = _Gateway(
- ToolResult(success=False, output=None, error="approval-denied (timeout)")
- )
- runtime_refs.set_supervisor_tool_gateway(gateway)
- worker = _BrokerCallingWorker()
- critic = FakeCriticRunner(_make_approve_verdict())
- kontrollierer = _make_kontrollierer(
- manager=manager,
- tmp_path=tmp_path,
- critic=critic,
- worker_factory_fn=lambda _step: worker,
- )
- mission_id = await manager.dispatch(prompt="Perform an external action")
-
- state = await kontrollierer.run_mission(mission_id)
-
- assert state == MissionState.APPROVED
- assert len(critic.calls) == 1
- critic_log = critic.calls[0]["worker_log"]
- assert "denied" in critic_log
events = await manager.store.events_for_mission(mission_id)
+ approved = [e for e in events if e.payload.event_type == "MissionApproved"]
failed = [e for e in events if e.payload.event_type == "MissionFailed"]
- assert failed == []
-
-
-def test_summary_partitions_refusals_from_integrity_failures() -> None:
- """Every non-success status belongs to exactly one bucket: observed
- refusal (keeps the iteration reviewable) or integrity failure (gates)."""
- from jarvis.missions.workers.worker_tool_broker import (
- WorkerToolCallOutcome,
- WorkerToolExecutionSummary,
- )
-
- def call(status: str) -> WorkerToolCallOutcome:
- return WorkerToolCallOutcome(trace_id="t", tool_name="x", status=status) # type: ignore[arg-type]
-
- refusals = WorkerToolExecutionSummary(
- calls=(call("denied"), call("error"), call("timed_out"), call("cancelled"))
- )
- assert refusals.clean is False
- assert refusals.integrity_compromised is False
- assert "denied" in (refusals.refusal_summary or "")
-
- for status in ("outcome_unknown", "active"):
- summary = WorkerToolExecutionSummary(calls=(call(status),))
- assert summary.integrity_compromised is True
- assert summary.refusal_summary is None
-
- clean = WorkerToolExecutionSummary(calls=(call("success"),))
- assert clean.clean is True
- assert clean.integrity_compromised is False
- assert clean.refusal_summary is None
+ assert approved == []
+ assert failed[-1].payload.error_class == "supervisor_tool_failed" # type: ignore[union-attr]
@pytest.mark.asyncio
diff --git a/tests/unit/brain/test_model_catalog_local.py b/tests/unit/brain/test_model_catalog_local.py
deleted file mode 100644
index 2f8da98a70..0000000000
--- a/tests/unit/brain/test_model_catalog_local.py
+++ /dev/null
@@ -1,347 +0,0 @@
-"""Model-catalog behavior pins: cloud regression half (S3a) + local providers.
-
-REGRESSION HALF (written and committed green BEFORE the endpoint refactor,
-maintainer amendment 2026-07-25): for every cloud catalog provider this pins
-the OBSERVABLE fetch behavior — exact URL, auth attachment shape, no-key
-behavior, and the bearer_opt anonymous retry — plus the parser output per
-payload shape. The refactor that makes endpoints resolve through
-``resolve_provider_endpoint`` MUST keep every one of these green without
-touching this file: with no base-url override configured, cloud behavior is
-byte-identical.
-"""
-
-from __future__ import annotations
-
-from typing import Any
-
-import pytest
-
-import jarvis.core.config as cfg
-from jarvis.brain.model_catalog import (
- CATALOG_PROVIDERS,
- ModelCatalog,
- parse_models_response,
-)
-from jarvis.core.config import JarvisConfig
-
-
-class _FakeResponse:
- def __init__(self, payload: dict[str, Any], status_code: int = 200) -> None:
- self._payload = payload
- self.status_code = status_code
-
- def raise_for_status(self) -> None:
- if self.status_code >= 400:
- raise RuntimeError(f"HTTP {self.status_code}")
-
- def json(self) -> dict[str, Any]:
- return self._payload
-
-
-class _FakeClient:
- """Records every GET; optionally rejects the first (authed) call with 401."""
-
- def __init__(self, payload: dict[str, Any], reject_authed: bool = False) -> None:
- self.payload = payload
- self.reject_authed = reject_authed
- self.calls: list[dict[str, Any]] = []
-
- async def __aenter__(self) -> _FakeClient:
- return self
-
- async def __aexit__(self, *exc: Any) -> None:
- return None
-
- async def get(
- self,
- url: str,
- headers: dict[str, str] | None = None,
- params: dict[str, str] | None = None,
- ) -> _FakeResponse:
- self.calls.append({"url": url, "headers": headers or {}, "params": params or {}})
- if self.reject_authed and headers and "Authorization" in headers:
- return _FakeResponse({}, status_code=401)
- return _FakeResponse(self.payload)
-
-
-def _catalog(tmp_path, client: _FakeClient) -> ModelCatalog:
- return ModelCatalog(
- cache_path=tmp_path / "cache.json",
- http_client_factory=lambda: client,
- )
-
-
-def _plain_env(monkeypatch, keys: dict[str, str | None]) -> None:
- """No base-url overrides, no team proxy — the stock cloud setup."""
- monkeypatch.setattr(cfg, "load_config", lambda: JarvisConfig())
- monkeypatch.setattr(cfg, "get_provider_secret", lambda pid: keys.get(pid))
-
-
-_OPENAI_SHAPE = {"data": [{"id": "model-b"}, {"id": "model-a"}]}
-_GEMINI_SHAPE = {"models": [{"name": "models/gemini-x", "displayName": "Gemini X"}]}
-
-# The pinned cloud contract: provider → (URL, auth shape). Deliberately a
-# LITERAL copy, not an import of _ENDPOINTS — the whole point is detecting an
-# accidental change of the wire behavior during the endpoint refactor.
-_PINNED: dict[str, tuple[str, str]] = {
- "claude-api": ("https://api.anthropic.com/v1/models", "x-api-key"),
- "openai": ("https://api.openai.com/v1/models", "bearer"),
- "gemini": ("https://generativelanguage.googleapis.com/v1beta/models", "query"),
- "openrouter": ("https://openrouter.ai/api/v1/models", "bearer_opt"),
- "grok": ("https://api.x.ai/v1/models", "bearer"),
- "nvidia": ("https://integrate.api.nvidia.com/v1/models", "bearer_opt"),
-}
-
-
-def test_pinned_contract_covers_every_cloud_catalog_provider() -> None:
- """A provider added to CATALOG_PROVIDERS must be pinned here (or is local,
- covered by the local half below)."""
- cloud = [p for p in CATALOG_PROVIDERS if p in _PINNED]
- assert set(cloud) == set(_PINNED), (
- "CATALOG_PROVIDERS and the pinned cloud contract diverged — pin the new "
- "provider's URL + auth shape here before shipping it"
- )
-
-
[email protected]("provider", sorted(_PINNED))
-async def test_cloud_fetch_url_and_auth_are_byte_identical(
- provider: str, tmp_path, monkeypatch
-) -> None:
- url, auth = _PINNED[provider]
- payload = _GEMINI_SHAPE if provider == "gemini" else _OPENAI_SHAPE
- client = _FakeClient(payload)
- _plain_env(monkeypatch, {provider: "sk-pin-test"})
-
- result = await _catalog(tmp_path, client).list_models(provider)
-
- assert result.source == "live"
- assert len(client.calls) == 1
- call = client.calls[0]
- assert call["url"] == url
- if auth == "x-api-key":
- assert call["headers"] == {
- "x-api-key": "sk-pin-test",
- "anthropic-version": "2023-06-01",
- }
- assert call["params"] == {}
- elif auth == "bearer":
- assert call["headers"] == {"Authorization": "Bearer sk-pin-test"}
- assert call["params"] == {}
- elif auth == "bearer_opt":
- assert call["headers"] == {"Authorization": "Bearer sk-pin-test"}
- assert call["params"] == {}
- elif auth == "query":
- assert call["headers"] == {}
- assert call["params"] == {"key": "sk-pin-test"}
-
-
- "provider", sorted(p for p, (_, a) in _PINNED.items() if a in ("x-api-key", "bearer", "query"))
-)
-async def test_keyed_cloud_provider_without_key_never_fetches(
- provider: str, tmp_path, monkeypatch
-) -> None:
- """No key → no network call; the picker gets the honest static fallback."""
- client = _FakeClient(_OPENAI_SHAPE)
- _plain_env(monkeypatch, {})
-
- result = await _catalog(tmp_path, client).list_models(provider)
-
- assert result.source == "static"
- assert client.calls == []
- assert result.models, "static fallback must still offer a useful list"
-
-
- "provider", sorted(p for p, (_, a) in _PINNED.items() if a == "bearer_opt")
-)
-async def test_public_catalog_fetches_anonymously_without_key(
- provider: str, tmp_path, monkeypatch
-) -> None:
- client = _FakeClient(_OPENAI_SHAPE)
- _plain_env(monkeypatch, {})
-
- result = await _catalog(tmp_path, client).list_models(provider)
-
- assert result.source == "live"
- assert len(client.calls) == 1
- assert "Authorization" not in client.calls[0]["headers"]
-
-
- "provider", sorted(p for p, (_, a) in _PINNED.items() if a == "bearer_opt")
-)
-async def test_public_catalog_retries_anonymously_on_rejected_key(
- provider: str, tmp_path, monkeypatch
-) -> None:
- """A stale optional key must not hide a PUBLIC catalog (pinned behavior:
- one authed attempt, then one anonymous retry)."""
- client = _FakeClient(_OPENAI_SHAPE, reject_authed=True)
- _plain_env(monkeypatch, {provider: "sk-stale"})
-
- result = await _catalog(tmp_path, client).list_models(provider)
-
- assert result.source == "live"
- assert len(client.calls) == 2
- assert client.calls[0]["headers"] == {"Authorization": "Bearer sk-stale"}
- assert "Authorization" not in client.calls[1]["headers"]
-
-
-# ── Parser pins (shapes the refactor must not disturb) ───────────────────
-def test_parser_openai_compatible_shape() -> None:
- models = parse_models_response("openai", {"data": [{"id": "gpt-x"}, {"id": ""}]})
- assert [(m.id, m.label) for m in models] == [("gpt-x", "gpt-x")]
-
-
-def test_parser_openrouter_uses_human_name_as_label() -> None:
- models = parse_models_response("openrouter", {"data": [{"id": "a/b", "name": "A B"}]})
- assert [(m.id, m.label) for m in models] == [("a/b", "A B")]
-
-
-def _local_env(
- monkeypatch,
- *,
- base_urls: dict[str, str] | None = None,
- stored_local_key: str | None = None,
-) -> None:
- """Hermetic env for the LOCAL providers: optional base-url overrides, no
- real keyring, no ambient OLLAMA_HOST."""
- from jarvis.core.config import BrainConfig, BrainProviderConfig
-
- providers = {pid: BrainProviderConfig(base_url=url) for pid, url in (base_urls or {}).items()}
- conf = JarvisConfig(brain=BrainConfig(providers=providers))
- monkeypatch.setattr(cfg, "load_config", lambda: conf)
- monkeypatch.setattr(cfg, "get_provider_secret", lambda pid: None)
- monkeypatch.setattr(
- cfg,
- "get_secret",
- lambda key, env=None: stored_local_key if key == "local_openai_api_key" else None,
- )
- monkeypatch.delenv("OLLAMA_HOST", raising=False)
-
-
-_OLLAMA_TAGS = {"models": [{"name": "qwen3.5:9b"}, {"name": "glm-5.1:latest"}]}
-
-
-# ── Local half (S3b): ollama /api/tags ───────────────────────────────────
-async def test_ollama_fetches_tags_keyless(tmp_path, monkeypatch) -> None:
- client = _FakeClient(_OLLAMA_TAGS)
- _local_env(monkeypatch)
-
- result = await _catalog(tmp_path, client).list_models("ollama")
-
- assert result.source == "live"
- # The picker applies its relevance sort — pin membership, not order.
- assert {m.id for m in result.models} == {"qwen3.5:9b", "glm-5.1:latest"}
- assert len(client.calls) == 1
- call = client.calls[0]
- assert call["url"] == "http://localhost:11434/api/tags"
- assert call["headers"] == {}
- assert call["params"] == {}
-
-
-async def test_ollama_honors_base_url_override(tmp_path, monkeypatch) -> None:
- """A pasted ``…/v1`` override is normalized to the server root first."""
- client = _FakeClient(_OLLAMA_TAGS)
- _local_env(monkeypatch, base_urls={"ollama": "http://gpu.lan:11434/v1/"})
-
- await _catalog(tmp_path, client).list_models("ollama")
-
- assert client.calls[0]["url"] == "http://gpu.lan:11434/api/tags"
-
-
-async def test_ollama_honors_ollama_host_env(tmp_path, monkeypatch) -> None:
- client = _FakeClient(_OLLAMA_TAGS)
- _local_env(monkeypatch)
- monkeypatch.setenv("OLLAMA_HOST", "0.0.0.0:12345")
-
- await _catalog(tmp_path, client).list_models("ollama")
-
- # 0.0.0.0 is a bind address, not a client target — mapped to localhost.
- assert client.calls[0]["url"] == "http://localhost:12345/api/tags"
-
-
-async def test_ollama_unreachable_returns_honest_empty_static(tmp_path, monkeypatch) -> None:
- """No fake curated list for a local provider: dead server → empty models,
- honest ``static`` source (the card's test button explains the fix)."""
-
- class _DeadClient(_FakeClient):
- async def get(self, url, headers=None, params=None): # type: ignore[override]
- raise RuntimeError("connection refused")
-
- _local_env(monkeypatch)
-
- result = await _catalog(tmp_path, _DeadClient({})).list_models("ollama")
-
- assert result.source == "static"
- assert result.models == ()
-
-
-# ── Local half (S3b): local-openai /v1/models ────────────────────────────
-async def test_local_openai_without_base_url_is_honestly_empty(tmp_path, monkeypatch) -> None:
- """No configured server → no network call, no fake list, no crash."""
- client = _FakeClient(_OPENAI_SHAPE)
- _local_env(monkeypatch)
-
- result = await _catalog(tmp_path, client).list_models("local-openai")
-
- assert result.source == "static"
- assert result.models == ()
- assert client.calls == []
-
-
-async def test_local_openai_fetches_v1_models_from_override(tmp_path, monkeypatch) -> None:
- client = _FakeClient({"data": [{"id": "Qwen/Qwen3.5-9B"}]})
- _local_env(monkeypatch, base_urls={"local-openai": "http://localhost:8000"})
-
- result = await _catalog(tmp_path, client).list_models("local-openai")
-
- assert result.source == "live"
- assert [m.id for m in result.models] == ["Qwen/Qwen3.5-9B"]
- call = client.calls[0]
- assert call["url"] == "http://localhost:8000/v1/models"
- assert call["headers"] == {}
-
-
-async def test_local_openai_attaches_optional_stored_key(tmp_path, monkeypatch) -> None:
- client = _FakeClient({"data": [{"id": "m"}]})
- _local_env(
- monkeypatch,
- base_urls={"local-openai": "http://localhost:8000"},
- stored_local_key="sk-local-pin",
- )
-
- await _catalog(tmp_path, client).list_models("local-openai")
-
- assert client.calls[0]["headers"] == {"Authorization": "Bearer sk-local-pin"}
-
-
-def test_local_ttl_capped_near_live(tmp_path) -> None:
- """The installed-model set changes with every pull/restart — a local
- catalog older than 60 s is stale even under the 6 h default TTL."""
- catalog = _catalog(tmp_path, _FakeClient({}))
- import time as _time
-
- two_minutes_ago = _time.time() - 120
- assert catalog._is_fresh("openai", two_minutes_ago) is True
- assert catalog._is_fresh("ollama", two_minutes_ago) is False
- assert catalog._is_fresh("local-openai", two_minutes_ago) is False
-
-
-def test_parser_ollama_tags_shape() -> None:
- models = parse_models_response("ollama", {"models": [{"name": "qwen3.5:9b"}, {"name": ""}]})
- assert [(m.id, m.label) for m in models] == [("qwen3.5:9b", "qwen3.5:9b")]
-
-
-def test_parser_gemini_strips_prefix_and_gates_on_generate_content() -> None:
- payload = {
- "models": [
- {"name": "models/gemini-x", "displayName": "Gemini X"},
- {
- "name": "models/embedding-001",
- "supportedGenerationMethods": ["embedContent"],
- },
- ]
- }
- models = parse_models_response("gemini", payload)
- assert [(m.id, m.label) for m in models] == [("gemini-x", "Gemini X")]
diff --git a/tests/unit/clis/test_prober_probe_all_partial.py b/tests/unit/clis/test_prober_probe_all_partial.py
new file mode 100644
index 0000000000..4dcfd00dca
--- /dev/null
+++ b/tests/unit/clis/test_prober_probe_all_partial.py
@@ -0,0 +1,141 @@
+"""Regression tests: one wedged CLI probe must not blank out ALL the others.
+
+Root cause this pins (observed 2026-07-25 09:06:10 in the desktop log):
+
+ cli-registry: probe_all exceeded the 30s bootstrap ceiling — keeping
+ 22 CLI(s) at 'unknown' status instead of hanging boot.
+ cli-registry: 0 von 22 CLIs als Tools exponiert
+
+``bootstrap()`` wrapped ``probe_all`` in a single ``asyncio.wait_for``. When a
+handful of Windows ``.cmd`` shims (firebase/wrangler/gcloud/twilio, plus the
+vercel auth probe) burned their full per-probe budget, the whole gather was
+cancelled — discarding the results of every CLI that had long since finished.
+Every entry was then replaced by ``CliStatus(error=...)``, so the CLIs view
+rendered 22 red "error" rows (0 connected, 0 installed) and the brain got
+ZERO cli_* tools, for the rest of the session.
+
+The ceiling was also structurally too tight to ever be a backstop: a single
+legitimate probe may take CHECK_TIMEOUT_S + KILL_WAIT_TIMEOUT_S +
+AUTH_TIMEOUT_S + KILL_WAIT_TIMEOUT_S == 29s, only 1s under the 30s ceiling —
+so normal Windows shim behaviour, not a bug, tripped it.
+"""
+from __future__ import annotations
+
+import asyncio
+
+import pytest
+
+from jarvis.clis import prober as prober_mod
+from jarvis.clis import registry as registry_mod
+from jarvis.clis.prober import CliStatusProber
+from jarvis.clis.spec import AuthConfig, CliSpec, CliStatus, InstallMethods, RiskConfig
+
+
+def _spec(name: str) -> CliSpec:
+ return CliSpec(
+ name=name,
+ display_name=name.upper(),
+ description="d",
+ homepage="",
+ binary_name=name,
+ check_command=(name, "--version"),
+ version_parse_regex=r"(\d+)",
+ install=InstallMethods(manual_url="https://x"),
+ auth=AuthConfig(type="oauth_cli", status_command=(name, "auth", "status")),
+ risk=RiskConfig(default_tier="monitor"),
+ )
+
+
+class _PartiallyWedgedProber(CliStatusProber):
+ """Probes every spec instantly except the ones named in ``hanging``."""
+
+ def __init__(self, hanging: set[str]) -> None:
+ self._hanging = hanging
+
+ async def probe(self, spec: CliSpec) -> CliStatus:
+ if spec.name in self._hanging:
+ await asyncio.sleep(3600)
+ return CliStatus(
+ installed=True,
+ version="1.2.3",
+ binary_path=f"/usr/bin/{spec.name}",
+ auth_status="connected",
+ )
+
+
+async def test_probe_all_keeps_finished_results_when_one_probe_wedges(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """A single wedged probe must cost only ITS OWN row, not everyone else's."""
+ monkeypatch.setattr(prober_mod, "PROBE_ALL_TIMEOUT_S", 0.05)
+
+ specs = [_spec("gh"), _spec("docker"), _spec("gcloud")]
+ prober = _PartiallyWedgedProber(hanging={"gcloud"})
+
+ statuses = await asyncio.wait_for(prober.probe_all(specs), timeout=5.0)
+
+ assert set(statuses) == {"gh", "docker", "gcloud"}
+ # The healthy CLIs survive the wedge with their real, probed result.
+ for name in ("gh", "docker"):
+ assert statuses[name].installed is True, f"{name} lost its probe result"
+ assert statuses[name].version == "1.2.3"
+ assert statuses[name].auth_status == "connected"
+
+
+async def test_wedged_probe_is_unknown_not_an_error_row(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """A probe that ran out of time is UNKNOWN, not a broken CLI.
+
+ ``cli_routes._status_string`` maps any non-empty ``status.error`` to the
+ red "error" label. A CLI we simply could not finish checking must not
+ claim to be faulty — it stays unknown ("checking") so the recheck button
+ and the next boot can still resolve it honestly.
+ """
+ monkeypatch.setattr(prober_mod, "PROBE_ALL_TIMEOUT_S", 0.05)
+
+ prober = _PartiallyWedgedProber(hanging={"gcloud"})
+ statuses = await asyncio.wait_for(prober.probe_all([_spec("gcloud")]), timeout=5.0)
+
+ assert statuses["gcloud"].error is None
+ assert statuses["gcloud"].installed is False
+
+
+async def test_probe_all_still_reports_per_probe_exceptions() -> None:
+ """The pre-existing contract: a raising probe becomes an error row."""
+
+ class _RaisingProber(CliStatusProber):
+ async def probe(self, spec: CliSpec) -> CliStatus:
+ raise RuntimeError("boom")
+
+ statuses = await asyncio.wait_for(
+ _RaisingProber().probe_all([_spec("gh")]), timeout=5.0
+ )
+ assert statuses["gh"].error is not None
+ assert "boom" in statuses["gh"].error
+
+
+async def test_probe_all_handles_an_empty_catalog() -> None:
+ """``asyncio.wait`` rejects an empty task set — guard that edge."""
+ assert await CliStatusProber().probe_all([]) == {}
+
+
+def test_bootstrap_ceiling_stays_above_the_probe_budget() -> None:
+ """Structural guard: the backstop must never be tighter than normal work.
+
+ The 30s ceiling sat 1s above a single legitimate worst-case probe, so
+ routine Windows shim timeouts tripped it and blanked the whole catalog.
+ Both bounds must stay ordered: one probe < the probe_all budget < the
+ registry's defence-in-depth ceiling.
+ """
+ single_probe_worst_case = (
+ prober_mod.CHECK_TIMEOUT_S
+ + prober_mod.AUTH_TIMEOUT_S
+ + 2 * prober_mod.KILL_WAIT_TIMEOUT_S
+ )
+ assert prober_mod.PROBE_ALL_TIMEOUT_S > single_probe_worst_case
+ assert registry_mod._BOOTSTRAP_CEILING_S > prober_mod.PROBE_ALL_TIMEOUT_S
diff --git a/tests/unit/plugins/brain/test_local_openai.py b/tests/unit/plugins/brain/test_local_openai.py
deleted file mode 100644
index f4723479fc..0000000000
--- a/tests/unit/plugins/brain/test_local_openai.py
+++ /dev/null
@@ -1,195 +0,0 @@
-"""Generic local OpenAI-compatible brain: required base URL, optional key.
-
-The card covers HuggingFace transformers serve, llama.cpp llama-server,
-LM Studio, and vLLM with ONE adapter. Unlike the cloud brains there is no
-vendor default endpoint — a missing base URL must raise an honest,
-example-bearing English error, never guess a port. The key is optional and
-only forwarded when the user stored one.
-"""
-
-from __future__ import annotations
-
-from typing import Any
-
-import httpx
-import pytest
-
-import jarvis.core.config as cfg
-from jarvis.core.config import BrainConfig, BrainProviderConfig, JarvisConfig
-from jarvis.plugins.brain.local_openai import LocalOpenAIBrain
-
-
-class _FakeOpenAI:
- last_kwargs: dict[str, Any] = {}
-
- def __init__(self, **kwargs: Any) -> None:
- _FakeOpenAI.last_kwargs = kwargs
-
-
-def _with_base_url(url: str | None, monkeypatch, stored_key: str | None = None) -> None:
- providers = {}
- if url is not None:
- providers["local-openai"] = BrainProviderConfig(base_url=url)
- conf = JarvisConfig(brain=BrainConfig(providers=providers))
- monkeypatch.setattr(cfg, "load_config", lambda: conf)
- monkeypatch.setattr(
- cfg,
- "get_secret",
- lambda key, env=None: stored_key if key == "local_openai_api_key" else None,
- )
-
-
-# ── Base URL is REQUIRED ─────────────────────────────────────────────────
-def test_missing_base_url_gives_honest_examples(monkeypatch) -> None:
- _with_base_url(None, monkeypatch)
- with pytest.raises(RuntimeError) as err:
- LocalOpenAIBrain()._resolve_root()
- msg = str(err.value)
- # The error must teach the fix: the config key and real example ports.
- assert "local-openai" in msg
- assert "http://localhost:8000" in msg # transformers serve / vLLM
- assert "http://localhost:8080" in msg # llama.cpp llama-server
- assert "http://localhost:1234" in msg # LM Studio
-
-
-def test_client_appends_v1_to_root(monkeypatch) -> None:
- import openai
-
- monkeypatch.setattr(openai, "AsyncOpenAI", _FakeOpenAI)
- _with_base_url("http://localhost:8000", monkeypatch)
- LocalOpenAIBrain()._ensure_client()
- assert _FakeOpenAI.last_kwargs["base_url"] == "http://localhost:8000/v1"
- # No stored key → placeholder the server ignores.
- assert _FakeOpenAI.last_kwargs["api_key"] == "local"
-
-
-def test_client_normalizes_pasted_v1(monkeypatch) -> None:
- import openai
-
- monkeypatch.setattr(openai, "AsyncOpenAI", _FakeOpenAI)
- _with_base_url("http://localhost:1234/v1/", monkeypatch)
- LocalOpenAIBrain()._ensure_client()
- assert _FakeOpenAI.last_kwargs["base_url"] == "http://localhost:1234/v1"
-
-
-def test_optional_key_is_forwarded_when_stored(monkeypatch) -> None:
- import openai
-
- monkeypatch.setattr(openai, "AsyncOpenAI", _FakeOpenAI)
- _with_base_url("http://localhost:8000", monkeypatch, stored_key="sk-local-test")
- LocalOpenAIBrain()._ensure_client()
- assert _FakeOpenAI.last_kwargs["api_key"] == "sk-local-test"
-
-
-def test_client_timeout_fast_connect_wide_read(monkeypatch) -> None:
- import openai
-
- monkeypatch.setattr(openai, "AsyncOpenAI", _FakeOpenAI)
- _with_base_url("http://localhost:8000", monkeypatch)
- LocalOpenAIBrain()._ensure_client()
- timeout = _FakeOpenAI.last_kwargs["timeout"]
- assert timeout.connect <= 2.0
- assert timeout.read >= 120.0
-
-
-# ── Model discovery via /v1/models ───────────────────────────────────────
-class _FakeResponse:
- def __init__(self, payload: dict[str, Any]) -> None:
- self._payload = payload
-
- def raise_for_status(self) -> None:
- return None
-
- def json(self) -> dict[str, Any]:
- return self._payload
-
-
-class _FakeAsyncClient:
- payload: dict[str, Any] = {}
- fail: bool = False
- last_url: str | None = None
- last_headers: dict[str, str] | None = None
-
- def __init__(self, **kwargs: Any) -> None:
- pass
-
- async def __aenter__(self) -> _FakeAsyncClient:
- return self
-
- async def __aexit__(self, *exc: Any) -> None:
- return None
-
- async def get(self, url: str, headers: dict[str, str] | None = None) -> _FakeResponse:
- _FakeAsyncClient.last_url = url
- _FakeAsyncClient.last_headers = headers
- if _FakeAsyncClient.fail:
- raise httpx.ConnectError("connection refused")
- return _FakeResponse(_FakeAsyncClient.payload)
-
-
-def fake_models(monkeypatch):
- monkeypatch.setattr(httpx, "AsyncClient", _FakeAsyncClient)
- _FakeAsyncClient.fail = False
- _FakeAsyncClient.payload = {}
- _FakeAsyncClient.last_url = None
- _FakeAsyncClient.last_headers = None
- return _FakeAsyncClient
-
-
-async def test_discovery_uses_first_served_model(monkeypatch, fake_models) -> None:
- _with_base_url("http://localhost:8000", monkeypatch)
- fake_models.payload = {"data": [{"id": "Qwen/Qwen3.5-9B"}, {"id": "other"}]}
- brain = LocalOpenAIBrain()
- assert await brain._resolve_model() == "Qwen/Qwen3.5-9B"
- assert fake_models.last_url == "http://localhost:8000/v1/models"
-
-
-async def test_discovery_sends_bearer_when_key_stored(monkeypatch, fake_models) -> None:
- _with_base_url("http://localhost:8000", monkeypatch, stored_key="sk-local-test")
- fake_models.payload = {"data": [{"id": "m"}]}
- await LocalOpenAIBrain()._resolve_model()
- assert fake_models.last_headers == {"Authorization": "Bearer sk-local-test"}
-
-
-async def test_empty_model_list_gives_honest_error(monkeypatch, fake_models) -> None:
- _with_base_url("http://localhost:8000", monkeypatch)
- fake_models.payload = {"data": []}
- with pytest.raises(RuntimeError) as err:
- await LocalOpenAIBrain()._resolve_model()
- assert "/v1/models is empty" in str(err.value)
-
-
-async def test_unreachable_server_gives_honest_error(monkeypatch, fake_models) -> None:
- _with_base_url("http://localhost:8000", monkeypatch)
- fake_models.fail = True
- with pytest.raises(RuntimeError) as err:
- await LocalOpenAIBrain()._resolve_model()
- msg = str(err.value)
- assert "not reachable" in msg
- assert "http://localhost:8000" in msg
-
-
-# ── Protocol surface ─────────────────────────────────────────────────────
-def test_capability_flags_and_cost() -> None:
- brain = LocalOpenAIBrain(model="x")
- assert brain.supports_tools is True
- assert brain.can_call_tools() is True
- # Deliberately False: whether an arbitrary local server accepts image
- # content is unknowable — the shared streamer then DROPS images with a
- # warning instead of letting a text-only server reject the whole turn.
- assert brain.supports_vision is False
- req_like = type("R", (), {"messages": (), "max_tokens": 100})()
- assert brain.estimate_cost(req_like) == 0.0
-
-
-def test_wizard_whitelists_the_optional_secret() -> None:
- """Saving the optional key from the app requires the wizard slot to exist
- (ALLOWED_SECRET_KEYS is derived from it)."""
- from jarvis.setup.wizard import SECRETS
-
- spec = next(s for s in SECRETS if s.key == "local_openai_api_key")
- assert spec.env_fallback == "LOCAL_OPENAI_API_KEY"
- # App-only: local servers usually need no key — it must not lengthen
- # first-run onboarding.
- assert spec.prompt is False