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.

feat(brain): discover new frontier models for logins without a catalog

rubenluetke10-beep2877f61b7734
diff --git a/jarvis/agent_chat/catalog.py b/jarvis/agent_chat/catalog.py
index 2ad41283bd..7eccc0e329 100644
--- a/jarvis/agent_chat/catalog.py
+++ b/jarvis/agent_chat/catalog.py
@@ -54,12 +54,15 @@ exist so the picker can show a provider before a key is typed.
from __future__ import annotations
+import logging
from dataclasses import dataclass, field
from typing import Any, Final, Literal
from jarvis.agent_chat.effort import default_effort, effort_levels
from jarvis.brain.model_catalog import CURATED_MODELS, GROK_BUILD_MODELS
+log = logging.getLogger(__name__)
+
Runner = Literal[
"api",
"brain",
@@ -154,6 +157,8 @@ def _agy_fallback_models() -> tuple[tuple[str, str, tuple[str, ...]], ...]:
#: aliases people type. Per-model effort caps follow the docs (no xhigh on
#: 4.6; no effort at all on Haiku 4.5 and the 4.5 generation).
CLAUDE_CODE_MODELS: Final[tuple[CuratedModel, ...]] = (
+ CuratedModel("claude-opus-5-5", "Claude Opus 5.5"),
+ CuratedModel("claude-fable-5-1", "Claude Fable 5.1"),
CuratedModel("claude-fable-5", "Claude Fable 5"),
CuratedModel("claude-opus-5", "Claude Opus 5"),
CuratedModel("claude-opus-5[1m]", "Claude Opus 5", note="1M context"),
@@ -171,6 +176,29 @@ CLAUDE_CODE_MODELS: Final[tuple[CuratedModel, ...]] = (
CuratedModel("claude-opus-4-5-20251101", "Claude Opus 4.5", efforts=()),
)
+
+def claude_code_models() -> tuple[CuratedModel, ...]:
+ """What the Claude Code picker offers: :data:`CLAUDE_CODE_MODELS` with any
+ newer Anthropic release placed first.
+
+ A subscription login publishes no model list, so the curated tuple above
+ would otherwise stay the whole answer until someone edits it. New releases
+ come from the public discovery feed
+ (:meth:`jarvis.brain.model_catalog.ModelCatalog.discovered`), read from its
+ cache with no network; :func:`jarvis.workspace.launch_picks.live_models`
+ refreshes that cache before a picker is drawn.
+ """
+ from jarvis.brain.model_catalog import not_yet_listed, shared_catalog
+
+ try:
+ discovered = shared_catalog().discovered("claude-api")
+ except Exception as exc: # noqa: BLE001 — discovery only adds; the curated list stands
+ log.debug("claude code picker: discovery cache unreadable: %s", exc)
+ return CLAUDE_CODE_MODELS
+ fresh = not_yet_listed(discovered, [(m.id, m.label) for m in CLAUDE_CODE_MODELS])
+ return (*(CuratedModel(m.id, m.label) for m in fresh), *CLAUDE_CODE_MODELS)
+
+
#: Codex's catalog as of codex 0.149 (the bundled list, ``visibility: list``),
#: for a box where ``models_cache.json`` cannot be read. The route prefers the
#: account's live list.
diff --git a/jarvis/brain/cost.py b/jarvis/brain/cost.py
index 3e821c62c0..776cbe683a 100644
--- a/jarvis/brain/cost.py
+++ b/jarvis/brain/cost.py
@@ -68,6 +68,9 @@ PRICING_USD_PER_MTOK: dict[str, tuple[float, float]] = {
# Claude 5 family (feed-verified 2026-08-25; the CLIs' "opus" / "sonnet"
# aliases resolve here via MODEL_ALIASES).
"claude-opus-5": (5.0, 25.0),
+ # Opus 5.5 / Fable 5.1 (OpenRouter feed, 2026-09-28).
+ "claude-opus-5-5": (4.0, 20.0),
+ "claude-fable-5-1": (10.0, 50.0),
"claude-sonnet-5": (2.0, 10.0),
"claude-opus-4-8": (15.0, 75.0),
"claude-opus-4-7-20251022": (15.0, 75.0),
@@ -100,6 +103,7 @@ PRICING_USD_PER_MTOK: dict[str, tuple[float, float]] = {
# here on 2026-08-18 and the live install showed a whole session as $0.
"gemini-3.6-flash": (0.75, 3.75),
"gemini-3.7-flash": (0.75, 3.75),
+ "gemini-3.8-flash": (0.75, 3.75), # OpenRouter feed, 2026-09-28
# Live API models — TEXT rates; audio rates live in
# REALTIME_AUDIO_PRICING_USD_PER_MTOK below.
"gemini-3.1-flash-live-preview": (0.75, 4.50),
@@ -116,6 +120,13 @@ PRICING_USD_PER_MTOK: dict[str, tuple[float, float]] = {
"gpt-5.6-terra": (2.0, 12.0),
"gpt-5.6-sol": (4.0, 20.0),
"gpt-5.6-luna": (0.20, 1.20),
+ # GPT-6 generation (OpenRouter feed, 2026-09-28).
+ "gpt-6-sol": (2.0, 10.0),
+ "gpt-6-sol-pro": (2.0, 10.0),
+ "gpt-6-astra": (10.0, 50.0),
+ "gpt-6-astra-pro": (10.0, 50.0),
+ "gpt-6-luna": (0.10, 0.50),
+ "gpt-6-luna-pro": (0.10, 0.50),
# Not a vendor model: Codex's review pass, which runs on the session's own
# model. Tracks gpt-5.6-sol, the default that pass runs on.
"codex-auto-review": (2.0, 10.0),
@@ -358,7 +369,7 @@ def feed_rates(model: str) -> tuple[float, float] | None:
#: "sonnet" is priced as the Sonnet the CLI actually ran.
MODEL_ALIASES: dict[str, str] = {
"sonnet": "claude-sonnet-5",
- "opus": "claude-opus-5",
+ "opus": "claude-opus-5-5",
"haiku": "claude-haiku-4-5",
}
diff --git a/jarvis/brain/model_catalog.py b/jarvis/brain/model_catalog.py
index e7d3e53862..efd4ad14f6 100644
--- a/jarvis/brain/model_catalog.py
+++ b/jarvis/brain/model_catalog.py
@@ -180,6 +180,10 @@ class ModelInfo:
context_length: int | None = None
quantization_level: str | None = None
parameter_size: str | None = None
+ # Release time (Unix seconds) where the catalog publishes one — OpenRouter
+ # and OpenAI send ``created``. Public discovery (``discovered_from_feed``)
+ # uses it to admit only models released within the last year.
+ created: float | None = None
def _curated(pairs: list[tuple[str, str]]) -> list[ModelInfo]:
@@ -197,6 +201,8 @@ def _curated(pairs: list[tuple[str, str]]) -> list[ModelInfo]:
CURATED_MODELS: dict[str, list[ModelInfo]] = {
"claude-api": _curated(
[
+ ("claude-opus-5-5", "Claude Opus 5.5"),
+ ("claude-fable-5-1", "Claude Fable 5.1"),
("claude-fable-5", "Claude Fable 5"),
("claude-opus-5", "Claude Opus 5"),
("claude-opus-4-8", "Claude Opus 4.8"),
@@ -206,6 +212,11 @@ CURATED_MODELS: dict[str, list[ModelInfo]] = {
),
"openai": _curated(
[
+ ("gpt-6-sol", "GPT-6 Sol"),
+ ("gpt-6-astra", "GPT-6 Astra"),
+ ("gpt-6-luna", "GPT-6 Luna"),
+ ("gpt-6-sol-pro", "GPT-6 Sol Pro"),
+ ("gpt-6-astra-pro", "GPT-6 Astra Pro"),
("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)"),
@@ -220,6 +231,7 @@ CURATED_MODELS: dict[str, list[ModelInfo]] = {
),
"gemini": _curated(
[
+ ("gemini-3.8-flash", "Gemini 3.8 Flash"),
("gemini-3.7-flash", "Gemini 3.7 Flash"),
("gemini-3.6-flash", "Gemini 3.6 Flash"),
("gemini-3.5-flash", "Gemini 3.5 Flash"),
@@ -233,16 +245,22 @@ CURATED_MODELS: dict[str, list[ModelInfo]] = {
),
"openrouter": _curated(
[
+ ("anthropic/claude-opus-5.5", "Claude Opus 5.5"),
+ ("anthropic/claude-fable-5.1", "Claude Fable 5.1"),
("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-6-sol", "GPT-6 Sol"),
+ ("openai/gpt-6-astra", "GPT-6 Astra"),
+ ("openai/gpt-6-luna", "GPT-6 Luna"),
("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.8-flash", "Gemini 3.8 Flash"),
("google/gemini-3.5-flash", "Gemini 3.5 Flash"),
("google/gemini-3.1-pro-preview", "Gemini 3.1 Pro"),
("x-ai/grok-4.7", "Grok 4.7"),
@@ -733,6 +751,10 @@ class CatalogSpec:
selects: str # "model" | "voice"
curated: tuple[ModelInfo, ...]
live: bool
+ #: The direct provider whose publicly discovered models join this curated
+ #: list (``discovered_from_feed``) — for a login that publishes no catalog
+ #: of its own. ``None`` = the curated list is the whole answer.
+ discover: str | None = None
def _build_provider_catalog() -> dict[str, CatalogSpec]:
@@ -808,7 +830,7 @@ def _build_provider_catalog() -> dict[str, CatalogSpec]:
# the user an empty picker on a working account; the curated list is the
# honest one, and a newer model can still be typed into the model field.
cat["vertex"] = CatalogSpec(
- "brain", "model", tuple(CURATED_MODELS.get("gemini", ())), live=False
+ "brain", "model", tuple(CURATED_MODELS.get("gemini", ())), live=False, discover="gemini"
)
cat["claude-cli"] = CatalogSpec(
"brain",
@@ -823,6 +845,9 @@ def _build_provider_catalog() -> dict[str, CatalogSpec]:
)
),
live=False,
+ # ``claude -p --model`` also takes full ids, so a release the aliases
+ # have not reached yet is still pickable by name.
+ discover="claude-api",
)
for p, (selects, opts) in TTS_CATALOG.items():
cat[p] = CatalogSpec("tts", selects, tuple(opts), live=False)
@@ -904,11 +929,20 @@ def parse_models_response(provider: str, payload: dict) -> list[ModelInfo]:
input_modalities=_input_modalities(m),
supported_parameters=_supported_parameters(m),
pricing=_pricing(m),
+ created=_created(m),
)
)
return out
+def _created(entry: dict) -> float | None:
+ """The entry's ``created`` Unix timestamp, or None when absent/non-numeric."""
+ raw = entry.get("created")
+ if isinstance(raw, bool) or not isinstance(raw, int | float) or raw <= 0:
+ return None
+ return float(raw)
+
+
def _pricing(entry: dict) -> tuple[float, float] | None:
"""Pull ``pricing.prompt`` / ``pricing.completion`` as USD per 1M tokens.
@@ -1290,6 +1324,15 @@ _FAMILY_RANK: tuple[tuple[str, int], ...] = (
)
+#: family -> (first frontier generation, its rank). Older generations fall
+#: through to the ``_FAMILY_RANK`` rows (``gpt-4`` 15, ``gemini-2`` 14, …).
+_FRONTIER_GENERATIONS: dict[str, tuple[int, int]] = {
+ "gpt": (5, 37),
+ "gemini": (3, 36),
+ "grok": (4, 35),
+}
+
+
def _family_rank(model_id: str) -> int:
"""Presentation-only relevance band for ``model_id`` (higher = first)."""
low = model_id.lower()
@@ -1299,6 +1342,14 @@ def _family_rank(model_id: str) -> int:
tail = low.rsplit("/", 1)[-1]
if tail.startswith(("o3", "o4")):
return 34
+ # The flagship families by generation, so a NEW generation (gpt-6,
+ # gemini-4, grok-5) ranks as frontier the day it ships instead of sinking
+ # to rank 0 until someone adds a row below.
+ gen = re.match(r"(gpt|gemini|grok)-(\d+)", tail)
+ if gen:
+ floor, rank = _FRONTIER_GENERATIONS[gen.group(1)]
+ if int(gen.group(2)) >= floor:
+ return rank
for needle, rank in _FAMILY_RANK:
if needle in low:
return rank
@@ -1501,6 +1552,98 @@ def sort_models(provider: str, models: list[ModelInfo]) -> list[ModelInfo]:
)
+# ----------------------------------------------------------------------
+# Public discovery — current models for logins that publish no catalog
+# ----------------------------------------------------------------------
+# A subscription login (Claude, ChatGPT, Google OAuth) or a missing key leaves
+# a picker on the curated lists above, and those age with every release: Opus
+# 5.5 shipped while the Claude list still ended at Opus 5. OpenRouter's catalog
+# is public, keyless and lists each vendor's release within hours, so it is
+# the discovery feed. A vendor model it lists that was released within
+# DISCOVERY_MAX_AGE_DAYS joins that vendor's picker under the vendor's own id.
+# Discovery only ever ADDS picks; the curated list stays as the floor, and a
+# provider whose own live catalog answers never needs it.
+
+#: OpenRouter namespace -> the direct provider whose picker gains its models.
+_DISCOVERY_NAMESPACES: dict[str, str] = {
+ "anthropic": "claude-api",
+ "openai": "openai",
+ "google": "gemini",
+ "x-ai": "grok",
+}
+#: The providers a discovered model can join.
+DISCOVERY_PROVIDERS: frozenset[str] = frozenset(_DISCOVERY_NAMESPACES.values())
+#: Nothing a year old or older is offered as "new" (the same line the local
+#: model defaults hold).
+DISCOVERY_MAX_AGE_DAYS = 365
+#: The one feed discovery reads — cached with the rest of the catalog.
+DISCOVERY_FEED = "openrouter"
+#: How long a failed feed fetch is not retried, so an offline box does not pay
+#: the timeout on every picker open.
+_DISCOVERY_RETRY_SECONDS = 5 * 60
+_DISCOVERY_TIMEOUT_SECONDS = 6.0
+
+
+def native_model_id(provider: str, gateway_tail: str) -> str:
+ """The vendor's own id for an OpenRouter id tail.
+
+ Anthropic spells versions with hyphens (``claude-opus-5-5``) where
+ OpenRouter writes a dot (``claude-opus-5.5``); the other vendors use one
+ spelling on both.
+ """
+ if provider == "claude-api":
+ return gateway_tail.replace(".", "-")
+ return gateway_tail
+
+
+def discovered_from_feed(
+ provider: str, feed: list[ModelInfo], *, now: float | None = None
+) -> list[ModelInfo]:
+ """``provider``'s models in the public feed released within the age window,
+ under their native ids, in the picker's order (:func:`sort_models`).
+
+ Variant rows (``:batch``, ``:free``) and non-chat models are skipped; a row
+ without a release time is skipped too, since its age cannot be shown to
+ be inside the window.
+ """
+ cutoff = (time.time() if now is None else now) - DISCOVERY_MAX_AGE_DAYS * 86400
+ out: list[ModelInfo] = []
+ seen: set[str] = set()
+ for m in filter_brain_models(feed):
+ namespace, sep, tail = m.id.partition("/")
+ if not sep or ":" in tail or _DISCOVERY_NAMESPACES.get(namespace) != provider:
+ continue
+ if m.created is None or m.created < cutoff:
+ continue
+ native = native_model_id(provider, tail)
+ if native in seen:
+ continue
+ seen.add(native)
+ # "Anthropic: Claude Opus 5.5" -> "Claude Opus 5.5"
+ label = m.label.split(": ", 1)[1] if ": " in m.label else m.label
+ out.append(replace(m, id=native, label=label))
+ # The picker's own order (flagship of each line first), so a small sibling
+ # released last week does not lead the list.
+ return sort_models(provider, out)
+
+
+def not_yet_listed(discovered: list[ModelInfo], listed: list[tuple[str, str]]) -> list[ModelInfo]:
+ """The discovered models a list of ``(id, label)`` pairs does not hold yet.
+
+ Compared separator-insensitively on id AND label, so a curated dated id
+ (``claude-haiku-4-5-20251001``) and its discovered alias
+ (``claude-haiku-4-5``), both "Claude Haiku 4.5", are not offered twice.
+ """
+ known = {_squash(i) for i, _ in listed} | {_squash(lbl) for _, lbl in listed}
+ return [m for m in discovered if _squash(m.id) not in known and _squash(m.label) not in known]
+
+
+def merge_discovered(listed: list[ModelInfo], discovered: list[ModelInfo]) -> list[ModelInfo]:
+ """``listed`` with the discovered models it lacks placed first."""
+ fresh = not_yet_listed(discovered, [(m.id, m.label) for m in listed])
+ return [*fresh, *listed]
+
+
# ----------------------------------------------------------------------
# Catalog with cache + live fetch + static fallback
# ----------------------------------------------------------------------
@@ -1542,6 +1685,8 @@ class ModelCatalog:
self._cache: dict[str, tuple[float, list[ModelInfo]]] = {}
self._lock = asyncio.Lock()
self._client_factory = http_client_factory
+ # When the discovery feed last failed to load (0 = never).
+ self._discovery_failed_at = 0.0
self._load_cache()
# -- cache I/O -----------------------------------------------------
@@ -1578,6 +1723,11 @@ class ModelCatalog:
if isinstance(m.get("pricing"), list) and len(m["pricing"]) == 2
else None
),
+ created=(
+ float(m["created"])
+ if isinstance(m.get("created"), int | float)
+ else None
+ ),
)
for m in entry.get("models", [])
]
@@ -1611,6 +1761,7 @@ class ModelCatalog:
else {}
),
**({"pricing": list(m.pricing)} if m.pricing is not None else {}),
+ **({"created": m.created} if m.created is not None else {}),
}
for m in models
],
@@ -1653,9 +1804,14 @@ class ModelCatalog:
# (no brain-model filtering/sorting — voices and STT models are not brain
# models and must keep their curated order).
if not spec.live:
+ curated = list(spec.curated)
+ if spec.discover:
+ async with self._lock:
+ feed = await self._discovery_feed()
+ curated = merge_discovered(curated, discovered_from_feed(spec.discover, feed))
return CatalogResult(
provider=provider,
- models=tuple(spec.curated),
+ models=tuple(curated),
source="curated",
fetched_at=0.0,
selects=spec.selects,
@@ -1685,6 +1841,9 @@ class ModelCatalog:
"model",
)
static = self._static_fallback(provider)
+ if provider in DISCOVERY_PROVIDERS:
+ feed = await self._discovery_feed()
+ static = merge_discovered(static, discovered_from_feed(provider, feed))
return CatalogResult(
provider,
self._present(provider, static),
@@ -1704,6 +1863,45 @@ class ModelCatalog:
"model",
)
+ # -- public discovery ---------------------------------------------
+
+ async def refresh_discovery(self) -> None:
+ """Load the discovery feed when its cache has expired (no-op when fresh).
+
+ For callers that then read :meth:`discovered` synchronously.
+ """
+ async with self._lock:
+ await self._discovery_feed()
+
+ def discovered(self, provider: str) -> list[ModelInfo]:
+ """``provider``'s publicly discovered models from the cached feed, with
+ no network: whatever the last :meth:`refresh_discovery` (or any
+ OpenRouter picker) loaded, including the copy on disk."""
+ cached = self._cache.get(DISCOVERY_FEED)
+ return discovered_from_feed(provider, cached[1]) if cached else []
+
+ async def _discovery_feed(self) -> list[ModelInfo]:
+ """The public feed, fetched when its cache has expired. Caller holds
+ ``self._lock``. A failed fetch serves the stale copy (or nothing) and is
+ not retried for ``_DISCOVERY_RETRY_SECONDS``."""
+ cached = self._cache.get(DISCOVERY_FEED)
+ if cached and self._is_fresh(DISCOVERY_FEED, cached[0]):
+ return cached[1]
+ if time.time() - self._discovery_failed_at < _DISCOVERY_RETRY_SECONDS:
+ return cached[1] if cached else []
+ try:
+ models = await asyncio.wait_for(
+ self._fetch_raw(DISCOVERY_FEED), timeout=_DISCOVERY_TIMEOUT_SECONDS
+ )
+ except Exception as exc: # noqa: BLE001 — discovery only adds; the curated list stands.
+ log.info("Public model discovery feed unavailable: %s", exc)
+ self._discovery_failed_at = time.time()
+ return cached[1] if cached else []
+ now = time.time()
+ self._cache[DISCOVERY_FEED] = (now, models)
+ self._save_cache()
+ return models
+
# -- network -------------------------------------------------------
async def _client(self) -> httpx.AsyncClient:
diff --git a/jarvis/ui/web/agent_chat_routes.py b/jarvis/ui/web/agent_chat_routes.py
index 018b9bdc66..7ed8cf9bd3 100644
--- a/jarvis/ui/web/agent_chat_routes.py
+++ b/jarvis/ui/web/agent_chat_routes.py
@@ -49,7 +49,7 @@ from pydantic import BaseModel, Field
from jarvis.agent_chat import attachments as chat_attachments
from jarvis.agent_chat import runner_cli, typeahead
-from jarvis.agent_chat.catalog import CLAUDE_CODE_MODELS, offers, rows_for
+from jarvis.agent_chat.catalog import claude_code_models, offers, rows_for
from jarvis.agent_chat.control_types import CommandRequest, CommandResult
from jarvis.agent_chat.effort import normalize_effort
from jarvis.agent_chat.events import make_event
@@ -293,7 +293,7 @@ async def get_catalog(
# Anthropic catalog route lists the models live.
if row.id == "claude-api":
if runner == "claude-cli":
- d["curated_models"] = [m.to_dict() for m in CLAUDE_CODE_MODELS]
+ d["curated_models"] = [m.to_dict() for m in claude_code_models()]
d["models_source"] = "curated"
else:
d["models_source"] = "live"
diff --git a/jarvis/workspace/launch_picks.py b/jarvis/workspace/launch_picks.py
index e48ee11c73..a4e976f0bb 100644
--- a/jarvis/workspace/launch_picks.py
+++ b/jarvis/workspace/launch_picks.py
@@ -246,6 +246,15 @@ async def live_models() -> dict[str, list[dict[str, Any]]]:
)
out: dict[str, list[dict[str, Any]]] = {}
+ if _installed("claude-cli"):
+ # A plan login publishes no model list; the public discovery feed is
+ # what brings a new Claude release into the picker (claude_code_models).
+ from jarvis.brain.model_catalog import shared_catalog
+
+ try:
+ await asyncio.wait_for(shared_catalog().refresh_discovery(), 3.0)
+ except Exception as exc: # noqa: BLE001 — the cached/curated list stands in
+ _log.debug("launch picks: model discovery unavailable: %s", exc)
if _installed("agy-cli"):
try:
out["agy-cli"] = await asyncio.wait_for(asyncio.to_thread(read_agy_models), 10.0)
@@ -308,7 +317,7 @@ def offered_models(
picks = picks_for(agent)
if picks is None or not picks.model_args or not picks.provider:
return []
- from jarvis.agent_chat.catalog import CLAUDE_CODE_MODELS, provider_row
+ from jarvis.agent_chat.catalog import claude_code_models, provider_row
row = provider_row(picks.provider)
if row is None:
@@ -319,7 +328,7 @@ def offered_models(
# Claude Code takes its own ids and aliases rather than the Anthropic
# API's catalog — the same exception the chat catalog route makes.
if picks.provider == "claude-api":
- return [m.to_dict() for m in CLAUDE_CODE_MODELS]
+ return [m.to_dict() for m in claude_code_models()]
return [m.to_dict() for m in row.curated_models]
diff --git a/tests/unit/brain/test_model_catalog_local.py b/tests/unit/brain/test_model_catalog_local.py
index 0b37c5f6ea..82295ac816 100644
--- a/tests/unit/brain/test_model_catalog_local.py
+++ b/tests/unit/brain/test_model_catalog_local.py
@@ -141,14 +141,17 @@ async def test_cloud_fetch_url_and_auth_are_byte_identical(
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."""
+ """No key → no call to the vendor; the picker gets the honest static
+ fallback. The only request is the keyless public discovery feed, which
+ carries no credential."""
client = _FakeClient(_OPENAI_SHAPE)
_plain_env(monkeypatch, {})
result = await _catalog(tmp_path, client).list_models(provider)
assert result.source == "static"
- assert client.calls == []
+ assert [c["url"] for c in client.calls] == ["https://openrouter.ai/api/v1/models"]
+ assert client.calls[0]["headers"] == {}
assert result.models, "static fallback must still offer a useful list"
diff --git a/tests/unit/brain/test_model_discovery.py b/tests/unit/brain/test_model_discovery.py
new file mode 100644
index 0000000000..aefea69465
--- /dev/null
+++ b/tests/unit/brain/test_model_discovery.py
@@ -0,0 +1,229 @@
+"""Public model discovery: a login with no catalog of its own still gets new releases.
+
+A subscription login (Claude Code, Vertex) or a missing key leaves a picker on
+the curated list; the public OpenRouter feed is what adds a model released
+after that list was written (Opus 5.5 arriving while the list ended at Opus 5).
+"""
+
+from __future__ import annotations
+
+import time
+from typing import Any
+
+import httpx
+import pytest
+
+from jarvis.brain import model_catalog as catalog_module
+from jarvis.brain.model_catalog import (
+ ModelCatalog,
+ ModelInfo,
+ discovered_from_feed,
+ merge_discovered,
+ native_model_id,
+)
+
+# Rows are dated relative to the real clock so the age window holds on any day.
+NOW = time.time()
+DAY = 86_400.0
+
+
+def _feed_row(model_id: str, name: str, age_days: float, **extra: Any) -> dict[str, Any]:
+ return {"id": model_id, "name": name, "created": int(NOW - age_days * DAY), **extra}
+
+
+FEED: dict[str, Any] = {
+ "data": [
+ _feed_row("anthropic/claude-opus-5.5", "Anthropic: Claude Opus 5.5", 1),
+ _feed_row("anthropic/claude-opus-5.5:batch", "Anthropic: Claude Opus 5.5 (batch)", 1),
+ _feed_row("anthropic/claude-opus-5", "Anthropic: Claude Opus 5", 60),
+ _feed_row("anthropic/claude-3-opus", "Anthropic: Claude 3 Opus", 900),
+ _feed_row("openai/gpt-6-sol", "OpenAI: GPT-6 Sol", 1),
+ _feed_row(
+ "openai/gpt-6-image",
+ "OpenAI: GPT-6 Image",
+ 1,
+ architecture={"output_modalities": ["image", "text"]},
+ ),
+ _feed_row("google/gemini-3.8-flash", "Google: Gemini 3.8 Flash", 20),
+ _feed_row("x-ai/grok-4.7", "xAI: Grok 4.7", 5),
+ _feed_row("deepseek/deepseek-v5", "DeepSeek: V5", 1),
+ ]
+}
+
+
+def _feed() -> list[ModelInfo]:
+ return catalog_module.parse_models_response("openrouter", FEED)
+
+
+class _Client:
+ """One scripted response per ``get``; records each call."""
+
+ def __init__(self, responses: list[httpx.Response | Exception]) -> None:
+ self.responses = responses
+ self.calls: list[str] = []
+
+ async def __aenter__(self) -> _Client:
+ return self
+
+ async def __aexit__(self, *_exc: object) -> bool:
+ return False
+
+ async def get(self, url: str, **_kwargs: Any) -> httpx.Response:
+ self.calls.append(url)
+ nxt = self.responses.pop(0)
+ if isinstance(nxt, Exception):
+ raise nxt
+ return nxt
+
+
+def _ok(payload: dict[str, Any]) -> httpx.Response:
+ return httpx.Response(200, request=httpx.Request("GET", "https://x/models"), json=payload)
+
+
+def _unauthorized() -> httpx.Response:
+ return httpx.Response(401, request=httpx.Request("GET", "https://x/models"), json={})
+
+
+def test_anthropic_ids_are_mapped_to_the_native_hyphen_spelling() -> None:
+ assert native_model_id("claude-api", "claude-opus-5.5") == "claude-opus-5-5"
+ assert native_model_id("openai", "gpt-5.6-sol") == "gpt-5.6-sol"
+ assert native_model_id("gemini", "gemini-3.8-flash") == "gemini-3.8-flash"
+
+
+def test_discovery_keeps_recent_chat_models_of_the_one_vendor_newest_first() -> None:
+ claude = discovered_from_feed("claude-api", _feed(), now=NOW)
+
+ assert [m.id for m in claude] == ["claude-opus-5-5", "claude-opus-5"]
+ assert claude[0].label == "Claude Opus 5.5"
+
+
+def test_discovery_drops_image_generators_and_other_vendors() -> None:
+ assert [m.id for m in discovered_from_feed("openai", _feed(), now=NOW)] == ["gpt-6-sol"]
+ assert [m.id for m in discovered_from_feed("gemini", _feed(), now=NOW)] == ["gemini-3.8-flash"]
+ assert [m.id for m in discovered_from_feed("grok", _feed(), now=NOW)] == ["grok-4.7"]
+
+
+def test_a_row_without_a_release_time_is_not_discovered() -> None:
+ feed = [ModelInfo(id="anthropic/claude-opus-9", label="Claude Opus 9")]
+ assert discovered_from_feed("claude-api", feed, now=NOW) == []
+
+
+def test_merge_adds_only_what_the_curated_list_lacks_and_leads_with_it() -> None:
+ curated = [
+ ModelInfo(id="claude-opus-5", label="Claude Opus 5"),
+ ModelInfo(id="claude-haiku-4-5-20251001", label="Claude Haiku 4.5"),
+ ]
+ discovered = [
+ ModelInfo(id="claude-opus-5-5", label="Claude Opus 5.5"),
+ ModelInfo(id="claude-opus-5", label="Claude Opus 5"),
+ # Same model as the dated curated id: matched on the label.
+ ModelInfo(id="claude-haiku-4-5", label="Claude Haiku 4.5"),
+ ]
+
+ merged = merge_discovered(curated, discovered)
+
+ assert [m.id for m in merged] == [
+ "claude-opus-5-5",
+ "claude-opus-5",
+ "claude-haiku-4-5-20251001",
+ ]
+
+
+def test_a_new_generation_ranks_as_frontier_the_day_it_ships() -> None:
+ assert catalog_module._family_rank("gpt-6-sol") == catalog_module._family_rank("gpt-5.5")
+ assert catalog_module._family_rank("gemini-4-pro") >= catalog_module.FRONTIER_RANK_FLOOR
+ assert catalog_module._family_rank("gpt-4o") < catalog_module.VALUE_RANK_FLOOR
+
+
+async def test_keyless_claude_picker_gains_the_new_release_from_the_public_feed(
+ monkeypatch: pytest.MonkeyPatch, tmp_path
+) -> None:
+ monkeypatch.setattr(catalog_module.cfg, "get_provider_secret", lambda _p: None)
+ client = _Client([_ok(FEED)])
+ catalog = ModelCatalog(cache_path=tmp_path / "c.json", http_client_factory=lambda: client)
+
+ result = await catalog.list_models("claude-api")
+
+ ids = [m.id for m in result.models]
+ assert result.source == "static"
+ assert "claude-opus-5-5" in ids
+ # The curated floor is still there.
+ assert "claude-sonnet-5" in ids
+ assert client.calls == ["https://openrouter.ai/api/v1/models"]
+
+
+async def test_a_working_live_catalog_is_not_mixed_with_discovery(
+ monkeypatch: pytest.MonkeyPatch, tmp_path
+) -> None:
+ monkeypatch.setattr(catalog_module.cfg, "get_provider_secret", lambda _p: "sk-test")
+ live = {"data": [{"id": "claude-opus-5", "display_name": "Claude Opus 5"}]}
+ client = _Client([_ok(live)])
+ catalog = ModelCatalog(cache_path=tmp_path / "c.json", http_client_factory=lambda: client)
+
+ result = await catalog.list_models("claude-api")
+
+ assert result.source == "live"
+ assert [m.id for m in result.models] == ["claude-opus-5"]
+ assert len(client.calls) == 1
+
+
+async def test_subscription_spec_with_discovery_lists_new_models_before_aliases(
+ monkeypatch: pytest.MonkeyPatch, tmp_path
+) -> None:
+ monkeypatch.setattr(catalog_module.cfg, "get_provider_secret", lambda _p: None)
+ client = _Client([_ok(FEED)])
+ catalog = ModelCatalog(cache_path=tmp_path / "c.json", http_client_factory=lambda: client)
+
+ result = await catalog.list_models("claude-cli")
+
+ ids = [m.id for m in result.models]
+ assert ids[:2] == ["claude-opus-5-5", "claude-opus-5"]
+ assert {"sonnet", "opus", "haiku"} <= set(ids)
+
+
+async def test_offline_feed_leaves_the_curated_list_and_is_not_retried_at_once(
+ monkeypatch: pytest.MonkeyPatch, tmp_path
+) -> None:
+ monkeypatch.setattr(catalog_module.cfg, "get_provider_secret", lambda _p: None)
+ client = _Client([httpx.ConnectError("offline"), httpx.ConnectError("offline")])
+ catalog = ModelCatalog(cache_path=tmp_path / "c.json", http_client_factory=lambda: client)
+
+ first = await catalog.list_models("claude-api")
+ second = await catalog.list_models("claude-api")
+
+ assert [m.id for m in first.models] == [m.id for m in second.models]
+ assert "claude-opus-5-5" in [m.id for m in first.models] # the curated floor
+ assert len(client.calls) == 1
+
+
+async def test_discovered_reads_the_cache_on_disk_without_network(tmp_path) -> None:
+ client = _Client([_ok(FEED)])
+ first = ModelCatalog(cache_path=tmp_path / "c.json", http_client_factory=lambda: client)
+ await first.refresh_discovery()
+
+ reopened = ModelCatalog(cache_path=tmp_path / "c.json", http_client_factory=lambda: None)
+
+ assert "claude-opus-5-5" in [m.id for m in reopened.discovered("claude-api")]
+
+
+def test_claude_code_picker_leads_with_discovered_releases(
+ monkeypatch: pytest.MonkeyPatch, tmp_path
+) -> None:
+ from jarvis.agent_chat import catalog as chat_catalog
+
+ catalog = ModelCatalog(cache_path=tmp_path / "c.json")
+ catalog._cache["openrouter"] = (
+ NOW,
+ [ModelInfo(id="anthropic/claude-opus-6", label="Anthropic: Claude Opus 6", created=NOW)],
+ )
+ monkeypatch.setattr(catalog_module, "_shared_catalog", catalog)
+
+ models = chat_catalog.claude_code_models()
+
+ assert models[0].id == "claude-opus-6"
+ assert models[1:] == chat_catalog.CLAUDE_CODE_MODELS