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.

fix(model-hub): keep the native [1M] suffix out of Claude model names (#2323)

Call Whitee688c8b13215
diff --git a/core/handlers/model_hub/service.py b/core/handlers/model_hub/service.py
index 4a73a5f68..71f8c4b60 100644
--- a/core/handlers/model_hub/service.py
+++ b/core/handlers/model_hub/service.py
@@ -47,6 +47,7 @@ from storage.db import get_cached_sqlite_engine
from storage.models import agent_sessions, messages
from vibe.backend_model_catalog import (
PROTOCOL_REASONING_EFFORT_DEFAULTS,
+ builtin_display_name,
bundled_catalog_reasoning_efforts_by_model,
)
from vibe.model_hub_runtime.api_key_vendors import (
@@ -5247,7 +5248,18 @@ class ModelHubService:
builtin_order = tuple(model.id for model in snapshot)
present = {model.id for model in agent.models}
removed = set(agent.removed_model_ids)
- added = False
+ touched = False
+ # Earlier releases stored a Claude row's native ` [1M]` suffix as its
+ # name (see `builtin_display_name`); give those rows back their id.
+ if backend in snapshots:
+ for model in agent.models:
+ if (
+ model.origin == "builtin"
+ and model.display_name is not None
+ and builtin_display_name(backend, model.id, model.display_name) is None
+ ):
+ model.display_name = None
+ touched = True
for model in snapshot:
model_id = model.id
if model_id in present or model_id in removed:
@@ -5258,8 +5270,8 @@ class ModelHubService:
builtin_order,
)
present.add(model_id)
- added = True
- if added:
+ touched = True
+ if touched:
changed.append(cast(BackendName, backend))
return changed
diff --git a/tests/test_backend_model_catalog.py b/tests/test_backend_model_catalog.py
index 14d842279..59d68c362 100644
--- a/tests/test_backend_model_catalog.py
+++ b/tests/test_backend_model_catalog.py
@@ -1457,6 +1457,22 @@ def test_backend_builtin_models_merge_backend_snapshots_but_exclude_user_config(
]
+def test_claude_builtin_rows_carry_no_native_1m_suffix_as_their_name(monkeypatch):
+ """The ` [1M]` suffix is the native picker's presentation, not a model name.
+
+ Stored as a Model Hub name it marked only the rows added after an adoption,
+ while the rows the adoption imported kept their bare ids.
+ """
+ monkeypatch.setattr(backend_model_catalog, "load_cached_remote_catalog", lambda **kwargs: {})
+ snapshot = backend_model_catalog.backend_builtin_snapshot("claude", schedule_refresh=False)
+ names = {item["id"]: item["display_name"] for item in snapshot["models"]}
+
+ assert "claude-sonnet-5-5" in names and "opus" in names
+ assert {model: name for model, name in names.items() if name is not None} == {}
+ # A Claude label that is a real name is still a name.
+ assert backend_model_catalog.builtin_display_name("claude", "claude-x", "Claude X") == "Claude X"
+
+
def test_builtin_snapshot_requires_each_catalog_once_when_cli_is_installed(
monkeypatch,
):
diff --git a/tests/test_model_hub_api.py b/tests/test_model_hub_api.py
index bebfab4cb..36d9207cf 100644
--- a/tests/test_model_hub_api.py
+++ b/tests/test_model_hub_api.py
@@ -3077,6 +3077,46 @@ def test_builtin_reconcile_inserts_in_snapshot_order_and_preserves_every_other_r
assert refreshed == ["codex"]
+def test_builtin_reconcile_gives_claude_rows_back_the_names_a_native_suffix_replaced(
+ monkeypatch,
+ tmp_path,
+):
+ """Earlier releases stored a Claude row's native ` [1M]` suffix as its name.
+
+ Only rows added after an adoption got it, so one model in a picker read
+ `claude-sonnet-5-5 [1M]` beside bare ids. A reconcile repairs exactly
+ those built-in names and leaves every real name alone.
+ """
+ service, store, _adapter = _service(tmp_path)
+ agent = store.config.agents["claude"]
+ agent.models = [
+ ModelHubBackendModelConfig(id="claude-opus-5-5", origin="builtin"),
+ ModelHubBackendModelConfig(id="claude-sonnet-5-5", origin="builtin", display_name="claude-sonnet-5-5 [1M]"),
+ ModelHubBackendModelConfig(id="opus", origin="builtin", display_name="opus [1M]"),
+ ModelHubBackendModelConfig(id="claude-haiku-4-5", origin="builtin", display_name="Haiku"),
+ ModelHubBackendModelConfig(id="claude-opus-5", origin="manual", display_name="claude-opus-5 [1M]"),
+ ]
+ agent.routes = {model.id: ModelHubRouteConfig() for model in agent.models}
+ monkeypatch.setattr(
+ service,
+ "_builtin_snapshots",
+ lambda _backends: {"claude": {"complete": True, "models": [{"id": model.id} for model in agent.models]}},
+ )
+
+ changed = asyncio.run(service.reconcile_builtin_models(("claude",)))
+
+ names = {model.id: model.display_name for model in store.config.agents["claude"].models}
+ assert changed == ["claude"]
+ assert names == {
+ "claude-opus-5-5": None,
+ "claude-sonnet-5-5": None,
+ "opus": None,
+ "claude-haiku-4-5": "Haiku",
+ # A name the user gave a row is theirs, whatever it says.
+ "claude-opus-5": "claude-opus-5 [1M]",
+ }
+
+
def test_retired_builtins_leave_the_picker_but_stay_routeable(monkeypatch, tmp_path):
service, store, _adapter = _service(tmp_path)
source = ModelHubSourceConfig(
diff --git a/vibe/backend_model_catalog.py b/vibe/backend_model_catalog.py
index 7bd6c90ef..378fb8dae 100644
--- a/vibe/backend_model_catalog.py
+++ b/vibe/backend_model_catalog.py
@@ -911,12 +911,7 @@ def backend_builtin_snapshot(
models=[
{
"id": entry["id"],
- "display_name": (
- entry.get("label")
- if isinstance(entry.get("label"), str)
- and entry["label"] != entry["id"]
- else None
- ),
+ "display_name": builtin_display_name(backend_key, entry["id"], entry.get("label")),
"reasoning_efforts": list(
entry.get("reasoning_efforts")
or _DEFAULT_REASONING_EFFORTS[backend_key]
@@ -928,6 +923,24 @@ def backend_builtin_snapshot(
)
+def builtin_display_name(backend: str, model_id: str, label: object) -> str | None:
+ """The name a built-in row stores in the Model Hub, or None for its id.
+
+ A Claude label is presentation, not a name: `format_claude_model_label`
+ appends ` [1M]` for the native picker. Stored as a name it would freeze
+ that suffix onto the rows added after a Hub adoption, while the rows the
+ adoption imported keep their bare ids.
+ """
+ if not isinstance(label, str) or label == model_id:
+ return None
+ if backend == "claude":
+ from modules.agents.opencode.utils import format_claude_model_label
+
+ if label == format_claude_model_label(model_id):
+ return None
+ return label
+
+
def _versioned_builtin_snapshot(
*,
complete: bool,