Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

chore(claude): drop retired models from the picker (#2124)

Call Whitea1a207aa3920
diff --git a/core/handlers/model_hub/service.py b/core/handlers/model_hub/service.py
index 07fb82334..a001e6012 100644
--- a/core/handlers/model_hub/service.py
+++ b/core/handlers/model_hub/service.py
@@ -4157,12 +4157,49 @@ class ModelHubService:
"routeable": True,
}
- @classmethod
def _catalog_models_payload(
- cls,
+ self,
agent: ModelHubAgentSupplyConfig,
) -> list[dict]:
- return [cls._catalog_model_payload(model) for model in agent.models]
+ hidden = self._hidden_retired_model_ids(agent)
+ return [self._catalog_model_payload(model) for model in agent.models if model.id not in hidden]
+
+ def _withdrawn_builtin_model_ids(self, backend: BackendName) -> set[str]:
+ # Either catalog may withdraw a model; the remote one does so without a
+ # release. A stale remote cache schedules the controller-owned refresh,
+ # whose completion reconciles the snapshot, so a new tombstone reaches
+ # the picker without waiting for a restart. A retired id the current
+ # snapshot revives is not withdrawn.
+ from vibe.backend_model_catalog import (
+ load_bundled_catalog,
+ load_cached_remote_catalog,
+ retired_backend_model_ids,
+ )
+
+ retired = retired_backend_model_ids(backend, load_bundled_catalog()) | retired_backend_model_ids(
+ backend, load_cached_remote_catalog()
+ )
+ if not retired:
+ return set()
+ return retired - {item["id"] for item in self._current_builtin_models(backend)}
+
+ def _hidden_retired_model_ids(self, agent: ModelHubAgentSupplyConfig) -> set[str]:
+ # A retired built-in stays persisted and routeable, so any session,
+ # channel, or Agent pin keeps working; it only leaves picker
+ # projections. A row a manual route pins or the backend currently
+ # requests stays visible.
+ withdrawn = self._withdrawn_builtin_model_ids(cast(BackendName, agent.backend))
+ if not withdrawn:
+ return set()
+ requested = self._requested_model(agent)
+ return {
+ model.id
+ for model in agent.models
+ if model.origin == "builtin"
+ and model.id in withdrawn
+ and model.id != requested
+ and normalized_model_hub_override(agent.routes.get(model.id)) is None
+ }
def backend_catalog_models(self, backend: str) -> list[dict]:
if backend not in MODEL_HUB_BACKENDS:
@@ -4175,8 +4212,9 @@ class ModelHubService:
*, live_recovery: Mapping[str, SourceRecoveryAnnotation] | None = None,
) -> dict:
backend = cast(BackendName, agent.backend)
+ hidden = self._hidden_retired_model_ids(agent)
builtin_models = (
- [model.id for model in agent.models]
+ [model.id for model in agent.models if model.id not in hidden]
if agent.menu_kind == "fixed"
else None
)
@@ -4193,7 +4231,7 @@ class ModelHubService:
unavailable_source_ids=unavailable_source_ids,
live_recovery=live_recovery,
)
- menu_model_ids = [model.id for model in agent.models]
+ menu_model_ids = [model.id for model in agent.models if model.id not in hidden]
model_supply = [
{
"model_id": model_id,
@@ -4395,6 +4433,10 @@ class ModelHubService:
)
provider_ids: list[str] = []
+ # A source inventory (a native subscription lists the full fixed menu)
+ # never re-offers a withdrawn built-in, whether or not a row persists;
+ # a still-visible pinned row is already in the menu.
+ withdrawn = self._withdrawn_builtin_model_ids(agent_backend)
source_by_id = {source.id: source for source in config.sources}
for source_id in agent.sources.order:
source = source_by_id.get(source_id)
@@ -4405,7 +4447,8 @@ class ModelHubService:
continue
candidate_id = model.id
if (
- candidate_id in menu_ids
+ candidate_id in withdrawn
+ or candidate_id in menu_ids
or candidate_id in builtin_ids
or candidate_id in provider_ids
):
@@ -5462,6 +5505,7 @@ class ModelHubService:
cast(BackendName, backend),
)
live_recovery = self.recovery.annotations(config)
+ hidden = self._hidden_retired_model_ids(agent) - {requested_model}
return [
self._agent_chain(
config,
@@ -5471,7 +5515,9 @@ class ModelHubService:
unavailable_source_ids=unavailable_source_ids,
live_recovery=live_recovery,
)
+ # The overview is a picker surface; routing keeps every persisted row.
for model_id in self._agent_model_ids(agent, requested_model)
+ if model_id not in hidden
]
def opencode_public_models(self) -> dict[str, dict[str, Any]]:
diff --git a/tests/test_backend_model_catalog.py b/tests/test_backend_model_catalog.py
index e21deeef2..0fad2bff0 100644
--- a/tests/test_backend_model_catalog.py
+++ b/tests/test_backend_model_catalog.py
@@ -933,6 +933,128 @@ def test_gpt_6_sol_and_luna_follow_astra_in_the_bundled_catalog():
assert codex[model]["reasoning_efforts"] == ["low", "medium", "high", "xhigh", "max"]
+RETIRED_CLAUDE_MODELS = (
+ "claude-opus-4",
+ "claude-sonnet-4",
+ "claude-haiku-4",
+ "claude-sonnet-4-0",
+ "claude-sonnet-4-20250514",
+ "claude-sonnet-3-7",
+ "claude-haiku-3-5",
+)
+
+
+def test_retired_claude_models_are_tombstoned_in_the_bundled_catalog():
+ entries = backend_model_catalog.backend_model_entries(
+ "claude", backend_model_catalog.load_bundled_catalog()
+ )
+ by_id = {entry["id"]: entry for entry in entries}
+ for model in RETIRED_CLAUDE_MODELS:
+ assert model in by_id, f"{model} must stay declared so the tombstone can suppress it"
+ assert by_id[model].get("visibility") == "hide", model
+
+
+def test_retired_claude_models_leave_the_merged_listing(monkeypatch):
+ catalog = backend_model_catalog.load_bundled_catalog()
+ monkeypatch.setattr(
+ backend_model_catalog, "load_cached_remote_catalog", lambda **kwargs: catalog
+ )
+
+ snapshot = backend_model_catalog.backend_model_snapshot("claude", schedule_refresh=False)
+
+ for model in RETIRED_CLAUDE_MODELS:
+ assert model not in snapshot["models"], model
+ assert model not in snapshot["reasoning_options"], model
+ # Survivors that the retired ids sit next to must be untouched.
+ for model in ("claude-opus-5", "claude-opus-4-5", "claude-sonnet-4-5", "claude-haiku-4-5"):
+ assert model in snapshot["models"], model
+
+
+def test_retired_models_stay_in_the_fixed_menu_for_released_configs():
+ """Persisted-shape rule: released configs imply the fixed menu, retired ids included."""
+
+ from config.v2_config import model_hub_fixed_menu_ids
+
+ fixed_menu = set(model_hub_fixed_menu_ids("claude"))
+
+ assert set(RETIRED_CLAUDE_MODELS) <= fixed_menu
+ assert "claude-opus-5" in fixed_menu
+ # The bare aliases are why claude_builtin_ids exists: they carry no
+ # "claude-"/"anthropic-" prefix, so dropping them would make every persisted
+ # alias selection inadmissible.
+ assert {"opus", "sonnet", "haiku", "opus[1m]", "sonnet[1m]"} <= fixed_menu
+
+
+def test_retiring_a_model_keeps_persisted_selections_admissible():
+ """Persisted-shape rule: a released version may already have written these ids."""
+
+ from config.v2_config import model_hub_fixed_menu_ids
+ from core.handlers.model_hub.catalog_admission import backend_model_admission_error
+
+ builtin_ids = model_hub_fixed_menu_ids("claude")
+ for model in (*RETIRED_CLAUDE_MODELS, "opus", "sonnet", "haiku"):
+ assert (
+ backend_model_admission_error("claude", model, claude_builtin_ids=builtin_ids)
+ is None
+ ), model
+
+
+def test_visible_backend_model_entries_drops_only_hidden_rows():
+ catalog = {
+ "backends": {
+ "claude": {
+ "models": [
+ {"id": "claude-opus-5"},
+ {"id": "claude-gone", "visibility": "hide"},
+ {"id": "claude-also-gone", "visibility": "hidden"},
+ {"id": "claude-kept", "visibility": "list"},
+ ]
+ }
+ }
+ }
+
+ visible = backend_model_catalog.visible_backend_model_entries("claude", catalog)
+
+ assert [entry["id"] for entry in visible] == ["claude-opus-5", "claude-kept"]
+
+
+def test_bundled_retirements_outrank_a_remote_catalog_cached_before_them():
+ import copy
+
+ bundled = backend_model_catalog.load_bundled_catalog()
+ stale = copy.deepcopy(bundled)
+ stale["backends"]["claude"]["models"] = [
+ {"id": "claude-opus-4"},
+ {"id": "claude-sonnet-4", "reasoning_efforts": ["low", "medium", "high"]},
+ {"id": "claude-opus-5"},
+ ]
+
+ blocked = backend_model_catalog._claude_blocked_model_ids(stale, bundled)
+ merged = backend_model_catalog.merge_model_sources(
+ backend_model_catalog._claude_sources(stale, bundled),
+ blocked_model_ids=blocked,
+ )
+
+ ids = {entry["id"] for entry in merged}
+ assert "claude-opus-5" in ids
+ assert not ids & set(RETIRED_CLAUDE_MODELS)
+
+
+def test_an_explicitly_listed_remote_row_can_revive_a_retired_model():
+ import copy
+
+ bundled = backend_model_catalog.load_bundled_catalog()
+ remote = copy.deepcopy(bundled)
+ remote["backends"]["claude"]["models"] = [{"id": "claude-opus-4", "visibility": "list"}]
+
+ merged = backend_model_catalog.merge_model_sources(
+ backend_model_catalog._claude_sources(remote, bundled),
+ blocked_model_ids=backend_model_catalog._claude_blocked_model_ids(remote, bundled),
+ )
+
+ assert "claude-opus-4" in {entry["id"] for entry in merged}
+
+
def test_snapshot_returns_immediately_while_remote_refresh_runs(monkeypatch, tmp_path):
refresh_started = threading.Event()
release_refresh = threading.Event()
diff --git a/tests/test_claude_model_catalog.py b/tests/test_claude_model_catalog.py
index 1e55d90e5..c957c2e77 100644
--- a/tests/test_claude_model_catalog.py
+++ b/tests/test_claude_model_catalog.py
@@ -2,6 +2,7 @@ from __future__ import annotations
from vibe.claude_model_catalog import (
FALLBACK_CLAUDE_MODELS,
+ RETIRED_CLAUDE_MODELS,
infer_models_from_bundle,
load_catalog_models,
sort_catalog_models,
@@ -38,6 +39,46 @@ def test_opus_5_5_sorts_before_opus_5_in_every_tracked_listing():
assert listing.index("claude-opus-5-5") < listing.index("claude-opus-5")
+def test_retired_models_leave_the_tracked_catalog_and_fallback():
+ """Anthropic retired these on 2026-06-15, or never shipped them under this id."""
+
+ models = load_catalog_models()
+ for model in (
+ "claude-opus-4",
+ "claude-sonnet-4",
+ "claude-haiku-4",
+ "claude-sonnet-4-0",
+ "claude-sonnet-4-20250514",
+ "claude-sonnet-3-7",
+ "claude-haiku-3-5",
+ ):
+ assert model not in models, model
+ assert model not in FALLBACK_CLAUDE_MODELS, model
+
+
+def test_bundle_inference_drops_retired_models(tmp_path):
+ bundle = tmp_path / "cli.js"
+ bundle.write_bytes(b";".join(f'"{model}"'.encode() for model in ("claude-opus-5", *RETIRED_CLAUDE_MODELS)))
+
+ assert infer_models_from_bundle(bundle) == ["claude-opus-5"]
+
+
+def test_live_legacy_models_survive_the_retirement_sweep():
+ """Ids that Claude Code still resolves must stay selectable."""
+
+ models = load_catalog_models()
+ for model in (
+ "claude-opus-4-0",
+ "claude-opus-4-1",
+ "claude-opus-4-1-20250805",
+ "claude-opus-4-20250514",
+ "claude-opus-4-5",
+ "claude-sonnet-4-5",
+ "claude-haiku-4-5",
+ ):
+ assert model in models, model
+
+
def test_catalog_excludes_dated_4_6_and_later_internal_ids():
models = load_catalog_models()
diff --git a/tests/test_model_hub_api.py b/tests/test_model_hub_api.py
index fc6c32ac9..95bd8a554 100644
--- a/tests/test_model_hub_api.py
+++ b/tests/test_model_hub_api.py
@@ -2178,7 +2178,7 @@ def test_source_create_nonce_owns_permanent_credential_through_cancellation(tmp_
def test_agents_endpoint_projects_builtin_models(tmp_path):
"""list_agents() carries each fixed menu from the backend catalog."""
- from vibe.backend_model_catalog import backend_model_entries, load_bundled_catalog
+ from vibe.backend_model_catalog import load_bundled_catalog, visible_backend_model_entries
service, _store, _adapter = _service(tmp_path)
agents = {agent["backend"]: agent for agent in service.list_agents()}
@@ -2187,7 +2187,7 @@ def test_agents_endpoint_projects_builtin_models(tmp_path):
catalog = load_bundled_catalog()
for backend in ("claude", "codex"):
- expected = [entry["id"] for entry in backend_model_entries(backend, catalog)]
+ expected = [entry["id"] for entry in visible_backend_model_entries(backend, catalog)]
assert expected, f"bundled catalog must list built-in {backend} models"
assert agents[backend]["builtin_models"] == expected
@@ -2856,6 +2856,186 @@ def test_builtin_reconcile_inserts_in_snapshot_order_and_preserves_every_other_r
assert refreshed == ["codex"]
+def test_retired_builtins_leave_the_picker_but_stay_routeable(monkeypatch, tmp_path):
+ service, store, _adapter = _service(tmp_path)
+ source = ModelHubSourceConfig(
+ id="src_pinned0001",
+ kind="api_key",
+ vendor="anthropic",
+ display_name="Pinned supplier",
+ protocol="anthropic",
+ supply_channel="hub",
+ billing="metered",
+ state=ModelHubSourceStateConfig(status="standby"),
+ models=[ModelHubModelConfig(id="claude-sonnet-4", provenance="manual")],
+ credential_ref="cred_pinned0001",
+ )
+ store.config.sources = [source]
+ agent = store.config.agents["claude"]
+ agent.sources.order = [source.id]
+ pinned_hop = ModelHubRouteHopConfig(source_id=source.id, model_id="claude-sonnet-4")
+ agent.models = [
+ ModelHubBackendModelConfig(id="claude-opus-5", origin="builtin"),
+ ModelHubBackendModelConfig(id="claude-opus-4", origin="builtin"),
+ ModelHubBackendModelConfig(id="claude-sonnet-4", origin="builtin"),
+ ModelHubBackendModelConfig(id="claude-haiku-4", origin="manual"),
+ ]
+ agent.routes = {"claude-sonnet-4": ModelHubRouteConfig(hops=(pinned_hop,))}
+ monkeypatch.setattr(
+ service,
+ "_builtin_snapshots",
+ lambda _backends: {"claude": {"complete": True, "models": [{"id": "claude-opus-5"}]}},
+ )
+
+ asyncio.run(service.reconcile_builtin_models(("claude",)))
+
+ # Every persisted row survives, so session, channel, and Agent pins still route.
+ assert [model.id for model in store.config.agents["claude"].models] == [
+ "claude-opus-5",
+ "claude-opus-4",
+ "claude-sonnet-4",
+ "claude-haiku-4",
+ ]
+ # Only the unpinned retired built-in leaves the picker.
+ assert [row["id"] for row in service.backend_catalog_models("claude")] == [
+ "claude-opus-5",
+ "claude-sonnet-4",
+ "claude-haiku-4",
+ ]
+
+
+def test_compatibility_projections_hide_retired_builtins_unless_requested(tmp_path):
+ service, store, _adapter = _service(tmp_path)
+ store.config.agents["claude"].models = [
+ ModelHubBackendModelConfig(id="claude-opus-5", origin="builtin"),
+ ModelHubBackendModelConfig(id="claude-opus-4", origin="builtin"),
+ ModelHubBackendModelConfig(id="claude-sonnet-4", origin="builtin"),
+ ]
+ service._builtin_snapshot_cache["claude"] = [{"id": "claude-opus-5"}]
+ store.requested_models["claude"] = "claude-sonnet-4"
+
+ payload = service.get_agent_sources("claude")
+
+ assert payload["builtin_models"] == ["claude-opus-5", "claude-sonnet-4"]
+ assert [row["model_id"] for row in payload["model_supply"]] == ["claude-opus-5", "claude-sonnet-4"]
+ assert [row["id"] for row in payload["catalog_models"]] == ["claude-opus-5", "claude-sonnet-4"]
+
+
+def test_a_remote_only_tombstone_hides_an_existing_builtin(monkeypatch, tmp_path):
+ from vibe import backend_model_catalog
+
+ service, store, _adapter = _service(tmp_path)
+ store.config.agents["claude"].models = [
+ ModelHubBackendModelConfig(id="claude-opus-5", origin="builtin"),
+ ModelHubBackendModelConfig(id="claude-opus-4-8", origin="builtin"),
+ ]
+ service._builtin_snapshot_cache["claude"] = [{"id": "claude-opus-5"}]
+ monkeypatch.setattr(
+ backend_model_catalog,
+ "load_cached_remote_catalog",
+ lambda **_kwargs: {"backends": {"claude": {"models": [{"id": "claude-opus-4-8", "visibility": "hide"}]}}},
+ )
+
+ assert [row["id"] for row in service.backend_catalog_models("claude")] == ["claude-opus-5"]
+ assert [model.id for model in store.config.agents["claude"].models] == ["claude-opus-5", "claude-opus-4-8"]
+
+
+def test_a_native_source_cannot_reoffer_a_hidden_retired_builtin(tmp_path):
+ service, store, _adapter = _service(tmp_path)
+ source = ModelHubSourceConfig(
+ id="src_native0001",
+ kind="api_key",
+ vendor="anthropic",
+ display_name="Native supplier",
+ protocol="anthropic",
+ supply_channel="hub",
+ billing="metered",
+ state=ModelHubSourceStateConfig(status="standby"),
+ models=[
+ ModelHubModelConfig(id="claude-opus-4", provenance="manual"),
+ ModelHubModelConfig(id="claude-opus-4-8", provenance="manual"),
+ ],
+ credential_ref="cred_native0001",
+ )
+ store.config.sources = [source]
+ agent = store.config.agents["claude"]
+ agent.sources.order = [source.id]
+ agent.models = [
+ ModelHubBackendModelConfig(id="claude-opus-5", origin="builtin"),
+ ModelHubBackendModelConfig(id="claude-opus-4", origin="builtin"),
+ ]
+ service._builtin_snapshot_cache["claude"] = [{"id": "claude-opus-5"}]
+
+ providers = [row["id"] for row in service.agent_model_candidates("claude")["providers"]]
+
+ assert "claude-opus-4" not in providers
+ assert "claude-opus-4-8" in providers
+
+
+def test_a_native_source_cannot_reoffer_a_removed_retired_builtin(tmp_path):
+ service, store, _adapter = _service(tmp_path)
+ source = ModelHubSourceConfig(
+ id="src_native0002",
+ kind="api_key",
+ vendor="anthropic",
+ display_name="Native supplier",
+ protocol="anthropic",
+ supply_channel="hub",
+ billing="metered",
+ state=ModelHubSourceStateConfig(status="standby"),
+ models=[ModelHubModelConfig(id="claude-opus-4", provenance="manual")],
+ credential_ref="cred_native0002",
+ )
+ store.config.sources = [source]
+ agent = store.config.agents["claude"]
+ agent.sources.order = [source.id]
+ agent.models = [ModelHubBackendModelConfig(id="claude-opus-5", origin="builtin")]
+ agent.removed_model_ids = ["claude-opus-4"]
+ service._builtin_snapshot_cache["claude"] = [{"id": "claude-opus-5"}]
+
+ providers = [row["id"] for row in service.agent_model_candidates("claude")["providers"]]
+
+ assert "claude-opus-4" not in providers
+
+
+def test_picker_reads_schedule_the_remote_catalog_refresh(monkeypatch, tmp_path):
+ from vibe import backend_model_catalog
+
+ service, store, _adapter = _service(tmp_path)
+ store.config.agents["claude"].models = [
+ ModelHubBackendModelConfig(id="claude-opus-5", origin="builtin"),
+ ]
+ service._builtin_snapshot_cache["claude"] = [{"id": "claude-opus-5"}]
+ calls = []
+
+ def cached(*, schedule_refresh=True, **_kwargs):
+ calls.append(schedule_refresh)
+ return {}
+
+ monkeypatch.setattr(backend_model_catalog, "load_cached_remote_catalog", cached)
+
+ service.get_agent_sources("claude")
+
+ assert calls and all(calls)
+
+
+def test_a_snapshot_revived_retired_builtin_stays_in_the_picker(monkeypatch, tmp_path):
+ service, store, _adapter = _service(tmp_path)
+ store.config.agents["claude"].models = [
+ ModelHubBackendModelConfig(id="claude-opus-4", origin="builtin", display_name="Opus 4 (kept)"),
+ ]
+ monkeypatch.setattr(
+ service,
+ "_builtin_snapshots",
+ lambda _backends: {"claude": {"complete": True, "models": [{"id": "claude-opus-4"}]}},
+ )
+
+ asyncio.run(service.reconcile_builtin_models(("claude",)))
+
+ rows = service.backend_catalog_models("claude")
+ assert [(row["id"], row["display_name"]) for row in rows] == [("claude-opus-4", "Opus 4 (kept)")]
+
+
def test_builtin_reconcile_is_blocked_only_by_store_writability(monkeypatch, tmp_path):
for store_writable in (False, True):
service, store, _adapter = _service(tmp_path)
diff --git a/tests/test_model_hub_config.py b/tests/test_model_hub_config.py
index 742e4dfc0..be752d783 100644
--- a/tests/test_model_hub_config.py
+++ b/tests/test_model_hub_config.py
@@ -1893,6 +1893,37 @@ def test_config_reload_migrates_legacy_mapping_to_exact_route_hop(monkeypatch, t
assert loaded.model_hub.sources[0].models[0].reasoning_efforts == []
+def test_config_reload_keeps_a_legacy_mapping_to_a_retired_model(monkeypatch, tmp_path):
+ """Persisted-shape rule: a pre-v5 file may map an id the catalog later retired."""
+
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ source = copy.deepcopy(_schema("source.schema.json")["examples"][0])
+ source["supply_channel"] = "native_cli"
+ source["models"][0]["provenance"] = source["models"][0].pop("origin")
+ source["models"][0]["id"] = "claude-sonnet-4"
+ current = api.config_to_payload(default_config(), include_secrets=True, include_internal=True)
+ legacy = _legacy_model_hub_payload(current["model_hub"])
+ legacy["sources"] = [source]
+ legacy["agents"]["claude"]["mode"] = "hub"
+ legacy["agents"]["claude"]["sources"] = {"policy": "custom", "order": [source["id"]]}
+ legacy["agents"]["claude"]["mappings"] = [
+ {"builtin_id": "claude-sonnet-4", "target_model_id": "claude-sonnet-4", "enabled": True}
+ ]
+ current["model_hub"] = legacy
+ config_path = tmp_path / "config.json"
+ config_path.write_text(json.dumps(current), encoding="utf-8")
+
+ loaded = V2Config.load(config_path=config_path)
+
+ agent = loaded.model_hub.agents["claude"]
+ assert loaded.load_warnings == ()
+ assert agent.mode == "hub"
+ assert agent.routes["claude-sonnet-4"].hops[0].source_id == source["id"]
+ # The released implicit menu is preserved, retired ids included, so pins
+ # stored outside `mappings` still resolve; only picker projections hide them.
+ assert "claude-opus-4" in {model.id for model in agent.models}
+
+
def test_config_reload_spells_route_hops_like_the_inventory_they_name(monkeypatch, tmp_path):
# A hop names a model in a source's inventory, and `inspect_exact_hop` decides
# membership by comparing the two identifiers exactly, so the chain only
diff --git a/vibe/backend_model_catalog.py b/vibe/backend_model_catalog.py
index 4f73a0e5c..0c72637fc 100644
--- a/vibe/backend_model_catalog.py
+++ b/vibe/backend_model_catalog.py
@@ -740,6 +740,27 @@ def backend_model_entries(backend: str, catalog: dict[str, Any] | None) -> list[
return [entry for entry in entries if entry]
+def visible_backend_model_entries(
+ backend: str, catalog: dict[str, Any] | None
+) -> list[dict[str, Any]]:
+ """Backend rows a picker may offer, with tombstoned rows dropped.
+
+ Callers that merge catalogs keep the raw entries instead, because
+ ``merge_model_sources`` needs to see a tombstone to suppress the same id in
+ the lower-priority sources behind it.
+ """
+
+ return [entry for entry in backend_model_entries(backend, catalog) if not _model_hidden(entry)]
+
+
+def retired_backend_model_ids(backend: str, catalog: dict[str, Any] | None) -> frozenset[str]:
+ """Ids this catalog tombstones, i.e. models the backend no longer serves."""
+
+ return frozenset(
+ entry["id"] for entry in backend_model_entries(backend, catalog) if _model_hidden(entry)
+ )
+
+
def backend_model_snapshot(backend: str, *, schedule_refresh: bool = True) -> dict[str, Any]:
backend_key = (backend or "").strip().lower()
if backend_key not in _SUPPORTED_BACKENDS:
@@ -755,7 +776,7 @@ def backend_model_snapshot(backend: str, *, schedule_refresh: bool = True) -> di
if backend_key == "claude":
sources = _claude_sources(remote_catalog, bundled_catalog)
- blocked: set[str] = set()
+ blocked = _claude_blocked_model_ids(remote_catalog, bundled_catalog)
else:
local_catalog = _read_codex_models_cache()
remote_entries = backend_model_entries("codex", remote_catalog)
@@ -860,7 +881,7 @@ def backend_builtin_snapshot(
bundled_catalog,
local_models=local_models,
)
- blocked: set[str] = set()
+ blocked = _claude_blocked_model_ids(remote_catalog, bundled_catalog)
else:
local_catalog, local_catalog_read = _read_codex_models_cache_with_status()
local_complete = not cli_installed or local_catalog_read
@@ -1080,6 +1101,27 @@ def _model_explicitly_visible(entry: dict[str, Any]) -> bool:
return isinstance(visibility, str) and visibility.strip().lower() in _VISIBLE_VISIBILITIES
+def _claude_blocked_model_ids(
+ remote_catalog: dict[str, Any],
+ bundled_catalog: dict[str, Any],
+) -> set[str]:
+ """Bundled retirements outrank a remote catalog cached before they shipped.
+
+ Only a remote row that is explicitly visible may bring a retired id back;
+ an old cached row that merely lists the id does not.
+ """
+
+ remote_entries = backend_model_entries("claude", remote_catalog)
+ explicit_remote_models = {
+ entry["id"] for entry in remote_entries if _model_explicitly_visible(entry)
+ }
+ return {
+ model
+ for model in retired_backend_model_ids("claude", bundled_catalog)
+ if model not in explicit_remote_models
+ }
+
+
def _codex_blocked_model_ids(
remote_entries: Sequence[dict[str, Any]],
local_catalog: Sequence[dict[str, Any]],
diff --git a/vibe/claude_model_catalog.py b/vibe/claude_model_catalog.py
index b682bf38b..9234b1867 100644
--- a/vibe/claude_model_catalog.py
+++ b/vibe/claude_model_catalog.py
@@ -20,9 +20,6 @@ FALLBACK_CLAUDE_MODELS: tuple[str, ...] = (
"claude-haiku-4-5",
"claude-opus-4-5",
"claude-sonnet-4-5",
- "claude-opus-4",
- "claude-sonnet-4",
- "claude-haiku-4",
)
# Fable is Anthropic's Mythos-class tier, positioned above Opus, so it sorts first.
@@ -128,7 +125,25 @@ def _dedupe_str_values(values: Iterable[str]) -> list[str]:
return normalized
+# Anthropic retired these on 2026-06-15, or never shipped them under this id.
+# Claude bundles still mention them in compatibility tables, so the generator
+# must drop them rather than rely on hand-editing its output.
+RETIRED_CLAUDE_MODELS = frozenset(
+ {
+ "claude-opus-4",
+ "claude-sonnet-4",
+ "claude-haiku-4",
+ "claude-sonnet-4-0",
+ "claude-sonnet-4-20250514",
+ "claude-sonnet-3-7",
+ "claude-haiku-3-5",
+ }
+)
+
+
def _is_public_catalog_model(model: str) -> bool:
+ if model in RETIRED_CLAUDE_MODELS:
+ return False
parts = model.split("-")
if len(parts) >= 4 and parts[-1].isdigit() and len(parts[-1]) == 8:
major = _int_or_none(parts[2])
diff --git a/vibe/data/backend_models.json b/vibe/data/backend_models.json
index 5d63b9a9a..462c07cb8 100644
--- a/vibe/data/backend_models.json
+++ b/vibe/data/backend_models.json
@@ -15,14 +15,18 @@
{"id": "claude-haiku-4-5", "reasoning_efforts": ["low", "medium", "high"]},
{"id": "claude-opus-4-5", "reasoning_efforts": ["low", "medium", "high"]},
{"id": "claude-sonnet-4-5", "reasoning_efforts": ["low", "medium", "high"]},
- {"id": "claude-opus-4", "reasoning_efforts": ["low", "medium", "high"]},
- {"id": "claude-sonnet-4", "reasoning_efforts": ["low", "medium", "high"]},
- {"id": "claude-haiku-4", "reasoning_efforts": ["low", "medium", "high"]},
{"id": "opus", "label": "opus [1M]", "reasoning_efforts": ["low", "medium", "high", "xhigh", "max"]},
{"id": "sonnet", "label": "sonnet [1M]", "reasoning_efforts": ["low", "medium", "high", "xhigh", "max"]},
{"id": "haiku", "reasoning_efforts": ["low", "medium", "high"]},
{"id": "opus[1m]", "label": "opus[1m] [1M]", "reasoning_efforts": ["low", "medium", "high", "xhigh", "max"]},
- {"id": "sonnet[1m]", "label": "sonnet[1m] [1M]", "reasoning_efforts": ["low", "medium", "high", "xhigh", "max"]}
+ {"id": "sonnet[1m]", "label": "sonnet[1m] [1M]", "reasoning_efforts": ["low", "medium", "high", "xhigh", "max"]},
+ {"id": "claude-opus-4", "visibility": "hide"},
+ {"id": "claude-sonnet-4", "visibility": "hide"},
+ {"id": "claude-haiku-4", "visibility": "hide"},
+ {"id": "claude-sonnet-4-0", "visibility": "hide"},
+ {"id": "claude-sonnet-4-20250514", "visibility": "hide"},
+ {"id": "claude-sonnet-3-7", "visibility": "hide"},
+ {"id": "claude-haiku-3-5", "visibility": "hide"}
]
},
"codex": {
diff --git a/vibe/data/claude_models.json b/vibe/data/claude_models.json
index c40c9efb9..e4bba4c2a 100644
--- a/vibe/data/claude_models.json
+++ b/vibe/data/claude_models.json
@@ -4,7 +4,6 @@
"claude-fable-5",
"claude-opus-5-5",
"claude-opus-5",
- "claude-opus-4",
"claude-opus-4-20250514",
"claude-opus-4-8",
"claude-opus-4-7",
@@ -15,16 +14,10 @@
"claude-opus-4-1-20250805",
"claude-opus-4-0",
"claude-sonnet-5",
- "claude-sonnet-4",
- "claude-sonnet-4-20250514",
"claude-sonnet-4-6",
"claude-sonnet-4-5",
"claude-sonnet-4-5-20250929",
- "claude-sonnet-4-0",
- "claude-sonnet-3-7",
- "claude-haiku-4",
"claude-haiku-4-5",
- "claude-haiku-4-5-20251001",
- "claude-haiku-3-5"
+ "claude-haiku-4-5-20251001"
]
}