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.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(model-hub): one owner of a Source model's effort levels (#2583)
Call Whitece58c5d7fb0f
diff --git a/core/controller.py b/core/controller.pyindex 6b7da394d..19d99f337 100644--- a/core/controller.py+++ b/core/controller.py@@ -3000,6 +3000,13 @@ class Controller:"Model Hub built-in reconciliation failed during startup",exc_info=True,)+ try:+ asyncio.run(self.model_hub_service.reconcile_source_reasoning_tiers())+ except Exception:+ logger.warning(+ "Model Hub could not derive saved Source tiers again during startup",+ exc_info=True,+ )self.model_hub_turn_gateway = ModelHubTurnGateway(self.model_hub_service,language_provider=lambda: self.config.language,diff --git a/core/handlers/model_hub/pricing.py b/core/handlers/model_hub/pricing.pyindex 7741dd55c..97aa72cb2 100644--- a/core/handlers/model_hub/pricing.py+++ b/core/handlers/model_hub/pricing.py@@ -29,6 +29,8 @@ from datetime import date, datetime, timedeltafrom pathlib import Pathfrom typing import Any, Callable, Final, Mapping, Optional+from vibe.backend_model_catalog import catalog_model_id+logger = logging.getLogger(__name__)PRICE_OVERRIDE_FILENAME: Final = "model_hub_prices.json"@@ -102,10 +104,6 @@ _PLAN_KEYS: Final[Mapping[tuple[str, str], str]] = {# resolves only through a fee key the override file names outright._PLAN_FAMILIES: Final[Mapping[str, str]] = {"anthropic": "anthropic", "openai": "openai", "codex": "openai"}-_DATE_SUFFIX: Final = re.compile(r"(?:-\d{8}|-\d{4}-\d{2}-\d{2}|@[^/]*)$")-_BRACKET_SUFFIX: Final = re.compile(r"\[[^\]]*\]$")--@dataclass(frozen=True)class ModelPrice:"""USD per million tokens."""@@ -223,18 +221,10 @@ def _flat_price(cost: object) -> Optional[ModelPrice]:def normalize_model_id(model_id: str) -> str:- """Fold the spellings agents send onto the one a price table lists.-- `anthropic/claude-opus-5[1m]` and `claude-opus-4-5-20251101` become- `claude-opus-5` and `claude-opus-4-5`: the context-window tag, the snapshot- date, and a provider prefix do not change a list price.- """+ """Fold the spellings agents send onto the one a price table lists (``catalog_model_id``): the context-window+ tag, the snapshot date, and a provider prefix do not change a list price."""- text = model_id.strip().lower()- text = text.rsplit("/", 1)[-1]- text = _BRACKET_SUFFIX.sub("", text)- text = _DATE_SUFFIX.sub("", text)- return text.strip()+ return catalog_model_id(model_id)def _first_party(model_id: str, vendor_map: Mapping[str, Any]) -> Optional[str]:diff --git a/core/handlers/model_hub/reasoning_tiers.py b/core/handlers/model_hub/reasoning_tiers.pyindex d4e572cff..f280209a6 100644--- a/core/handlers/model_hub/reasoning_tiers.py+++ b/core/handlers/model_hub/reasoning_tiers.py@@ -8,6 +8,7 @@ from typing import Literal, Mapping, Sequencefrom vibe.backend_model_catalog import (PROTOCOL_REASONING_EFFORT_DEFAULTS,bundled_catalog_wire_efforts_by_model,+ catalog_row_value,without_client_presets,)@@ -33,23 +34,31 @@ def resolve_reasoning_tiers() -> ReasoningTierResolution:"""Apply upstream, bundled-catalog, then user provenance in that order.- A catalog row is a client's menu: its ``client_presets`` (Codex ``ultra``)+ The catalog row is found by the model's id, or by the id a snapshot, tag or+ provider prefix folds to (``catalog_model_id``), and it bounds the protocol+ defaults an upstream signal stands for. A catalog row is a client's menu: its ``client_presets`` (Codex ``ultra``)are names the client maps before sending, so a Source's wire tiers neverinclude them (#2539). ``catalog_efforts_by_model`` is therefore the wireindex, ``bundled_catalog_wire_efforts_by_model()``."""+ catalog_efforts = catalog_row_value(+ bundled_catalog_wire_efforts_by_model() if catalog_efforts_by_model is None else catalog_efforts_by_model,+ model_id,+ )if supported_parameters is not None and any(parameter.strip().lower() in _UPSTREAM_REASONING_PARAMETERSfor parameter in supported_parameters):defaults = PROTOCOL_REASONING_EFFORT_DEFAULTS.get(protocol)if defaults is not None:- return ReasoningTierResolution(defaults, "upstream")+ # A generic reasoning parameter says the upstream takes the protocol's levels; the model's own row+ # bounds them, so the hop declares exactly the levels its model has (Opus 4.6 has no xhigh).+ return ReasoningTierResolution(+ defaults if catalog_efforts is None else tuple(effort for effort in defaults if effort in catalog_efforts),+ "upstream",+ )- catalog_efforts = (- bundled_catalog_wire_efforts_by_model() if catalog_efforts_by_model is None else catalog_efforts_by_model- ).get(model_id)if catalog_efforts is not None:return ReasoningTierResolution(catalog_efforts, "catalog")@@ -66,3 +75,37 @@ def catalog_wire_efforts(model_id: str, efforts: Sequence[str]) -> tuple[str, .."""return tuple(without_client_presets((model_id,), efforts))+++def rederive_persisted_tiers(+ *,+ protocol: str,+ model_id: str,+ efforts: Sequence[str],+ source: ReasoningEffortsSource,+ catalog_efforts_by_model: Mapping[str, tuple[str, ...]],+) -> ReasoningTierResolution | None:+ """A saved Source declaration derived again by this ladder, or None to keep it as saved.++ An earlier build derived rows by its own rules: 3.2.0 matched only exact+ ids, and gave every model behind a generic reasoning parameter the whole+ protocol default list. A row the bundled catalog describes is derived again+ when this ladder made it (``catalog``, ``upstream``) or found nothing for it+ (no source and no tiers). An upstream row keeps its upstream signal. A+ user's list waits for discovery, which reports when the catalog outranks it.+ """++ if catalog_row_value(catalog_efforts_by_model, model_id) is None:+ return None+ if source == "upstream":+ return resolve_reasoning_tiers(+ protocol=protocol,+ model_id=model_id,+ supported_parameters=("reasoning",),+ catalog_efforts_by_model=catalog_efforts_by_model,+ )+ if source == "catalog" or (source is None and not efforts):+ return resolve_reasoning_tiers(+ protocol=protocol, model_id=model_id, catalog_efforts_by_model=catalog_efforts_by_model,+ )+ return Nonediff --git a/core/handlers/model_hub/service.py b/core/handlers/model_hub/service.pyindex bfc39267c..11946d5b0 100644--- a/core/handlers/model_hub/service.py+++ b/core/handlers/model_hub/service.py@@ -181,7 +181,7 @@ from .provenance import (produce_turn_outcome,)from .request import ModelHubRequest, without_opaque_history-from .reasoning_tiers import catalog_wire_efforts, resolve_reasoning_tiers+from .reasoning_tiers import catalog_wire_efforts, rederive_persisted_tiers, resolve_reasoning_tiersfrom .stream_wire import ProtocolSSEState, ProtocolUsageReportfrom .resolver import (BackendName,@@ -6546,6 +6546,43 @@ class ModelHubService:return backend_builtin_models(backend)+ async def reconcile_source_reasoning_tiers(self) -> list[tuple[str, str]]:+ """Derive saved Source tiers again by the current ladder, once at startup; the (Source, model) pairs it changed.++ Rows an earlier build derived keep its rules until discovery revisits+ them: 3.2.0 found no catalog row for a snapshot id and declared the whole+ protocol default list for Opus 4.6. ``rederive_persisted_tiers`` decides+ which rows are derived again. The result is saved once, so a later start+ changes nothing.+ """++ async with self._mutation_lock:+ previous = self.store.load()+ config = self._clone_config(previous)+ catalog_efforts_by_model = bundled_catalog_wire_efforts_by_model()+ changed: list[tuple[str, str]] = []+ for source in config.sources:+ for model in source.models:+ resolution = rederive_persisted_tiers(+ protocol=source.protocol,+ model_id=model.id,+ efforts=model.reasoning_efforts,+ source=model.reasoning_efforts_source,+ catalog_efforts_by_model=catalog_efforts_by_model,+ )+ if resolution is None or (+ list(resolution.efforts) == list(model.reasoning_efforts)+ and resolution.source == model.reasoning_efforts_source+ ):+ continue+ model.reasoning_efforts = list(resolution.efforts)+ model.reasoning_efforts_source = resolution.source+ changed.append((source.id, model.id))+ if changed and self._reconcile_store_writable():+ await self._commit_synced(previous, config)+ return changed+ return []+async def reconcile_builtin_models(self,backends: Iterable[BackendName] = ("claude", "codex"),diff --git a/docs/plans/model-hub-capability-model.md b/docs/plans/model-hub-capability-model.mdindex 5b1363058..9d4d54823 100644--- a/docs/plans/model-hub-capability-model.md+++ b/docs/plans/model-hub-capability-model.md@@ -132,7 +132,7 @@ and is pruned at the next write.| Consumer | Rule || --- | --- |-| Effort menu for a model on an Agent | each hop's declared tiers, then the union across hops. A hop's declared tiers follow `model-hub-reasoning-tiers.md`'s ladder: an upstream reasoning signal (the protocol's ladder), else the bundled backend row's efforts minus that row's `client_presets` (provenance `catalog`; it outranks a user list, with a visible override event), else the user's list, else models.dev `reasoning_options` when the catalog row is built. A persisted `catalog` list is also read without `client_presets`, since released builds wrote them, and Vibey's own model rows always drop them at config load (3.2.0 saved rows with Codex's `ultra`; Vibey is never the client a preset belongs to, and no provider documents `ultra` as a wire effort). A user-authored Source list is never filtered. The overlay's `wire_efforts` slots in before the backend row once a vendor needs it; no shipped entry sets it yet. A tier is omitted only if **every** hop that can serve the model has negative evidence for it. A tier with negative evidence on some hops is shown with "not on: <Source>". Model Hub projects this per hop as the chain API's read-only `refused_efforts` (`agent-chain.schema.json`); the UI renders the omission and the hint from it. |+| Effort menu for a model on an Agent | each hop's declared tiers, then the union across hops. A hop's declared tiers follow `model-hub-reasoning-tiers.md`'s ladder: an upstream reasoning signal (the protocol's ladder, bounded by the model's catalog row when it has one), else the bundled backend row's efforts minus that row's `client_presets` (provenance `catalog`; it outranks a user list, with a visible override event), else the user's list, else models.dev `reasoning_options` when the catalog row is built. A persisted `catalog` list is also read without `client_presets`, since released builds wrote them, and Vibey's own model rows always drop them at config load (3.2.0 saved rows with Codex's `ultra`; Vibey is never the client a preset belongs to, and no provider documents `ultra` as a wire effort). A user-authored Source list is never filtered. The overlay's `wire_efforts` slots in before the backend row once a vendor needs it; no shipped entry sets it yet. A tier is omitted only if **every** hop that can serve the model has negative evidence for it. A tier with negative evidence on some hops is shown with "not on: <Source>". Model Hub projects this per hop as the chain API's read-only `refused_efforts` (`agent-chain.schema.json`); the UI renders the omission and the hint from it. || Effort at request time | Forwarded unchanged (reasoning-intent). A hop with **negative** evidence for that effort is skipped for this request, as if it were not a candidate. If no candidate remains, the request fails before invocation with `effort_unsupported` naming the effort and the Sources, instead of a provider 400. Never clamped silently. || Hosted tool mode on a hop | `native` only with positive `call` evidence taken on the current engine and probe shape, and the user's toggle on; otherwise the gateway proxy (`vibey-hosted-tools.md`). A wrong native declaration is a terminal 400 or a silent drop; the proxy is lossless. So this feature needs positive evidence, unlike efforts. || Native payload replay | only to the same Source, and only while its `replay` evidence is positive and taken on the current engine and probe shape. The decision is made at every request from `HopResolution`; the transcript never stores it. |diff --git a/docs/plans/model-hub-reasoning-tiers.md b/docs/plans/model-hub-reasoning-tiers.mdindex f767715f0..25d7ff455 100644--- a/docs/plans/model-hub-reasoning-tiers.md+++ b/docs/plans/model-hub-reasoning-tiers.md@@ -51,7 +51,22 @@ shape and treats everything else as "not carried":- OpenRouter-shape `supported_parameters` arrays: if the model entry contains`"reasoning"` (or `"reasoning_effort"`), the model is reasoning-capable.Upstream signals are capability booleans, not level enums, so the applied- tier list is the UNIFIED VOCABULARY for the source's protocol family (below).+ tier list is the UNIFIED VOCABULARY for the source's protocol family (below),+ bounded by the model's own catalog row when it has one: a generic signal says+ the upstream takes the protocol's levels, not that this model has all of+ them (Opus 4.6 has `max` but no `xhigh`). A model without a row keeps the+ whole list.+- Every catalog lookup finds a model's row by its id, or by the id a snapshot+ date, a context tag or a provider prefix folds to+ (`backend_model_catalog.catalog_model_id`, the one folding owner, which+ pricing also uses): `claude-opus-5-20260724` and `anthropic/claude-opus-5[1m]`+ are `claude-opus-5`.+- Rows a released build derived by older rules (3.2.0 matched only exact ids+ and never bounded the protocol list) are derived again once at controller+ startup (`ModelHubService.reconcile_source_reasoning_tiers`): every `catalog`+ or `upstream` row, or a row with no source and no tiers, whose model has a+ catalog row. A user's list waits for the next discovery, which records the+ override event.- Any other/unknown metadata shape → rung 1 does not apply. No guessing frommodel-id patterns (family inference was explicitly deferred; wrong claimsturn into upstream 400s).diff --git a/tests/fixtures/model_hub/released_3_2_0_source_tiers.json b/tests/fixtures/model_hub/released_3_2_0_source_tiers.jsonnew file mode 100644index 000000000..943d4a343--- /dev/null+++ b/tests/fixtures/model_hub/released_3_2_0_source_tiers.json@@ -0,0 +1,793 @@+{+ "enabled": true,+ "runtime_default_applied": true,+ "sources": [+ {+ "id": "src_tiers3201",+ "created_at": "2026-10-01T00:00:00Z",+ "last_discovered_at": null,+ "kind": "api_key",+ "vendor": "anthropic",+ "display_name": "anthropic relay",+ "protocol": "anthropic",+ "base_url": null,+ "supply_channel": "hub",+ "billing": "metered",+ "state": {+ "status": "active",+ "retry_at": null,+ "detail_key": null+ },+ "models": [+ {+ "id": "claude-opus-4-6",+ "display_name": null,+ "origin": "discovered",+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ],+ "reasoning_efforts_source": "upstream",+ "discovered_at": null+ },+ {+ "id": "claude-sonnet-4-6-20260301",+ "display_name": null,+ "origin": "discovered",+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ],+ "reasoning_efforts_source": "upstream",+ "discovered_at": null+ },+ {+ "id": "claude-opus-5-20260724",+ "display_name": null,+ "origin": "discovered",+ "reasoning_efforts": [],+ "reasoning_efforts_source": null,+ "discovered_at": null+ },+ {+ "id": "relay-house-model",+ "display_name": null,+ "origin": "discovered",+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ],+ "reasoning_efforts_source": "upstream",+ "discovered_at": null+ },+ {+ "id": "claude-haiku-4-5-20251001",+ "display_name": null,+ "origin": "discovered",+ "reasoning_efforts": [+ "low",+ "high"+ ],+ "reasoning_efforts_source": "user",+ "discovered_at": null+ }+ ],+ "credential_ref": "cred_src_tiers3201",+ "account_label": null,+ "masked_credential": null+ },+ {+ "id": "src_tiers3202",+ "created_at": "2026-10-01T00:00:00Z",+ "last_discovered_at": null,+ "kind": "api_key",+ "vendor": "openai",+ "display_name": "openai relay",+ "protocol": "openai_responses",+ "base_url": null,+ "supply_channel": "hub",+ "billing": "metered",+ "state": {+ "status": "active",+ "retry_at": null,+ "detail_key": null+ },+ "models": [+ {+ "id": "gpt-6-astra-2026-09-01",+ "display_name": null,+ "origin": "discovered",+ "reasoning_efforts": [],+ "reasoning_efforts_source": null,+ "discovered_at": null+ }+ ],+ "credential_ref": "cred_src_tiers3202",+ "account_label": null,+ "masked_credential": null+ }+ ],+ "agents": {+ "opencode": {+ "backend": "opencode",+ "mode": "direct",+ "menu_kind": "open",+ "sources": {+ "order": []+ },+ "routes": {},+ "menu": {+ "view": "featured",+ "checked": []+ },+ "models": [],+ "removed_model_ids": []+ },+ "claude": {+ "backend": "claude",+ "mode": "direct",+ "menu_kind": "fixed",+ "sources": {+ "order": []+ },+ "routes": {},+ "menu": null,+ "models": [+ {+ "id": "claude-fable-5-1",+ "display_name": "claude-fable-5-1 [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "claude-fable-5",+ "display_name": "claude-fable-5 [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "claude-opus-5-5",+ "display_name": "claude-opus-5-5 [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "claude-opus-5",+ "display_name": "claude-opus-5 [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "claude-opus-4-8",+ "display_name": "claude-opus-4-8 [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "claude-opus-4-7",+ "display_name": "claude-opus-4-7 [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "claude-opus-4-6",+ "display_name": "claude-opus-4-6 [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "max"+ ]+ },+ {+ "id": "claude-sonnet-5-5",+ "display_name": "claude-sonnet-5-5 [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "claude-sonnet-5",+ "display_name": "claude-sonnet-5 [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "claude-sonnet-4-6",+ "display_name": "claude-sonnet-4-6 [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "max"+ ]+ },+ {+ "id": "claude-haiku-4-5",+ "display_name": null,+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high"+ ]+ },+ {+ "id": "claude-opus-4-5",+ "display_name": null,+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high"+ ]+ },+ {+ "id": "claude-sonnet-4-5",+ "display_name": null,+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high"+ ]+ },+ {+ "id": "opus",+ "display_name": "opus [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "sonnet",+ "display_name": "sonnet [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "haiku",+ "display_name": null,+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high"+ ]+ },+ {+ "id": "opus[1m]",+ "display_name": "opus[1m] [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "sonnet[1m]",+ "display_name": "sonnet[1m] [1M]",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "claude-opus-4",+ "display_name": null,+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": []+ },+ {+ "id": "claude-sonnet-4",+ "display_name": null,+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": []+ },+ {+ "id": "claude-haiku-4",+ "display_name": null,+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": []+ },+ {+ "id": "claude-sonnet-4-0",+ "display_name": null,+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": []+ },+ {+ "id": "claude-sonnet-4-20250514",+ "display_name": null,+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": []+ },+ {+ "id": "claude-sonnet-3-7",+ "display_name": null,+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": []+ },+ {+ "id": "claude-haiku-3-5",+ "display_name": null,+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": []+ }+ ],+ "removed_model_ids": []+ },+ "codex": {+ "backend": "codex",+ "mode": "direct",+ "menu_kind": "fixed",+ "sources": {+ "order": []+ },+ "routes": {},+ "menu": null,+ "models": [+ {+ "id": "gpt-6-astra",+ "display_name": "GPT-6-Astra",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max",+ "ultra"+ ]+ },+ {+ "id": "gpt-6.1-sol",+ "display_name": "GPT-6.1-Sol",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "gpt-6-sol",+ "display_name": "GPT-6-Sol",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "gpt-6-luna",+ "display_name": "GPT-6-Luna",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "gpt-5.6-sol",+ "display_name": "GPT-5.6-Sol",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max",+ "ultra"+ ]+ },+ {+ "id": "gpt-5.6-terra",+ "display_name": "GPT-5.6-Terra",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max",+ "ultra"+ ]+ },+ {+ "id": "gpt-5.6-luna",+ "display_name": "GPT-5.6-Luna",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh",+ "max"+ ]+ },+ {+ "id": "gpt-5.5",+ "display_name": "GPT-5.5",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh"+ ]+ },+ {+ "id": "gpt-5.4",+ "display_name": "GPT-5.4",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh"+ ]+ },+ {+ "id": "gpt-5.4-mini",+ "display_name": "GPT-5.4-Mini",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh"+ ]+ },+ {+ "id": "gpt-5.2",+ "display_name": "GPT-5.2",+ "origin": "builtin",+ "models_dev_id": null,+ "context_window": null,+ "max_output_tokens": null,+ "input_modalities": [],+ "output_modalities": [],+ "supports_tools": null,+ "supports_reasoning": null,+ "reasoning_efforts": [+ "low",+ "medium",+ "high",+ "xhigh"+ ]+ }+ ],+ "removed_model_ids": []+ }+ }+}diff --git a/tests/scenarios/model_hub/catalog.yaml b/tests/scenarios/model_hub/catalog.yamlindex 90714ecc9..34f10ee2c 100644--- a/tests/scenarios/model_hub/catalog.yaml+++ b/tests/scenarios/model_hub/catalog.yaml@@ -263,6 +263,8 @@ scenarios:- tests/test_model_hub_reasoning_tiers.py::test_a_persisted_catalog_list_offers_no_client_preset_to_vibey- tests/test_model_hub_vibey_consumer.py::test_a_released_vibey_row_loads_without_its_client_preset- tests/test_model_hub_evidence_rules.py::test_a_refused_effort_still_waits_for_a_capable_hop_that_is_cooling_down+ - tests/test_model_hub_reasoning_tiers.py::test_the_hop_declares_exactly_its_models_levels+ - tests/test_model_hub_reasoning_tiers.py::test_rows_saved_by_3_2_0_are_derived_again_once_at_startup- id: MH-HOSTED-VIBEY-002name: Every native hosted item becomes one hosted call with a provider-neutral action and its record; citations stay on the text that cites them; the response's counters and reported cost go to its summarystatus: covereddiff --git a/tests/test_model_hub_api.py b/tests/test_model_hub_api.pyindex 11bbd347b..ba022c6a7 100644--- a/tests/test_model_hub_api.py+++ b/tests/test_model_hub_api.py@@ -7066,7 +7066,8 @@ def test_add_model_upsert_cannot_bypass_catalog_tier_lock(tmp_path):id="gpt-5.6-sol",supported_parameters=("reasoning_effort",),),- ["minimal", "low", "medium", "high", "xhigh"],+ # The protocol defaults, bounded by the model's catalog row.+ ["low", "medium", "high", "xhigh"],"upstream","upstream_tiers",),diff --git a/tests/test_model_hub_reasoning_tiers.py b/tests/test_model_hub_reasoning_tiers.pyindex 7d28bb05b..50626ffb7 100644--- a/tests/test_model_hub_reasoning_tiers.py+++ b/tests/test_model_hub_reasoning_tiers.py@@ -16,9 +16,10 @@ def test_upstream_reasoning_signal_uses_only_the_protocol_default(protocol: str,expected: tuple[str, ...],) -> None:+ # A model no catalog row describes: nothing bounds what its protocol allows.resolution = resolve_reasoning_tiers(protocol=protocol,- model_id="gpt-5.6-sol",+ model_id="relay-reasoning-model",supported_parameters=("temperature", "reasoning"),existing_efforts=("user-only",),existing_source="user",@@ -28,6 +29,31 @@ def test_upstream_reasoning_signal_uses_only_the_protocol_default(assert resolution.source == "upstream"+ ("protocol", "model_id", "reported", "efforts", "source"),+ (+ # A model's own row bounds the protocol defaults: Opus and Sonnet 4.6 have max but no xhigh.+ ("anthropic", "claude-opus-4-6", ("reasoning",), ("low", "medium", "high", "max"), "upstream"),+ ("anthropic", "claude-sonnet-4-6-20260301", ("reasoning",), ("low", "medium", "high", "max"), "upstream"),+ ("openai_responses", "gpt-5.6-sol", ("reasoning_effort",), ("low", "medium", "high", "xhigh"), "upstream"),+ # Mythos 5 and 5.1 have every Anthropic level, which is exactly the protocol default list, so no row is+ # needed for them.+ ("anthropic", "claude-mythos-5-1", ("reasoning",), ("low", "medium", "high", "xhigh", "max"), "upstream"),+ # A snapshot, a context tag or a provider prefix names the same row.+ ("anthropic", "claude-opus-5-20260724", None, ("low", "medium", "high", "xhigh", "max"), "catalog"),+ ("anthropic", "anthropic/claude-opus-5[1m]", None, ("low", "medium", "high", "xhigh", "max"), "catalog"),+ # ... and the row's client presets with it: a snapshot of gpt-6-astra still never offers Codex's ultra.+ ("openai_responses", "gpt-6-astra-2026-09-01", None, ("low", "medium", "high", "xhigh", "max"), "catalog"),+ ),+)+def test_the_hop_declares_exactly_its_models_levels(protocol, model_id, reported, efforts, source) -> None:+ """MH-HOSTED-006: one owner of effort levels. A snapshot or qualified id finds its model's catalog row, and that+ row bounds the protocol defaults a generic reasoning parameter stands for."""+ resolution = resolve_reasoning_tiers(protocol=protocol, model_id=model_id, supported_parameters=reported)++ assert (resolution.efforts, resolution.source) == (efforts, source)++def test_catalog_row_outranks_user_and_drops_its_client_presets() -> None:"""MH-HOSTED-006 (#2539): Codex's ``ultra`` is a client preset, never a Source's wire tier."""resolution = resolve_reasoning_tiers(@@ -157,3 +183,46 @@ def test_a_persisted_catalog_list_offers_no_client_preset_to_vibey(tmp_path, pro[row] = [row for row in providers if row["id"] == "gpt-5.6-sol"]assert row["reasoning_efforts"] == expected+++async def test_rows_saved_by_3_2_0_are_derived_again_once_at_startup(tmp_path) -> None:+ """MH-HOSTED-006: 3.2.0 found no row for a snapshot id and declared xhigh for Opus and Sonnet 4.6. The fixture+ was written by v3.2.0's own ladder; the startup reconcile derives those rows again, and only those."""+ import json+ from pathlib import Path++ from config.v2_config import ModelHubConfig+ from tests.test_model_hub_api import _service++ section = json.loads(+ (Path(__file__).parent / "fixtures/model_hub/released_3_2_0_source_tiers.json").read_text(encoding="utf-8")+ )+ service, store, _adapter = _service(tmp_path)+ store.config = ModelHubConfig.from_payload(section)++ changed = await service.reconcile_source_reasoning_tiers()++ rows = {+ (source.id, model.id): (model.reasoning_efforts, model.reasoning_efforts_source)+ for source in store.load().sources+ for model in source.models+ }+ assert rows == {+ ("src_tiers3201", "claude-opus-4-6"): (["low", "medium", "high", "max"], "upstream"),+ ("src_tiers3201", "claude-sonnet-4-6-20260301"): (["low", "medium", "high", "max"], "upstream"),+ ("src_tiers3201", "claude-opus-5-20260724"): (["low", "medium", "high", "xhigh", "max"], "catalog"),+ # No catalog row describes it: its upstream list stays as saved.+ ("src_tiers3201", "relay-house-model"): (["low", "medium", "high", "xhigh", "max"], "upstream"),+ # A user's list waits for discovery, which reports when the catalog outranks it.+ ("src_tiers3201", "claude-haiku-4-5-20251001"): (["low", "high"], "user"),+ ("src_tiers3202", "gpt-6-astra-2026-09-01"): (["low", "medium", "high", "xhigh", "max"], "catalog"),+ }+ assert sorted(changed) == [+ ("src_tiers3201", "claude-opus-4-6"),+ ("src_tiers3201", "claude-opus-5-20260724"),+ ("src_tiers3201", "claude-sonnet-4-6-20260301"),+ ("src_tiers3202", "gpt-6-astra-2026-09-01"),+ ]+ # Saved once: the next start finds nothing to change.+ assert await service.reconcile_source_reasoning_tiers() == []diff --git a/vibe/backend_model_catalog.py b/vibe/backend_model_catalog.pyindex 313f619ff..253efc925 100644--- a/vibe/backend_model_catalog.py+++ b/vibe/backend_model_catalog.py@@ -542,6 +542,32 @@ def prepare_codex_hub_catalog()+#: Spellings that name the same model: a snapshot date or version tag, and a context-window tag.+_MODEL_SNAPSHOT_SUFFIX: Final = re.compile(r"(?:-\d{8}|-\d{4}-\d{2}-\d{2}|@[^/]*)$")+_MODEL_CONTEXT_TAG: Final = re.compile(r"\[[^\]]*\]$")+++def catalog_model_id(model_id: str) -> str:+ """Fold the spellings agents send onto the one catalogs list.++ ``anthropic/claude-opus-5[1m]`` and ``claude-opus-4-5-20251101`` become ``claude-opus-5`` and ``claude-opus-4-5``:+ a provider prefix, the context-window tag and the snapshot date name the same model, its levels and its price.+ """++ text = model_id.strip().lower()+ text = text.rsplit("/", 1)[-1]+ text = _MODEL_CONTEXT_TAG.sub("", text)+ text = _MODEL_SNAPSHOT_SUFFIX.sub("", text)+ return text.strip()+++def catalog_row_value(index: Mapping[str, tuple[str, ...]], model_id: str) -> tuple[str, ...] | None:+ """A per-model catalog list for ``model_id``: its own row's, else the row's its spelling folds to."""++ value = index.get(model_id)+ return value if value is not None else index.get(catalog_model_id(model_id))++def load_bundled_catalog(path: Path | None = None) -> dict[str, Any]:return _read_catalog(path or get_bundled_catalog_path()) or {}@@ -621,7 +647,7 @@ def without_client_presets(model_ids: Sequence[str], efforts: Sequence[str]) ->"""presets = bundled_client_presets_once()- dropped = {preset for model_id in model_ids for preset in presets.get(model_id, ())}+ dropped = {preset for model_id in model_ids for preset in catalog_row_value(presets, model_id) or ()}return [effort for effort in efforts if effort not in dropped]