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(codex): drop retired models from the picker (#2143)

Call Whitea45f5686a782
diff --git a/core/handlers/model_hub/service.py b/core/handlers/model_hub/service.py
index a001e6012..8ae61ccc2 100644
--- a/core/handlers/model_hub/service.py
+++ b/core/handlers/model_hub/service.py
@@ -4174,10 +4174,13 @@ class ModelHubService:
load_bundled_catalog,
load_cached_remote_catalog,
retired_backend_model_ids,
+ unlisted_retired_backend_model_ids,
)
- retired = retired_backend_model_ids(backend, load_bundled_catalog()) | retired_backend_model_ids(
- backend, load_cached_remote_catalog()
+ retired = (
+ retired_backend_model_ids(backend, load_bundled_catalog())
+ | retired_backend_model_ids(backend, load_cached_remote_catalog())
+ | unlisted_retired_backend_model_ids(backend)
)
if not retired:
return set()
diff --git a/tests/test_backend_model_catalog.py b/tests/test_backend_model_catalog.py
index 0fad2bff0..186bd3d14 100644
--- a/tests/test_backend_model_catalog.py
+++ b/tests/test_backend_model_catalog.py
@@ -921,7 +921,7 @@ def test_remote_hidden_tombstone_overrides_stale_local_visible(monkeypatch, tmp_
def test_gpt_6_sol_and_luna_follow_astra_in_the_bundled_catalog():
codex = {
entry["id"]: entry
- for entry in backend_model_catalog.backend_model_entries(
+ for entry in backend_model_catalog.visible_backend_model_entries(
"codex", backend_model_catalog.load_bundled_catalog()
)
}
@@ -1642,3 +1642,73 @@ def test_builtin_snapshot_rereads_remote_cache_file_and_changes_generation(
assert first["generation"] != second["generation"]
assert first["models"][0]["id"] == "gpt-file-generation-one"
assert second["models"][0]["id"] == "gpt-file-generation-two"
+
+
+RETIRED_CODEX_MODELS = (
+ "gpt-5.3-codex",
+ "gpt-5.2-codex",
+ "gpt-5.2",
+ "gpt-5.4-nano",
+ "gpt-5.1-codex-max",
+ "gpt-5.1-codex-mini",
+ "gpt-5.1",
+ "gpt-5",
+)
+
+
+def test_codex_retirements_outrank_stale_remote_and_local_caches(monkeypatch, tmp_path):
+ codex_dir = tmp_path / ".codex"
+ codex_dir.mkdir()
+ (codex_dir / "models_cache.json").write_text(
+ json.dumps(
+ {
+ "models": [
+ {"slug": "gpt-5.2", "visibility": "list"},
+ {"slug": "gpt-5.1-codex-mini", "visibility": "list"},
+ {"slug": "gpt-5.3-codex", "visibility": "list"},
+ {"slug": "gpt-5.4", "visibility": "list"},
+ ]
+ }
+ ),
+ encoding="utf-8",
+ )
+ monkeypatch.setenv("CODEX_HOME", str(codex_dir))
+ stale_remote = {"backends": {"codex": {"models": [{"id": "gpt-5.2"}, {"id": "gpt-6-sol"}]}}}
+ monkeypatch.setattr(backend_model_catalog, "load_cached_remote_catalog", lambda **_kwargs: stale_remote)
+
+ models = backend_model_catalog.backend_model_snapshot("codex", schedule_refresh=False)["models"]
+
+ assert {"gpt-6-sol", "gpt-5.4", "gpt-5.3-codex-spark"} <= set(models)
+ assert not set(models) & set(RETIRED_CODEX_MODELS)
+
+
+def test_an_explicitly_listed_remote_row_can_revive_a_retired_codex_model(monkeypatch, tmp_path):
+ monkeypatch.setenv("CODEX_HOME", str(tmp_path / ".codex"))
+ remote = {"backends": {"codex": {"models": [{"id": "gpt-5.2", "visibility": "list"}]}}}
+ monkeypatch.setattr(backend_model_catalog, "load_cached_remote_catalog", lambda **_kwargs: remote)
+
+ models = backend_model_catalog.backend_model_snapshot("codex", schedule_refresh=False)["models"]
+
+ assert "gpt-5.2" in models
+
+
+def test_a_revived_gpt_5_2_keeps_its_bundled_metadata():
+ from config.v2_config import _default_backend_models
+
+ row = next(model for model in _default_backend_models("codex") if model.id == "gpt-5.2")
+
+ assert row.display_name == "GPT-5.2"
+ assert row.reasoning_efforts == ["low", "medium", "high", "xhigh"]
+
+
+def test_retired_codex_models_stay_in_the_fixed_menu_for_released_configs():
+ from config.v2_config import model_hub_fixed_menu_ids
+
+ # Only gpt-5.2 ever shipped in the bundled menu; the legacy-only ids are
+ # dropped outright, so the fixed menu gains no never-released rows.
+ fixed_menu = set(model_hub_fixed_menu_ids("codex"))
+
+ assert set(RETIRED_CODEX_MODELS) & fixed_menu == {"gpt-5.2"}
+ assert backend_model_catalog.retired_backend_model_ids(
+ "codex", backend_model_catalog.load_bundled_catalog()
+ ) == {"gpt-5.2"}
diff --git a/tests/test_model_hub_api.py b/tests/test_model_hub_api.py
index 95bd8a554..bd15befb5 100644
--- a/tests/test_model_hub_api.py
+++ b/tests/test_model_hub_api.py
@@ -2998,6 +2998,18 @@ def test_a_native_source_cannot_reoffer_a_removed_retired_builtin(tmp_path):
assert "claude-opus-4" not in providers
+def test_a_legacy_only_retired_codex_row_leaves_the_picker(tmp_path):
+ service, store, _adapter = _service(tmp_path)
+ store.config.agents["codex"].models = [
+ ModelHubBackendModelConfig(id="gpt-6-sol", origin="builtin"),
+ ModelHubBackendModelConfig(id="gpt-5.1-codex-max", origin="builtin"),
+ ]
+ service._builtin_snapshot_cache["codex"] = [{"id": "gpt-6-sol"}]
+
+ assert [row["id"] for row in service.backend_catalog_models("codex")] == ["gpt-6-sol"]
+ assert [model.id for model in store.config.agents["codex"].models] == ["gpt-6-sol", "gpt-5.1-codex-max"]
+
+
def test_picker_reads_schedule_the_remote_catalog_refresh(monkeypatch, tmp_path):
from vibe import backend_model_catalog
diff --git a/tests/test_ui_api.py b/tests/test_ui_api.py
index d59d18ba4..6f9cd481f 100644
--- a/tests/test_ui_api.py
+++ b/tests/test_ui_api.py
@@ -2806,9 +2806,10 @@ def test_codex_models_merges_cli_cache_and_filters_hidden_models(monkeypatch, tm
]
assert result["models"].index("gpt-5.4") < result["models"].index("gpt-5.4-mini")
assert "gpt-5.3-codex-spark" in result["models"]
- assert "gpt-5.1-codex-mini" in result["models"]
+ # Retired ids stay out even when a local CLI cache still lists them.
+ assert "gpt-5.1-codex-mini" not in result["models"]
assert "gpt-5.1" not in result["models"]
- assert "gpt-5.2" in result["models"]
+ assert "gpt-5.2" not in result["models"]
assert result["models"].count("gpt-5.4") == 1
@@ -2842,8 +2843,8 @@ def test_codex_models_falls_back_when_cli_cache_missing(monkeypatch, tmp_path):
]
assert "custom-codex-model" not in result["models"]
assert "legacy-codex" not in result["models"]
- assert "gpt-5.1-codex-max" in result["models"]
- assert "gpt-5.1-codex-mini" in result["models"]
+ assert "gpt-5.3-codex-spark" in result["models"]
+ assert "gpt-5.1-codex-max" not in result["models"]
def test_codex_models_includes_static_reasoning(monkeypatch, tmp_path):
@@ -2854,7 +2855,7 @@ def test_codex_models_includes_static_reasoning(monkeypatch, tmp_path):
expected = ["__default__", "minimal", "low", "medium", "high", "xhigh"]
# static set, surfaced under the default "" key and per-model
assert [o["value"] for o in result["reasoning_options"][""]] == expected
- assert [o["value"] for o in result["reasoning_options"]["gpt-5.1-codex-max"]] == expected
+ assert [o["value"] for o in result["reasoning_options"]["gpt-5.3-codex-spark"]] == expected
def test_agent_model_options_claude_strips_default_and_marks_default(monkeypatch):
diff --git a/vibe/backend_model_catalog.py b/vibe/backend_model_catalog.py
index 0c72637fc..7bd6c90ef 100644
--- a/vibe/backend_model_catalog.py
+++ b/vibe/backend_model_catalog.py
@@ -76,16 +76,22 @@ _CODEX_BUILT_IN_MODELS = [
"gpt-5.5",
"gpt-5.4",
"gpt-5.4-mini",
- "gpt-5.4-nano",
- "gpt-5.3-codex",
"gpt-5.3-codex-spark",
- "gpt-5.2-codex",
- "gpt-5.2",
- "gpt-5.1-codex-max",
- "gpt-5.1-codex-mini",
- "gpt-5.1",
- "gpt-5",
]
+# Retired Codex ids that only ever came from the legacy list or a Codex CLI
+# cache, never the bundled menu. They are blocked here rather than tombstoned in
+# the bundled catalog, which would add them to the persisted fixed menu.
+_RETIRED_CODEX_MODELS = frozenset(
+ {
+ "gpt-5.3-codex",
+ "gpt-5.2-codex",
+ "gpt-5.4-nano",
+ "gpt-5.1-codex-max",
+ "gpt-5.1-codex-mini",
+ "gpt-5.1",
+ "gpt-5",
+ }
+)
_REASONING_LABELS = {
"none": "None",
"minimal": "Minimal",
@@ -753,6 +759,12 @@ def visible_backend_model_entries(
return [entry for entry in backend_model_entries(backend, catalog) if not _model_hidden(entry)]
+def unlisted_retired_backend_model_ids(backend: str) -> frozenset[str]:
+ """Retired ids no bundled catalog row carries, so no tombstone can name them."""
+
+ return _RETIRED_CODEX_MODELS if (backend or "").strip().lower() == "codex" else frozenset()
+
+
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."""
@@ -781,7 +793,7 @@ def backend_model_snapshot(backend: str, *, schedule_refresh: bool = True) -> di
local_catalog = _read_codex_models_cache()
remote_entries = backend_model_entries("codex", remote_catalog)
blocked = _codex_blocked_model_ids(
- remote_entries,
+ remote_catalog,
local_catalog,
bundled_catalog,
)
@@ -887,7 +899,7 @@ def backend_builtin_snapshot(
local_complete = not cli_installed or local_catalog_read
remote_entries = backend_model_entries("codex", remote_catalog)
blocked = _codex_blocked_model_ids(
- remote_entries,
+ remote_catalog,
local_catalog,
bundled_catalog,
)
@@ -1101,7 +1113,8 @@ 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(
+def _bundled_retired_model_ids(
+ backend: str,
remote_catalog: dict[str, Any],
bundled_catalog: dict[str, Any],
) -> set[str]:
@@ -1111,29 +1124,40 @@ def _claude_blocked_model_ids(
an old cached row that merely lists the id does not.
"""
- remote_entries = backend_model_entries("claude", remote_catalog)
+ remote_entries = backend_model_entries(backend, 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)
+ for model in retired_backend_model_ids(backend, bundled_catalog)
if model not in explicit_remote_models
}
+def _claude_blocked_model_ids(
+ remote_catalog: dict[str, Any],
+ bundled_catalog: dict[str, Any],
+) -> set[str]:
+ return _bundled_retired_model_ids("claude", remote_catalog, bundled_catalog)
+
+
def _codex_blocked_model_ids(
- remote_entries: Sequence[dict[str, Any]],
+ remote_catalog: dict[str, Any],
local_catalog: Sequence[dict[str, Any]],
bundled_catalog: dict[str, Any],
) -> set[str]:
+ remote_entries = backend_model_entries("codex", remote_catalog)
bundled_entries = backend_model_entries("codex", bundled_catalog)
explicit_catalog_models = {
entry["id"]
for entry in [*remote_entries, *bundled_entries]
if _model_explicitly_visible(entry)
}
- return {
+ retired = _bundled_retired_model_ids("codex", remote_catalog, bundled_catalog) | {
+ model for model in _RETIRED_CODEX_MODELS if model not in explicit_catalog_models
+ }
+ return retired | {
entry["id"] for entry in remote_entries if _model_hidden(entry)
} | {
entry["id"]
diff --git a/vibe/data/backend_models.json b/vibe/data/backend_models.json
index 462c07cb8..d23655e87 100644
--- a/vibe/data/backend_models.json
+++ b/vibe/data/backend_models.json
@@ -40,7 +40,7 @@
{"id": "gpt-5.5", "label": "GPT-5.5", "priority": 12, "reasoning_efforts": ["low", "medium", "high", "xhigh"]},
{"id": "gpt-5.4", "label": "GPT-5.4", "priority": 16, "reasoning_efforts": ["low", "medium", "high", "xhigh"]},
{"id": "gpt-5.4-mini", "label": "GPT-5.4-Mini", "priority": 23, "reasoning_efforts": ["low", "medium", "high", "xhigh"]},
- {"id": "gpt-5.2", "label": "GPT-5.2", "priority": 29, "reasoning_efforts": ["low", "medium", "high", "xhigh"]}
+ {"id": "gpt-5.2", "label": "GPT-5.2", "priority": 29, "visibility": "hide", "reasoning_efforts": ["low", "medium", "high", "xhigh"]}
]
}
}