Skip to content

armgit / avibe

Public Imported from GitHub
0

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

fix(model-hub): run a proxied search only on a model its Source lists, and word transient failures as such (#2681)

Call Whited0da9a54b932
diff --git a/core/agent_core/messages.py b/core/agent_core/messages.py
index a71fd918d..c57c4483f 100644
--- a/core/agent_core/messages.py
+++ b/core/agent_core/messages.py
@@ -54,6 +54,7 @@ HOSTED_ERROR_CODES: tuple[str, ...] = (
"image_reference_unreadable",
# The gateway's search executor and image endpoint (vibey-hosted-tools.md §6, §7.4).
"provider_refused",
+ "provider_unavailable",
"provider_timed_out",
"provider_unreachable",
"provider_unreadable",
diff --git a/core/handlers/model_hub/hosted_executor.py b/core/handlers/model_hub/hosted_executor.py
index 7078f8d8e..1adf5f9b2 100644
--- a/core/handlers/model_hub/hosted_executor.py
+++ b/core/handlers/model_hub/hosted_executor.py
@@ -166,6 +166,7 @@ Say = Callable[..., str]
# worded in the user's language and shown as written.
FAILURE_CODES: Final[Mapping[str, str]] = {
"modelHub.hostedTools.providerRefused": "provider_refused",
+ "modelHub.hostedTools.providerUnavailable": "provider_unavailable",
"modelHub.hostedTools.timedOut": "provider_timed_out",
"modelHub.hostedTools.unreachable": "provider_unreachable",
"modelHub.hostedTools.unreadable": "provider_unreadable",
diff --git a/core/handlers/model_hub/hosted_tools.py b/core/handlers/model_hub/hosted_tools.py
index 7009ecd33..2b7564809 100644
--- a/core/handlers/model_hub/hosted_tools.py
+++ b/core/handlers/model_hub/hosted_tools.py
@@ -15,12 +15,13 @@ from __future__ import annotations
import json
import os
+import re
from dataclasses import dataclass, replace
from datetime import datetime
from functools import lru_cache
from importlib import resources
from pathlib import Path
-from typing import Any, Callable, Literal, Mapping, Optional
+from typing import Any, Callable, Final, Literal, Mapping, Optional
from config.v2_config import (
MODEL_HUB_HOSTED_TOOLS,
@@ -39,7 +40,7 @@ from vibe.backend_model_catalog import (
HostedToolSpec,
ImageModelSpec,
bundled_provider_vendors,
- provider_executor_model,
+ provider_executor_models,
provider_image_models,
provider_overlay_entry,
)
@@ -154,6 +155,10 @@ class HostedEvidence:
return self.refusal(source, model_id, feature) is not None
+# A provider's dated snapshot of a model id, as `claude-haiku-4-5-20251001` is of `claude-haiku-4-5`.
+_DATED_SNAPSHOT: Final = re.compile(r"-\d{8}")
+
+
@dataclass(frozen=True)
class HostedToolFacts:
"""What priors and evidence say about one search tool on one hop (§3.4).
@@ -217,34 +222,67 @@ def executor_candidates(
) -> tuple[ExecutorCandidate, ...]:
"""The executor chain for a search tool, in effective order (§6).
- Sources whose vendor offers the tool natively on its ``executor_model``,
- with no current refusal for that pair: the user's ``executor_order`` first,
- then Vibey's Source order.
+ Sources whose vendor offers the tool natively on the executor model they
+ list (``listed_executor_model``), with no current refusal for that pair:
+ the user's ``executor_order`` first, then Vibey's Source order.
"""
if tool not in MODEL_HUB_SEARCH_TOOLS:
return ()
candidates: dict[str, ExecutorCandidate] = {}
for source in _vibey_order(config):
- model_id = provider_executor_model(source.vendor)
- if model_id is None:
- continue
- spec = runs_on(source, model_id, tool, spec_for=spec_for)
- if spec is None or evidence.unsupported(source, model_id, EvidenceFeature.hosted(tool, "call")):
- continue
- candidates[source.id] = ExecutorCandidate(source, model_id, spec.declaration, tuple(spec.include), spec.price)
+ model_id = listed_executor_model(source)
+ candidate = executor_candidate(source, model_id, tool, evidence=evidence, spec_for=spec_for) if model_id else None
+ if candidate is not None:
+ candidates[source.id] = candidate
order = hosted_tool_setting(config, tool).executor_order or ()
first = [candidates[source_id] for source_id in order if source_id in candidates]
return tuple(first + [candidate for source_id, candidate in candidates.items() if source_id not in order])
+def listed_executor_model(source: ModelHubSourceConfig) -> Optional[str]:
+ """The model this Source runs proxied searches on: the first of its vendor's executor models it lists (§6).
+
+ Only a listed model: an API-key Source admits unlisted models on a turn's
+ hop, but an executor call nobody asked for must not guess. A dated snapshot
+ of an entry counts as listing it, the latest first; a retired one does not.
+ """
+
+ listed = {model.id for model in source.models if not model.retired}
+ for entry in provider_executor_models(source.vendor):
+ if entry in listed:
+ return entry
+ snapshots = sorted(model for model in listed if _DATED_SNAPSHOT.fullmatch(model.removeprefix(entry)) and model != entry)
+ if snapshots:
+ return snapshots[-1]
+ return None
+
+
+def executor_candidate(
+ source: ModelHubSourceConfig, model_id: str, tool: str, *, evidence: HostedEvidence, spec_for: SpecLookup
+) -> Optional[ExecutorCandidate]:
+ """This (Source, model) as an executor of ``tool``, or None: listed, running the tool, and not refused it.
+
+ The one rule for building a chain and for admitting a turn's frozen slot
+ again, so a slot stays good while its model is still listed and runnable,
+ even after the Source lists a model its vendor prefers.
+ """
+
+ if not any(model.id == model_id and not model.retired for model in source.models):
+ return None
+ spec = runs_on(source, model_id, tool, spec_for=spec_for)
+ if spec is None or evidence.unsupported(source, model_id, EvidenceFeature.hosted(tool, "call")):
+ return None
+ return ExecutorCandidate(source, model_id, spec.declaration, tuple(spec.include), spec.price)
+
+
def executor_vendors(tool: str) -> tuple[str, ...]:
- """The vendors whose Sources can run a proxied search ``tool``: their executor model's family declares it."""
+ """The vendors whose Sources can run a proxied search ``tool``: one of their executor models' families declares it."""
vendors = []
for vendor, entry in bundled_provider_vendors().items():
- family = provider_overlay_entry(vendor, entry.executor_model) if entry.executor_model else None
- if family is not None and any(tool in specs for specs in family.hosted_tools.values()):
+ families = (provider_overlay_entry(vendor, model_id) for model_id in entry.executor_models)
+ if any(family is not None and any(tool in specs for specs in family.hosted_tools.values()) for family in families):
vendors.append(vendor)
return tuple(sorted(vendors))
diff --git a/core/handlers/model_hub/service.py b/core/handlers/model_hub/service.py
index fa971ed59..f17e19f33 100644
--- a/core/handlers/model_hub/service.py
+++ b/core/handlers/model_hub/service.py
@@ -163,7 +163,7 @@ from .hosted_tools import (
apply_hosted_tool_put,
clear_request,
engine_stamp,
- executor_candidates,
+ executor_candidate,
executor_vendors,
freeze_turn_tools,
hop_hosted_tools,
@@ -873,6 +873,9 @@ def _executor_failure(outcome: RawCallOutcome | None, say: Callable[..., str], *
)
if outcome.upstream_detail:
detail = f"{detail}: {outcome.upstream_detail}" if detail else outcome.upstream_detail
+ if classify_outcome(replace(outcome, stream_started=False)).reason == "server_error":
+ # An overload or server error is transient: the provider did not refuse the call.
+ return failure(say, "modelHub.hostedTools.providerUnavailable", detail=detail or outcome.kind.value)
return failure(say, "modelHub.hostedTools.providerRefused", detail=detail or outcome.kind.value)
@@ -6490,18 +6493,11 @@ class ModelHubService:
"""
config = self.store.load()
-
- return next(
- (
- candidate
- for candidate in executor_candidates(
- config, tool, evidence=self.hosted_evidence(), spec_for=hosted_tool_spec,
- )
- if (candidate.source.id, candidate.model_id) == (slot.source_id, slot.model_id)
- and identity_digest(candidate.source) == slot.identity
- ),
- None,
- )
+ source = next((item for item in config.sources if item.id == slot.source_id), None)
+ if source is None or identity_digest(source) != slot.identity:
+ return None
+ # The frozen model while it stays listed and runnable, even if the Source now lists one its vendor prefers.
+ return executor_candidate(source, slot.model_id, tool, evidence=self.hosted_evidence(), spec_for=hosted_tool_spec)
async def run_hosted_tool(
self,
@@ -6946,17 +6942,15 @@ class ModelHubService:
Nothing reaches Vibey until the chain returns, so a failure mid-response
counts as before output here. A narrow rule's refusal records its
- evidence, as on any hop. A refusal of the executor model records that
- the Source does not run the tool on it, so the Source leaves the chain
- until the refusal is cleared or its wire stamp changes.
+ evidence, as on any hop. A refusal of the executor model (the Source
+ does not serve it) skips the Source for this call only: it names the
+ model, not the tool, so it is no evidence about the tool (§6 step 4).
"""
learned = await self._learn_capability_evidence(source, model_id, request, outcome)
if learned is not None and learned.feature.kind == "hosted_tool":
return True
if not outcome.stream_started and names_model_refusal(outcome):
- detail = f"{outcome.http_status or 'error'} {outcome.error_code or outcome.error_type or 'model'}"[:64]
- await self.record_hosted_refusals(source, ((model_id, EvidenceFeature.hosted(tool, "call"), detail),))
return True
decision = classify_outcome(replace(outcome, stream_started=False))
return decision.action in {"fallback", "refresh"}
diff --git a/docs/plans/agent-core-contracts/model-hub-consumer.md b/docs/plans/agent-core-contracts/model-hub-consumer.md
index bc1c82c76..5c584e39c 100644
--- a/docs/plans/agent-core-contracts/model-hub-consumer.md
+++ b/docs/plans/agent-core-contracts/model-hub-consumer.md
@@ -153,13 +153,15 @@ consumer's requirements, and the Model Hub lane lands the change in both places.
`image_generate` a model outside the turn's frozen models, is 409 `tool_not_enabled`. Nothing runs. Stopping
the turn cancels an admitted call, which is still metered.
- **A search call runs on a chain** built from the turn's frozen executor order: each candidate is a Source
- whose vendor offers the tool natively, called with its vendor's `executor_model`, and admitted on the final
- snapshot when the gateway reaches it (`runs_on`, its identity, no current negative `call` evidence). The
- gateway sends one short native request (the overlay's declaration; on Responses `tool_choice: "required"`;
- Anthropic is asked in the message alone; no reasoning effort) and moves to the next candidate on a failure
- normal routing fails over from, a narrow-rule refusal, or a failure mid-stream. A refusal of the executor
- model (`model_not_found`) also writes negative `call` evidence for (Source, `executor_model`, tool). A
- completed response that never ran the tool ends the chain. One deadline covers the whole chain (180 s).
+ whose vendor offers the tool natively, called with the first of its vendor's `executor_models` the Source
+ lists (a Source listing none is no candidate), and admitted on the final snapshot when the gateway reaches it
+ (`runs_on`, its identity, no current negative `call` evidence). The gateway sends one short native request
+ (the overlay's declaration; on Responses `tool_choice: "required"`; Anthropic is asked in the message alone;
+ no reasoning effort) and moves to the next candidate on a failure normal routing fails over from (an overload
+ or server error included), a narrow-rule refusal, a refusal of the executor model (`model_not_found`), or a
+ failure mid-stream. Only the narrow rule writes negative `call` evidence; a model refusal is not a refusal of
+ the tool. A completed response that never ran the tool ends the chain. One deadline covers the whole chain
+ (180 s).
- **An `image_generate` call** runs directly on the image endpoint of the (Source, model) the turn's frozen
models name (`vibey-hosted-tools.md` §7.4), admitted on the final snapshot; there is no chain and no
fallback. Its arguments are `{model, prompt, size?, images?, n?}`, `images` being at most 4 base64 strings,
diff --git a/docs/plans/model-hub-capability-model.md b/docs/plans/model-hub-capability-model.md
index e5ac4715d..4b6a8a251 100644
--- a/docs/plans/model-hub-capability-model.md
+++ b/docs/plans/model-hub-capability-model.md
@@ -209,7 +209,7 @@ Fields of one vendor entry, mirrored by
| `match` | exactly one of `prefix` or `id`, non-empty |
| `wire_efforts` | a list of effort names, or `null` (or absent) to defer to models.dev |
| `hosted_tools` | optional; protocol (`anthropic`, `openai_responses`, `openai_chat`, `google`) → search tool (`web_search`, `x_search`) → `{declaration, price?, include?}`. `declaration` is required, has a `type`, and is sent verbatim. `price` is optional: absent means no list price is known, never zero. `include` lists Responses `include` values the tool needs (OpenAI web search: `web_search_call.action.sources`). v1's OpenAI `image_generation` entry is removed: no chat request declares a hosted image tool (`vibey-hosted-tools.md` §7). |
-| `executor_model` | new, optional, at vendor scope (beside `models[]`): the vendor's lightweight model id that runs proxied search calls on this vendor's Sources (`vibey-hosted-tools.md` §6), e.g. a Haiku, mini or fast tier. The executor call's declaration and `include` are those of the family row that model id matches, on the Source's protocol. A vendor without it is never an executor. |
+| `executor_models` | new, optional, at vendor scope (beside `models[]`): the vendor's lightweight model ids that run proxied search calls on this vendor's Sources, preferred first (`vibey-hosted-tools.md` §6), e.g. Haiku, mini or fast tiers; a Source runs the first it lists. The executor call's declaration and `include` are those of the family row that model id matches, on the Source's protocol. A vendor without it is never an executor. |
| `image_models[]` | new, optional per vendor: `{id, description, params, size_forms, kinds?, request?, prices?, tokens_per_image?}`. Every image model runs through the engine's images endpoints (`/v1/images/generations`, or `/v1/images/edits` when the call carries reference images). `description` is the one line the `image_generate` enum shows; `params` lists which common parameters the model takes (`size`, `images`, `n`), and `size_forms` which forms of `size` it accepts (`pixels`, `ratio`); `kinds` names the credential kinds (`api_key`, `subscription`) its route was verified on, every kind when absent, so a subscription whose route is unverified is never offered the model; `request` holds the fixed scalar fields every call to it sends (an output format, base64 results), never a field the call names itself; `prices[]` is optional, each entry a `price` with an `image` unit keyed by the `size` and `quality` it applies to (absent keys match any), so a vendor that prices sizes or qualities apart is valued at the size the call resolved. `tokens_per_image` is optional: the documented output tokens of one image, which the pricing module values at the model's output token rate as an estimate (shown with ≈) where no per-image price exists. Only models whose route the implementation verified through the shipped engine are listed. |
| `price` | `unit` (`call`, `search`, `post`, `profile`, `image`), `usd_per_1k` ≥ 0, `as_of` (date) and `url` (https), all required; optional `extra[]` of `{unit, usd_per_1k}`. An `image` unit may carry `quality` and `size` when the vendor prices them apart. |
- The overlay records what the **provider** offers, and it is the prior every hop starts from: a hosted tool is
diff --git a/docs/plans/model-hub-contracts/README.md b/docs/plans/model-hub-contracts/README.md
index f0fab58ef..d029bc341 100644
--- a/docs/plans/model-hub-contracts/README.md
+++ b/docs/plans/model-hub-contracts/README.md
@@ -13,7 +13,7 @@ before it ships.
with their default.
- The probe endpoint and `hosted-tool-probe-result.schema.json` are removed. `POST /api/models/hosted-tools/<tool>/clear`
and `POST /api/models/sources/<source_id>/evidence/clear` clear refusals; the PUT is per field.
-- The provider overlay gains a vendor's `executor_model` and `image_models[]`, and loses the native `image_generation`
+- The provider overlay gains a vendor's `executor_models[]` and `image_models[]`, and loses the native `image_generation`
declaration.
- `HopResolution.capabilities` gains `context_price_steps` (`hop-resolution.schema.json`): where the target model's
list price rises with its context, from the price table, which Vibey's compaction threshold stays below.
diff --git a/docs/plans/model-hub-contracts/provider-overlay.schema.json b/docs/plans/model-hub-contracts/provider-overlay.schema.json
index c0b2a1dcd..4e33d72f1 100644
--- a/docs/plans/model-hub-contracts/provider-overlay.schema.json
+++ b/docs/plans/model-hub-contracts/provider-overlay.schema.json
@@ -192,9 +192,14 @@
"$ref": "#/definitions/ModelFamily"
}
},
- "executor_model": {
- "$ref": "#/definitions/Token",
- "description": "The vendor's lightweight model that runs proxied search calls on this vendor's Sources (vibey-hosted-tools.md §6). The executor call uses the declaration of the family row this id matches. A vendor without it is never an executor."
+ "executor_models": {
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/Token"
+ },
+ "description": "The vendor's lightweight models that run proxied search calls on this vendor's Sources, preferred first (vibey-hosted-tools.md §6). A Source runs the first one it lists, exactly or as a dated snapshot (`<id>-YYYYMMDD`), and is no executor if it lists none. The executor call uses the declaration of the family row that model matches. A vendor without them is never an executor."
},
"image_models": {
"type": "array",
diff --git a/docs/plans/vibey-hosted-tools.md b/docs/plans/vibey-hosted-tools.md
index b03a3c8fa..b7a7d7f1e 100644
--- a/docs/plans/vibey-hosted-tools.md
+++ b/docs/plans/vibey-hosted-tools.md
@@ -88,7 +88,7 @@ The user has an Anthropic API key, an xAI API key and an OpenAI API key, and has
- **The catalog is the overlay's `providers` section** (capability model §4), bundled with the code that sends its
declarations. For each vendor and model family, per protocol, it holds:
- the native declaration of each search tool the vendor offers, with its `include` values and list price;
- - new, at vendor scope: `executor_model`, the vendor's lightweight model that runs proxied search calls (§6), e.g.
+ - new, at vendor scope: `executor_models`, the vendor's lightweight models that run proxied search calls, preferred first (§6), e.g.
Anthropic's Haiku tier, OpenAI's mini tier, xAI's fast tier; the executor call uses the declaration of the family
row that model matches. The implementation PR picks the shipped ids;
- new: `image_models`, the vendor's image models with a one-line description, the endpoint kind (§7.4), the
@@ -480,9 +480,11 @@ These rules are C-1 rows in `cross-provider.md` and per-protocol rows in `conver
and closed admission); only the per-turn executor binding goes. Stopping the turn cancels the call, and it is
still metered. A candidate whose identity changed since the chain was built is not used.
- **The chain, built at call time.**
- 1. Candidates are the Sources whose vendor offers the tool natively (§3.1), with `runs_on` holding for the
- vendor's `executor_model` and no current negative `call` evidence for that pair. So a subscription that does
- not list the vendor's lightweight model is excluded when the chain is built, not found by a 404.
+ 1. Candidates are the Sources whose vendor offers the tool natively (§3.1) and that list one of the vendor's
+ `executor_models`: the first one the Source lists, exactly or as a dated snapshot, never a retired one. `runs_on`
+ must hold for it, with no current negative `call` evidence for that pair. A Source that lists none is excluded
+ when the chain is built, not found by a 404: an API-key Source admits unlisted models on a turn's hop, but a
+ call 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 remaining
candidates in Vibey's Source order, as they stood at the turn's first resolution. A Source added mid-turn joins
from the next turn.
@@ -491,16 +493,17 @@ These rules are C-1 rows in `cross-provider.md` and per-protocol rows in `conver
calling a removed or re-identified Source. This is the same per-request admission every model request of the
turn already gets (C-6 item 3, #2616's identity rule): the turn freezes the order, not the Sources' runtime, and a
removed Source cannot be served at all. It calls the first admitted candidate: one short native request on
- that Source's `executor_model`, with the
+ that Source's executor model, with the
overlay's declaration, the tool forced where the protocol allows it (`tool_choice: "required"` on Responses;
Anthropic is asked in the message alone), a fixed instruction to search and list numbered results with one or
two cited sentences each, a small output cap, and no reasoning effort.
- 4. On a failure that normal routing fails over from, or a narrow-rule refusal (which also writes negative
- evidence), it tries the next candidate. A model refusal (the upstream's machine code naming the model, such as
- `model_not_found`, or a 404 `not_found_error`, as routing's classifier reads it; L1 hands no prose to it) skips
- that Source for this call without settling its health, as `_InvocationUnsupported` does, and, because it names
- the executor model, writes negative `call` evidence for (Source, `executor_model`, tool), so the Source leaves
- the chain until the refusal is cleared or its wire stamp changes, and shows and clears like any refusal. A failure mid-stream moves on too: nothing
+ 4. On a failure that normal routing fails over from (a transient one such as an overload or a server error
+ included), or a narrow-rule refusal (which also writes negative evidence), it tries the next candidate. A model
+ refusal (the upstream's machine code naming the model, such as `model_not_found`, or a 404 `not_found_error`, as
+ routing's classifier reads it; L1 hands no prose to it) skips that Source for this call without settling its
+ health, as `_InvocationUnsupported` does. It is not a refusal of the tool and writes no evidence: only the
+ narrow rule, an error naming the feature, does. With the executor model taken from the Source's listing, it
+ means a stale listing, which the Source's next inventory refresh corrects. A failure mid-stream moves on too: nothing
reaches Vibey until the gateway returns the record, so "before output" here means before the result is
returned, and the partial call is still metered on its Source. A completed response that never ran the tool
(the model chose not to; Anthropic is asked in the message alone) ends the chain with a `failed` record: it is
@@ -825,7 +828,7 @@ under the freeze protocol (`model-hub-contracts/README.md`).
`source_id`, → the read, §3.3) and
`POST /api/models/sources/<source_id>/evidence/clear` (`{model_id, feature}` with an effort feature → the Source,
for an effort refusal; capability model §5), each with its `api-response.schema.json` branch.
-- `provider-overlay.schema.json` gains `executor_model` per vendor and `image_models[]`.
+- `provider-overlay.schema.json` gains `executor_models[]` per vendor and `image_models[]`.
- V2 config: `model_hub.hosted_tools` as §3.3.
### 10.4 Pricing
@@ -857,7 +860,7 @@ phase D's display work; that PR adds the codes' en and zh copy in `vibe/i18n` an
| PR | Lane | Work | Depends on |
| --- | --- | --- | --- |
-| **A1** Evidence, priors, settings | foundation | the evidence model: status-keyed records with `mode`, negative-only routing, no time limit (efforts included), the in-memory `wire` stamp computed at `sync_sources`, memory updated when a refusal's write fails, no `probe` basis or `shape`, the `hosted_wire` branch gone; the positive rule's entry point, which B1's observer calls; the clear endpoints (hosted and effort) with their edge and persistence rules; overlay `executor_model` and `image_models` (schema and loader; image entries land with B2); the `hosted_tools` config v2 with the generic loader rule; the hop-fact functions (§3.4) and the image enum function; the `hosted-tools-status` v2 read and per-field PUT with the `latest_ok` projection; removal of the probe stack (§11 Model Hub); the Model Hub contracts of §10.3 and the coordinated version event | — |
+| **A1** Evidence, priors, settings | foundation | the evidence model: status-keyed records with `mode`, negative-only routing, no time limit (efforts included), the in-memory `wire` stamp computed at `sync_sources`, memory updated when a refusal's write fails, no `probe` basis or `shape`, the `hosted_wire` branch gone; the positive rule's entry point, which B1's observer calls; the clear endpoints (hosted and effort) with their edge and persistence rules; overlay `executor_models` and `image_models` (schema and loader; image entries land with B2); the `hosted_tools` config v2 with the generic loader rule; the hop-fact functions (§3.4) and the image enum function; the `hosted-tools-status` v2 read and per-field PUT with the `latest_ok` projection; removal of the probe stack (§11 Model Hub); the Model Hub contracts of §10.3 and the coordinated version event | — |
| **B1** Signal, refusal, executor chain | gateway | the observer's projection paths and the positive write at settlement (§3.2); `pin_unavailable.reason` and admission on negative evidence only; `HopResolution.hosted_tools` v2 from A1's facts, frozen in the turn trace with the executor order and the image enum; the executor chain (§6) with `{arguments}` bodies, `turn_not_live` / `tool_not_enabled`, failover, one deadline, `failed_attempts`, and the executor-model refusal; the C-6 text (§10.2); gateway removals (§11) | A1 |
| **C1** Declarations and re-render | Vibey | declarations from facts and the turn freeze; the 409 matched on `type` and `code`; `pin_unavailable` surfaced to the loop and re-resolve with its bounds; the decrypt refusal; the in-flight rule; the C-1 changes of §10.1 (`execution.mode`, `failed_attempts`, `generate.model`, the two image error codes with en and zh copy); the localized context-load error for a row that no longer validates; Vibey removals (§11) | B1's HopResolution and executor body: developed on B1's branch and merged together with it |
| **B2** Image endpoints | gateway | the engine images invoke path, `stream_wire`'s images taxonomy, the per-model `image` flag, the image narrow rule (upstream refusals only), request and response bounds, enum authorization; one hermetic engine E2E per image path; the overlay `image_models` entries for the paths that pass | A1, B1 |
diff --git a/tests/scenarios/model_hub/catalog.yaml b/tests/scenarios/model_hub/catalog.yaml
index c0457461a..457d6e7ab 100644
--- a/tests/scenarios/model_hub/catalog.yaml
+++ b/tests/scenarios/model_hub/catalog.yaml
@@ -237,7 +237,7 @@ scenarios:
- tests/test_provider_overlay.py::test_bundled_providers_section_satisfies_its_schema
- tests/test_provider_overlay.py::test_an_invalid_vendor_entry_disables_only_that_vendor
- tests/test_provider_overlay.py::test_an_image_model_entry_is_read_in_a_stable_form
- - tests/test_provider_overlay.py::test_each_vendors_executor_model_runs_every_search_tool_the_vendor_offers
+ - tests/test_provider_overlay.py::test_each_vendors_executor_models_run_every_search_tool_the_vendor_offers
- id: MH-HOSTED-UI-008
name: The execution-process group draws a native, a proxied and a direct hosted call as one card, with how it ran, its known cost (a lower bound when an attempt was unpriced) and its sources or image
status: covered
diff --git a/tests/test_model_hub_hosted_executor.py b/tests/test_model_hub_hosted_executor.py
index c72fedf07..a9170e95e 100644
--- a/tests/test_model_hub_hosted_executor.py
+++ b/tests/test_model_hub_hosted_executor.py
@@ -19,7 +19,7 @@ from datetime import timedelta
import aiohttp
import pytest
-from config.v2_config import ModelHubHostedToolConfig
+from config.v2_config import ModelHubModelConfig, ModelHubHostedToolConfig
from core.agent_core.messages import HostedCost, message_from_dict
from core.handlers.model_hub import service as service_module
from core.handlers.model_hub.adapter import InvokeCancelledError, RawOutcomeKind, UpstreamRejection
@@ -107,13 +107,13 @@ def _sources(*extra):
# The vendors' executor models these tests run with, in place of the bundled overlay's (vibey-hosted-tools.md §6).
-_EXECUTOR_MODELS: dict[str, str] = {}
+_EXECUTOR_MODELS: dict[str, tuple[str, ...]] = {}
@pytest.fixture(autouse=True)
def _executor_models(monkeypatch):
_EXECUTOR_MODELS.clear()
- monkeypatch.setattr(hosted_tools_module, "provider_executor_model", _EXECUTOR_MODELS.get)
+ monkeypatch.setattr(hosted_tools_module, "provider_executor_models", lambda vendor: _EXECUTOR_MODELS.get(vendor, ()))
def _bind(service, tool, executor):
@@ -126,7 +126,7 @@ def _bind(service, tool, executor):
if executor is None:
return
source = next(item for item in config.sources if item.id == executor[0])
- _EXECUTOR_MODELS[source.vendor] = executor[1]
+ _EXECUTOR_MODELS[source.vendor] = (executor[1],)
async def _call(service, tool, body, *, token=None, after_launch=None, language="en"):
@@ -346,10 +346,10 @@ FAILED_WITH_PARTIAL = {**WEB_CALL, "status": "failed"}
@pytest.mark.asyncio
@pytest.mark.parametrize(("case", "bound", "handles", "error", "sources", "executed"), [
# No Source can run it: the record says which providers' Sources could.
- ("no_candidate", None, [], "No Source can run web search right now. Add an API key from one of Anthropic, OpenAI, xAI.", [], False),
- ("source_removed", (XAI, "grok-4.6"), [], "No Source can run web search right now. Add an API key from one of Anthropic, OpenAI, xAI.", [], False),
+ ("no_candidate", None, [], "No Source can run web search right now. Add an API key from one of Anthropic, OpenAI, xAI as a Source in Models › Sources & gateway; a key stored in Vaults is not used for this.", [], False),
+ ("source_removed", (XAI, "grok-4.6"), [], "No Source can run web search right now. Add an API key from one of Anthropic, OpenAI, xAI as a Source in Models › Sources & gateway; a key stored in Vaults is not used for this.", [], False),
# A new base URL or credential is a new identity, which the turn's chain was not built for.
- ("source_identity_changed", (XAI, "grok-4.6"), [], "No Source can run web search right now. Add an API key from one of Anthropic, OpenAI, xAI.", [], False),
+ ("source_identity_changed", (XAI, "grok-4.6"), [], "No Source can run web search right now. Add an API key from one of Anthropic, OpenAI, xAI as a Source in Models › Sources & gateway; a key stored in Vaults is not used for this.", [], False),
# The only candidate failed: its failure, and the Sources tried.
("provider_refused", (XAI, "grok-4.6"),
[InvokeHandle(_outcome(RawOutcomeKind.HTTP_ERROR, status=429, code="rate_limit_error", source_id=XAI))],
@@ -365,7 +365,7 @@ FAILED_WITH_PARTIAL = {**WEB_CALL, "status": "failed"}
("stream_failed_after_items", (XAI, "grok-4.6"),
[LiveInvokeHandle(_outcome(RawOutcomeKind.HTTP_ERROR, status=200, code="server_error", source_id=XAI,
stream_started=True), _responses(WEB_CALL, WEB_ANSWER)[:-1])],
- "refused the call (HTTP 200 server_error)",
+ "is unavailable right now (HTTP 200 server_error)",
[{"url": PAGE_B, "snippet": "v8.0.27 is the latest release. It adds a streaming keepalive."}, {"url": PAGE_A}],
True),
])
@@ -398,7 +398,7 @@ async def test_a_proxied_call_that_cannot_complete_is_a_failed_record(
"no_candidate": None, "source_removed": None,
"source_identity_changed": None, "provider_refused": "provider_refused",
"tool_never_ran": "search_not_run", "call_failed_with_partial_results": "search_failed",
- "stream_failed_after_items": "provider_refused",
+ "stream_failed_after_items": "provider_unavailable",
}[case]
assert answer["record"]["sources"] == sources
assert ("execution" in answer) is executed
@@ -412,7 +412,7 @@ def _chain(service, tool, *executors):
config = service.store.config
config.hosted_tools[tool] = ModelHubHostedToolConfig(enabled=True, executor_order=tuple(e[0] for e in executors))
for source_id, model_id in executors:
- _EXECUTOR_MODELS[next(item for item in config.sources if item.id == source_id).vendor] = model_id
+ _EXECUTOR_MODELS[next(item for item in config.sources if item.id == source_id).vendor] = (model_id,)
def _refusal(status, code, source_id, **fields):
@@ -424,12 +424,86 @@ def _served_by_openai():
BILLED = ProtocolUsageReport.of(input_tokens=900, cached_input_tokens=0, output_tokens=40)
+OVERLOADED = "Our servers are currently overloaded. Please try again later."
NARROW = replace(
_refusal(400, "invalid_request_error", XAI),
rejection=UpstreamRejection(status=400, code="invalid_request_error", unsupported_tool_type="web_search"),
)
+async def test_a_frozen_executor_slot_runs_while_its_model_stays_listed(tmp_path):
+ """MH-HOSTED-GATEWAY-005: a turn froze its slot on a fallback model; the Source then lists the model its vendor
+ prefers. The frozen model is still listed and runnable, so the call runs on it instead of finding no executor."""
+
+ body = json.dumps({
+ "type": "message", "role": "assistant", "stop_reason": "end_turn",
+ "content": [{"type": "text", "text": "no results"}], "usage": {"input_tokens": 10, "output_tokens": 2},
+ }).encode()
+ service = _vibey_service(tmp_path, _sources(), handles=[
+ LiveInvokeHandle(_outcome(RawOutcomeKind.SUCCESS, source_id=ANTHROPIC), (body,)),
+ ])
+ _bind(service, "web_search", (ANTHROPIC, "claude-haiku-4-5"))
+ _EXECUTOR_MODELS["anthropic"] = ("claude-haiku-5-5", "claude-haiku-4-5")
+
+ def preferred_now_listed(_hop):
+ source = next(item for item in service.store.config.sources if item.id == ANTHROPIC)
+ source.models.append(ModelHubModelConfig(id="claude-haiku-5-5", provenance="discovered"))
+
+ status, answer = await _call(service, "web_search", {"arguments": {"query": "q"}}, after_launch=preferred_now_listed)
+ assert status == 200
+ assert service.adapter.invocations == [(ANTHROPIC, "claude-haiku-4-5", "vibey")]
+ assert answer["execution"]["executor_origin"]["model"] == "claude-haiku-4-5"
+
+
+# Each vendor's own answer for a model it does not serve, as its API sends it.
+MODEL_NOT_SERVED = {
+ "anthropic": (ANTHROPIC, "claude-haiku-4-5", "anthropic", {
+ "type": "error", "error": {"type": "not_found_error", "message": "model: claude-haiku-5-5"},
+ }),
+ "openai": (OPENAI, "gpt-6-astra", "openai_responses", {
+ "error": {"message": "The model `gpt-6-luna` does not exist or you do not have access to it.",
+ "type": "invalid_request_error", "param": None, "code": "model_not_found"},
+ }),
+}
+
+
+async def _engine_outcome(protocol, status, body):
+ """The outcome the real engine client reads from this answer."""
+
+ from aiohttp import web
+
+ from tests.test_model_hub_retry_advice import _engine, _source as _engine_source
+
+ async def respond(_request):
+ return web.json_response(body, status=status)
+
+ async with _engine(respond) as (client, _requests):
+ handle = await client.invoke(_engine_source(protocol), "model-a", {"input": "q"}, stream=False)
+ return await handle.outcome()
+
+
[email protected]("vendor", sorted(MODEL_NOT_SERVED))
+async def test_a_model_the_source_does_not_serve_moves_on_and_refuses_no_tool(tmp_path, vendor):
+ """MH-HOSTED-GATEWAY-005: a model-not-found names the model, not the tool, so it is no refusal (§6 step 4).
+
+ It used to write negative ``call`` evidence that never expires, silently dropping the Source from the chain.
+ """
+
+ source_id, model_id, protocol, body = MODEL_NOT_SERVED[vendor]
+ not_served = replace(await _engine_outcome(protocol, 404, body), source_id=source_id)
+ served = LiveInvokeHandle(_outcome(RawOutcomeKind.SUCCESS, source_id=XAI), _responses(WEB_CALL, WEB_ANSWER))
+ service = _vibey_service(tmp_path, _sources(), handles=[InvokeHandle(not_served), served])
+ _chain(service, "web_search", (source_id, model_id), (XAI, "grok-4.6"))
+ status, answer = await _call(service, "web_search", {"arguments": {"query": "q"}})
+ assert (status, answer["record"]["status"], answer["execution"]["executor_source_id"]) == (200, "completed", XAI)
+ source = next(item for item in service.store.config.sources if item.id == source_id)
+ assert not service.hosted_evidence().unsupported(source, model_id, EvidenceFeature.hosted("web_search", "call"))
+ chain = service.freeze_turn_hosted_tools(service.store.config).executors["web_search"]
+ assert [slot.source_id for slot in chain] == [source_id, XAI]
+
+
@pytest.mark.asyncio
@pytest.mark.parametrize(("case", "handles", "invoked", "status", "served_by", "failed_attempts"), [
# A failure normal routing fails over from moves on; a refusal before output that reported no tokens is unbilled.
@@ -440,9 +514,10 @@ NARROW = replace(
LiveInvokeHandle(_refusal(200, "server_error", XAI, stream_started=True, usage=BILLED), _responses(WEB_CALL)[:-1]),
_served_by_openai(),
], [XAI, OPENAI], "completed", OPENAI, [XAI]),
- # A refusal of the executor model, or a narrow rule's: the Source leaves the chain until the refusal is cleared.
- ("executor_model_refused", lambda: [InvokeHandle(_refusal(404, "model_not_found", XAI)), _served_by_openai()],
+ # An overload is transient: it moves on, and it is no refusal.
+ ("overloaded", lambda: [InvokeHandle(_refusal(200, "server_error", XAI, message=OVERLOADED)), _served_by_openai()],
[XAI, OPENAI], "completed", OPENAI, []),
+ # A narrow rule's refusal names the tool: the Source leaves the chain until the refusal is cleared.
("narrow_rule_refused", lambda: [InvokeHandle(NARROW), _served_by_openai()], [XAI, OPENAI], "completed", OPENAI, []),
# The model chose not to search: no Source failed, and moving on would double the cost.
("model_chose_not_to_run", lambda: [
@@ -474,7 +549,7 @@ async def test_the_chain_moves_on_only_past_a_source_failure(
assert answer["record"]["error"].endswith("Tried: xAI key, OpenAI key.")
xai = next(item for item in service.store.config.sources if item.id == XAI)
refused = service.hosted_evidence().unsupported(xai, "grok-4.6", EvidenceFeature.hosted("web_search", "call"))
- assert refused is (case in {"executor_model_refused", "narrow_rule_refused"})
+ assert refused is (case == "narrow_rule_refused")
# The next turn's chain leaves a refused Source out.
chain = service.freeze_turn_hosted_tools(service.store.config).executors["web_search"]
assert [slot.source_id for slot in chain] == ([OPENAI] if refused else [XAI, OPENAI])
@@ -514,7 +589,7 @@ async def test_failure_text_is_in_the_users_language(tmp_path):
service, "x_search", {"arguments": {"query": "q"}}, language="zh",
)
assert status == 200
- assert answer["record"]["error"] == "当前没有能运行 X 搜索的供应商。请添加 xAI 的 API Key。"
+ assert answer["record"]["error"] == "当前没有能运行 X 搜索的供应商。请在 模型 › 供应商与路由 中把 xAI 的 API Key 添加为供应商;存在 Vaults 里的密钥不会用于这里。"
@pytest.mark.asyncio
diff --git a/tests/test_model_hub_hosted_tools_config.py b/tests/test_model_hub_hosted_tools_config.py
index 3680181db..2cc593977 100644
--- a/tests/test_model_hub_hosted_tools_config.py
+++ b/tests/test_model_hub_hosted_tools_config.py
@@ -35,7 +35,11 @@ SOURCE = {
"supply_channel": "hub",
"billing": "metered",
"state": {"status": "standby", "retry_at": None, "detail_key": None},
- "models": [{"id": "grok-4.6", "display_name": "Grok 4.6", "origin": "discovered", "reasoning_efforts": [], "reasoning_efforts_source": None}],
+ # An executor runs only on a model its Source lists, so the fixture lists xAI's lightweight model as xAI does.
+ "models": [
+ {"id": "grok-4.6", "display_name": "Grok 4.6", "origin": "discovered", "reasoning_efforts": [], "reasoning_efforts_source": None},
+ {"id": "grok-4.20-0309-non-reasoning", "origin": "discovered", "reasoning_efforts": [], "reasoning_efforts_source": None},
+ ],
"created_at": "2026-10-13T00:00:00Z",
"credential_ref": "cred_src_xai00001",
}
diff --git a/tests/test_model_hub_hosted_tools_resolution.py b/tests/test_model_hub_hosted_tools_resolution.py
index 3d0ca4891..d8f7b1628 100644
--- a/tests/test_model_hub_hosted_tools_resolution.py
+++ b/tests/test_model_hub_hosted_tools_resolution.py
@@ -59,7 +59,7 @@ SPECS = {
("anthropic", "anthropic", "web_search"): _spec({"type": "web_search_20250305", "name": "web_search"}),
("google", "google", "web_search"): _spec({"type": "google_search"}),
}
-EXECUTOR_MODELS = {"xai": "grok-fast", "openai": "gpt-mini", "anthropic": "claude-haiku"}
+EXECUTOR_MODELS = {"xai": ("grok-fast",), "openai": ("gpt-mini",), "anthropic": ("claude-haiku",)}
def _image(model_id: str, description: str, *, price: float | None = None, kinds=("api_key", "subscription")) -> ImageModelSpec:
@@ -80,7 +80,7 @@ IMAGE_MODELS = {
@pytest.fixture(autouse=True)
def _overlay(monkeypatch):
- monkeypatch.setattr(hosted_tools_module, "provider_executor_model", EXECUTOR_MODELS.get)
+ monkeypatch.setattr(hosted_tools_module, "provider_executor_models", lambda vendor: EXECUTOR_MODELS.get(vendor, ()))
monkeypatch.setattr(hosted_tools_module, "provider_image_models", lambda vendor: IMAGE_MODELS.get(vendor, ()))
# The bundled overlay's vendors; which of them list image models is `IMAGE_MODELS`.
monkeypatch.setattr(hosted_tools_module, "bundled_provider_vendors", lambda: dict.fromkeys(("anthropic", "openai", "xai")))
@@ -90,7 +90,7 @@ def _spec_for(vendor, protocol, model_id, tool):
return SPECS.get((vendor, protocol, tool))
-def _source(source_id, vendor, protocol, model_id, *, kind="api_key", base_url=None) -> ModelHubSourceConfig:
+def _source(source_id, vendor, protocol, model_id, *, kind="api_key", base_url=None, listed=()) -> ModelHubSourceConfig:
return ModelHubSourceConfig(
id=source_id,
kind=kind,
@@ -100,14 +100,16 @@ def _source(source_id, vendor, protocol, model_id, *, kind="api_key", base_url=N
supply_channel="hub",
billing="monthly" if kind == "subscription" else "metered",
state=ModelHubSourceStateConfig(status="standby"),
- models=[ModelHubModelConfig(id=model_id, provenance="discovered")],
+ models=[ModelHubModelConfig(id=model, provenance="discovered") for model in (model_id, *listed)],
credential_ref=f"cred_{source_id}",
base_url=base_url,
)
-XAI = _source("src_xai00001", "xai", "openai_responses", "grok-4.6")
-OPENAI = _source("src_oai00001", "openai", "openai_responses", "gpt-6-astra", base_url="https://relay.example/v1")
+XAI = _source("src_xai00001", "xai", "openai_responses", "grok-4.6", listed=("grok-fast",))
+OPENAI = _source(
+ "src_oai00001", "openai", "openai_responses", "gpt-6-astra", base_url="https://relay.example/v1", listed=("gpt-mini",),
+)
CLAUDE_SUB = _source("src_cla00001", "anthropic", "anthropic", "claude-opus-5-5", kind="subscription")
GEMINI = _source("src_gem00001", "google", "google", "gemini-3-pro")
ALL = [CLAUDE_SUB, XAI, OPENAI, GEMINI]
@@ -168,6 +170,35 @@ def test_a_hops_facts_come_from_priors_and_refusals(tmp_path, primary, tool, ref
assert (facts.declaration is not None) is (native == "assumed")
+ "listed,retired,expected",
+ [
+ # The relay that 404'd the catalog prior: the next listed model of the family runs the call.
+ (("claude-3-5-haiku-20241022", "claude-haiku-4-5", "claude-haiku-4-5-20251001"), (), "claude-haiku-4-5"),
+ (("claude-haiku-5-5", "claude-haiku-4-5"), (), "claude-haiku-5-5"),
+ # A dated snapshot names its model, the latest first; a lookalike id does not.
+ (("claude-haiku-4-5-20251001", "claude-haiku-4-5-20260101"), (), "claude-haiku-4-5-20260101"),
+ (("claude-haiku-5-50",), (), None),
+ # A retired row is not listed; a Source that lists none runs no executor call.
+ (("claude-haiku-5-5", "claude-haiku-4-5"), ("claude-haiku-5-5",), "claude-haiku-4-5"),
+ (("claude-opus-5-5",), (), None),
+ ],
+ ids=["prior-unlisted", "prior-listed", "dated-snapshot", "lookalike", "retired", "none-listed"],
+)
+def test_an_executor_runs_on_a_model_its_source_lists(tmp_path, monkeypatch, listed, retired, expected):
+ """MH-HOSTED-001: an API-key Source admits unlisted models on a hop, but an executor call nobody asked for must
+ not guess one: the first of the vendor's executor models the Source lists, or the Source is no executor."""
+ monkeypatch.setattr(
+ hosted_tools_module, "provider_executor_models",
+ lambda vendor: ("claude-haiku-5-5", "claude-haiku-4-5") if vendor == "anthropic" else (),
+ )
+ source = _source("src_rel00001", "anthropic", "anthropic", listed[0], listed=listed[1:])
+ for model in source.models:
+ model.retired = model.id in retired or None
+ chain = executor_candidates(_config(sources=[source]), "web_search", evidence=_evidence(tmp_path), spec_for=_spec_for)
+ assert [candidate.model_id for candidate in chain] == ([] if expected is None else [expected])
+
+
def test_the_executor_chain_follows_the_users_order_then_vibeys(tmp_path):
"""MH-HOSTED-001: Sources whose vendor offers the tool, each on its vendor's executor model; a refused pair and
a Claude subscription never are candidates."""
diff --git a/tests/test_provider_overlay.py b/tests/test_provider_overlay.py
index 99d42d92b..0c7805c4d 100644
--- a/tests/test_provider_overlay.py
+++ b/tests/test_provider_overlay.py
@@ -234,7 +234,12 @@ _PRICE = (*_X_SEARCH, "price")
pytest.param("xai", _edit((*_PRICE, "url"), "http://docs.x.ai/developers/pricing"), id="url-not-https"),
pytest.param("xai", _edit((*_PRICE, "url"), _DROP), id="url-missing"),
pytest.param("xai", _edit((*_PRICE, "extra", 0, "unit"), "image"), id="extra-unit-per-image"),
- pytest.param("xai", _edit(("executor_model",), " "), id="executor-model-blank"),
+ pytest.param("xai", _edit(("executor_models", 0), " "), id="executor-model-blank"),
+ pytest.param("xai", _edit(("executor_models",), "grok-4.20-0309-non-reasoning"), id="executor-models-not-a-list"),
+ pytest.param("xai", _edit(("executor_models",), []), id="executor-models-empty"),
+ pytest.param(
+ "xai", _edit(("executor_models",), ["grok-4.20-0309-non-reasoning"] * 2), id="executor-model-repeated",
+ ),
pytest.param("xai", _edit(("image_models",), {}), id="image-models-not-a-list"),
pytest.param("xai", _image_edit(("kinds",), ["oauth"]), id="image-kind-unknown"),
pytest.param("xai", _image_edit(("kinds",), []), id="image-kinds-empty"),
@@ -286,19 +291,20 @@ def test_an_image_model_entry_is_read_in_a_stable_form(monkeypatch, tmp_path):
@pytest.mark.parametrize("vendor", sorted(BUNDLED["providers"]))
-def test_each_vendors_executor_model_runs_every_search_tool_the_vendor_offers(vendor):
+def test_each_vendors_executor_models_run_every_search_tool_the_vendor_offers(vendor):
"""MH-HOSTED-005: an executor model the overlay does not declare a tool on would silently drop the vendor from
- that tool's executor chain."""
+ that tool's executor chain on every Source that lists it first."""
offered = {
(protocol, tool)
for family in catalog.bundled_provider_overlay()[vendor]
for protocol, tools in family.hosted_tools.items()
for tool in tools
}
- executor = catalog.provider_executor_model(vendor)
- assert (executor is not None) is bool(offered)
- for protocol, tool in offered:
- assert catalog.hosted_tool_spec(vendor, protocol, executor, tool) is not None, (protocol, tool)
+ executors = catalog.provider_executor_models(vendor)
+ assert bool(executors) is bool(offered)
+ for executor in executors:
+ for protocol, tool in offered:
+ assert catalog.hosted_tool_spec(vendor, protocol, executor, tool) is not None, (executor, protocol, tool)
@pytest.mark.parametrize("providers", [[], "openai", None])
diff --git a/tests/test_vibey_agent.py b/tests/test_vibey_agent.py
index 6eea03f02..b2dc91eaa 100644
--- a/tests/test_vibey_agent.py
+++ b/tests/test_vibey_agent.py
@@ -3053,7 +3053,7 @@ async def test_a_proxied_call_after_the_turn_moved_to_another_source_runs_on_the
from tests.test_model_hub_hosted_executor import OPENAI, XAI, _served_by_openai, _sources
from tests.test_model_hub_vibey_consumer import _vibey_service
- monkeypatch.setattr(hosted_tools_module, "provider_executor_model", {"openai": "gpt-6-astra"}.get)
+ monkeypatch.setattr(hosted_tools_module, "provider_executor_models", lambda vendor: ("gpt-6-astra",) if vendor == "openai" else ())
service = _vibey_service(tmp_path, _sources(), handles=[_served_by_openai()])
config = service.store.config
config.hosted_tools["web_search"] = ModelHubHostedToolConfig(enabled=True, executor_order=(OPENAI,))
@@ -3186,7 +3186,7 @@ async def test_a_search_its_source_refused_names_that_source_through_the_real_ga
from tests.test_model_hub_hosted_executor import OPENAI, XAI, _served_by_openai, _sources
from tests.test_model_hub_vibey_consumer import _vibey_service
- monkeypatch.setattr(hosted_tools_module, "provider_executor_model", {"openai": "gpt-6-astra"}.get)
+ monkeypatch.setattr(hosted_tools_module, "provider_executor_models", lambda vendor: ("gpt-6-astra",) if vendor == "openai" else ())
service = _vibey_service(tmp_path, _sources(), handles=[_served_by_openai()])
service.store.config.hosted_tools["web_search"] = ModelHubHostedToolConfig(enabled=True, executor_order=(OPENAI,))
xai = next(source for source in service.store.config.sources if source.id == XAI)
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 246897f00..b34f45daa 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -4959,6 +4959,7 @@
"image_argument_invalid": "The image call had an argument it can't send.",
"image_reference_unreadable": "A reference image couldn't be read.",
"provider_refused": "The provider refused the call.",
+ "provider_unavailable": "The provider is unavailable right now. Try again later.",
"provider_timed_out": "The call timed out.",
"provider_unreachable": "Couldn't reach the provider.",
"provider_unreadable": "The provider's response couldn't be read.",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 181f20a62..c73f36529 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -4959,6 +4959,7 @@
"image_argument_invalid": "图片调用的参数无法发送。",
"image_reference_unreadable": "无法读取参考图片。",
"provider_refused": "供应商拒绝了这次调用。",
+ "provider_unavailable": "供应商暂时不可用,请稍后重试。",
"provider_timed_out": "调用超时。",
"provider_unreachable": "无法连接供应商。",
"provider_unreadable": "无法读取供应商的回复。",
diff --git a/vibe/backend_model_catalog.py b/vibe/backend_model_catalog.py
index 09e6832b7..aaf199fd1 100644
--- a/vibe/backend_model_catalog.py
+++ b/vibe/backend_model_catalog.py
@@ -783,10 +783,10 @@ class ProviderModelOverlay:
@dataclass(frozen=True)
class ProviderVendorOverlay:
- """One vendor of the ``providers`` section: its model families, executor model and image models."""
+ """One vendor of the ``providers`` section: its model families, executor models and image models."""
models: tuple[ProviderModelOverlay, ...]
- executor_model: str | None = None
+ executor_models: tuple[str, ...] = ()
image_models: tuple[ImageModelSpec, ...] = ()
@@ -796,11 +796,14 @@ def bundled_provider_overlay() -> Mapping[str, tuple[ProviderModelOverlay, ...]]
return MappingProxyType({vendor: entry.models for vendor, entry in bundled_provider_vendors().items()})
-def provider_executor_model(vendor: str) -> str | None:
- """The vendor's lightweight model that runs proxied search calls (vibey-hosted-tools.md §6)."""
+def provider_executor_models(vendor: str) -> tuple[str, ...]:
+ """The vendor's lightweight models that run proxied search calls, preferred first (vibey-hosted-tools.md §6).
+
+ A Source runs the first of them it lists; each names its dated snapshots too.
+ """
entry = bundled_provider_vendors().get(vendor.strip().lower())
- return entry.executor_model if entry is not None else None
+ return entry.executor_models if entry is not None else ()
def provider_image_models(vendor: str) -> tuple[ImageModelSpec, ...]:
@@ -875,17 +878,22 @@ def _overlay_vendor_id(vendor: str) -> str:
def _overlay_vendor(raw: object) -> ProviderVendorOverlay:
- vendor = _overlay_object(raw, "vendor entry", required=("models",), optional=("executor_model", "image_models"))
+ vendor = _overlay_object(raw, "vendor entry", required=("models",), optional=("executor_models", "image_models"))
models = vendor["models"]
if not isinstance(models, list):
raise ValueError("models must be a list")
image_models = vendor.get("image_models", [])
if not isinstance(image_models, list):
raise ValueError("image_models must be a list")
- executor_model = vendor.get("executor_model")
+ executor_models = vendor.get("executor_models", [])
+ if not isinstance(executor_models, list) or ("executor_models" in vendor and not executor_models):
+ raise ValueError("executor_models must be a non-empty list")
+ executor_ids = tuple(_overlay_token(item, "executor_models") for item in executor_models)
+ if len(set(executor_ids)) != len(executor_ids):
+ raise ValueError("executor_models must not repeat a model")
return ProviderVendorOverlay(
models=tuple(_overlay_model(item) for item in models),
- executor_model=None if executor_model is None else _overlay_token(executor_model, "executor_model"),
+ executor_models=executor_ids,
image_models=tuple(_overlay_image_model(item) for item in image_models),
)
diff --git a/vibe/data/backend_models.json b/vibe/data/backend_models.json
index 9e80174c0..5be21b1e8 100644
--- a/vibe/data/backend_models.json
+++ b/vibe/data/backend_models.json
@@ -49,7 +49,7 @@
},
"providers": {
"anthropic": {
- "executor_model": "claude-haiku-5-5",
+ "executor_models": ["claude-haiku-5-5", "claude-haiku-4-5"],
"models": [
{
"match": {"prefix": "claude-"},
@@ -66,7 +66,7 @@
]
},
"openai": {
- "executor_model": "gpt-6-luna",
+ "executor_models": ["gpt-6-luna", "gpt-5.6-luna"],
"models": [
{
"match": {"prefix": "gpt-"},
@@ -117,7 +117,7 @@
]
},
"xai": {
- "executor_model": "grok-4.20-0309-non-reasoning",
+ "executor_models": ["grok-4.20-0309-non-reasoning"],
"models": [
{
"match": {"prefix": "grok-4"},
diff --git a/vibe/i18n/en.json b/vibe/i18n/en.json
index 51dddb357..7c512b120 100644
--- a/vibe/i18n/en.json
+++ b/vibe/i18n/en.json
@@ -1141,11 +1141,12 @@
},
"hostedTools": {
"noExecutor": {
- "web_search": {"one": "No Source can run web search right now. Add an API key from {vendors}.", "several": "No Source can run web search right now. Add an API key from one of {vendors}."},
- "x_search": {"one": "No Source can run X search right now. Add an API key from {vendors}.", "several": "No Source can run X search right now. Add an API key from one of {vendors}."}
+ "web_search": {"one": "No Source can run web search right now. Add an API key from {vendors} as a Source in Models › Sources & gateway; a key stored in Vaults is not used for this.", "several": "No Source can run web search right now. Add an API key from one of {vendors} as a Source in Models › Sources & gateway; a key stored in Vaults is not used for this."},
+ "x_search": {"one": "No Source can run X search right now. Add an API key from {vendors} as a Source in Models › Sources & gateway; a key stored in Vaults is not used for this.", "several": "No Source can run X search right now. Add an API key from one of {vendors} as a Source in Models › Sources & gateway; a key stored in Vaults is not used for this."}
},
"listSeparator": ", ",
"providerRefused": "The executor's provider refused the call ({detail}).",
+ "providerUnavailable": "The executor's provider is unavailable right now ({detail}). Try again later.",
"timedOut": "The executor call timed out.",
"unreachable": "The executor could not be reached.",
"unreadable": "The executor's response could not be read.",
@@ -1796,6 +1797,7 @@
"image_argument_invalid": "the image call had an argument it can't send",
"image_reference_unreadable": "a reference image couldn't be read",
"provider_refused": "the provider refused the call",
+ "provider_unavailable": "the provider is unavailable right now, try again later",
"provider_timed_out": "the call timed out",
"provider_unreachable": "couldn't reach the provider",
"provider_unreadable": "the provider's response couldn't be read",
diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.json
index bc45f8485..19287c6ad 100644
--- a/vibe/i18n/zh.json
+++ b/vibe/i18n/zh.json
@@ -1141,11 +1141,12 @@
},
"hostedTools": {
"noExecutor": {
- "web_search": {"one": "当前没有能运行网页搜索的供应商。请添加 {vendors} 的 API Key。", "several": "当前没有能运行网页搜索的供应商。请添加 {vendors} 其中一家的 API Key。"},
- "x_search": {"one": "当前没有能运行 X 搜索的供应商。请添加 {vendors} 的 API Key。", "several": "当前没有能运行 X 搜索的供应商。请添加 {vendors} 其中一家的 API Key。"}
+ "web_search": {"one": "当前没有能运行网页搜索的供应商。请在 模型 › 供应商与路由 中把 {vendors} 的 API Key 添加为供应商;存在 Vaults 里的密钥不会用于这里。", "several": "当前没有能运行网页搜索的供应商。请在 模型 › 供应商与路由 中把 {vendors} 其中一家的 API Key 添加为供应商;存在 Vaults 里的密钥不会用于这里。"},
+ "x_search": {"one": "当前没有能运行 X 搜索的供应商。请在 模型 › 供应商与路由 中把 {vendors} 的 API Key 添加为供应商;存在 Vaults 里的密钥不会用于这里。", "several": "当前没有能运行 X 搜索的供应商。请在 模型 › 供应商与路由 中把 {vendors} 其中一家的 API Key 添加为供应商;存在 Vaults 里的密钥不会用于这里。"}
},
"listSeparator": "、",
"providerRefused": "执行方的供应商拒绝了此次调用({detail})。",
+ "providerUnavailable": "执行方的供应商暂时不可用({detail}),请稍后重试。",
"timedOut": "执行方调用超时。",
"unreachable": "无法连接执行方。",
"unreadable": "无法读取执行方的响应。",
@@ -1796,6 +1797,7 @@
"image_argument_invalid": "图片调用的参数无法发送",
"image_reference_unreadable": "无法读取参考图片",
"provider_refused": "供应商拒绝了这次调用",
+ "provider_unavailable": "供应商暂时不可用,请稍后重试",
"provider_timed_out": "调用超时",
"provider_unreachable": "无法连接供应商",
"provider_unreadable": "无法读取供应商的回复",