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
feat(model-hub): a Use for web search switch on each model executor (#3077)
Call Whiteb3402b8ac92c
diff --git a/config/v2_config.py b/config/v2_config.pyindex f1b2ec014..aa0711f9f 100644--- a/config/v2_config.py+++ b/config/v2_config.py@@ -3331,6 +3331,42 @@ def _search_service_settings_from_payload(return settings+@dataclass(frozen=True)+class ModelHubExecutorSettings:+ """A model executor Source's saved web-search choice (``vibey-hosted-tools.md`` §6): on unless turned off."""++ enabled: bool = True++ @classmethod+ def from_payload(cls, payload: object) -> "ModelHubExecutorSettings":+ if not isinstance(payload, dict):+ raise ValueError("Config 'model_hub.hosted_tools.web_search.executors' entries must be objects")+ if set(payload) - {"enabled"}:+ logger.warning("Config 'model_hub.hosted_tools.web_search.executors' ignores unknown fields")+ enabled = payload.get("enabled", True)+ if not isinstance(enabled, bool):+ raise ValueError("Config search executor enabled must be a boolean")+ return cls(enabled=enabled)++ def to_payload(self) -> dict[str, Any]:+ return {"enabled": self.enabled}+++def _executor_settings_from_payload(+ payload: object, sources: Optional[list[ModelHubSourceConfig]]+) -> dict[str, ModelHubExecutorSettings]:+ if not isinstance(payload, dict) or any(not is_model_hub_source_id(key) for key in payload):+ raise ValueError("Config 'model_hub.hosted_tools.web_search.executors' must map Source ids to settings")+ live = {source.id for source in sources} if sources is not None else None+ # Removed Sources have no settings; an extant Source keeps its opt-out while it lists no executor model, so the+ # choice holds if it lists one again. Only an opt-out is a choice: on is the default.+ return {+ source_id: saved+ for source_id, raw in payload.items()+ if (live is None or source_id in live) and not (saved := ModelHubExecutorSettings.from_payload(raw)).enabled+ }++@dataclass(frozen=True)class ModelHubFetchServiceSettings:"""Fetch-only partial consent; search settings never authorize a page read."""@@ -3400,6 +3436,8 @@ class ModelHubHostedToolConfig:prefer_native: bool = Trueservices: Mapping[str, ModelHubSearchServiceSettings | ModelHubFetchServiceSettings] = field(default_factory=dict)executor_order_kinds: Optional[Mapping[str, str]] = None+ # ``web_search`` only: model executor Sources the user turned off (§6), by Source id.+ executors: Mapping[str, ModelHubExecutorSettings] = field(default_factory=dict)@classmethoddef from_payload(@@ -3413,7 +3451,7 @@ class ModelHubHostedToolConfig:if tool == "web_fetch":known |= {"executor_order", "services", "executor_order_kinds"}elif tool == "web_search":- known |= {"executor_order", "service_order", "prefer_native", "services", "executor_order_kinds"}+ known |= {"executor_order", "service_order", "prefer_native", "services", "executor_order_kinds", "executors"}elif tool in MODEL_HUB_SEARCH_TOOLS:known.add("executor_order")else:@@ -3448,6 +3486,10 @@ class ModelHubHostedToolConfig:_executor_order_kinds_from_payload(payload["executor_order_kinds"], order, sources, tool=tool)if tool in {"web_search", "web_fetch"} and "executor_order_kinds" in payload else None),+ executors=(+ _executor_settings_from_payload(payload["executors"], sources)+ if tool == "web_search" and "executors" in payload else {}+ ),default_image=(ModelHubImageModelChoice.from_payload(payload["default_model"], tool=tool) if has_default else None),@@ -3470,6 +3512,8 @@ class ModelHubHostedToolConfig:source_id: kind for source_id, kind in self.executor_order_kinds.items()if source_id in (self.executor_order or ())}+ if self.executors:+ out["executors"] = {source_id: saved.to_payload() for source_id, saved in self.executors.items()}return outdiff --git a/core/handlers/model_hub/adapter.py b/core/handlers/model_hub/adapter.pyindex d69771923..9f2ec184a 100644--- a/core/handlers/model_hub/adapter.py+++ b/core/handlers/model_hub/adapter.py@@ -1,4 +1,4 @@-"""Model Hub EngineAdapter interface. FINAL CONTRACT v22 (2026-10-27).+"""Model Hub EngineAdapter interface. FINAL CONTRACT v23 (2026-10-30).This file is the canonical adapter boundary and must remain byte-identical to``core/handlers/model_hub/adapter.py``. The adapter owns one-Source operations:diff --git a/core/handlers/model_hub/hosted_tools.py b/core/handlers/model_hub/hosted_tools.pyindex a179ace9d..cea0457a8 100644--- a/core/handlers/model_hub/hosted_tools.py+++ b/core/handlers/model_hub/hosted_tools.py@@ -35,6 +35,7 @@ from config.v2_config import (ModelHubConfig,ModelHubHostedToolConfig,ModelHubImageModelChoice,+ ModelHubExecutorSettings,ModelHubSearchServiceSettings,ModelHubSourceConfig,hosted_tool_setting,@@ -260,10 +261,17 @@ def executor_candidates(def _search_chain(config: ModelHubConfig, setting: ModelHubHostedToolConfig, models: Mapping[str, ExecutorCandidate],) -> tuple[ExecutorCandidate, ...]:- """One role per Source; stale/unnamed service roles precede the first model, without a config write."""+ """One role per Source; stale/unnamed service roles precede the first model, without a config write.++ A role the user turned off, a service's or a model executor's, follows every other at the end, never tried. A+ model executor turned off is placed as if on, then moved to the end, so the others keep their places.+ """services: dict[str, ExecutorCandidate] = {}- remaining = dict(models)+ remaining = {+ source_id: replace(candidate, settings={"enabled": source_id not in setting.executors})+ for source_id, candidate in models.items()+ }disabled: list[ExecutorCandidate] = []ordered = _vibey_order(config)keyless = model_hub_keyless_exa_source() if KEYLESS_EXA_ACTIVE else None@@ -316,8 +324,10 @@ def _search_chain(named_ids = {candidate.source.id for candidate in named}additions = [c for sid, c in services.items() if sid not in named_ids]position = next((i for i, c in enumerate(named) if c.kind == "model"), len(named))- return tuple(named[:position] + additions + named[position:]- + [c for sid, c in remaining.items() if sid not in named_ids] + disabled)+ chain = (named[:position] + additions + named[position:]+ + [c for sid, c in remaining.items() if sid not in named_ids] + disabled)+ off = [candidate for candidate in chain if candidate.kind == "model" and not candidate.settings["enabled"]]+ return tuple([candidate for candidate in chain if candidate not in off] + off)def listed_executor_model(source: ModelHubSourceConfig, tool: str, *, spec_for: SpecLookup) -> Optional[str]:@@ -749,6 +759,8 @@ def hosted_tools_status("billing": candidate.source.billing,"relay": is_relay(candidate.source),"price": _price_payload(candidate.price),+ # The web-search switch (§6); X search keeps none.+ **({"settings": dict(candidate.settings)} if candidate.settings is not None else {}),}if candidate.kind == "model" else _service_candidate_payload(candidate.source, setting,@@ -829,7 +841,7 @@ def apply_hosted_tool_put(config: ModelHubConfig, tool: str, payload: object) ->if tool == "web_fetch":allowed.add("services")if tool == "web_search":- allowed |= {"prefer_native", "services"}+ allowed |= {"prefer_native", "services", "executors"}if not isinstance(payload, dict) or not payload or set(payload) - allowed:raise HostedToolSettingRefused("invalid_parameter", 400)changes: dict[str, Any] = {}@@ -849,6 +861,8 @@ def apply_hosted_tool_put(config: ModelHubConfig, tool: str, payload: object) ->changes["services"] = patch_fetch_services(config, payload["services"])else:changes["services"] = _patch_search_services(config, payload["services"])+ if "executors" in payload:+ changes["executors"] = _patch_executors(config, payload["executors"])if "executor_order" in payload:order = payload["executor_order"]changes["executor_order"] = None if order is None else model_hub_executor_order(order, tool=tool)@@ -903,6 +917,36 @@ def _patch_search_services(config: ModelHubConfig, payload: object) -> dict[str,return saved+def _patch_executors(config: ModelHubConfig, payload: object) -> dict[str, ModelHubExecutorSettings]:+ """A Source-keyed patch of model executors' web-search switches: ``{"enabled": bool}``, or null for the default.++ Only a Source that lists a web-search executor model takes a switch; on is the default, so only an opt-out is+ saved.+ """++ if not isinstance(payload, dict):+ raise ValueError("executors must be a Source-keyed patch")+ saved = dict(hosted_tool_setting(config, "web_search").executors)+ live = {source.id: source for source in config.sources}+ for source_id, patch in payload.items():+ if not is_model_hub_source_id(source_id):+ raise ValueError("executors keys must be Source ids")+ if patch is None:+ saved.pop(source_id, None)+ continue+ source = live.get(source_id)+ if (+ source is None or not isinstance(patch, dict) or set(patch) != {"enabled"}+ or listed_executor_model(source, "web_search", spec_for=hosted_tool_spec) is None+ ):+ raise ValueError("executors must name a web-search executor Source and its switch")+ if ModelHubExecutorSettings.from_payload(patch).enabled:+ saved.pop(source_id, None)+ else:+ saved[source_id] = ModelHubExecutorSettings(enabled=False)+ return saved++def clear_request(tool: str, payload: object) -> Callable[[EvidenceRecord], bool]:"""One ``POST /api/models/hosted-tools/<tool>/clear`` body read as the refusals it clears.diff --git a/core/handlers/model_hub/provenance.py b/core/handlers/model_hub/provenance.pyindex 90afcd486..3dc1499ba 100644--- a/core/handlers/model_hub/provenance.py+++ b/core/handlers/model_hub/provenance.py@@ -2779,7 +2779,7 @@ class TurnCorrelationRegistry:self.store.put({- "contract_version": 22,+ "contract_version": 23,"turn_id": normalized_turn_id,"ts": ts or _utc_now_iso(),"agent": trace.agent,diff --git a/core/handlers/model_hub/service.py b/core/handlers/model_hub/service.pyindex 7c26a9492..3d53eb9cb 100644--- a/core/handlers/model_hub/service.py+++ b/core/handlers/model_hub/service.py@@ -274,7 +274,7 @@ from .usage import (local_usage_day,)-CONTRACT_VERSION = 22+CONTRACT_VERSION = 23def seeded_source_name(vendor: str) -> str:@@ -397,8 +397,8 @@ def _described_as_unfit_for_agent_turns(match: Mapping[str, Any]) -> bool:)-AGENT_CHAIN_CONTRACT_VERSION = 22-PROBE_RESULT_CONTRACT_VERSION = 22+AGENT_CHAIN_CONTRACT_VERSION = 23+PROBE_RESULT_CONTRACT_VERSION = 23_SOURCE_DISCOVERY_TIMEOUT_SECONDS = 15_SOURCE_PROBE_TIMEOUT_SECONDS = 60# Background inventory refresh. The first tick doubles as the startup delay, so@@ -1405,7 +1405,7 @@ def _runtime_payload(status: EngineStatus, *, enabled: bool) -> dict:manager = EngineRuntimeManager()return {- "contract_version": 22,+ "contract_version": 23,"enabled": enabled,"host_platform": status.host_platform or manager.host_platform(),"manifest": manager.contract_manifest(),diff --git a/docs/plans/model-hub-contracts/README.md b/docs/plans/model-hub-contracts/README.mdindex cb919b977..d9e924185 100644--- a/docs/plans/model-hub-contracts/README.md+++ b/docs/plans/model-hub-contracts/README.md@@ -1,6 +1,17 @@# Model Hub contracts-Status: **contract_version 22**, 2026-10-27: Gemini API keys on the native `google` protocol+Status: **contract_version 23**, 2026-10-30: a switch for each web-search model executor+(`../vibey-hosted-tools.md` §6). `gh-v3.2.4rc1` and `rc2` carry v22, so this opens v23.+- `web_search` gains saved `executors`: `{<source_id>: {"enabled": false}}` for each model executor Source the user+ turned off. On is the default and is never saved. A turned-off executor ends the effective order with the+ turned-off services and is never tried; its frozen turn slot is `enabled: false`, skipped as `disabled`.+- The Tools read's web-search model candidates carry `settings: {enabled}` (`hosted-tools-status.schema.json`);+ X search candidates carry none. `PUT /api/models/hosted-tools/web_search` takes an `executors` patch:+ `{"enabled": bool}`, or null for the default, only for a Source that lists a web-search executor model.+- **Downgrade:** a release before v23 ignores `executors` with a warning, so a turned-off executor runs again+ there until the user upgrades.++It builds on v22 (2026-10-27): Gemini API keys on the native `google` protocol(`../vibey-gemini-native.md` §3). `gh-v3.2.3rc8` through `rc12` carry v21, so this opens v22.- The `gemini` catalog row pins `google` on `https://generativelanguage.googleapis.com`; a `google` Source's vendor is`custom` or `gemini` (`source.schema.json`, `source-create.schema.json`, `google-protocol.md`).@@ -407,7 +418,7 @@ comparison. A gate may not report success by comparing stale input with itself.## Version closure-`contract_version` 22 must coexist in all registered version locations on the same tested head:+`contract_version` 23 must coexist in all registered version locations on the same tested head:- `mirror-registry.json`- `agent-chain.schema.json`diff --git a/docs/plans/model-hub-contracts/adapter-interface.py b/docs/plans/model-hub-contracts/adapter-interface.pyindex d69771923..9f2ec184a 100644--- a/docs/plans/model-hub-contracts/adapter-interface.py+++ b/docs/plans/model-hub-contracts/adapter-interface.py@@ -1,4 +1,4 @@-"""Model Hub EngineAdapter interface. FINAL CONTRACT v22 (2026-10-27).+"""Model Hub EngineAdapter interface. FINAL CONTRACT v23 (2026-10-30).This file is the canonical adapter boundary and must remain byte-identical to``core/handlers/model_hub/adapter.py``. The adapter owns one-Source operations:diff --git a/docs/plans/model-hub-contracts/agent-chain.schema.json b/docs/plans/model-hub-contracts/agent-chain.schema.jsonindex 73a0d3345..9e2af00dc 100644--- a/docs/plans/model-hub-contracts/agent-chain.schema.json+++ b/docs/plans/model-hub-contracts/agent-chain.schema.json@@ -7,7 +7,7 @@"required": ["contract_version", "backend", "model_id", "manual_override", "route_origin", "chain", "current", "supply_state"],"additionalProperties": false,"properties": {- "contract_version": { "const": 22 },+ "contract_version": { "const": 23 },"backend": { "enum": ["claude", "codex", "opencode", "vibey"] },"model_id": { "type": "string" },"manual_override": {@@ -259,7 +259,7 @@],"examples": [{- "contract_version": 22,+ "contract_version": 23,"backend": "codex","model_id": "unlisted-model","manual_override": null,@@ -269,7 +269,7 @@"supply_state": "ok"},{- "contract_version": 22,+ "contract_version": 23,"backend": "codex","model_id": "gpt-5.6","manual_override": null,@@ -279,7 +279,7 @@"supply_state": "ok"},{- "contract_version": 22,+ "contract_version": 23,"backend": "claude","model_id": "claude-opus-4-6","manual_override": null,@@ -289,7 +289,7 @@"supply_state": "waiting"},{- "contract_version": 22,+ "contract_version": 23,"backend": "opencode","model_id": "glm-5.2","manual_override": { "hops": [{ "source_id": "src_relay9c1x", "model_id": "glm-5.2" }] },@@ -299,7 +299,7 @@"supply_state": "waiting"},{- "contract_version": 22,+ "contract_version": 23,"backend": "codex","model_id": "gpt-5.6","manual_override": null,@@ -309,7 +309,7 @@"supply_state": "interrupted"},{- "contract_version": 22,+ "contract_version": 23,"backend": "codex","model_id": "gpt-5.6","manual_override": null,@@ -319,7 +319,7 @@"supply_state": "interrupted"},{- "contract_version": 22,+ "contract_version": 23,"backend": "claude","model_id": "claude-haiku-4-5","manual_override": null,diff --git a/docs/plans/model-hub-contracts/api-response.schema.json b/docs/plans/model-hub-contracts/api-response.schema.jsonindex 0846c6dc8..1fd6d0a52 100644--- a/docs/plans/model-hub-contracts/api-response.schema.json+++ b/docs/plans/model-hub-contracts/api-response.schema.json@@ -63,7 +63,7 @@"required": ["ok", "contract_version", "probe"],"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"probe": {"$ref": "model-hub/source-probe-result.schema.json"}}},@@ -162,7 +162,7 @@"SuccessCore": {"properties": {"ok": {"const": true},- "contract_version": {"const": 22}+ "contract_version": {"const": 23}}},"SourceListResponse": {@@ -171,7 +171,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"sources": {"type": "array", "items": {"$ref": "#/definitions/SourceApi"}}}},@@ -181,7 +181,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"observation": {"$ref": "model-hub/observation-result.schema.json"}}},@@ -191,7 +191,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"source": {"$ref": "#/definitions/SourceApi"},"added_to": {"type": "array", "items": {"$ref": "#/definitions/AddedTo"}},"adopted_by": {"type": "array", "items": {"$ref": "#/definitions/AdoptedBy"}, "uniqueItems": true}@@ -203,7 +203,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"source": {"$ref": "#/definitions/SourceApi"}}},@@ -213,7 +213,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"source": {"$ref": "#/definitions/SourceApi"},"removed_hops": {"type": "array", "items": {"$ref": "#/definitions/RouteHopRef"}},"interrupted": {"type": "array", "items": {"$ref": "#/definitions/SupplyGap"}}@@ -225,7 +225,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"source": {"allOf": [{"$ref": "#/definitions/SourceApi"},@@ -243,7 +243,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"removed_hops": {"type": "array", "items": {"$ref": "#/definitions/RouteHopRef"}},"interrupted": {"type": "array", "items": {"$ref": "#/definitions/SupplyGap"}}}@@ -254,7 +254,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"agents": {"type": "array", "items": {"$ref": "#/definitions/AgentSupplyApi"}}}},@@ -264,7 +264,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"agent": {"$ref": "#/definitions/AgentSupplyApi"}}},@@ -281,7 +281,7 @@],"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"agent": {"$ref": "#/definitions/AgentSupplyApi"},"removed_hops": {"type": "array", "items": {"$ref": "#/definitions/RouteHopRef"}, "uniqueItems": true},"interrupted": {"type": "array", "items": {"$ref": "#/definitions/SupplyGap"}, "uniqueItems": true}@@ -306,7 +306,7 @@"additionalProperties": false,"properties": {"ok": {"const": false},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"error": {"const": "candidate_suppliers_changed"},"detail": {"type": "string", "minLength": 1},"changed": {@@ -326,7 +326,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"agent": {"type": "object","required": ["backend", "mode", "catalog_models"],@@ -427,7 +427,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"candidates": {"type": "object","required": ["builtin", "providers", "in_list"],@@ -446,7 +446,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"matches": {"type": "array","maxItems": 8,@@ -480,7 +480,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"chain": {"$ref": "model-hub/agent-chain.schema.json"}}},@@ -490,7 +490,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"chains": {"type": "array", "items": {"$ref": "model-hub/agent-chain.schema.json"}}}},@@ -500,7 +500,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"chain": {"$ref": "model-hub/agent-chain.schema.json"},"removed_hops": {"type": "array", "items": {"$ref": "#/definitions/RouteHopRef"}},"interrupted": {"type": "array", "items": {"$ref": "#/definitions/SupplyGap"}}@@ -512,7 +512,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"probe": {"$ref": "model-hub/probe-result.schema.json"}}},@@ -522,7 +522,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"events": {"type": "array", "items": {"$ref": "model-hub/resolution-event.schema.json"}}}},@@ -532,7 +532,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"usage": {"$ref": "model-hub/usage-summary.schema.json"}}},@@ -542,7 +542,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"quota": {"$ref": "model-hub/quota-summary.schema.json"}}},@@ -552,7 +552,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"hosted_tools": {"$ref": "model-hub/hosted-tools-status.schema.json"}}},@@ -562,7 +562,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"flow": {"allOf": [{"$ref": "model-hub/oauth-flow.schema.json"},@@ -584,7 +584,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"flow": {"allOf": [{"$ref": "model-hub/oauth-flow.schema.json"},@@ -607,7 +607,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"flow": {"allOf": [{"$ref": "model-hub/oauth-flow.schema.json"},@@ -632,7 +632,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22}+ "contract_version": {"const": 23}}},"RuntimeApi": {@@ -654,7 +654,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"scan": {"$ref": "model-hub/migration-scan.schema.json"}}},@@ -664,7 +664,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"applied": {"type": "integer", "minimum": 0},"sources": {"type": "array", "items": {"$ref": "#/definitions/SourceApi"}},"added_to": {"type": "array", "items": {"$ref": "#/definitions/AddedTo"}}@@ -676,7 +676,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"provenance": {"$ref": "model-hub/turn-provenance.schema.json"}}},@@ -687,7 +687,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"provenance": {"anyOf": [{"$ref": "model-hub/turn-provenance.schema.json"},@@ -702,7 +702,7 @@"additionalProperties": false,"properties": {"ok": {"const": true},- "contract_version": {"const": 22},+ "contract_version": {"const": 23},"runtime": {"$ref": "#/definitions/RuntimeApi"}}}diff --git a/docs/plans/model-hub-contracts/api.md b/docs/plans/model-hub-contracts/api.mdindex 1a7cf53ab..b64d775b7 100644--- a/docs/plans/model-hub-contracts/api.md+++ b/docs/plans/model-hub-contracts/api.md@@ -8,11 +8,11 @@ credential redaction and supply-impact confirmation rules still apply; unknownAPI siblings retain the Owner default.-Status: **Normative, `contract_version` 22** — Model Hub implementations must conform, and the response conformance guard enumerates this route table and validates one real server response for every route.+Status: **Normative, `contract_version` 23** — Model Hub implementations must conform, and the response conformance guard enumerates this route table and validates one real server response for every route.-Success envelope: `{ok: true, contract_version: 22, ...}`.+Success envelope: `{ok: true, contract_version: 23, ...}`.Failure envelope:-`{ok: false, contract_version: 22, error: <machine_code>, detail?: <i18n_key>}`.+`{ok: false, contract_version: 23, error: <machine_code>, detail?: <i18n_key>}`.`detail` is always a string. Structured error data lives in a named sibling.Guarded mutation refusals specialize that envelope through`guard-refusal.schema.json`; both report arrays are required and together form the plan@@ -24,7 +24,7 @@ table. The contract guard requires the two endpoint sets to be identical, requirexercised HTTP response for every registry entry, and validates that response againstthe route's named schema.-The shared envelope and every versioned nested contract carry `contract_version` 22, the+The shared envelope and every versioned nested contract carry `contract_version` 23, theterminal value. Supported persisted config shapes and historical TurnProvenanceremain readable; ephemeral envelopes use only the terminal version.@@ -75,7 +75,7 @@ runtime open. Once models are configured it participates in the runtime Stop gua| GET `/api/models/hosted-tools` | → `{hosted_tools: HostedToolsStatus}` | Models → Tools (`hosted-tools-status.schema.json`): every catalog tool with its switch (absent setting = on), its passive status from real use (`latest_ok`, current `refused[]`, per-pair `verified[]`), for a search tool the saved and effective executor order with every eligible executor candidate and its unit rates, and for `image_generate` the saved and effective default and the available image models. Memory only; nothing is probed. || POST `/api/models/hosted-tools/web_fetch/services/<source_id>/retry` | `{}` → `{}` | Clears the same Source/service cooldown and generation as search for Exa (`src_exakeyless`, `exa/mcp`), or Jina's own. Member management role; no fetch is sent. Local has no whole-executor retry and returns `404 source_not_found`. || POST `/api/models/hosted-tools/web_search/services/<source_id>/retry` | `{}` → `{}` | Clears the controller's `(Source, service)` cooldown, advances its generation, and leaves Source health unchanged. The Tools read is the follow-up source of truth. Member management role. |-| PUT `/api/models/hosted-tools/<tool>` | `{enabled?: boolean, executor_order?: null \| [source_id], default_model?: null \| {source_id, model_id}, prefer_native?: boolean, services?: {source_id: null \| {results?: integer \| null, enabled?: boolean \| null}}}` → `{hosted_tools: HostedToolsStatus}` | Changes one tool's settings field by field: an absent field is unchanged, `null` resets `executor_order` to automatic or `default_model` to the default. `executor_order` is for search/fetch tools and `default_model` for `image_generate`; values are saved as given, never resolved. It applies from the next turn and interrupts nothing. An unknown tool returns `404 hosted_tool_not_found`; an empty or malformed body `400 invalid_parameter`, including a null `enabled`, an id that is not a Source id (`src_…`), or a model id with surrounding whitespace. |+| PUT `/api/models/hosted-tools/<tool>` | `{enabled?: boolean, executor_order?: null \| [source_id], default_model?: null \| {source_id, model_id}, prefer_native?: boolean, services?: {source_id: null \| {results?: integer \| null, enabled?: boolean \| null}}, executors?: {source_id: null \| {enabled: boolean}}}` → `{hosted_tools: HostedToolsStatus}` | Changes one tool's settings field by field: an absent field is unchanged, `null` resets `executor_order` to automatic or `default_model` to the default. `executor_order` is for search/fetch tools and `default_model` for `image_generate`; values are saved as given, never resolved. `executors` (`web_search` only) switches a model executor Source on or off for web search; `null` or `enabled: true` restores the default (on), and only a Source that lists a web-search executor model takes one. It applies from the next turn and interrupts nothing. An unknown tool returns `404 hosted_tool_not_found`; an empty or malformed body `400 invalid_parameter`, including a null `enabled`, an id that is not a Source id (`src_…`), or a model id with surrounding whitespace. || POST `/api/models/hosted-tools/<tool>/clear` | `{source_id?, model_id?}` → `{hosted_tools: HostedToolsStatus}` | Clears the tool's refusals (`call` and `replay`): on one Source and model, on one Source (every model), or with `{}` on every Source. `model_id` requires `source_id`; neither is nullable, so a malformed body is refused rather than widened into a broader clear. A Source or model with nothing to clear is a no-op that answers the read. The file is written first: a failed write returns `500 state_write_failed` and changes nothing. A cleared Source is assumed again from its next request. An unknown tool returns `404 hosted_tool_not_found`; any other body `400 invalid_parameter`. || POST `/api/models/sources/<source_id>/evidence/clear` | `{model_id, feature: {kind: "effort", name}}` → `{source: Source}` | Clears one effort refusal of a Source's model, so the next request at that effort may reach it. A missing record is a no-op. An unknown Source returns `404 source_not_found`; a hosted-tool feature or any other body `400 invalid_parameter` (hosted refusals clear through the Tools clear); a failed write `500 state_write_failed` with nothing changed. || POST `/api/models/oauth/start` | `{vendor, channel, client_nonce?}` → `{flow: OAuthFlow}` | Starts creation of a new subscription source. Before provider work, the optional exact `(client_nonce, vendor, channel)` tuple is atomically claimed; concurrent retries coalesce to its one pending start and terminal result. |@@ -85,7 +85,7 @@ runtime open. Once models are configured it participates in the runtime Stop gua| POST `/api/models/migration/scan` | → `{scan: MigrationScan}` | Read-only. || POST `/api/models/migration/apply` | `{item_ids: string[], clean_api_keys?: boolean}` → `{applied, sources, added_to}` | Applies one grouped, server-owned custody transaction. It checks saved configuration and custody locally, copies API keys without upstream validation, upgrades an existing native subscription Source in place when present, and commits Source/Routes/backend mode atomically. API-key originals are kept unless cleanup was selected. Pre-exposure failure is reversible; post-exposure recovery is forward-only and keeps the backend blocked until terminalized. || GET `/api/models/turns/<turn_id>/provenance` | → `{provenance: TurnProvenance}` or documented absence error | Debug read for exactly attributed Hub turns. |-| GET `/api/models/runtime/status` | → `{runtime: RuntimeDependency}` | Read-only managed engine status. The nested object carries `contract_version` 22 and persisted user intent in `enabled`; `not_started` is installed lazy-start idleness, not an alarm. |+| GET `/api/models/runtime/status` | → `{runtime: RuntimeDependency}` | Read-only managed engine status. The nested object carries `contract_version` 23 and persisted user intent in `enabled`; `not_started` is installed lazy-start idleness, not an alarm. || POST `/api/models/runtime/install` | → `{runtime: RuntimeDependency}` | Idempotently starts server-owned installation. It returns and persists `installing`; reload reads the same state. Uses the existing mutation authentication and CSRF guards. || POST `/api/models/runtime/start` | → `{runtime: RuntimeDependency}` | Persists `enabled: true` and explicitly starts the managed engine. Service startup restores this intent; runtime availability has no separate enable-confirmation step. Uses the existing mutation authentication and CSRF guards; status reads never start it. || POST `/api/models/runtime/stop` | → `{runtime: RuntimeDependency}` | Explicitly stops the managed engine, persists `enabled: false`, and returns it to `not_started`. The mutation is rejected with `runtime_in_use` while any native backend is configured for Hub mode or Avibe has catalog models, so disabling the shared runtime cannot strand a configured route. An empty Avibe catalog does not keep the runtime open. |@@ -768,7 +768,7 @@ The terminal result of both ordinary API-key creation and OAuth creation is:```json{"ok": true,- "contract_version": 22,+ "contract_version": 23,"source": {"id": "src_anthkey01","kind": "api_key",@@ -878,7 +878,7 @@ Every guarded Source/inventory mutation uses the §4.5 envelope matrix and the c```json{"ok": false,- "contract_version": 22,+ "contract_version": 23,"error": "source_last_supplier","would_remove_hops": [],"would_interrupt": [@@ -1017,7 +1017,7 @@ API-key success:```json{"ok": true,- "contract_version": 22,+ "contract_version": 23,"source": {"id": "src_relay9c1x","kind": "api_key",@@ -1112,7 +1112,7 @@ Status and submit return the same terminal shape:```json{"ok": true,- "contract_version": 22,+ "contract_version": 23,"flow": {"flow_id": "oaf_claude01","client_nonce": "ofn_01j5w8z7p4n6q2rt",@@ -1185,9 +1185,9 @@ a valid `interrupted` chain.```json{"ok": true,- "contract_version": 22,+ "contract_version": 23,"chain": {- "contract_version": 22,+ "contract_version": 23,"backend": "codex","model_id": "gpt-5.6","manual_override": null,@@ -1214,7 +1214,7 @@ In Direct mode both chain and probe refuse with:```json{"ok": false,- "contract_version": 22,+ "contract_version": 23,"error": "direct_mode","detail": "models.hub.direct_mode"}@@ -1228,9 +1228,9 @@ A successful probe nests its result:```json{"ok": true,- "contract_version": 22,+ "contract_version": 23,"probe": {- "contract_version": 22,+ "contract_version": 23,"backend": "claude","channel": "hub","reachable": false,@@ -1253,7 +1253,7 @@ not-ready carries the closed i18n key `models.probe.native_cli_unavailable`.```json{- "contract_version": 22,+ "contract_version": 23,"backend": "codex","channel": "native_cli","reachable": true,@@ -1266,7 +1266,7 @@ not-ready carries the closed i18n key `models.probe.native_cli_unavailable`.```json{- "contract_version": 22,+ "contract_version": 23,"backend": "codex","channel": "native_cli","reachable": false,@@ -1282,7 +1282,7 @@ No candidate is an API error with a typed model-scoped state:```json{"ok": false,- "contract_version": 22,+ "contract_version": 23,"error": "probe_no_candidate","detail": "models.probe.no_candidate.waiting","supply": {@@ -1473,7 +1473,7 @@ The store retains at most 500 exactly attributed settled turns with its existingwrites. Ambiguous attribution remains excluded; this is not a log of every upstreamrequest. Null means no matching retained record, including eviction. A newer served,canceled or other record without a terminal error supersedes older error display.-Success uses exactly `{ok: true, contract_version: 22, provenance: TurnProvenance | null}`;+Success uses exactly `{ok: true, contract_version: 23, provenance: TurnProvenance | null}`;there is no `success` field or envelope exception.Local `engine_down` records may also contain `local_error_detail`, an OS-generated@@ -1577,7 +1577,7 @@ ambiguous absence are explicit and distinguishable from an unknown turn:```json{"ok": false,- "contract_version": 22,+ "contract_version": 23,"error": "provenance_unavailable","detail": "models.provenance.direct_mode"}@@ -1586,7 +1586,7 @@ ambiguous absence are explicit and distinguishable from an unknown turn:```json{"ok": false,- "contract_version": 22,+ "contract_version": 23,"error": "provenance_unavailable","detail": "models.provenance.attribution_ambiguous"}diff --git a/docs/plans/model-hub-contracts/guard-refusal.schema.json b/docs/plans/model-hub-contracts/guard-refusal.schema.jsonindex a9f069574..374ce652c 100644--- a/docs/plans/model-hub-contracts/guard-refusal.schema.json+++ b/docs/plans/model-hub-contracts/guard-refusal.schema.json@@ -61,7 +61,7 @@],"properties": {"ok": { "const": false },- "contract_version": { "const": 22 },+ "contract_version": { "const": 23 },"error": {"enum": ["source_last_supplier",@@ -116,7 +116,7 @@"examples": [{"ok": false,- "contract_version": 22,+ "contract_version": 23,"error": "source_model_in_route_chain","detail": "modelHub.errors.source_model_in_route_chain","would_remove_hops": [diff --git a/docs/plans/model-hub-contracts/hosted-tools-status.schema.json b/docs/plans/model-hub-contracts/hosted-tools-status.schema.jsonindex f1a61b9b5..5d41261c0 100644--- a/docs/plans/model-hub-contracts/hosted-tools-status.schema.json+++ b/docs/plans/model-hub-contracts/hosted-tools-status.schema.json@@ -126,7 +126,14 @@"model_id": { "type": "string", "minLength": 1 },"billing": { "enum": ["monthly", "metered"] },"relay": { "type": "boolean", "description": "A non-official endpoint is priced at its vendor's API price." },- "price": { "oneOf": [{ "type": "null" }, { "$ref": "#/definitions/ListPrice" }] }+ "price": { "oneOf": [{ "type": "null" }, { "$ref": "#/definitions/ListPrice" }] },+ "settings": {+ "type": "object",+ "description": "Web search only: the executor's switch. Off ends the order and is never tried; X search candidates carry none.",+ "required": ["enabled"],+ "additionalProperties": false,+ "properties": { "enabled": { "type": "boolean" } }+ }}},"ServiceExecutor": {diff --git a/docs/plans/model-hub-contracts/mirror-registry.json b/docs/plans/model-hub-contracts/mirror-registry.jsonindex 988a4bdb4..d5761f319 100644--- a/docs/plans/model-hub-contracts/mirror-registry.json+++ b/docs/plans/model-hub-contracts/mirror-registry.json@@ -1,5 +1,5 @@{- "contract_version": 22,+ "contract_version": 23,"input_generation": {"mode": "same_run_live_files","external_snapshot": "content_fingerprint_required"diff --git a/docs/plans/model-hub-contracts/observation-result.schema.json b/docs/plans/model-hub-contracts/observation-result.schema.jsonindex c7d49f9de..70e11e7ab 100644--- a/docs/plans/model-hub-contracts/observation-result.schema.json+++ b/docs/plans/model-hub-contracts/observation-result.schema.json@@ -16,7 +16,7 @@],"additionalProperties": false,"properties": {- "contract_version": { "const": 22 },+ "contract_version": { "const": 23 },"outcome": {"enum": ["observed",@@ -150,7 +150,7 @@],"examples": [{- "contract_version": 22,+ "contract_version": 23,"outcome": "observed","reachable": true,"authenticated": "authenticated",@@ -165,7 +165,7 @@]},{- "contract_version": 22,+ "contract_version": 23,"outcome": "authentication_failed","reachable": true,"authenticated": "rejected",@@ -175,7 +175,7 @@"model_metadata": []},{- "contract_version": 22,+ "contract_version": 23,"outcome": "ambiguous","reachable": true,"authenticated": "unknown",@@ -185,7 +185,7 @@"model_metadata": []},{- "contract_version": 22,+ "contract_version": 23,"outcome": "unreachable","reachable": false,"authenticated": "unknown",@@ -195,7 +195,7 @@"model_metadata": []},{- "contract_version": 22,+ "contract_version": 23,"outcome": "adapter_error","reachable": null,"authenticated": "unknown",@@ -205,7 +205,7 @@"model_metadata": []},{- "contract_version": 22,+ "contract_version": 23,"outcome": "timeout","reachable": null,"authenticated": "unknown",diff --git a/docs/plans/model-hub-contracts/probe-result.schema.json b/docs/plans/model-hub-contracts/probe-result.schema.jsonindex 5175772fc..a031f9049 100644--- a/docs/plans/model-hub-contracts/probe-result.schema.json+++ b/docs/plans/model-hub-contracts/probe-result.schema.json@@ -7,7 +7,7 @@"required": ["contract_version", "backend", "channel", "reachable", "source_id", "model_id", "latency_ms", "error"],"additionalProperties": false,"properties": {- "contract_version": { "const": 22 },+ "contract_version": { "const": 23 },"backend": { "enum": ["claude", "codex", "opencode", "vibey"] },"channel": { "enum": ["hub", "native_cli"] },"reachable": { "type": "boolean" },@@ -68,10 +68,10 @@}],"examples": [- { "contract_version": 22, "backend": "codex", "channel": "hub", "reachable": true, "source_id": "src_chatgptplus", "model_id": "gpt-5.6", "latency_ms": 412, "error": null },- { "contract_version": 22, "backend": "claude", "channel": "hub", "reachable": false, "source_id": "src_relay9c1x", "model_id": "glm-5.2", "latency_ms": 287, "error": "models.source.needs_action.balance_exhausted" },- { "contract_version": 22, "backend": "codex", "channel": "hub", "reachable": false, "source_id": "src_chatgptplus", "model_id": "gpt-5.6", "latency_ms": null, "error": "models.source.backoff.connection_failed" },- { "contract_version": 22, "backend": "codex", "channel": "native_cli", "reachable": true, "source_id": "src_chatgptplus", "model_id": "gpt-5.6", "latency_ms": null, "error": null },- { "contract_version": 22, "backend": "codex", "channel": "native_cli", "reachable": false, "source_id": "src_chatgptplus", "model_id": "gpt-5.6", "latency_ms": null, "error": "models.probe.native_cli_unavailable" }+ { "contract_version": 23, "backend": "codex", "channel": "hub", "reachable": true, "source_id": "src_chatgptplus", "model_id": "gpt-5.6", "latency_ms": 412, "error": null },+ { "contract_version": 23, "backend": "claude", "channel": "hub", "reachable": false, "source_id": "src_relay9c1x", "model_id": "glm-5.2", "latency_ms": 287, "error": "models.source.needs_action.balance_exhausted" },+ { "contract_version": 23, "backend": "codex", "channel": "hub", "reachable": false, "source_id": "src_chatgptplus", "model_id": "gpt-5.6", "latency_ms": null, "error": "models.source.backoff.connection_failed" },+ { "contract_version": 23, "backend": "codex", "channel": "native_cli", "reachable": true, "source_id": "src_chatgptplus", "model_id": "gpt-5.6", "latency_ms": null, "error": null },+ { "contract_version": 23, "backend": "codex", "channel": "native_cli", "reachable": false, "source_id": "src_chatgptplus", "model_id": "gpt-5.6", "latency_ms": null, "error": "models.probe.native_cli_unavailable" }]}diff --git a/docs/plans/model-hub-contracts/runtime-dependency.schema.json b/docs/plans/model-hub-contracts/runtime-dependency.schema.jsonindex 49b91bb58..6513b153c 100644--- a/docs/plans/model-hub-contracts/runtime-dependency.schema.json+++ b/docs/plans/model-hub-contracts/runtime-dependency.schema.json@@ -7,7 +7,7 @@"required": ["contract_version", "manifest", "status"],"additionalProperties": false,"properties": {- "contract_version": { "const": 22 },+ "contract_version": { "const": 23 },"enabled": {"type": "boolean","description": "Persisted user intent for the managed gateway. Fresh/default configuration is true; explicit stop persists false."@@ -131,7 +131,7 @@},"examples": [{- "contract_version": 22,+ "contract_version": 23,"host_platform": "darwin-arm64","manifest": {"name": "cliproxyapi",diff --git a/docs/plans/model-hub-contracts/turn-provenance.schema.json b/docs/plans/model-hub-contracts/turn-provenance.schema.jsonindex 5520166c9..dd1452ed8 100644--- a/docs/plans/model-hub-contracts/turn-provenance.schema.json+++ b/docs/plans/model-hub-contracts/turn-provenance.schema.json@@ -54,7 +54,7 @@"additionalProperties": false,"properties": {"contract_version": {- "enum": [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22],+ "enum": [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],"$comment": "The only versioned object written to disk, so released versions form a set rather than a constant. Historical records validate after the existing persistence-read normalization of retired reasons; tests/fixtures/model_hub/released_v5_permission_denied.json exercises that boundary, not raw-file validation. Reading preserves the writer generation and requires no new route fields. New records carry the terminal member. Other versioned objects are ephemeral envelopes pinned to that value alone.","description": "Generation that wrote this record. Readers retain every supported released value, apply existing retired-reason normalization independently of version, and do not require route_origin or manual_override."},@@ -527,7 +527,7 @@],"examples": [{- "contract_version": 22,+ "contract_version": 23,"turn_id": "turn_01k9x2m4","ts": "2026-07-29T06:32:11Z","agent": "claude",@@ -552,7 +552,7 @@"blockers": []},{- "contract_version": 22,+ "contract_version": 23,"turn_id": "turn_01k9x33p","ts": "2026-07-29T06:41:02Z","agent": "opencode",@@ -573,7 +573,7 @@"blockers": []},{- "contract_version": 22,+ "contract_version": 23,"turn_id": "turn_01k9x3zq","ts": "2026-07-29T06:48:20Z","agent": "codex",@@ -593,7 +593,7 @@]},{- "contract_version": 22,+ "contract_version": 23,"turn_id": "turn_01k9x4b7","ts": "2026-07-29T07:02:44Z","agent": "claude",@@ -613,7 +613,7 @@"blockers": []},{- "contract_version": 22,+ "contract_version": 23,"turn_id": "turn_modelmissing01","ts": "2026-09-05T17:31:10Z","agent": "claude",@@ -635,7 +635,7 @@"blockers": []},{- "contract_version": 22,+ "contract_version": 23,"turn_id": "turn_01k9x5ca","ts": "2026-07-29T07:08:00Z","agent": "codex",diff --git a/docs/plans/vibey-hosted-tools.md b/docs/plans/vibey-hosted-tools.mdindex cf072390e..506f23eae 100644--- a/docs/plans/vibey-hosted-tools.md+++ b/docs/plans/vibey-hosted-tools.md@@ -236,6 +236,7 @@ The evidence store, its record and its owner are the capability model's §3. v2| `enabled` | boolean; absent means **on** || `executor_order` | search tools only, optional: Source ids in the order the user wants executors tried. Absent means fully automatic (§6). Ids that no longer name a Source are skipped. || `default_model` | `image_generate` only, optional: `{source_id, model_id}`. Absent, or naming a model no longer available, means the first available model in catalog order (§7.2). |+ | `executors` | `web_search` only, optional (amended 2026-10-30, contract v23): `{<source_id>: {"enabled": false}}` for each model executor Source the user turned off with its **Use for web search** switch. On is the default and is never saved; a removed Source's entry is dropped on load. A release before v23 ignores the field, so the executor runs again there. |- **Absence means on.** The section is absent on every released config, so an upgrade from 3.2.0 turns everytool on (owner decision, §0). A tool key the loader does not know is ignored with a warning.@@ -642,7 +643,9 @@ These rules are C-1 rows in `cross-provider.md` and per-protocol rows in `convercall nobody asked for must not guess.2. Order: the turn's frozen effective order, which is the user's `executor_order` when set, then the remainingcandidates in Vibey's Source order, as they stood at the turn's first resolution. A Source added mid-turn joins- from the next turn.+ from the next turn. A model executor the user turned off for web search (`executors`, §3.3) is placed as if on and+ then moved to the end, after the turned-off services, so the others keep their places; its frozen slot is+ `enabled: false`, and the chain skips it as `disabled` without calling it (amended 2026-10-30).3. The gateway admits each candidate on the final snapshot, under the mutation lock, at the moment it calls it(`runs_on`, identity, no negative `call` evidence), so a config change during the chain moves on instead ofcalling a removed or re-identified Source. This is the same per-request admission every model request of thediff --git a/tests/e2e/test_model_hub_runtime.py b/tests/e2e/test_model_hub_runtime.pyindex 2364720d4..46d6f9e29 100644--- a/tests/e2e/test_model_hub_runtime.py+++ b/tests/e2e/test_model_hub_runtime.py@@ -684,7 +684,7 @@ def test_a1_feature_flag_disables_the_complete_models_api(assert response.status == 404, (method, path, body)assert body == {"ok": False,- "contract_version": 22,+ "contract_version": 23,"error": "feature_disabled",}diff --git a/tests/e2e/test_model_hub_sources.py b/tests/e2e/test_model_hub_sources.pyindex d08966974..16b8f115e 100644--- a/tests/e2e/test_model_hub_sources.py+++ b/tests/e2e/test_model_hub_sources.py@@ -13,7 +13,7 @@ from tests.e2e.drivers.mock_llm_upstream import MockLLMUpstreampytestmark = pytest.mark.e2e_model_hub-CONTRACT_VERSION = 22+CONTRACT_VERSION = 23MENU_MODEL = "claude-sonnet-4-6"SYNTHETIC_API_KEY = "sk-model-hub-e2e-not-real"diff --git a/tests/test_model_hub_api.py b/tests/test_model_hub_api.pyindex 4eb353f44..54beeb80f 100644--- a/tests/test_model_hub_api.py+++ b/tests/test_model_hub_api.py@@ -1101,7 +1101,7 @@ def test_runtime_start_is_explicit_and_returns_v4_status(tmp_path):assert adapter.start_calls == 1assert store.config.enabled is Trueassert runtime["enabled"] is True- assert runtime["contract_version"] == 22+ assert runtime["contract_version"] == 23assert runtime["status"]["health"] == "ok"_assert_valid("runtime-dependency.schema.json", runtime)@@ -1408,7 +1408,7 @@ def test_runtime_start_crosses_the_controller_rpc_boundary(monkeypatch):async def rpc(operation, payload=None):calls.append((operation, payload))- return {"contract_version": 22, "status": {"health": "ok"}}+ return {"contract_version": 23, "status": {"health": "ok"}}monkeypatch.setattr(model_hub_client, "_rpc", rpc)@@ -1425,7 +1425,7 @@ def test_runtime_stop_crosses_the_controller_rpc_boundary(monkeypatch):async def rpc(operation, payload=None):calls.append((operation, payload))- return {"contract_version": 22, "status": {"health": "not_started"}}+ return {"contract_version": 23, "status": {"health": "not_started"}}monkeypatch.setattr(model_hub_client, "_rpc", rpc)@@ -1442,7 +1442,7 @@ def test_runtime_install_crosses_the_controller_rpc_boundary(monkeypatch):async def rpc(operation, payload=None):calls.append((operation, payload))- return {"contract_version": 22, "status": {"health": "installing"}}+ return {"contract_version": 23, "status": {"health": "installing"}}monkeypatch.setattr(model_hub_client, "_rpc", rpc)@@ -1460,7 +1460,7 @@ def test_runtime_dependency_ensure_crosses_the_controller_rpc_boundary(monkeypatdef rpc(operation, payload=None):calls.append((operation, payload))return {- "contract_version": 22,+ "contract_version": 23,"changed": True,"status": {"health": "not_started", "verified": True},}@@ -4934,7 +4934,7 @@ def test_agent_models_route_returns_only_picker_catalog_fields(monkeypatch):assert response.status_code == 200assert response.get_json() == {"ok": True,- "contract_version": 22,+ "contract_version": 23,"agent": {"backend": "codex","mode": "hub",@@ -10213,7 +10213,7 @@ def test_runtime_start_route_requires_csrf_before_starting_engine(monkeypatch, tassert accepted.status_code == 200runtime = accepted.get_json()["runtime"]assert adapter.start_calls == 1- assert runtime["contract_version"] == 22+ assert runtime["contract_version"] == 23_assert_valid("runtime-dependency.schema.json", runtime)diff --git a/tests/test_model_hub_config.py b/tests/test_model_hub_config.pyindex 7baa8208e..612b4bffb 100644--- a/tests/test_model_hub_config.py+++ b/tests/test_model_hub_config.py@@ -97,7 +97,7 @@ def test_auto_detect_asks_for_responses_before_chat():def test_unsaved_observation_schema_closes_all_terminal_shapes():schema = _schema("observation-result.schema.json")- assert schema["properties"]["contract_version"]["const"] == 22+ assert schema["properties"]["contract_version"]["const"] == 23assert tuple(schema["properties"]["outcome"]["enum"]) == tuple(member.value for member in ObservationOutcome)@@ -121,7 +121,7 @@ def test_observation_terminal_authority_and_schema_accept_the_same_products():def payload(observation: SourceObservation) -> dict:return {- "contract_version": 22,+ "contract_version": 23,"outcome": observation.outcome.value,"reachable": observation.reachable,"authenticated": (@@ -737,7 +737,7 @@ def test_guard_refusal_error_requires_its_corresponding_nonempty_plan_array():route_refusal = {"ok": False,- "contract_version": 22,+ "contract_version": 23,"error": "source_in_route_chain","detail": "modelHub.errors.source_in_route_chain","would_remove_hops": [hop],@@ -753,7 +753,7 @@ def test_guard_refusal_error_requires_its_corresponding_nonempty_plan_array():}candidate_refusal = {"ok": False,- "contract_version": 22,+ "contract_version": 23,"error": "candidate_suppliers_changed","detail": "modelHub.errors.candidate_suppliers_changed","changed": {@@ -837,7 +837,7 @@ def test_v8_mirror_registry_is_executable_and_complete():registry = json.loads((CONTRACTS / "mirror-registry.json").read_text(encoding="utf-8"))schemas = _mirror_schemas(registry)- assert registry["contract_version"] == 22+ assert registry["contract_version"] == 23ids = [entry["id"] for entry in registry["entries"]]assert idsassert len(ids) == len(set(ids))@@ -974,8 +974,8 @@ def test_model_hub_authority_closure_anchors_the_persisted_version_floor(monkeyp"kind": "contract_version_schema_drift","domain": "V1","file": "docs/plans/model-hub-contracts/turn-provenance.schema.json",- "values": [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22],- "expected": [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22],+ "values": [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],+ "expected": [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],} in result["findings"]@@ -993,11 +993,11 @@ def _versioned_nodes(node):yield from _versioned_nodes(item)-def test_turn_provenance_keeps_released_v21_and_current_v22_read_shapes():- """The v22 mirror still accepts the released v21 provenance version."""+def test_turn_provenance_keeps_released_v22_and_current_v23_read_shapes():+ """The v23 mirror still accepts the released v22 provenance version."""schema = _schema("turn-provenance.schema.json")validator = Draft7Validator(schema)- for version in (21, 22):+ for version in (22, 23):example = copy.deepcopy(schema["examples"][0])example["contract_version"] = versionvalidator.validate(example)@@ -1354,7 +1354,7 @@ def test_v5_shape_amendments_reject_the_false_states_they_replace():with pytest.raises(ValidationError):chain_validator.validate(interrupted)exact_hop = {- "contract_version": 22,+ "contract_version": 23,"backend": "claude","model_id": "claude-opus-4-6","manual_override": None,diff --git a/tests/test_model_hub_l3.py b/tests/test_model_hub_l3.pyindex d8666722c..67153e620 100644--- a/tests/test_model_hub_l3.py+++ b/tests/test_model_hub_l3.py@@ -5582,7 +5582,7 @@ def test_backend_failure_keeps_the_gateway_terminal_error_no_later_request_superdef test_released_backend_rejection_records_read_unchanged(tmp_path: Path) -> None:"""Records the earlier bridge wrote stay as written: no reason or phase is re-derived on read."""released = {- "contract_version": 22,+ "contract_version": 23,"turn_id": "turn_released_rejection","ts": NOW.isoformat(),"agent": "vibey",@@ -7058,7 +7058,7 @@ def test_source_observation_reduces_the_order_at_the_first_authenticated_proof(_assert_valid("observation-result.schema.json",{- "contract_version": 22,+ "contract_version": 23,"outcome": "adapter_error","reachable": True,"authenticated": "unknown",@@ -9592,7 +9592,7 @@ def test_native_chain_visibility_and_probe_readiness(tmp_path: Path) -> None:probe = asyncio.run(service.probe_agent("codex", "shared-model"))assert probe == {- "contract_version": 22,+ "contract_version": 23,"backend": "codex","channel": "native_cli","reachable": True,diff --git a/tests/test_model_hub_provenance.py b/tests/test_model_hub_provenance.pyindex dbe51b54a..996e2e426 100644--- a/tests/test_model_hub_provenance.py+++ b/tests/test_model_hub_provenance.py@@ -261,7 +261,7 @@ def test_live_recovery_snapshots_never_revive_invalid_or_terminal_owners(tmp_patdef _record(turn_id, *, backend="claude", model=MODEL, outcome="failed_terminal"):identity = {"source_id": "src_deleted01", "configured_model_id": "unknown-model", "channel": "hub"}return {- "contract_version": 22,+ "contract_version": 23,"turn_id": turn_id,"ts": "2026-09-06T00:00:00Z","agent": backend,@@ -707,6 +707,6 @@ def test_model_history_client_rpc_http_share_nullable_read_only_result(monkeypatf"/api/models/agents/claude/provenance?model={MODEL}", headers=csrf_headers(client, origin), base_url=origin)assert response.status_code == 200- assert response.get_json() == {"ok": True, "contract_version": 22, "provenance": record}+ assert response.get_json() == {"ok": True, "contract_version": 23, "provenance": record}assert store.config.to_payload() == beforeassert adapter.synced == []diff --git a/tests/test_model_hub_resolution.py b/tests/test_model_hub_resolution.pyindex 74090d9d5..966ab41d4 100644--- a/tests/test_model_hub_resolution.py+++ b/tests/test_model_hub_resolution.py@@ -1808,7 +1808,7 @@ def test_service_accepts_authoritative_reachable_adapter_error(tmp_path):)assert result["observation"] == {- "contract_version": 22,+ "contract_version": 23,"outcome": "adapter_error","reachable": True,"authenticated": "unknown",@@ -1839,7 +1839,7 @@ def test_unknown_adapter_error_does_not_claim_connection(tmp_path):assert exc.value.code == "discovery_failed"assert exc.value.detail == "modelHub.errors.adapter_error"assert exc.value.data["observation"] == {- "contract_version": 22,+ "contract_version": 23,"outcome": "adapter_error","reachable": None,"authenticated": "unknown",diff --git a/tests/test_model_hub_runtime.py b/tests/test_model_hub_runtime.pyindex b1df0f8f8..623100b45 100644--- a/tests/test_model_hub_runtime.py+++ b/tests/test_model_hub_runtime.py@@ -1367,7 +1367,7 @@ def test_manifest_resolution_drives_admission_persistence_and_schema(installer=manager,state_store=EngineStateStore(tmp_path / "state"),)- projected = {"contract_version": 22, **supervisor.status()}+ projected = {"contract_version": 23, **supervisor.status()}schema = json.loads(Path("docs/plans/model-hub-contracts/runtime-dependency.schema.json").read_text(encoding="utf-8"diff --git a/tests/test_model_hub_search_chain.py b/tests/test_model_hub_search_chain.pyindex 857d25af8..f93745b22 100644--- a/tests/test_model_hub_search_chain.py+++ b/tests/test_model_hub_search_chain.py@@ -1273,7 +1273,7 @@ def test_retry_http_client_rpc_clears_only_the_service_fence_with_plain_success(response = client.post(f"/api/models/hosted-tools/web_search/services/{EXA}/retry", json={},headers=csrf_headers(client, "http://127.0.0.1:15131"))assert response.status_code == 200- assert response.get_json() == {"ok": True, "contract_version": 22}+ assert response.get_json() == {"ok": True, "contract_version": 23}assert calls == [("clear_service_cooldown", {"source_id": EXA, "service_id": None})]assert not service._service_cooldowns.current(source, "exa/search", generation)assert service.store.load().sources[0].state == source.state@@ -1298,6 +1298,24 @@ async def test_blocked_model_executor_keeps_its_own_remedy_beside_a_disabled_ser_hosted_result("web_search", result)+async def test_a_model_executor_turned_off_is_never_tried_even_when_saved_first(tmp_path, monkeypatch):+ """vibey-hosted-tools.md §6: the turn freezes a turned-off model executor at the end, off, and the chain skips it."""++ service = owner(tmp_path, ("exa",), model=True,+ web={"executor_order": [MODEL, EXA], "executors": {MODEL: {"enabled": False}}})+ turn = service.freeze_turn_hosted_tools(service.store.load())+ assert [(slot.source_id, slot.enabled) for slot in turn.executors["web_search"]] == [+ (EXA, True), (KEYLESS_EXA_SOURCE_ID, False), (MODEL, False),+ ]+ answers(monkeypatch, service, wire(status=500))+ result = await run(service, turn=turn)+ assert result["record"]["attempts"][-1] == {+ "source_id": MODEL, "label": next(s for s in service.store.load().sources if s.id == MODEL).display_name,+ "kind": "model", "outcome": "skipped", "skipped": "disabled",+ }++@pytest.mark.asyncioasync def test_trial_reservation_is_released_even_when_health_persistence_fails(tmp_path, monkeypatch):"""A failed local write keeps the persisted blocker, not an unreleasable in-flight trial."""diff --git a/tests/test_model_hub_search_settings.py b/tests/test_model_hub_search_settings.pyindex 4913230d3..6ffea93e8 100644--- a/tests/test_model_hub_search_settings.py+++ b/tests/test_model_hub_search_settings.py@@ -291,6 +291,14 @@ async def test_concurrent_different_fields_and_sources_are_not_lost(tmp_path):("web_search", {"services": {TAVILY: {"unknown": True}}}),("web_search", {"services": {GONE: {"results": 5}}}),("web_search", {"services": {MODEL: {"enabled": True}}}),+ # A model executor's switch: only a Source that lists a web-search executor model, only ``enabled``.+ ("web_search", {"executors": None}),+ ("web_search", {"executors": {TAVILY: {"enabled": False}}}),+ ("web_search", {"executors": {GONE: {"enabled": False}}}),+ ("web_search", {"executors": {MODEL: {}}}),+ ("web_search", {"executors": {MODEL: {"enabled": 0}}}),+ ("web_search", {"executors": {MODEL: {"enabled": False, "results": 3}}}),+ ("x_search", {"executors": {MODEL: {"enabled": False}}}),("x_search", {"prefer_native": False}), ("image_generate", {"services": {}}),])@pytest.mark.asyncio@@ -367,6 +375,41 @@ async def test_role_metadata_drops_removed_sources_on_load_and_real_deletion(tmpassert V2ModelHubConfigStore().load().hosted_tools["web_search"].to_payload() == written+async def test_a_model_executor_switch_saves_only_its_opt_out_and_ends_the_order(tmp_path):+ """vibey-hosted-tools.md §6: a model executor turned off for web search ends the effective order, the saved order+ untouched; on is the default, so turning it back on, or null, leaves nothing saved."""++ service, path, _ = _disk_service(tmp_path, _config({+ "executor_order": [MODEL, TAVILY], "executor_order_kinds": {MODEL: "model", TAVILY: "service"},+ }))+ baseline = _web(service)["effective_order"]+ assert baseline[-1] != MODEL+ await service.set_hosted_tool("web_search", {"executors": {MODEL: {"enabled": False}}})+ web = _web(service)+ assert next(c for c in web["executor_candidates"] if c["source_id"] == MODEL)["settings"] == {"enabled": False}+ assert web["effective_order"] == [*(sid for sid in baseline if sid != MODEL), MODEL]+ assert web["executor_order"] == [MODEL, TAVILY]+ assert V2ModelHubConfigStore().load().hosted_tools["web_search"].to_payload()["executors"] == {+ MODEL: {"enabled": False},+ }+ for back_on in ({"enabled": True}, None):+ await service.set_hosted_tool("web_search", {"executors": {MODEL: {"enabled": False}}})+ await service.set_hosted_tool("web_search", {"executors": {MODEL: back_on}})+ web = _web(service)+ assert next(c for c in web["executor_candidates"] if c["source_id"] == MODEL)["settings"] == {"enabled": True}+ assert web["effective_order"] == baseline+ assert "executors" not in V2ModelHubConfigStore().load().hosted_tools["web_search"].to_payload()+ # X search keeps no switch: its candidates carry none.+ x_search = next(t for t in service.hosted_tools_status()["hosted_tools"]["tools"] if t["name"] == "x_search")+ assert all("settings" not in candidate for candidate in x_search["executor_candidates"])+++def test_only_an_extant_sources_opt_out_is_loaded():+ config = _config({"executors": {MODEL: {"enabled": False}, GONE: {"enabled": False}, TAVILY: {"enabled": True}}})+ assert config.hosted_tools["web_search"].to_payload()["executors"] == {MODEL: {"enabled": False}}++def test_removed_source_settings_are_ignored_before_validation():config = _config({"services": {GONE: "obsolete", TAVILY: {"results": 6}}})assert config.hosted_tools["web_search"].enabled@@ -374,7 +417,8 @@ def test_removed_source_settings_are_ignored_before_validation():@pytest.mark.parametrize("field,value", [("prefer_native", None), ("services", None),- ("services", {TAVILY: {"enabled": None}})])+ ("services", {TAVILY: {"enabled": None}}),+ ("executors", []), ("executors", {MODEL: {"enabled": None}})])def test_damaged_optional_settings_disable_only_web_search(field, value):config = _config({"executor_order": [TAVILY], field: value})assert not config.hosted_tools["web_search"].enabled@@ -486,11 +530,13 @@ def test_rc12_loader_preserves_tool_switch_and_orders_but_drops_service_overridereleased = runpy.run_path(str(Path(__file__).parent / "fixtures/model_hub/released_rc12_hosted_tools.py"))section = _config({"enabled": False, "prefer_native": False, "executor_order": [MODEL, DEEPSEEK],"executor_order_kinds": {MODEL: "model", DEEPSEEK: "service"},- "services": {DEEPSEEK: {"enabled": False}}, "service_order": [TAVILY]}).to_payload()+ "services": {DEEPSEEK: {"enabled": False}}, "service_order": [TAVILY],+ "executors": {MODEL: {"enabled": False}}}).to_payload()loaded = released["_hosted_tools_from_payload"](section)written = loaded["web_search"].to_payload()assert written == {"enabled": False, "executor_order": [MODEL, DEEPSEEK], "service_order": [TAVILY]}- assert all(field in caplog.text for field in ("prefer_native", "services", "executor_order_kinds"))+ # An older release ignores a model executor's opt-out too (contract v23's downgrade boundary).+ assert all(field in caplog.text for field in ("prefer_native", "services", "executor_order_kinds", "executors"))assert "service_order" not in caplog.textsection["hosted_tools"]["web_search"] = writtenupgraded = ModelHubConfig.from_payload(section)diff --git a/tests/test_model_hub_vibey_contract_matrix.py b/tests/test_model_hub_vibey_contract_matrix.pyindex 10f5c40bf..741df1c79 100644--- a/tests/test_model_hub_vibey_contract_matrix.py+++ b/tests/test_model_hub_vibey_contract_matrix.py@@ -48,13 +48,13 @@ def _fixture(kind):# Start from a valid native response so no Hub latency constraint can# accidentally reject the Avibe/native pairing for an unrelated cause.return {- "contract_version": 22, "backend": "claude", "channel": "native_cli", "reachable": True,+ "contract_version": 23, "backend": "claude", "channel": "native_cli", "reachable": True,"source_id": "src_fixture01", "model_id": "fixture-model", "latency_ms": None,"error": None,}if kind == "chain":return {- "contract_version": 22, "backend": "vibey", "model_id": "fixture-model",+ "contract_version": 23, "backend": "vibey", "model_id": "fixture-model","manual_override": None, "route_origin": "automatic","chain": [{"source_id": "src_fixture01", "model_id": "fixture-model", "channel": "hub","health": "healthy", "runnable": True, "reason": None, "retry_at": None}],@@ -66,7 +66,7 @@ def _fixture(kind):"proposed_action": "import", "selected": False,}return {- "contract_version": 22, "turn_id": "turn-fixture", "ts": "2026-10-02T07:00:00Z",+ "contract_version": 23, "turn_id": "turn-fixture", "ts": "2026-10-02T07:00:00Z","agent": "vibey", "requested_model_id": "fixture-model", "outcome": kind,"failed_attempts": [{**identity, "reason": "rate_limited"}] if kind == "exhausted" else [],"served": identity if kind == "served" else None,diff --git a/ui/e2e/chat-interactions/interactions.spec.ts b/ui/e2e/chat-interactions/interactions.spec.tsindex 2548865cf..53a143ef7 100644--- a/ui/e2e/chat-interactions/interactions.spec.ts+++ b/ui/e2e/chat-interactions/interactions.spec.ts@@ -11,7 +11,7 @@ for (const lang of ['en', 'zh'] as const) {if (url.origin !== 'http://127.0.0.1:5227' || route.request().method() !== 'GET') return route.abort();if (url.pathname === `/api/models/turns/${TURN}/provenance`) {return route.fulfill({ json: { provenance: {- contract_version: 22, turn_id: TURN, agent: 'codex', requested_model_id: 'fixture-model',+ contract_version: 23, turn_id: TURN, agent: 'codex', requested_model_id: 'fixture-model',outcome: 'failed_terminal', failed_attempts: [], blockers: [],terminal_error: { source_id: 'fixture-source', configured_model_id: 'fixture-model', reason: 'engine_down' },} } });diff --git a/ui/e2e/model-catalog/gatewayFixture.tsx b/ui/e2e/model-catalog/gatewayFixture.tsxindex 866529c09..ac63b9f3a 100644--- a/ui/e2e/model-catalog/gatewayFixture.tsx+++ b/ui/e2e/model-catalog/gatewayFixture.tsx@@ -35,13 +35,13 @@ export function GatewayFixture() {}],};const chains = Object.fromEntries(ids.map((model_id, index) => [modelChainKey(backend, model_id), readyRegion<AgentChain>({- contract_version: 22, backend, model_id, route_origin: origins[index],+ contract_version: 23, backend, model_id, route_origin: origins[index],manual_override: origins[index] === 'manual' ? { hops: [{ source_id: source.id, model_id }] } : null,current: { source_id: source.id, model_id }, supply_state: 'ok',chain: [{ source_id: source.id, model_id, channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }],})]));const runtime = freshRuntimeProjection(readyRegion({- contract_version: 22,+ contract_version: 23,manifest: { name: 'cliproxyapi', resolution: 'resolved', version: '1.0.0', source_sha: 'fixture', assets: [] },status: { installed_version: '1.0.0', verified: true, listening: null, health: 'ok', last_check: null },}));diff --git a/ui/e2e/model-catalog/routeFixture.tsx b/ui/e2e/model-catalog/routeFixture.tsxindex 1b76191c8..8958ebce6 100644--- a/ui/e2e/model-catalog/routeFixture.tsx+++ b/ui/e2e/model-catalog/routeFixture.tsx@@ -28,7 +28,7 @@ const supply: AgentSupply = {sources: { order: sources.map((source) => source.id), eligibility: sources.map((source) => ({ source_id: source.id, eligible: true })) },};const makeChain = (hops: RouteHop[], manual: boolean): AgentChain => ({- contract_version: 22, backend, model_id: modelId,+ contract_version: 23, backend, model_id: modelId,manual_override: manual ? { hops } : null,route_origin: manual ? 'manual' : origin === 'passthrough' ? 'passthrough' : 'automatic',current: hops[0] ?? null, supply_state: hops.length ? 'ok' : 'interrupted',diff --git a/ui/e2e/model-routing-origin.spec.ts b/ui/e2e/model-routing-origin.spec.tsindex 4cd358007..6ef3bb9ce 100644--- a/ui/e2e/model-routing-origin.spec.ts+++ b/ui/e2e/model-routing-origin.spec.ts@@ -102,7 +102,7 @@ test('MH-ROUTING-007 follow-defaults switch, undo, cancel, and save preserve expwould_remove_hops: [{ backend: gateway.backend, menu_model: gateway.model, ...manual.hops[0], position: 1 }],would_interrupt: [],};- expect(await refused.json()).toMatchObject({ ok: false, contract_version: 22, error: 'source_in_route_chain', ...plan });+ expect(await refused.json()).toMatchObject({ ok: false, contract_version: 23, error: 'source_in_route_chain', ...plan });expect((await api.agentChain(gateway.backend, gateway.model)).manual_override).toEqual(manual);// The one question is its own modal over the chain the user was editing.const guard = hub.dialogTitled(copy('guard.title.saveRoute', { menuModel: gateway.model }));diff --git a/ui/e2e/onboarding-fidelity/hub-ownership.spec.ts b/ui/e2e/onboarding-fidelity/hub-ownership.spec.tsindex f9010623f..425b70d74 100644--- a/ui/e2e/onboarding-fidelity/hub-ownership.spec.ts+++ b/ui/e2e/onboarding-fidelity/hub-ownership.spec.ts@@ -92,7 +92,7 @@ for (const width of [1200, 390]) {if (path === '/api/models/runtime/status') return answer({ok: true,runtime: {- contract_version: 22, enabled: true, host_platform: 'linux',+ contract_version: 23, enabled: true, host_platform: 'linux',manifest: { name: 'cliproxyapi', resolution: 'resolved', version: 'fixture', source_sha: 'a'.repeat(40), assets: [] },status: { installed_version: 'fixture', verified: true, health: 'ok' },},diff --git a/ui/e2e/onboarding-fidelity/pm-main-flow.spec.ts b/ui/e2e/onboarding-fidelity/pm-main-flow.spec.tsindex 068a3a8af..18c8e605c 100644--- a/ui/e2e/onboarding-fidelity/pm-main-flow.spec.ts+++ b/ui/e2e/onboarding-fidelity/pm-main-flow.spec.ts@@ -18,7 +18,7 @@ for (const [width,chosen] of [[1200,"claude"],[390,"claude"],[1200,"codex"]] asconst config=()=>({version:'v2',mode:'self_host',setup_completed:completed,setup_state:{needs_setup:!completed},capabilities:{model_hub:{enabled:true}},platforms:{primary:'slack',enabled:[]},runtime:{},agents:Object.fromEntries(['claude','codex','opencode'].map(b=>[b,{enabled:b!=='opencode',cli_path:b}])),agent:{default_cwd:'/fixture/work'},model_hub:{enabled:true,runtime_default_applied:true}});const source={id:'src_fixture',kind:'api_key',vendor:'openai',display_name:'Fixture source',protocol:'openai_chat',supply_channel:'hub',billing:'metered',state:{status:'active'},masked_credential:'fixture-only',models:hops.map(h=>({id:h.model_id,display_name:h.model_id==='gpt-5'?'GPT-5':undefined,origin:'discovered',reasoning_efforts:[],reasoning_efforts_source:null})),last_discovered_at:null};const supply=(b:string)=>({backend:b,cli_present:true,mode:'hub',menu_kind:'fixed',sources:{order:[source.id],eligibility:[{source_id:source.id,eligible:true}]},routes:{},builtin_models:[],catalog_models:[],menu:null,model_supply:[],named_agents:[{name:b,effective_model_id:agent(b).model,supply_status:saved[b].length?'ok':'unavailable'}],supply_status:saved[b].length?'ok':'unavailable'});- const chain=(b:string,hs=saved[b])=>({contract_version:22,backend:b,model_id:agent(b).model,manual_override:hs.length?{hops:hs}:null,route_origin:hs.length?'manual':'automatic',current:hs[0]??null,chain:hs.map(h=>({...h,channel:'hub',health:'healthy',runnable:true,reason:null,retry_at:null})),supply_state:hs.length?'ok':'unavailable'});+ const chain=(b:string,hs=saved[b])=>({contract_version:23,backend:b,model_id:agent(b).model,manual_override:hs.length?{hops:hs}:null,route_origin:hs.length?'manual':'automatic',current:hs[0]??null,chain:hs.map(h=>({...h,channel:'hub',health:'healthy',runnable:true,reason:null,retry_at:null})),supply_state:hs.length?'ok':'unavailable'});await page.addInitScript(()=>localStorage.setItem('i18nextLng','en'));await page.route(`${ORIGIN}/api/**`,async route=>{const req=route.request(),path=new URL(req.url()).pathname;@@ -34,7 +34,7 @@ for (const [width,chosen] of [[1200,"claude"],[390,"claude"],[1200,"codex"]] as}if(path==='/api/agents')return answer({ok:true,default_agent_name:defaultName,agents:[agent('claude'),agent('codex')]});if(/^\/api\/agents\/(claude|codex)$/.test(path))return answer({ok:true,agent:agent(path.split('/').at(-1)!),default_agent_name:defaultName});- if(path==='/api/models/runtime/status')return answer({ok:true,runtime:{contract_version:22,enabled:true,host_platform:'linux',manifest:{name:'cliproxyapi',resolution:'resolved',version:'fixture',source_sha:'a'.repeat(40),assets:[]},status:{installed_version:'fixture',verified:true,health:'ok'}}});+ if(path==='/api/models/runtime/status')return answer({ok:true,runtime:{contract_version:23,enabled:true,host_platform:'linux',manifest:{name:'cliproxyapi',resolution:'resolved',version:'fixture',source_sha:'a'.repeat(40),assets:[]},status:{installed_version:'fixture',verified:true,health:'ok'}}});if(path==='/api/models/sources')return answer({ok:true,sources:[source]});if(path==='/api/models/agents')return answer({ok:true,agents:[supply('claude'),supply('codex')]});if(/\/api\/models\/agents\/(claude|codex)\/chains$/.test(path)){diff --git a/ui/e2e/onboarding-fidelity/provider-support.ts b/ui/e2e/onboarding-fidelity/provider-support.tsindex 2a057143c..0cf37b27b 100644--- a/ui/e2e/onboarding-fidelity/provider-support.ts+++ b/ui/e2e/onboarding-fidelity/provider-support.ts@@ -130,7 +130,7 @@ const CONFIG = {/** Installed, verified and serving: the screen's `gatewayIntent` reads `running` and* starts no install, which is the state every proof below is about something else. */const RUNTIME = {- contract_version: 22,+ contract_version: 23,enabled: true,host_platform: 'darwin',manifest: {diff --git a/ui/e2e/onboarding-fidelity/support.ts b/ui/e2e/onboarding-fidelity/support.tsindex 2ca0050b3..7519f716a 100644--- a/ui/e2e/onboarding-fidelity/support.ts+++ b/ui/e2e/onboarding-fidelity/support.ts@@ -91,7 +91,7 @@ export async function serveProduct(page: Page) {const backend = new URL(route.request().url()).pathname.split('/')[4];return route.fulfill({ json: { ok: true, agent: { backend, mode: 'direct', sources: { order: [], eligibility: [] }, routes: {}, builtin_models: [], catalog_models: [], named_agents: [], menu: null, model_supply: [], supply_status: 'unavailable' } } });});- await page.route('**/api/models/runtime/status', (route) => route.fulfill({ json: { ok: true, runtime: { contract_version: 22, enabled: true, host_platform: 'linux', manifest: { name: 'cliproxyapi', resolution: 'resolved', version: 'fixture', source_sha: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', assets: [] }, status: { installed_version: 'fixture', verified: true, health: 'ok' } } } }));+ await page.route('**/api/models/runtime/status', (route) => route.fulfill({ json: { ok: true, runtime: { contract_version: 23, enabled: true, host_platform: 'linux', manifest: { name: 'cliproxyapi', resolution: 'resolved', version: 'fixture', source_sha: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', assets: [] }, status: { installed_version: 'fixture', verified: true, health: 'ok' } } } }));await page.route(`${ORIGIN}/status`, (route) => route.fulfill({ json: { state: 'running' } }));await page.route('**/api/backend/*/connection', (route) => route.fulfill({ json: { ok: true, backend: new URL(route.request().url()).pathname.split('/').at(-2), installed: true, enabled: true, auth: 'none', application: 'applied', ready: false, entry_eligible: false } }));await page.route('**/api/config', (route) => route.fulfill({ json: CONFIG }));diff --git a/ui/e2e/workbench-general/geometry.spec.ts b/ui/e2e/workbench-general/geometry.spec.tsindex cc2dd81c9..7b2b14cac 100644--- a/ui/e2e/workbench-general/geometry.spec.ts+++ b/ui/e2e/workbench-general/geometry.spec.ts@@ -48,7 +48,7 @@ const MODEL_HUB_AGENT = {};const MODEL_HUB_RUNTIME = {- contract_version: 22,+ contract_version: 23,enabled: true,manifest: { name: 'cliproxyapi', resolution: 'resolved', version: 'fixture', source_sha: 'f'.repeat(40), assets: [] },status: { installed_version: 'fixture', verified: true, listening: { host: '127.0.0.1', port: 43123 }, health: 'ok' },diff --git a/ui/src/components/onboarding/AssistantSetup.test.tsx b/ui/src/components/onboarding/AssistantSetup.test.tsxindex 3f27de3bd..f139306e6 100644--- a/ui/src/components/onboarding/AssistantSetup.test.tsx+++ b/ui/src/components/onboarding/AssistantSetup.test.tsx@@ -50,7 +50,7 @@ const hubAgent = (enabled = true) => ({system_prompt: null, created_at: '', metadata: { builtin_default: true },});const hubChain = (modelId: string) => ({- contract_version: 22, backend: 'claude', model_id: 'opus-5',+ contract_version: 23, backend: 'claude', model_id: 'opus-5',manual_override: { hops: [{ source_id: 'src_a', model_id: modelId }] },route_origin: 'manual', current: { source_id: 'src_a', model_id: modelId },chain: [{ source_id: 'src_a', model_id: modelId, channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }],@@ -354,7 +354,7 @@ describe('assistant installation presentation', () => {mock.api.getVibeAgent.mockResolvedValue({ ok: true, agent });mock.models.listSources.mockResolvedValue([]);const chain = {- contract_version: 22, backend: 'claude', model_id: 'opus-5',+ contract_version: 23, backend: 'claude', model_id: 'opus-5',manual_override: { hops: [{ source_id: 'src_a', model_id: 'opus-5' }, { source_id: 'src_b', model_id: 'opus-5' }] },route_origin: 'manual', current: { source_id: 'src_a', model_id: 'opus-5' },chain: [diff --git a/ui/src/components/onboarding/BuiltinAssistant.test.tsx b/ui/src/components/onboarding/BuiltinAssistant.test.tsxindex 02d84951e..0a90cee16 100644--- a/ui/src/components/onboarding/BuiltinAssistant.test.tsx+++ b/ui/src/components/onboarding/BuiltinAssistant.test.tsx@@ -65,7 +65,7 @@ const vibeyAgent = (model: string | null) => ({system_prompt: null, created_at: '', metadata: { builtin_default: true, lock_delete: true },});const chain = (modelId: string) => ({- contract_version: 22, backend: 'vibey', model_id: modelId,+ contract_version: 23, backend: 'vibey', model_id: modelId,manual_override: null, route_origin: 'automatic', current: { source_id: 'src_openai', model_id: modelId },chain: [{ source_id: 'src_openai', model_id: modelId, channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }],supply_state: 'ok',diff --git a/ui/src/components/onboarding/providers/ProvidersScreen.test.tsx b/ui/src/components/onboarding/providers/ProvidersScreen.test.tsxindex b902b155b..b1a231238 100644--- a/ui/src/components/onboarding/providers/ProvidersScreen.test.tsx+++ b/ui/src/components/onboarding/providers/ProvidersScreen.test.tsx@@ -79,7 +79,7 @@ const supply = (over: Partial<AgentSupply> & { backend: AgentSupply['backend'] }});const runtimeOf = (health: RuntimeHealth, over: Partial<RuntimeDependency> = {}): RuntimeDependency => ({- contract_version: 22,+ contract_version: 23,manifest: { name: 'cliproxyapi', resolution: 'resolved', version: '1.0.0', source_sha: 'sha', assets: [] },status: { verified: true, health },...over,diff --git a/ui/src/components/onboarding/providers/providerStage.test.ts b/ui/src/components/onboarding/providers/providerStage.test.tsindex a0a8f5c1f..16d631481 100644--- a/ui/src/components/onboarding/providers/providerStage.test.ts+++ b/ui/src/components/onboarding/providers/providerStage.test.ts@@ -660,7 +660,7 @@ describe('adoptionBackend', () => {});const runtime = (health: RuntimeHealth, over: Partial<RuntimeDependency> = {}): RuntimeDependency => ({- contract_version: 22,+ contract_version: 23,manifest: { name: 'cliproxyapi', resolution: 'resolved', version: '1.0.0', source_sha: 'sha', assets: [] },status: { verified: true, health },...over,diff --git a/ui/src/components/settings/models/AgentCard.test.tsx b/ui/src/components/settings/models/AgentCard.test.tsxindex 4e753cd9e..4a1f1bb5e 100644--- a/ui/src/components/settings/models/AgentCard.test.tsx+++ b/ui/src/components/settings/models/AgentCard.test.tsx@@ -17,7 +17,7 @@ import { freshRuntimeProjection } from './runtimeLifecycle';import type { AgentSupply, RuntimeDependency, Source } from './types';const runtime: RuntimeDependency = {- contract_version: 22,+ contract_version: 23,manifest: { name: 'cliproxyapi', resolution: 'resolved', version: '1.0.0', source_sha: 'fixture', assets: [] },status: { installed_version: '1.0.0', verified: true, listening: null, health: 'ok', last_check: null },};@@ -414,7 +414,7 @@ describe('AgentCard', () => {['zh', 'Backup → claude-opus-4-6(已自动切换)', '打开 claude-opus-4-6 的路由 · Backup → claude-opus-4-6(已自动切换)'],] as const)('derives and announces takeover from the exact current hop in %s', (lng, mappingCopy, accessibleName) => {const key = modelChainKey('claude', 'claude-opus-4-6');- render(<I18nextProvider i18n={localeInstance(lng)}><AgentCard agents={[hubAgent]} sources={[source('src_a', 'Primary'), source('src_b', 'Backup')]} chains={{ [key]: readyRegion({ manual_override: {hops:[{source_id:'src_a',model_id:'claude-opus-4-6'},{source_id:'src_b',model_id:'claude-opus-4-6'}]}, route_origin: "manual" as const, contract_version: 22, backend: 'claude', model_id: 'claude-opus-4-6', current: { source_id: 'src_b', model_id: 'claude-opus-4-6' }, chain: [{ source_id: 'src_a', model_id: 'claude-opus-4-6', channel: 'hub', health: 'cooldown', runnable: false, reason: null, retry_at: '2099-01-01T00:00:00Z' }, { source_id: 'src_b', model_id: 'claude-opus-4-6', channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }], supply_state: 'ok' }) }} pendingBackends={new Set()} switchFailures={new Set()} connectingBackend={null} onConnectHub={vi.fn()} onSwitchDirect={vi.fn()} onOpenOrder={vi.fn()} onOpenRoute={vi.fn()} onProbeSettled={vi.fn()} /></I18nextProvider>);+ render(<I18nextProvider i18n={localeInstance(lng)}><AgentCard agents={[hubAgent]} sources={[source('src_a', 'Primary'), source('src_b', 'Backup')]} chains={{ [key]: readyRegion({ manual_override: {hops:[{source_id:'src_a',model_id:'claude-opus-4-6'},{source_id:'src_b',model_id:'claude-opus-4-6'}]}, route_origin: "manual" as const, contract_version: 23, backend: 'claude', model_id: 'claude-opus-4-6', current: { source_id: 'src_b', model_id: 'claude-opus-4-6' }, chain: [{ source_id: 'src_a', model_id: 'claude-opus-4-6', channel: 'hub', health: 'cooldown', runnable: false, reason: null, retry_at: '2099-01-01T00:00:00Z' }, { source_id: 'src_b', model_id: 'claude-opus-4-6', channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }], supply_state: 'ok' }) }} pendingBackends={new Set()} switchFailures={new Set()} connectingBackend={null} onConnectHub={vi.fn()} onSwitchDirect={vi.fn()} onOpenOrder={vi.fn()} onOpenRoute={vi.fn()} onProbeSettled={vi.fn()} /></I18nextProvider>);expect(screen.getByText(/Backup/)).toBeTruthy();expect(screen.getByTitle(mappingCopy)).toBeTruthy();expect(screen.getByRole('button', { name: accessibleName })).toBeTruthy();@@ -434,7 +434,7 @@ describe('AgentCard', () => {sources={[source('src_b', 'Backup source')]}chains={{[key]: readyRegion({ manual_override: {hops:[{source_id:'src_b',model_id:'routed-opus'}]}, route_origin: "manual" as const,- contract_version: 22,+ contract_version: 23,backend: 'claude',model_id: 'claude-opus-4-6',current: { source_id: 'src_b', model_id: 'routed-opus' },@@ -467,7 +467,7 @@ describe('AgentCard', () => {it('does not call a later current hop takeover unless the head is unavailable for cooldown', () => {const key = modelChainKey('claude', 'claude-opus-4-6');- render(<I18nextProvider i18n={i18n}><AgentCard agents={[hubAgent]} sources={[source('src_a', 'Primary'), source('src_b', 'Backup')]} chains={{ [key]: readyRegion({ manual_override: {hops:[{source_id:'src_a',model_id:'claude-opus-4-6'},{source_id:'src_b',model_id:'claude-opus-4-6'}]}, route_origin: "manual" as const, contract_version: 22, backend: 'claude', model_id: 'claude-opus-4-6', current: { source_id: 'src_b', model_id: 'claude-opus-4-6' }, chain: [{ source_id: 'src_a', model_id: 'claude-opus-4-6', channel: 'native_cli', health: 'healthy', runnable: false, reason: 'native_cli_unavailable', retry_at: null }, { source_id: 'src_b', model_id: 'claude-opus-4-6', channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }], supply_state: 'ok' }) }} pendingBackends={new Set()} switchFailures={new Set()} connectingBackend={null} onConnectHub={vi.fn()} onSwitchDirect={vi.fn()} onOpenOrder={vi.fn()} onOpenRoute={vi.fn()} onProbeSettled={vi.fn()} /></I18nextProvider>);+ render(<I18nextProvider i18n={i18n}><AgentCard agents={[hubAgent]} sources={[source('src_a', 'Primary'), source('src_b', 'Backup')]} chains={{ [key]: readyRegion({ manual_override: {hops:[{source_id:'src_a',model_id:'claude-opus-4-6'},{source_id:'src_b',model_id:'claude-opus-4-6'}]}, route_origin: "manual" as const, contract_version: 23, backend: 'claude', model_id: 'claude-opus-4-6', current: { source_id: 'src_b', model_id: 'claude-opus-4-6' }, chain: [{ source_id: 'src_a', model_id: 'claude-opus-4-6', channel: 'native_cli', health: 'healthy', runnable: false, reason: 'native_cli_unavailable', retry_at: null }, { source_id: 'src_b', model_id: 'claude-opus-4-6', channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }], supply_state: 'ok' }) }} pendingBackends={new Set()} switchFailures={new Set()} connectingBackend={null} onConnectHub={vi.fn()} onSwitchDirect={vi.fn()} onOpenOrder={vi.fn()} onOpenRoute={vi.fn()} onProbeSettled={vi.fn()} /></I18nextProvider>);expect(screen.getByText(/Backup/)).toBeTruthy();expect(screen.queryByText(/takeover/i)).toBeNull();});@@ -475,7 +475,7 @@ describe('AgentCard', () => {it('hides current and takeover projections while the runtime is stopped', () => {const key = modelChainKey('claude', 'claude-opus-4-6');const stopped = { ...runtime, status: { ...runtime.status, health: 'down' as const } };- render(<I18nextProvider i18n={i18n}><RuntimeAgentCard runtime={freshRuntimeProjection(readyRegion(stopped))} agents={[hubAgent]} sources={[source('src_a', 'Primary'), source('src_b', 'Backup')]} chains={{ [key]: readyRegion({ manual_override: {hops:[{source_id:'src_a',model_id:'claude-opus-4-6'},{source_id:'src_b',model_id:'claude-opus-4-6'}]}, route_origin: "manual" as const, contract_version: 22, backend: 'claude', model_id: 'claude-opus-4-6', current: { source_id: 'src_b', model_id: 'claude-opus-4-6' }, chain: [{ source_id: 'src_a', model_id: 'claude-opus-4-6', channel: 'hub', health: 'cooldown', runnable: false, reason: null, retry_at: '2099-01-01T00:00:00Z' }, { source_id: 'src_b', model_id: 'claude-opus-4-6', channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }], supply_state: 'ok' }) }} pendingBackends={new Set()} switchFailures={new Set()} connectingBackend={null} onConnectHub={vi.fn()} onSwitchDirect={vi.fn()} onOpenModels={vi.fn()} onOpenOrder={vi.fn()} onOpenRoute={vi.fn()} onProbeSettled={vi.fn()} /></I18nextProvider>);+ render(<I18nextProvider i18n={i18n}><RuntimeAgentCard runtime={freshRuntimeProjection(readyRegion(stopped))} agents={[hubAgent]} sources={[source('src_a', 'Primary'), source('src_b', 'Backup')]} chains={{ [key]: readyRegion({ manual_override: {hops:[{source_id:'src_a',model_id:'claude-opus-4-6'},{source_id:'src_b',model_id:'claude-opus-4-6'}]}, route_origin: "manual" as const, contract_version: 23, backend: 'claude', model_id: 'claude-opus-4-6', current: { source_id: 'src_b', model_id: 'claude-opus-4-6' }, chain: [{ source_id: 'src_a', model_id: 'claude-opus-4-6', channel: 'hub', health: 'cooldown', runnable: false, reason: null, retry_at: '2099-01-01T00:00:00Z' }, { source_id: 'src_b', model_id: 'claude-opus-4-6', channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }], supply_state: 'ok' }) }} pendingBackends={new Set()} switchFailures={new Set()} connectingBackend={null} onConnectHub={vi.fn()} onSwitchDirect={vi.fn()} onOpenModels={vi.fn()} onOpenOrder={vi.fn()} onOpenRoute={vi.fn()} onProbeSettled={vi.fn()} /></I18nextProvider>);expect(screen.queryByText(/Backup/)).toBeNull();expect(screen.queryByText(/takeover/i)).toBeNull();@@ -487,7 +487,7 @@ describe('AgentCard', () => {const onOpenModels = vi.fn();const key = modelChainKey('claude', 'claude-opus-4-6');const directAgent: AgentSupply = { ...hubAgent, mode: 'direct', sources: null, routes: null, supply_status: null, model_supply: null };- render(<I18nextProvider i18n={i18n}><AgentCard agents={[directAgent]} sources={[source('src_a', 'Primary'), source('src_b', 'Backup')]} chains={{ [key]: readyRegion({ manual_override: {hops:[{source_id:'src_a',model_id:'claude-opus-4-6'},{source_id:'src_b',model_id:'claude-opus-4-6'}]}, route_origin: "manual" as const, contract_version: 22, backend: 'claude', model_id: 'claude-opus-4-6', current: { source_id: 'src_b', model_id: 'claude-opus-4-6' }, chain: [{ source_id: 'src_a', model_id: 'claude-opus-4-6', channel: 'hub', health: 'cooldown', runnable: false, reason: null, retry_at: '2099-01-01T00:00:00Z' }, { source_id: 'src_b', model_id: 'claude-opus-4-6', channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }], supply_state: 'ok' }) }} pendingBackends={new Set()} switchFailures={new Set()} connectingBackend={null} onConnectHub={vi.fn()} onSwitchDirect={vi.fn()} onOpenModels={onOpenModels} onOpenOrder={vi.fn()} onOpenRoute={vi.fn()} onProbeSettled={vi.fn()} /></I18nextProvider>);+ render(<I18nextProvider i18n={i18n}><AgentCard agents={[directAgent]} sources={[source('src_a', 'Primary'), source('src_b', 'Backup')]} chains={{ [key]: readyRegion({ manual_override: {hops:[{source_id:'src_a',model_id:'claude-opus-4-6'},{source_id:'src_b',model_id:'claude-opus-4-6'}]}, route_origin: "manual" as const, contract_version: 23, backend: 'claude', model_id: 'claude-opus-4-6', current: { source_id: 'src_b', model_id: 'claude-opus-4-6' }, chain: [{ source_id: 'src_a', model_id: 'claude-opus-4-6', channel: 'hub', health: 'cooldown', runnable: false, reason: null, retry_at: '2099-01-01T00:00:00Z' }, { source_id: 'src_b', model_id: 'claude-opus-4-6', channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }], supply_state: 'ok' }) }} pendingBackends={new Set()} switchFailures={new Set()} connectingBackend={null} onConnectHub={vi.fn()} onSwitchDirect={vi.fn()} onOpenModels={onOpenModels} onOpenOrder={vi.fn()} onOpenRoute={vi.fn()} onProbeSettled={vi.fn()} /></I18nextProvider>);expect(screen.queryByText(/Adjust priority/i)).toBeNull();expect(screen.queryByRole('button', { name: /route chain/i })).toBeNull();expect(screen.queryByText(/Backup/)).toBeNull();diff --git a/ui/src/components/settings/models/BackendSupplyModeCard.test.tsx b/ui/src/components/settings/models/BackendSupplyModeCard.test.tsxindex 130e9220c..9ed382a5a 100644--- a/ui/src/components/settings/models/BackendSupplyModeCard.test.tsx+++ b/ui/src/components/settings/models/BackendSupplyModeCard.test.tsx@@ -34,7 +34,7 @@ const CLAUDE_KEY: MigrationItem = {};const RUNTIME: RuntimeDependency = {- contract_version: 22,+ contract_version: 23,manifest: { name: 'cliproxyapi', resolution: 'resolved', version: '1', source_sha: 'a'.repeat(40), assets: [] },status: { installed_version: '1', verified: true, health: 'ok' },};diff --git a/ui/src/components/settings/models/RouteChainDialog.directEdit.test.tsx b/ui/src/components/settings/models/RouteChainDialog.directEdit.test.tsxindex 5bb25f5da..81ce340a9 100644--- a/ui/src/components/settings/models/RouteChainDialog.directEdit.test.tsx+++ b/ui/src/components/settings/models/RouteChainDialog.directEdit.test.tsx@@ -17,7 +17,7 @@ const sources: Source[] = ['a', 'b'].map((id) => ({}));const hops = sources.map((source) => ({ source_id: source.id, model_id: 'gpt-test' }));const makeChain = (backend: AgentSupply['backend'], routeOrigin: 'automatic' | 'passthrough' | 'manual'): AgentChain => ({- contract_version: 22, backend, model_id: 'gpt-test', route_origin: routeOrigin,+ contract_version: 23, backend, model_id: 'gpt-test', route_origin: routeOrigin,manual_override: routeOrigin === 'manual' ? { hops } : null,current: hops[0], supply_state: 'ok',chain: hops.map((hop) => ({ ...hop, channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null })),diff --git a/ui/src/components/settings/models/RouteChainDialog.test.tsx b/ui/src/components/settings/models/RouteChainDialog.test.tsxindex 9d9be9790..7cad3a4f2 100644--- a/ui/src/components/settings/models/RouteChainDialog.test.tsx+++ b/ui/src/components/settings/models/RouteChainDialog.test.tsx@@ -57,7 +57,7 @@ const sources: Source[] = [},];const chain: AgentChain = { manual_override: {hops:[{source_id:"src_a",model_id:"claude-opus-5"},{source_id:"src_b",model_id:"opus-5"}]}, route_origin: "manual" as const,- contract_version: 22,+ contract_version: 23,backend: "claude",model_id: "opus-5",current: { source_id: "src_b", model_id: "opus-5" },diff --git a/ui/src/components/settings/models/RouteRecordedTurn.test.tsx b/ui/src/components/settings/models/RouteRecordedTurn.test.tsxindex 227ebfb4a..ce3f2ec73 100644--- a/ui/src/components/settings/models/RouteRecordedTurn.test.tsx+++ b/ui/src/components/settings/models/RouteRecordedTurn.test.tsx@@ -15,7 +15,7 @@ import { PERSISTED_TURN_CONTRACT_VERSIONS } from './types';import type { RouteHop, TurnProvenance } from './types';const record: TurnProvenance = {- contract_version: 22, turn_id: 'turn-recorded', ts: '2026-09-05T15:00:00Z', agent: 'codex', requested_model_id: 'requested-model',+ contract_version: 23, turn_id: 'turn-recorded', ts: '2026-09-05T15:00:00Z', agent: 'codex', requested_model_id: 'requested-model',outcome: 'failed_terminal', failed_attempts: [], served: null, canceled_attempt: null, model_supply_state: null, blockers: [],terminal_error: { source_id: 'src_historical', configured_model_id: 'historical-model', channel: 'hub', reason: 'invalid_parameter', stream_started: false, http_status: 404, upstream_error_code: 'model_not_found' },};diff --git a/ui/src/components/settings/models/RuntimeNotStartedAction.test.tsx b/ui/src/components/settings/models/RuntimeNotStartedAction.test.tsxindex 5948d33f2..40149eefc 100644--- a/ui/src/components/settings/models/RuntimeNotStartedAction.test.tsx+++ b/ui/src/components/settings/models/RuntimeNotStartedAction.test.tsx@@ -31,7 +31,7 @@ const runtime = (? 'unresolved' as const: hostPlatform === 'linux-amd64' ? 'unsupported' as const : 'resolved' as const;return {- contract_version: 22,+ contract_version: 23,...(hostPlatform === undefined ? {} : { host_platform: hostPlatform }),manifest: resolution === 'unresolved'? { name: 'cliproxyapi', resolution, assets: [] }diff --git a/ui/src/components/settings/models/SearchServiceParts.tsx b/ui/src/components/settings/models/SearchServiceParts.tsxindex 88b77abf9..e966acfa4 100644--- a/ui/src/components/settings/models/SearchServiceParts.tsx+++ b/ui/src/components/settings/models/SearchServiceParts.tsx@@ -9,7 +9,7 @@ import { ToggleSwitch } from '../SettingsPrimitives';import { Field } from './dialogFields';import { atLeast, cooldownTime, formatCost, formatCount, formatMonthDay, formatSmallUsd, formatUsd } from './format';import { foldRegionRead, regionFailed, type RegionRead } from './regionRead';-import { KEYLESS_EXA_SOURCE_ID, serviceSettings } from './searchServices';+import { KEYLESS_EXA_SOURCE_ID, candidateEnabled, serviceSettings } from './searchServices';import { sourceStatePresentation } from './sourceStatePresentation';import { usageHasNoPrice, type ServiceMonth } from './usageProjection';import { VendorGlyph } from './vendorGlyph';@@ -47,7 +47,7 @@ export const SearchCandidateStatus: React.FC<{let tone = 'model-hub-status-mint';const until = candidate.kind === 'service' ? candidate.cooldown_until : null;const time = until ? cooldownTime(until, i18n.language) : null;- if (candidate.kind === 'service' && !candidate.settings.enabled) {+ if (!candidateEnabled(candidate)) {text = t('settings.models.searchServices.unused');tone = 'model-hub-accent-pill--neutral';} else if (keyless) {diff --git a/ui/src/components/settings/models/SearchServices.test.tsx b/ui/src/components/settings/models/SearchServices.test.tsxindex 961ebb4a0..9442a8496 100644--- a/ui/src/components/settings/models/SearchServices.test.tsx+++ b/ui/src/components/settings/models/SearchServices.test.tsx@@ -174,6 +174,36 @@ describe('search service activation and mixed order', () => {expect(onSave).toHaveBeenCalledWith('web_search', { services: { src_exakeyless: { enabled: false } } });});+ it('switches a web-search model executor off and on, and a switched-off one ends the order without moves', async () => {+ const model = ACTIVE_SEARCH.executor_candidates.find((row) => row.kind === 'model')!;+ const onSave = vi.fn();+ // A server with the switch (contract v23) sends it on each web-search model executor.+ tab({ ...ACTIVE_SEARCH, executor_candidates: ACTIVE_SEARCH.executor_candidates.map((row) => (row.kind === 'model' ? { ...row, settings: { enabled: true } } : row)) }, onSave);+ const row = () => document.querySelector(`[data-executor="${model.source_id}"]`) as HTMLElement;+ await userEvent.click(within(row()).getByRole('switch', { name: 'Use for web search' }));+ expect(onSave).toHaveBeenCalledWith('web_search', { executors: { [model.source_id]: { enabled: false } } });+ cleanup();++ const off = { ...model, settings: { enabled: false } };+ const save = vi.fn();+ tab({+ ...ACTIVE_SEARCH,+ effective_order: [...ACTIVE_SEARCH.effective_order.filter((id) => id !== model.source_id), model.source_id],+ executor_candidates: [...ACTIVE_SEARCH.executor_candidates.filter((row) => row !== model), off],+ }, save);+ expect(within(row()).getByText('—')).toBeTruthy();+ expect(within(row()).getByText('Not used for search')).toBeTruthy();+ for (const button of within(row()).getAllByRole('button', { name: /^Move / })) expect((button as HTMLButtonElement).disabled).toBe(true);+ await userEvent.click(within(row()).getByRole('switch', { name: 'Use for web search' }));+ expect(save).toHaveBeenCalledWith('web_search', { executors: { [model.source_id]: { enabled: true } } });+ });++ it('shows no switch on a model executor from a server without one', () => {+ tab();+ const model = ACTIVE_SEARCH.executor_candidates.find((row) => row.kind === 'model')!;+ expect(within(document.querySelector(`[data-executor="${model.source_id}"]`) as HTMLElement).queryByRole('switch')).toBeNull();+ });+it('opens the built-in keyless detail without key or removal actions', () => {const candidate = KEYLESS_ACTIVE_SEARCH.executor_candidates.find((row) => row.source_id === 'src_exakeyless');const vendor = KEYLESS_ACTIVE_SEARCH.service_vendors?.find((row) => row.id === 'exa-mcp');diff --git a/ui/src/components/settings/models/SettingsModelsPage.render.test.tsx b/ui/src/components/settings/models/SettingsModelsPage.render.test.tsxindex 75fc374e5..afbb351a2 100644--- a/ui/src/components/settings/models/SettingsModelsPage.render.test.tsx+++ b/ui/src/components/settings/models/SettingsModelsPage.render.test.tsx@@ -49,7 +49,7 @@ const manifest = {} satisfies RuntimeManifest;const runtime: RuntimeDependency = {- contract_version: 22,+ contract_version: 23,manifest,status: { installed_version: '1', verified: true, health: 'ok' },};@@ -120,7 +120,7 @@ const takeoverAgent: AgentSupply = {};const takeoverChain: AgentChain = { manual_override: {hops:[{source_id:'src_head',model_id:'gpt-5.6-sol'},{source_id:'src_relay',model_id:'gpt-5.6-sol'}]}, route_origin: "manual" as const,- contract_version: 22,+ contract_version: 23,backend: 'codex',model_id: 'gpt-5.6-sol',current: { source_id: 'src_relay', model_id: 'gpt-5.6-sol' },@@ -224,7 +224,7 @@ const routedHubAgent: AgentSupply = {const routedChain: AgentChain = {manual_override: { hops: [{ source_id: retainedSource.id, model_id: routedModelId }] },route_origin: 'manual' as const,- contract_version: 22,+ contract_version: 23,backend: 'claude',model_id: routedModelId,current: { source_id: retainedSource.id, model_id: routedModelId },diff --git a/ui/src/components/settings/models/SupplyGraph.test.ts b/ui/src/components/settings/models/SupplyGraph.test.tsindex a6c2ed601..fd4c854f8 100644--- a/ui/src/components/settings/models/SupplyGraph.test.ts+++ b/ui/src/components/settings/models/SupplyGraph.test.ts@@ -7,7 +7,7 @@ import { buildSupplyRelations as buildRelations } from './supplyRelations';import type { AgentChain, AgentSupply, RuntimeDependency, Source } from './types';const runtime: RuntimeDependency = {- contract_version: 22,+ contract_version: 23,manifest: { name: 'cliproxyapi', resolution: 'resolved', version: '1.0.0', source_sha: 'fixture', assets: [] },status: { installed_version: '1.0.0', verified: true, listening: null, health: 'ok', last_check: null },};@@ -47,7 +47,7 @@ const agent: AgentSupply = {};const chain = (current: string, headHealth: AgentChain['chain'][number]['health'] = 'healthy', headRunnable = true, reason: AgentChain['chain'][number]['reason'] = null): AgentChain => ({ manual_override: {hops:[{source_id:'native',model_id:'model-a'},{source_id:'relay',model_id:'model-a'},{source_id:'unused',model_id:'model-a'}]}, route_origin: "manual" as const,- contract_version: 22,+ contract_version: 23,backend: 'claude',model_id: 'model-a',current: { source_id: current, model_id: 'model-a' },diff --git a/ui/src/components/settings/models/ToolsTab.tsx b/ui/src/components/settings/models/ToolsTab.tsxindex bbdb9fe52..fc2b6af2a 100644--- a/ui/src/components/settings/models/ToolsTab.tsx+++ b/ui/src/components/settings/models/ToolsTab.tsx@@ -16,7 +16,7 @@ import { ToggleSwitch } from '../SettingsPrimitives';import { cooldownTime, formatMonthDay, formatNameList, formatSmallUsd } from './format';import { executorOrderAfterMove, imageModelCopyKey, pairEvidence, refusalSummary, type PairEvidence, type RefusalSummary } from './hostedTools';import { foldRegionRead, regionFailed, type RegionRead } from './regionRead';-import { KEYLESS_EXA_SOURCE_ID, searchServicesActive, serviceVendorForSource, webSearchTool } from './searchServices';+import { KEYLESS_EXA_SOURCE_ID, candidateEnabled, searchServicesActive, serviceVendorForSource, webSearchTool } from './searchServices';import { SearchCandidateStatus, SearchServicePrice, SearchVendorGlyph } from './SearchServiceParts';import { WebFetchOrder } from './WebFetchOrder';import { fetchVendorForSource, webFetchTool } from './webFetch';@@ -174,7 +174,7 @@ const ExecutorOrder: React.FC<{ tool: HostedSearchToolStatus; lookup: SourceLookconst toolInline = t(`settings.models.tools.tool.${tool.name}.inline`) as string;const activeWeb = tool.name === 'web_search' && searchServicesActive(tool) ? tool : null;const candidates = tool.executor_candidates;- const movable = candidates.filter((candidate) => candidate.kind !== 'service' || candidate.settings.enabled);+ const movable = candidates.filter(candidateEnabled);const custom = tool.executor_order !== null;// A move is announced, and focus follows the moved row, only once the server's// order shows it. One that did not land (refused, or lost and reconciled to@@ -215,7 +215,7 @@ const ExecutorOrder: React.FC<{ tool: HostedSearchToolStatus; lookup: SourceLooksetRequested({sourceId: shown[index],direction,- expected: [...executorOrderAfterMove(null, shown, index, direction), ...candidates.filter((candidate) => candidate.kind === 'service' && !candidate.settings.enabled).map((candidate) => candidate.source_id)].join('\n'),+ expected: [...executorOrderAfterMove(null, shown, index, direction), ...candidates.filter((candidate) => !candidateEnabled(candidate)).map((candidate) => candidate.source_id)].join('\n'),position: index + direction + 1,count: shown.length,sent: false,@@ -252,9 +252,11 @@ const ExecutorOrder: React.FC<{ tool: HostedSearchToolStatus; lookup: SourceLookconst cooldown = candidate.kind === 'service' && candidate.cooldown_until !== null? cooldownTime(candidate.cooldown_until, i18n.language): null;- const disabledService = candidate.kind === 'service' && !candidate.settings.enabled;+ const switchedOff = !candidateEnabled(candidate);+ // A web-search model executor carries its switch on a server that has one (contract v23).+ const modelSwitch = candidate.kind === 'model' ? candidate.settings : undefined;const arrow = (direction: -1 | 1) => {- const blocked = disabledService || (direction === -1 ? index === 0 : index === movable.length - 1);+ const blocked = switchedOff || (direction === -1 ? index === 0 : index === movable.length - 1);return (<Buttonref={(node) => {@@ -279,7 +281,7 @@ const ExecutorOrder: React.FC<{ tool: HostedSearchToolStatus; lookup: SourceLook};return (<li key={candidate.source_id} className="model-hub-tool-executor-row grid items-center rounded-lg border border-border bg-background" data-executor={candidate.source_id}>- <span className={cn('model-hub-order-ordinal', index === 0 && 'is-first')}>{disabledService ? '—' : index + 1}</span>+ <span className={cn('model-hub-order-ordinal', index === 0 && 'is-first')}>{switchedOff ? '—' : index + 1}</span>{activeWeb ? <div className="flex min-w-0 items-center gap-3">{source ? <SearchVendorGlyph vendor={source.vendor} /> : candidate.kind === 'service' ? <SearchVendorGlyph vendor={vendor?.id ?? candidate.model_id} /> : <SourceGlyph source={source} />}<div className="flex min-w-0 flex-col gap-1">@@ -287,13 +289,15 @@ const ExecutorOrder: React.FC<{ tool: HostedSearchToolStatus; lookup: SourceLook{candidate.kind === 'service' ? <button type="button" data-search-source={candidate.source_id} className="truncate text-left font-semibold text-foreground hover:underline" onClick={(event) => onOpenService?.(candidate.source_id, event.currentTarget)}>{name}</button> : <span className="truncate font-semibold text-foreground">{name}</span>}<span className={cn('model-hub-pill border', candidate.kind === 'service' ? ACCENT_PILL.cyan : ACCENT_PILL.muted)}>{t(candidate.kind === 'service' ? 'settings.models.searchServices.kind' : 'settings.models.searchServices.modelKind')}</span><SearchCandidateStatus candidate={candidate} tool={activeWeb} source={source} />- {candidate.kind === 'service' && <span className="inline-flex items-center gap-2">+ {(candidate.kind === 'service' || modelSwitch) && <span className="inline-flex items-center gap-2"><span className="model-hub-tool-note">{t('settings.models.searchServices.use')}</span><ToggleSwitch- enabled={candidate.settings.enabled}+ enabled={!switchedOff}disabled={pending}label={t('settings.models.searchServices.use') as string}- onClick={() => onSave('web_search', { services: { [candidate.source_id]: { enabled: !candidate.settings.enabled } } })}+ onClick={() => onSave('web_search', candidate.kind === 'service'+ ? { services: { [candidate.source_id]: { enabled: switchedOff } } }+ : { executors: { [candidate.source_id]: { enabled: switchedOff } } })}/></span>}</div>diff --git a/ui/src/components/settings/models/apiFailure.test.ts b/ui/src/components/settings/models/apiFailure.test.tsindex e35d6dfb0..6ee347a15 100644--- a/ui/src/components/settings/models/apiFailure.test.ts+++ b/ui/src/components/settings/models/apiFailure.test.ts@@ -33,7 +33,7 @@ afterEach(() => {describe('apiFailure — whether the route named the failure', () => {it('posts installation to the dedicated runtime route', async () => {const runtime = {- contract_version: 22,+ contract_version: 23,manifest: { name: 'cliproxyapi', resolution: 'resolved', version: '1', source_sha: 'sha', assets: [] },status: { installed_version: null, verified: false, listening: null, health: 'installing', last_check: null },} as const;diff --git a/ui/src/components/settings/models/gatewayAdoption.test.ts b/ui/src/components/settings/models/gatewayAdoption.test.tsindex 068d84c47..7ec9e294f 100644--- a/ui/src/components/settings/models/gatewayAdoption.test.ts+++ b/ui/src/components/settings/models/gatewayAdoption.test.ts@@ -14,7 +14,7 @@ const agent = (mode: AgentSupply['mode']): AgentSupply => ({});const runtime = (health: RuntimeDependency['status']['health']): RuntimeDependency => ({- contract_version: 22,+ contract_version: 23,manifest: { name: 'cliproxyapi', resolution: 'resolved', version: '1', source_sha: 'a'.repeat(40), assets: [] },status: { installed_version: health === 'not_installed' ? null : '1', verified: health !== 'not_installed', health },});diff --git a/ui/src/components/settings/models/routeProjectionReconciliation.test.ts b/ui/src/components/settings/models/routeProjectionReconciliation.test.tsindex f1b7c0172..d96ba2254 100644--- a/ui/src/components/settings/models/routeProjectionReconciliation.test.ts+++ b/ui/src/components/settings/models/routeProjectionReconciliation.test.ts@@ -24,7 +24,7 @@ const source: Source = {};const report: RouteReport = {chain: {- contract_version: 22,+ contract_version: 23,backend: "claude",model_id: "模型/opus",manual_override: null,diff --git a/ui/src/components/settings/models/runtimeLifecycle.test.ts b/ui/src/components/settings/models/runtimeLifecycle.test.tsindex 670131bb6..8f2e77899 100644--- a/ui/src/components/settings/models/runtimeLifecycle.test.ts+++ b/ui/src/components/settings/models/runtimeLifecycle.test.ts@@ -11,7 +11,7 @@ const asset = (platform: 'darwin-arm64' | 'linux-amd64') => ({});const runtime = (resolution: 'resolved' | 'unresolved' | 'unsupported'): RuntimeDependency => ({- contract_version: 22,+ contract_version: 23,host_platform: 'darwin-arm64',manifest: resolution === 'unresolved'? { name: 'cliproxyapi', resolution, assets: [] }diff --git a/ui/src/components/settings/models/searchServices.ts b/ui/src/components/settings/models/searchServices.tsindex 817d0aba2..1498e959c 100644--- a/ui/src/components/settings/models/searchServices.ts+++ b/ui/src/components/settings/models/searchServices.ts@@ -1,4 +1,4 @@-import type { HostedSearchServiceVendor, HostedToolsStatus, HostedWebSearchToolStatus, Source, SourceState } from './types';+import type { HostedExecutorCandidate, HostedSearchServiceVendor, HostedToolsStatus, HostedWebSearchToolStatus, Source, SourceState } from './types';export const KEYLESS_EXA_SOURCE_ID = 'src_exakeyless';export const KEYLESS_EXA_VENDOR_ID = 'exa-mcp';@@ -40,3 +40,7 @@ export const serviceSettings = (tool: HostedWebSearchToolStatus, vendor: HostedSresults: tool.services[sourceId]?.results ?? Math.min(5, vendor.results_max),};};++/** Whether the chain may try this candidate: a service's switch, or a web-search model executor's; absent is on. */+export const candidateEnabled = (candidate: HostedExecutorCandidate): boolean =>+ candidate.kind === 'service' ? candidate.settings.enabled : candidate.settings?.enabled ?? true;diff --git a/ui/src/components/settings/models/types.ts b/ui/src/components/settings/models/types.tsindex 068087bce..c45e0099c 100644--- a/ui/src/components/settings/models/types.ts+++ b/ui/src/components/settings/models/types.ts@@ -10,8 +10,8 @@// and the PR records the server implementation and feature-flag activation// edge. The client never synthesizes a fallback payload shape.-export const CONTRACT_VERSION = 22 as const;-export const PERSISTED_TURN_CONTRACT_VERSIONS = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] as const;+export const CONTRACT_VERSION = 23 as const;+export const PERSISTED_TURN_CONTRACT_VERSIONS = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23] as const;export const AGENT_CHAIN_CONTRACT_VERSION = CONTRACT_VERSION;export const PROBE_RESULT_CONTRACT_VERSION = CONTRACT_VERSION;@@ -1174,6 +1174,8 @@ export type HostedModelExecutorCandidate = {relay: boolean;/** Null when no list price is known, never zero. */price: HostedToolListPrice | null;+ /** Web search only: the executor's switch. Off ends the order and is never tried. Absent (X search) is on. */+ settings?: { enabled: boolean };};/** A search service's catalog list price, in searches rather than model calls. */@@ -1285,6 +1287,8 @@ export type HostedToolPut = {prefer_native?: boolean;/** web_search only; null removes a Source override or one of its saved fields. */services?: Record<string, { [K in keyof HostedSearchServiceSettings]?: HostedSearchServiceSettings[K] | null } | null>;+ /** web_search only: a model executor's switch; null (or on) restores the default, on. */+ executors?: Record<string, { enabled: boolean } | null>;executor_order?: string[] | null;default_model?: HostedModelRef | null;};