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.

Vibey: bind encrypted reasoning and other opaque payloads to the Source identity that served them (contract_version 14) (#2626)

Call White1f6322c6a975
diff --git a/core/agent_core/ai/_common.py b/core/agent_core/ai/_common.py
index c782f8ba1..a34703c6a 100644
--- a/core/agent_core/ai/_common.py
+++ b/core/agent_core/ai/_common.py
@@ -73,12 +73,14 @@ class ServedResolution:
"""The response origin, whether its signature data is verified, and its Source.
``source_id`` is the endpoint's own Source in direct mode (``None`` when it names none), and ``None`` for a
- missing or invalid served-hop report.
+ missing or invalid served-hop report. ``source_identity`` is the endpoint's identity when its own Source served
+ the response, else ``None``: the identity of another Source is unknown here.
"""
origin: Origin
verified: bool
source_id: str | None
+ source_identity: str | None = None
ServedHopResolver = Callable[
@@ -206,6 +208,7 @@ class StreamAssembler:
self.usage: Any = None
#: The Source that served the response (the served-hop report): the ``native.source_id`` of its hosted calls.
self.source_id: str | None = None
+ self.source_identity: str | None = None
self._citations: dict[int, list[Citation]] = {}
self._hosted_inputs: dict[Hashable, io.StringIO] = {}
self._hosted_counts: dict[str, int] = {}
@@ -250,15 +253,27 @@ class StreamAssembler:
return self._emitted_output
- def set_origin(self, origin: Origin, verified_origin: bool, source_id: str | None = None) -> None:
+ def set_origin(
+ self,
+ origin: Origin,
+ verified_origin: bool,
+ source_id: str | None = None,
+ source_identity: str | None = None,
+ ) -> None:
if self._continuing:
- # A continued response is one message (§4.3): verified only when every response in it was, from one origin,
- # and its usage is the latest response's, none if that reports none.
- verified_origin = verified_origin and self.verified_origin and origin == self.origin
+ # A continued response is one message (§4.3): verified only when every response in it was, from one origin
+ # and one Source identity, and its usage is the latest response's, none if that reports none.
+ verified_origin = (
+ verified_origin
+ and self.verified_origin
+ and origin == self.origin
+ and source_identity == self.source_identity
+ )
self.usage = None
self.origin = origin
self.verified_origin = verified_origin
self.source_id = source_id
+ self.source_identity = source_identity
def begin_driver(self) -> None:
"""Defer terminal marking while the shared lifecycle driver runs."""
@@ -1110,6 +1125,7 @@ class StreamAssembler:
error_message=error_message,
verified_origin=self.verified_origin,
hosted_summary=self._hosted_summary(final),
+ source_identity=self.source_identity,
)
def pause(self) -> AssistantMessage | ProviderError:
@@ -1133,6 +1149,7 @@ class StreamAssembler:
verified_origin=self.verified_origin,
stop_reason=stop_reason,
hosted_summary=self._hosted_summary(content),
+ source_identity=self.source_identity,
)
def error(
@@ -1510,7 +1527,7 @@ async def resolve_served_origin(
direct = endpoint_origin(endpoint)
if not gateway:
# Without a gateway the endpoint is the served hop, and its Source, when it names one, served the response.
- return ServedResolution(direct, True, endpoint.source_id)
+ return ServedResolution(direct, True, endpoint.source_id, endpoint.source_identity)
candidate = resolver(headers) if resolver is not None else default_served_hop_resolver(headers)
if inspect.isawaitable(candidate):
try:
@@ -1523,7 +1540,8 @@ async def resolve_served_origin(
return None
if served is None:
return ServedResolution(direct, False, None)
- return ServedResolution(served.origin, True, served.source_id)
+ identity = endpoint.source_identity if served.source_id == endpoint.source_id else None
+ return ServedResolution(served.origin, True, served.source_id, identity)
def default_served_hop_resolver(headers: Mapping[str, str]) -> ServedHop | None:
@@ -1631,12 +1649,13 @@ def _pin_unavailable(body: str) -> bool:
def portable_request(request: ModelRequest) -> ModelRequest:
- """The same request in portable form (§3.5): no Source to pin to, and every hosted tool as its function, so it
- carries no native declaration and replays no native payload."""
+ """The same request in portable form (§3.5): never pinned, and every hosted tool as its function, so it carries no
+ native declaration and replays no native payload. The hop's Source and identity stay for attribution: a response
+ that Source serves is still its own, and its opaque payloads are bound to that identity."""
endpoint = request.endpoint
routes = {name: HostedToolRoute("proxy", route.executor, False) for name, route in endpoint.hosted_tools.items()}
- return replace(request, endpoint=replace(endpoint, source_id=None, hosted_tools=routes))
+ return replace(request, endpoint=replace(endpoint, portable=True, hosted_tools=routes))
@dataclass(frozen=True)
@@ -1680,7 +1699,9 @@ def hosted_pin(request: ModelRequest, messages: tuple[Any, ...] = ()) -> dict[st
def replays(message: Any) -> bool:
return isinstance(message, AssistantMessage) and any(isinstance(b, HostedToolBlock) for b in message.content)
- if not native_hosted_tools(request) and not any(replays(message) for message in messages):
+ if request.endpoint.portable or (
+ not native_hosted_tools(request) and not any(replays(message) for message in messages)
+ ):
return {}
if not request.endpoint.source_id:
raise ValueError("native hosted content needs the Source the request is pinned to")
@@ -1850,7 +1871,12 @@ async def drive_sse_stream(
if resolved_origin is None:
candidate = assembler.aborted(cancel.reason)
else:
- assembler.set_origin(resolved_origin.origin, resolved_origin.verified, resolved_origin.source_id)
+ assembler.set_origin(
+ resolved_origin.origin,
+ resolved_origin.verified,
+ resolved_origin.source_id,
+ resolved_origin.source_identity,
+ )
async for item in translate(iter_sse_events(response, cancel, max_line_size=max_line_size)):
if isinstance(item, (Done, ProviderError)):
candidate = item
@@ -2194,6 +2220,7 @@ def assistant_message(
error_message: str | None = None,
verified_origin: bool = True,
hosted_summary: HostedSummary | None = None,
+ source_identity: str | None = None,
) -> AssistantMessage:
if not verified_origin:
sanitized: list[AssistantContent] = []
@@ -2219,6 +2246,8 @@ def assistant_message(
usage=usage,
error_message=error_message,
hosted_summary=hosted_summary,
+ # An unverified origin names no Source its opaque payloads could go back to; it keeps none anyway.
+ source_identity=source_identity if verified_origin else None,
)
@@ -2251,6 +2280,7 @@ def partial_message(
verified_origin: bool = True,
stop_reason: str = "aborted",
hosted_summary: HostedSummary | None = None,
+ source_identity: str | None = None,
) -> AssistantMessage:
if stop_reason in {"aborted", "error"}:
content = [block for block in content if not isinstance(block, ToolCallBlock)]
@@ -2261,6 +2291,7 @@ def partial_message(
usage=usage,
verified_origin=verified_origin,
hosted_summary=hosted_summary,
+ source_identity=source_identity,
)
diff --git a/core/agent_core/ai/provider.py b/core/agent_core/ai/provider.py
index 89647e109..7ea2f1aea 100644
--- a/core/agent_core/ai/provider.py
+++ b/core/agent_core/ai/provider.py
@@ -93,6 +93,12 @@ class ModelEndpoint:
provider: str = ""
#: The hop's Source (``HopResolution.source_id``): the pin of a request that carries native hosted content.
source_id: Optional[str] = None
+ #: That Source's credential-free identity (``HopResolution.source_identity``): the account a response's opaque
+ #: payloads are bound to (``cross-provider.md``).
+ source_identity: Optional[str] = None
+ #: A portable request (§3.5, ``portable_request``): never pinned, and no native hosted content. Its Source and
+ #: identity stay, so a response its own Source serves is still attributed to them.
+ portable: bool = False
#: Each enabled hosted tool's route on this hop, in Model Hub's order; empty when none is enabled.
hosted_tools: Mapping[str, HostedToolRoute] = field(default_factory=dict)
diff --git a/core/agent_core/ai/transform.py b/core/agent_core/ai/transform.py
index d8548c695..1af927df1 100644
--- a/core/agent_core/ai/transform.py
+++ b/core/agent_core/ai/transform.py
@@ -76,8 +76,10 @@ def transform_messages(
) -> TransformResult:
"""Compile canonical history for one target origin.
- The returned map is per request. The transcript is never mutated. ``endpoint`` is the hop the request goes to; a
- response's hosted calls go back verbatim only to the Source that served them (``native_replay``).
+ The returned map is per request. The transcript is never mutated. ``endpoint`` is the hop the request goes to: a
+ response's opaque payloads (signatures, redacted thinking) go back only to a hop of the Source identity that served
+ it, and its hosted calls verbatim only to the Source that served them (``native_replay``). Without an
+ ``endpoint``, the origin alone decides.
"""
target_protocol = protocol or target.api
@@ -123,7 +125,12 @@ def transform_messages(
continue
pending_tool_ids.clear()
- same_origin = message.origin == target
+ # Opaque payloads are bound to the account that issued them, the Source identity: another account's ciphertext
+ # is refused (xAI, OpenAI). A message another identity served, or one no known identity did, is sent as a
+ # different origin's.
+ same_origin = message.origin == target and (
+ endpoint is None or message.source_identity == endpoint.source_identity
+ )
content: list[AssistantContent] = []
turn_tool_ids: dict[str, list[str]] = {}
in_flight = position == live
@@ -264,7 +271,10 @@ def native_replay(
"""
blocks = [block for block in message.content if isinstance(block, HostedToolBlock)]
- if not blocks or endpoint is None or not endpoint.source_id or message.origin != target:
+ if not blocks or endpoint is None or not endpoint.source_id or endpoint.portable or message.origin != target:
+ return False
+ # A native payload is opaque provider content too: it goes back only to the account that issued it.
+ if message.source_identity != endpoint.source_identity:
return False
if protocol not in ("anthropic", "openai_responses"):
return False
diff --git a/core/agent_core/messages.py b/core/agent_core/messages.py
index 0ff8309f6..bbe221cc2 100644
--- a/core/agent_core/messages.py
+++ b/core/agent_core/messages.py
@@ -566,6 +566,10 @@ class AssistantMessage:
usage: Optional[Usage] = None
error_message: Optional[str] = None
hosted_summary: Optional[HostedSummary] = None
+ #: The identity of the Source that served the message (credential, base URL, protocol, vendor, kind,
+ #: credential generation), when known: its opaque payloads go back only to a hop of that identity, since an account
+ #: refuses another's ciphertext (``cross-provider.md``). Credential-free.
+ source_identity: Optional[str] = None
def __post_init__(self) -> None:
_require_blocks(self.content, (TextBlock, ThinkingBlock, ToolCallBlock, HostedToolBlock), "assistant message")
@@ -574,6 +578,7 @@ class AssistantMessage:
_require(self.usage, Usage, "usage", optional=True)
_require(self.error_message, str, "error_message", optional=True)
_require(self.hosted_summary, HostedSummary, "hosted_summary", optional=True)
+ _require_text(self.source_identity, "source_identity", optional=True)
hosted = any(isinstance(block, HostedToolBlock) for block in self.content)
if hosted != (self.hosted_summary is not None):
raise ValueError("a hosted summary is present exactly when the message has hosted tool blocks")
@@ -892,6 +897,7 @@ def message_to_dict(message: Message) -> dict[str, Any]:
if summary.cost is not None:
hosted["cost"] = _cost_to_dict(summary.cost)
out["hosted_summary"] = hosted
+ _put(out, "source_identity", message.source_identity)
return out
if isinstance(message, ToolResultMessage):
result: dict[str, Any] = {
@@ -934,7 +940,7 @@ def message_from_dict(data: Mapping[str, Any]) -> Message:
data,
"assistant message",
{"role": str, "content": list, "origin": dict, "stop_reason": str},
- {"usage": dict, "error_message": str, "hosted_summary": dict},
+ {"usage": dict, "error_message": str, "hosted_summary": dict, "source_identity": str},
)
summary = None
if "hosted_summary" in f:
@@ -951,6 +957,7 @@ def message_from_dict(data: Mapping[str, Any]) -> Message:
usage=usage_from_dict(f["usage"]) if "usage" in f else None,
error_message=f.get("error_message"),
hosted_summary=summary,
+ source_identity=f.get("source_identity"),
)
if role == "tool_result":
f = _read(
diff --git a/core/handlers/model_hub/adapter.py b/core/handlers/model_hub/adapter.py
index 82e66a6e7..c6441e78b 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 v13 (2026-10-14).
+"""Model Hub EngineAdapter interface. FINAL CONTRACT v14 (2026-10-14).
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/provenance.py b/core/handlers/model_hub/provenance.py
index f6e3f8072..5fec0c736 100644
--- a/core/handlers/model_hub/provenance.py
+++ b/core/handlers/model_hub/provenance.py
@@ -73,8 +73,13 @@ class HopOrigin:
api: str
model: str
# The serving Source: two Sources can share an origin. Equality stays the
- # origin's, since opaque payloads are origin-bound, not Source-bound.
+ # origin's; opaque payloads are also bound to the Source's account (C-6 item
+ # 6), which the failover strip compares on its own.
source: str = field(compare=False)
+ # The launch Source's credential-free identity (``identity_digest``), taken
+ # from the snapshot the origin came from. In memory only: never in
+ # ``payload()``, the served-hop header, or persisted provenance.
+ identity: str = field(default="", compare=False, repr=False)
def payload(self) -> dict[str, str]:
return {"provider": self.provider, "api": self.api, "model": self.model}
@@ -770,6 +775,10 @@ class PreparedGatewayRoute:
source_id: str
gateway_request_model_id: str
primary_origin: HopOrigin | None = None
+ # Vibey only: the primary Source's identity at launch. ``HopOrigin`` compares
+ # without it, but a route under another identity is another route, so its
+ # credential carries the launch identity the gateway compares against.
+ primary_identity: str = ""
# Vibey only: the proxy executor bound for each enabled hosted tool, as
# ``HopResolution.hosted_tools`` states it, with the executor Source's
# identity digest at launch: (tool, (source_id, model_id, identity) | None).
@@ -1703,6 +1712,7 @@ class TurnCorrelationRegistry:
source_id=source_id,
gateway_request_model_id=request_model_id,
primary_origin=primary_origin,
+ primary_identity=primary_origin.identity if primary_origin is not None else "",
hosted_executors=hosted_executors,
)
@@ -2702,7 +2712,7 @@ class TurnCorrelationRegistry:
self.store.put(
{
- "contract_version": 13,
+ "contract_version": 14,
"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.py
index 84aa18492..0b2af437f 100644
--- a/core/handlers/model_hub/service.py
+++ b/core/handlers/model_hub/service.py
@@ -240,7 +240,7 @@ from .usage import (
local_usage_day,
)
-CONTRACT_VERSION = 13
+CONTRACT_VERSION = 14
def seeded_source_name(vendor: str) -> str:
@@ -363,8 +363,8 @@ def _described_as_unfit_for_agent_turns(match: Mapping[str, Any]) -> bool:
)
-AGENT_CHAIN_CONTRACT_VERSION = 13
-PROBE_RESULT_CONTRACT_VERSION = 13
+AGENT_CHAIN_CONTRACT_VERSION = 14
+PROBE_RESULT_CONTRACT_VERSION = 14
_SOURCE_DISCOVERY_TIMEOUT_SECONDS = 15
_SOURCE_PROBE_TIMEOUT_SECONDS = 60
# Background inventory refresh. The first tick doubles as the startup delay, so
@@ -1226,7 +1226,7 @@ def _runtime_payload(status: EngineStatus, *, enabled: bool) -> dict:
manager = EngineRuntimeManager()
return {
- "contract_version": 13,
+ "contract_version": 14,
"enabled": enabled,
"host_platform": status.host_platform or manager.host_platform(),
"manifest": manager.contract_manifest(),
@@ -9740,10 +9740,28 @@ class ModelHubService:
origin.response_headers()
except ServedHopHeaderTooLarge:
raise ModelHubError("served_hop_too_large", status=422) from None
- # A pinned request was rendered for its pinned Source and is
- # never rewritten; only an unpinned one is stripped here.
- if pinned_hop is None and getattr(request, "primary_origin", None) != origin:
+ # Opaque payloads are bound to the account that issued them,
+ # the Source identity, not only to the origin (C-6 item 6). The
+ # request was rendered for the launch primary's identity; the
+ # serving one is read on this final snapshot, so a key rotated
+ # while the engine was prepared counts.
+ primary = getattr(request, "primary_origin", None)
+ identity = identity_digest(source)
+ other_account = (
+ primary != origin or primary.source != origin.source or primary.identity != identity
+ )
+ if pinned_hop is None and other_account:
+ # An unpinned request is stripped for any other account.
attempt_request = without_opaque_history(request)
+ elif (
+ other_account
+ and primary is not None
+ and pinned_hop == (primary.source, primary.model)
+ ):
+ # A pinned request is never rewritten: rendered for the
+ # primary's identity, it cannot go to the primary under
+ # another, so Vibey renders it again portably.
+ raise _pin_unavailable()
# Hosted content is admitted on this final snapshot, so evidence
# or a Source that changed while the engine was prepared counts.
if hosted and not self._admits_hosted(hosted, source, model_id):
@@ -9752,7 +9770,7 @@ class ModelHubService:
# claim is made here, under the exclusion this call is admitted in,
# so no concurrent request or config change slips between them.
claim = getattr(request, "pin_identity_claim", None)
- if hosted and (claim is None or not claim(identity_digest(source), bool(hosted.in_flight))):
+ if hosted and (claim is None or not claim(identity, bool(hosted.in_flight))):
raise _pin_unavailable()
if self._engine_synced:
if recovery_request is not None and recovery_request.expired:
diff --git a/docs/plans/agent-core-contracts/cross-provider.md b/docs/plans/agent-core-contracts/cross-provider.md
index b92c591f9..d5be59b5c 100644
--- a/docs/plans/agent-core-contracts/cross-provider.md
+++ b/docs/plans/agent-core-contracts/cross-provider.md
@@ -21,6 +21,14 @@ Invariants:
- "Opaque provider payload" means any `signature` field on any block, and any redacted thinking. Every rule here
about signatures applies to all of them. A signature is never synthesized and never sent to a different origin.
+- Opaque payloads are also bound to the account that issued them, the identity of the Source that served the message
+ (`AssistantMessage.source_identity`, from HopResolution `source_identity`), because a provider refuses another
+ account's ciphertext (OpenAI and xAI encrypted reasoning). When the request names its hop (`endpoint`), a message
+ takes the "same origin" column only if its origin equals the target's **and** its `source_identity` equals the
+ hop's. A message another identity served (another Source, or the same Source after its key or relay changed), or
+ one no known identity served (after a failover to another Source, or a row written before the field), takes the
+ "different origin" column at a hop that names an identity. The gateway applies the same binding at failover
+ (C-6 item 6).
- Tool-call id normalization is deterministic: the stored id when the target accepts it; otherwise
`call_` + the first 24 hex characters of SHA-256 of the stored id. Anthropic accepts `^[a-zA-Z0-9_-]{1,64}$`; the
other protocols' limits are recorded in the `ai` lane's conversion tables. The map is computed per request; the
diff --git a/docs/plans/agent-core-contracts/hop-resolution.schema.json b/docs/plans/agent-core-contracts/hop-resolution.schema.json
index c578607d2..9f4887468 100644
--- a/docs/plans/agent-core-contracts/hop-resolution.schema.json
+++ b/docs/plans/agent-core-contracts/hop-resolution.schema.json
@@ -12,6 +12,7 @@
"token",
"runtime_model",
"source_id",
+ "source_identity",
"provider",
"capabilities",
"request_headers",
@@ -45,6 +46,11 @@
"source_id": {
"type": "string"
},
+ "source_identity": {
+ "type": "string",
+ "minLength": 1,
+ "description": "The primary hop Source's credential-free identity (`identity_digest`), from the snapshot its origin came from. The agent records it on each response its own Source served and replays opaque payloads only to a hop of the same identity (C-1, cross-provider.md)."
+ },
"provider": {
"type": "string",
"description": "Vendor identity of the primary hop; becomes `origin.provider` unless the served-hop report differs."
@@ -338,6 +344,7 @@
"token": "<in-memory>",
"runtime_model": "claude-opus-5-5",
"source_id": "src_anthropic_main",
+ "source_identity": "sha256:9f2c4e1a7b3d5c6e8f0a1b2c3d4e5f60718293a4b5c6d7e8f9a0b1c2d3e4f5a6",
"provider": "anthropic",
"request_headers": {},
"capabilities": {
diff --git a/docs/plans/agent-core-contracts/message.schema.json b/docs/plans/agent-core-contracts/message.schema.json
index 38eef516d..f09d8ce48 100644
--- a/docs/plans/agent-core-contracts/message.schema.json
+++ b/docs/plans/agent-core-contracts/message.schema.json
@@ -353,6 +353,11 @@
},
"hosted_summary": {
"$ref": "#/definitions/HostedSummary"
+ },
+ "source_identity": {
+ "type": "string",
+ "minLength": 1,
+ "description": "The credential-free identity of the Source that served the message (HopResolution `source_identity`), when known: recorded when the served-hop report names the hop's own Source. Its opaque payloads go back only to a hop of the same identity (`cross-provider.md`). Absent when unknown, as after a failover to another Source or for a message written before this field: its opaque payloads then go back only to a hop that names no identity either."
}
},
"if": {
diff --git a/docs/plans/agent-core-contracts/model-hub-consumer.md b/docs/plans/agent-core-contracts/model-hub-consumer.md
index 2c96e8219..2dace5460 100644
--- a/docs/plans/agent-core-contracts/model-hub-consumer.md
+++ b/docs/plans/agent-core-contracts/model-hub-consumer.md
@@ -25,6 +25,17 @@ consumer's requirements, and the Model Hub lane lands the change in both places.
retryable error.
- `request_headers` carries `x-avibe-turn-id`, the Turn the resolution was made for, and the agent sends it on
every gateway request: model calls and proxied hosted calls.
+ - `source_identity` is the primary hop Source's credential-free identity (`identity_digest`: kind, vendor,
+ protocol, supply channel, base URL, credential reference, credential generation), taken from the snapshot its origin
+ came from. The agent records it on each response its own Source served (C-1 `AssistantMessage.source_identity`)
+ and replays opaque payloads only to a hop of the same identity (`cross-provider.md`). Its inputs are therefore
+ a persisted comparison key: changing them later sends every stored message once in the different-origin form,
+ which is safe degradation and needs no migration, but should be deliberate.
+ - The agent infers the serving identity from the launch's: the served-hop report names the Source, never its
+ identity. A key changed between resolution and admission therefore labels the response with the launch
+ identity, although the new account served it. That label errs only toward dropping: an identity never recurs
+ after a credential change, so it matches no later hop, and the response's payloads go once in the
+ different-origin form. They never go to another account.
- The token answers for the route, which later Turns of the Session reuse. The gateway credits a request only
to the Turn it names, and only while that Turn holds the token's route and still admits work.
- A model request from a finished Turn still routes but is credited to no Turn. A hosted call from one is
@@ -40,8 +51,13 @@ consumer's requirements, and the Model Hub lane lands the change in both places.
another protocol, the gateway converts (degraded, not broken) and the served-hop report says so.
6. **No opaque payload crosses origins at failover.** The agent builds the request for the primary hop's origin, so it
may carry that origin's opaque payloads (C-1: any block's signature, redacted thinking). When the gateway fails
- over to a hop whose origin `(provider, api, model)` differs from the primary's, it removes every such payload
- before sending, applying the same rule as `cross-provider.md`, whether or not it converts protocols. Known limit:
+ over to a hop whose origin `(provider, api, model)`, Source, or Source identity differs from the primary's, it
+ removes every such payload before sending, applying the same rule as `cross-provider.md`, whether or not it
+ converts protocols. Opaque payloads are bound to the account that issued them, the Source identity, as well as
+ the origin: a provider refuses another account's ciphertext. The serving identity is read on the final admission
+ snapshot, so a key rotated mid-turn counts. A pinned request is never rewritten: one pinned to the primary hop
+ whose identity has changed since the launch answers `pin_unavailable`, and the agent renders it again portably.
+ The identity stays in memory: it is never in the served-hop report or persisted provenance. Known limit:
the next request targets the primary origin again, so payloads returned by a fallback origin are not replayed if a
later request fails over to that same fallback; a provider that then rejects the call surfaces as a provider error.
diff --git a/docs/plans/model-hub-contracts/README.md b/docs/plans/model-hub-contracts/README.md
index 4b66cc571..fa6ff5d43 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 13**, 2026-10-14: publishes the hosted-tools Phase 1 additions
+Status: **contract_version 14**, 2026-10-14: opaque history is bound to the account that issued it, the Source
+identity, not only to the origin (#2620): a provider refuses another account's encrypted reasoning.
+- `HopResolution.source_identity` (`hop-resolution.schema.json`) names the primary hop Source's credential-free
+ identity, which Vibey records on each response its own Source served and matches before replaying opaque payloads.
+- The gateway strips an unpinned request's opaque history for another origin, Source, or Source identity, read on the
+ final admission snapshot. A request pinned to the primary hop whose identity changed since the launch answers
+ `pin_unavailable` (`vibey-consumer.md`). The identity stays in memory: never in the served-hop header or provenance.
+- `source.schema.json` gains the optional `credential_generation`; Source identity follows it instead of
+ `verification_pending`, so verification changes no identity and an identity never reverts after a credential
+ change.
+
+It builds on v13 (2026-10-14), which published the hosted-tools Phase 1 additions
(`../vibey-hosted-tools.md`) as one version event:
- the capability evidence the engine's 400s teach (`UpstreamRejection` in `adapter-interface.py`) and refused efforts,
on agent-chain hops and Source models, with when they change (`changes_at`);
@@ -195,7 +206,7 @@ comparison. A gate may not report success by comparing stale input with itself.
## Version closure
-`contract_version` 13 must coexist in all registered version locations on the same tested head:
+`contract_version` 14 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.py
index 82e66a6e7..c6441e78b 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 v13 (2026-10-14).
+"""Model Hub EngineAdapter interface. FINAL CONTRACT v14 (2026-10-14).
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.json
index 8183a556a..3fbeb36fe 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": 13 },
+ "contract_version": { "const": 14 },
"backend": { "enum": ["claude", "codex", "opencode", "vibey"] },
"model_id": { "type": "string" },
"manual_override": {
@@ -254,7 +254,7 @@
],
"examples": [
{
- "contract_version": 13,
+ "contract_version": 14,
"backend": "codex",
"model_id": "unlisted-model",
"manual_override": null,
@@ -264,7 +264,7 @@
"supply_state": "ok"
},
{
- "contract_version": 13,
+ "contract_version": 14,
"backend": "codex",
"model_id": "gpt-5.6",
"manual_override": null,
@@ -274,7 +274,7 @@
"supply_state": "ok"
},
{
- "contract_version": 13,
+ "contract_version": 14,
"backend": "claude",
"model_id": "claude-opus-4-6",
"manual_override": null,
@@ -284,7 +284,7 @@
"supply_state": "waiting"
},
{
- "contract_version": 13,
+ "contract_version": 14,
"backend": "opencode",
"model_id": "glm-5.2",
"manual_override": { "hops": [{ "source_id": "src_relay9c1x", "model_id": "glm-5.2" }] },
@@ -294,7 +294,7 @@
"supply_state": "waiting"
},
{
- "contract_version": 13,
+ "contract_version": 14,
"backend": "codex",
"model_id": "gpt-5.6",
"manual_override": null,
@@ -304,7 +304,7 @@
"supply_state": "interrupted"
},
{
- "contract_version": 13,
+ "contract_version": 14,
"backend": "codex",
"model_id": "gpt-5.6",
"manual_override": null,
@@ -314,7 +314,7 @@
"supply_state": "interrupted"
},
{
- "contract_version": 13,
+ "contract_version": 14,
"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.json
index d2038a6fc..25299822b 100644
--- a/docs/plans/model-hub-contracts/api-response.schema.json
+++ b/docs/plans/model-hub-contracts/api-response.schema.json
@@ -59,7 +59,7 @@
"required": ["ok", "contract_version", "probe"],
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"probe": {"$ref": "model-hub/source-probe-result.schema.json"}
}
},
@@ -158,7 +158,7 @@
"SuccessCore": {
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13}
+ "contract_version": {"const": 14}
}
},
"SourceListResponse": {
@@ -167,7 +167,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"sources": {"type": "array", "items": {"$ref": "#/definitions/SourceApi"}}
}
},
@@ -177,7 +177,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"observation": {"$ref": "model-hub/observation-result.schema.json"}
}
},
@@ -187,7 +187,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"source": {"$ref": "#/definitions/SourceApi"},
"added_to": {"type": "array", "items": {"$ref": "#/definitions/AddedTo"}},
"adopted_by": {"type": "array", "items": {"$ref": "#/definitions/AdoptedBy"}, "uniqueItems": true}
@@ -199,7 +199,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"source": {"$ref": "#/definitions/SourceApi"}
}
},
@@ -209,7 +209,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"source": {"$ref": "#/definitions/SourceApi"},
"removed_hops": {"type": "array", "items": {"$ref": "#/definitions/RouteHopRef"}},
"interrupted": {"type": "array", "items": {"$ref": "#/definitions/SupplyGap"}}
@@ -221,7 +221,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"removed_hops": {"type": "array", "items": {"$ref": "#/definitions/RouteHopRef"}},
"interrupted": {"type": "array", "items": {"$ref": "#/definitions/SupplyGap"}}
}
@@ -232,7 +232,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"agents": {"type": "array", "items": {"$ref": "#/definitions/AgentSupplyApi"}}
}
},
@@ -242,7 +242,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"agent": {"$ref": "#/definitions/AgentSupplyApi"}
}
},
@@ -259,7 +259,7 @@
],
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"agent": {"$ref": "#/definitions/AgentSupplyApi"},
"removed_hops": {"type": "array", "items": {"$ref": "#/definitions/RouteHopRef"}, "uniqueItems": true},
"interrupted": {"type": "array", "items": {"$ref": "#/definitions/SupplyGap"}, "uniqueItems": true}
@@ -284,7 +284,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": false},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"error": {"const": "candidate_suppliers_changed"},
"detail": {"type": "string", "minLength": 1},
"changed": {
@@ -304,7 +304,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"agent": {
"type": "object",
"required": ["backend", "mode", "catalog_models"],
@@ -405,7 +405,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"candidates": {
"type": "object",
"required": ["builtin", "providers", "in_list"],
@@ -424,7 +424,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"matches": {
"type": "array",
"maxItems": 8,
@@ -458,7 +458,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"chain": {"$ref": "model-hub/agent-chain.schema.json"}
}
},
@@ -468,7 +468,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"chains": {"type": "array", "items": {"$ref": "model-hub/agent-chain.schema.json"}}
}
},
@@ -478,7 +478,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"chain": {"$ref": "model-hub/agent-chain.schema.json"},
"removed_hops": {"type": "array", "items": {"$ref": "#/definitions/RouteHopRef"}},
"interrupted": {"type": "array", "items": {"$ref": "#/definitions/SupplyGap"}}
@@ -490,7 +490,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"probe": {"$ref": "model-hub/probe-result.schema.json"}
}
},
@@ -500,7 +500,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"events": {"type": "array", "items": {"$ref": "model-hub/resolution-event.schema.json"}}
}
},
@@ -510,7 +510,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"usage": {"$ref": "model-hub/usage-summary.schema.json"}
}
},
@@ -520,7 +520,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"quota": {"$ref": "model-hub/quota-summary.schema.json"}
}
},
@@ -530,7 +530,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"hosted_tools": {"$ref": "model-hub/hosted-tools-status.schema.json"}
}
},
@@ -540,7 +540,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"probe": {"$ref": "model-hub/hosted-tool-probe-result.schema.json"},
"hosted_tools": {"$ref": "model-hub/hosted-tools-status.schema.json"}
}
@@ -551,7 +551,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"flow": {
"allOf": [
{"$ref": "model-hub/oauth-flow.schema.json"},
@@ -573,7 +573,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"flow": {
"allOf": [
{"$ref": "model-hub/oauth-flow.schema.json"},
@@ -596,7 +596,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"flow": {
"allOf": [
{"$ref": "model-hub/oauth-flow.schema.json"},
@@ -621,7 +621,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13}
+ "contract_version": {"const": 14}
}
},
"RuntimeApi": {
@@ -643,7 +643,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"scan": {"$ref": "model-hub/migration-scan.schema.json"}
}
},
@@ -653,7 +653,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"applied": {"type": "integer", "minimum": 0},
"sources": {"type": "array", "items": {"$ref": "#/definitions/SourceApi"}},
"added_to": {"type": "array", "items": {"$ref": "#/definitions/AddedTo"}}
@@ -665,7 +665,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"provenance": {"$ref": "model-hub/turn-provenance.schema.json"}
}
},
@@ -676,7 +676,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"provenance": {
"anyOf": [
{"$ref": "model-hub/turn-provenance.schema.json"},
@@ -691,7 +691,7 @@
"additionalProperties": false,
"properties": {
"ok": {"const": true},
- "contract_version": {"const": 13},
+ "contract_version": {"const": 14},
"runtime": {"$ref": "#/definitions/RuntimeApi"}
}
}
diff --git a/docs/plans/model-hub-contracts/api.md b/docs/plans/model-hub-contracts/api.md
index 6d8deb9a6..8662070a4 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; unknown
API siblings retain the Owner default.
-Status: **Normative, `contract_version` 13** — 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` 14** — 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: 13, ...}`.
+Success envelope: `{ok: true, contract_version: 14, ...}`.
Failure envelope:
-`{ok: false, contract_version: 13, error: <machine_code>, detail?: <i18n_key>}`.
+`{ok: false, contract_version: 14, 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, requir
exercised HTTP response for every registry entry, and validates that response against
the route's named schema.
-The shared envelope and every versioned nested contract carry `contract_version` 13, the
+The shared envelope and every versioned nested contract carry `contract_version` 14, the
terminal value. Supported persisted config shapes and historical TurnProvenance
remain readable; ephemeral envelopes use only the terminal version.
@@ -81,7 +81,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` 13 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` 14 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. |
@@ -639,7 +639,7 @@ The terminal result of both ordinary API-key creation and OAuth creation is:
```json
{
"ok": true,
- "contract_version": 13,
+ "contract_version": 14,
"source": {
"id": "src_anthkey01",
"kind": "api_key",
@@ -749,7 +749,7 @@ Every guarded Source/inventory mutation uses the §4.5 envelope matrix and the c
```json
{
"ok": false,
- "contract_version": 13,
+ "contract_version": 14,
"error": "source_last_supplier",
"would_remove_hops": [],
"would_interrupt": [
@@ -885,7 +885,7 @@ API-key success:
```json
{
"ok": true,
- "contract_version": 13,
+ "contract_version": 14,
"source": {
"id": "src_relay9c1x",
"kind": "api_key",
@@ -976,7 +976,7 @@ Status and submit return the same terminal shape:
```json
{
"ok": true,
- "contract_version": 13,
+ "contract_version": 14,
"flow": {
"flow_id": "oaf_claude01",
"client_nonce": "ofn_01j5w8z7p4n6q2rt",
@@ -1049,9 +1049,9 @@ a valid `interrupted` chain.
```json
{
"ok": true,
- "contract_version": 13,
+ "contract_version": 14,
"chain": {
- "contract_version": 13,
+ "contract_version": 14,
"backend": "codex",
"model_id": "gpt-5.6",
"manual_override": null,
@@ -1078,7 +1078,7 @@ In Direct mode both chain and probe refuse with:
```json
{
"ok": false,
- "contract_version": 13,
+ "contract_version": 14,
"error": "direct_mode",
"detail": "models.hub.direct_mode"
}
@@ -1092,9 +1092,9 @@ A successful probe nests its result:
```json
{
"ok": true,
- "contract_version": 13,
+ "contract_version": 14,
"probe": {
- "contract_version": 13,
+ "contract_version": 14,
"backend": "claude",
"channel": "hub",
"reachable": false,
@@ -1117,7 +1117,7 @@ not-ready carries the closed i18n key `models.probe.native_cli_unavailable`.
```json
{
- "contract_version": 13,
+ "contract_version": 14,
"backend": "codex",
"channel": "native_cli",
"reachable": true,
@@ -1130,7 +1130,7 @@ not-ready carries the closed i18n key `models.probe.native_cli_unavailable`.
```json
{
- "contract_version": 13,
+ "contract_version": 14,
"backend": "codex",
"channel": "native_cli",
"reachable": false,
@@ -1146,7 +1146,7 @@ No candidate is an API error with a typed model-scoped state:
```json
{
"ok": false,
- "contract_version": 13,
+ "contract_version": 14,
"error": "probe_no_candidate",
"detail": "models.probe.no_candidate.waiting",
"supply": {
@@ -1337,7 +1337,7 @@ The store retains at most 500 exactly attributed settled turns with its existing
writes. Ambiguous attribution remains excluded; this is not a log of every upstream
request. 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: 13, provenance: TurnProvenance | null}`;
+Success uses exactly `{ok: true, contract_version: 14, provenance: TurnProvenance | null}`;
there is no `success` field or envelope exception.
Local `engine_down` records may also contain `local_error_detail`, an OS-generated
@@ -1431,7 +1431,7 @@ ambiguous absence are explicit and distinguishable from an unknown turn:
```json
{
"ok": false,
- "contract_version": 13,
+ "contract_version": 14,
"error": "provenance_unavailable",
"detail": "models.provenance.direct_mode"
}
@@ -1440,7 +1440,7 @@ ambiguous absence are explicit and distinguishable from an unknown turn:
```json
{
"ok": false,
- "contract_version": 13,
+ "contract_version": 14,
"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.json
index 8c3e770de..06682d181 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": 13 },
+ "contract_version": { "const": 14 },
"error": {
"enum": [
"source_last_supplier",
@@ -116,7 +116,7 @@
"examples": [
{
"ok": false,
- "contract_version": 13,
+ "contract_version": 14,
"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/hop-resolution.schema.json b/docs/plans/model-hub-contracts/hop-resolution.schema.json
index 0550b301e..31eef3506 100644
--- a/docs/plans/model-hub-contracts/hop-resolution.schema.json
+++ b/docs/plans/model-hub-contracts/hop-resolution.schema.json
@@ -4,7 +4,7 @@
"title": "HopResolution",
"description": "C-6 runtime consumer projection of ModelHubLaunch. Unknown planning metadata remains null; credentials are in-memory only.",
"type": "object",
- "required": ["backend", "requested_model", "protocol", "base_url", "token", "runtime_model", "source_id", "provider", "request_headers", "capabilities", "hosted_tools"],
+ "required": ["backend", "requested_model", "protocol", "base_url", "token", "runtime_model", "source_id", "source_identity", "provider", "request_headers", "capabilities", "hosted_tools"],
"additionalProperties": false,
"properties": {
"backend": { "const": "vibey" },
@@ -14,6 +14,11 @@
"token": { "type": "string" },
"runtime_model": { "type": "string" },
"source_id": { "type": "string" },
+ "source_identity": {
+ "type": "string",
+ "minLength": 1,
+ "description": "The primary hop Source's credential-free identity (identity_digest), from the snapshot its origin came from. The consumer replays opaque payloads only to a hop of the identity that served them."
+ },
"provider": { "type": "string" },
"request_headers": { "type": "object", "additionalProperties": { "type": "string" } },
"capabilities": {
diff --git a/docs/plans/model-hub-contracts/mirror-registry.json b/docs/plans/model-hub-contracts/mirror-registry.json
index cfd2f9d6c..93c014a8c 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": 13,
+ "contract_version": 14,
"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.json
index e95de248e..fa13cb029 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": 13 },
+ "contract_version": { "const": 14 },
"outcome": {
"enum": [
"observed",
@@ -150,7 +150,7 @@
],
"examples": [
{
- "contract_version": 13,
+ "contract_version": 14,
"outcome": "observed",
"reachable": true,
"authenticated": "authenticated",
@@ -165,7 +165,7 @@
]
},
{
- "contract_version": 13,
+ "contract_version": 14,
"outcome": "authentication_failed",
"reachable": true,
"authenticated": "rejected",
@@ -175,7 +175,7 @@
"model_metadata": []
},
{
- "contract_version": 13,
+ "contract_version": 14,
"outcome": "ambiguous",
"reachable": true,
"authenticated": "unknown",
@@ -185,7 +185,7 @@
"model_metadata": []
},
{
- "contract_version": 13,
+ "contract_version": 14,
"outcome": "unreachable",
"reachable": false,
"authenticated": "unknown",
@@ -195,7 +195,7 @@
"model_metadata": []
},
{
- "contract_version": 13,
+ "contract_version": 14,
"outcome": "adapter_error",
"reachable": null,
"authenticated": "unknown",
@@ -205,7 +205,7 @@
"model_metadata": []
},
{
- "contract_version": 13,
+ "contract_version": 14,
"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.json
index c9b16bda1..525ef4bf6 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": 13 },
+ "contract_version": { "const": 14 },
"backend": { "enum": ["claude", "codex", "opencode", "vibey"] },
"channel": { "enum": ["hub", "native_cli"] },
"reachable": { "type": "boolean" },
@@ -66,10 +66,10 @@
}
],
"examples": [
- { "contract_version": 13, "backend": "codex", "channel": "hub", "reachable": true, "source_id": "src_chatgptplus", "model_id": "gpt-5.6", "latency_ms": 412, "error": null },
- { "contract_version": 13, "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": 13, "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": 13, "backend": "codex", "channel": "native_cli", "reachable": true, "source_id": "src_chatgptplus", "model_id": "gpt-5.6", "latency_ms": null, "error": null },
- { "contract_version": 13, "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": 14, "backend": "codex", "channel": "hub", "reachable": true, "source_id": "src_chatgptplus", "model_id": "gpt-5.6", "latency_ms": 412, "error": null },
+ { "contract_version": 14, "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": 14, "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": 14, "backend": "codex", "channel": "native_cli", "reachable": true, "source_id": "src_chatgptplus", "model_id": "gpt-5.6", "latency_ms": null, "error": null },
+ { "contract_version": 14, "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.json
index b9957c9e2..0c0eff09b 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": 13 },
+ "contract_version": { "const": 14 },
"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": 13,
+ "contract_version": 14,
"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.json
index 994dc61ca..5b8388c40 100644
--- a/docs/plans/model-hub-contracts/turn-provenance.schema.json
+++ b/docs/plans/model-hub-contracts/turn-provenance.schema.json
@@ -36,7 +36,7 @@
"additionalProperties": false,
"properties": {
"contract_version": {
- "enum": [5, 6, 7, 8, 9, 10, 11, 12, 13],
+ "enum": [5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
"$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."
},
@@ -478,7 +478,7 @@
],
"examples": [
{
- "contract_version": 13,
+ "contract_version": 14,
"turn_id": "turn_01k9x2m4",
"ts": "2026-07-29T06:32:11Z",
"agent": "claude",
@@ -503,7 +503,7 @@
"blockers": []
},
{
- "contract_version": 13,
+ "contract_version": 14,
"turn_id": "turn_01k9x33p",
"ts": "2026-07-29T06:41:02Z",
"agent": "opencode",
@@ -524,7 +524,7 @@
"blockers": []
},
{
- "contract_version": 13,
+ "contract_version": 14,
"turn_id": "turn_01k9x3zq",
"ts": "2026-07-29T06:48:20Z",
"agent": "codex",
@@ -544,7 +544,7 @@
]
},
{
- "contract_version": 13,
+ "contract_version": 14,
"turn_id": "turn_01k9x4b7",
"ts": "2026-07-29T07:02:44Z",
"agent": "claude",
@@ -564,7 +564,7 @@
"blockers": []
},
{
- "contract_version": 13,
+ "contract_version": 14,
"turn_id": "turn_modelmissing01",
"ts": "2026-09-05T17:31:10Z",
"agent": "claude",
@@ -586,7 +586,7 @@
"blockers": []
},
{
- "contract_version": 13,
+ "contract_version": 14,
"turn_id": "turn_01k9x5ca",
"ts": "2026-07-29T07:08:00Z",
"agent": "codex",
diff --git a/docs/plans/model-hub-contracts/vibey-consumer.md b/docs/plans/model-hub-contracts/vibey-consumer.md
index 46907ecfa..0ac4c9471 100644
--- a/docs/plans/model-hub-contracts/vibey-consumer.md
+++ b/docs/plans/model-hub-contracts/vibey-consumer.md
@@ -102,8 +102,14 @@ travels as in-memory request metadata, never as upstream JSON or a caller-suppli
header. Each revalidated Vibey attempt compares its admitted origin against that
original primary, including fallback, credential refresh, and recovery walks.
-If any origin component differs, or the primary origin cannot be verified, the
-gateway strips opaque history **before engine invocation and protocol conversion**:
+If any origin component differs, the serving Source or its identity differs
+from the primary's, or the primary origin cannot be verified, the gateway strips
+opaque history **before engine invocation and protocol conversion**. Opaque
+payloads are bound to the account that issued them: a provider refuses another
+account's ciphertext. The serving identity (`identity_digest`) is read on the
+final admission snapshot, so a key rotated while the engine was prepared counts.
+The launch identity rides only on the in-memory primary origin, never in the
+served-hop header, `HopOrigin.payload()`, or persisted provenance.
- Block `signature`, `thoughtSignature`, `thought_signature`, and encrypted
reasoning payloads are removed, including protocol-owned tool-call extensions.
@@ -113,10 +119,13 @@ gateway strips opaque history **before engine invocation and protocol conversion
- Tool ids, arguments, results, and unrelated request options remain unchanged.
A tool argument named `signature` is user data, not protocol metadata.
-Same-origin fallback, even on another Source, retains the original history. Each
-attempt gets its own cleaned history; cleaning never mutates the original request
-that a later same-origin attempt might reuse. Native callers retain their existing
-history behavior.
+A retry on the primary Source under its launch identity retains the original
+history; a fallback to another Source of the same origin does not. A pinned
+request is never rewritten: one pinned to the primary hop whose identity changed
+since the launch answers `pin_unavailable`, and Vibey renders it again
+portably. Each attempt gets its own cleaned history; cleaning never mutates the
+original request that a later attempt might reuse. Native callers retain their
+existing history behavior.
After a request completes, the consumer may resolve the **same catalog alias and
turn** again to obtain a different primary hop. The existing turn keeps its attempt
diff --git a/modules/agents/model_hub.py b/modules/agents/model_hub.py
index a40aa1629..2e03d65f9 100644
--- a/modules/agents/model_hub.py
+++ b/modules/agents/model_hub.py
@@ -191,13 +191,15 @@ class ModelHubLaunch:
supports_images: Optional[bool] = None
# Vibey only: each enabled hosted tool's mode, declaration, executor and replay.
hosted_tools: Mapping[str, Mapping[str, Any]] = field(default_factory=dict)
+ # Vibey only: the Source's credential-free identity, from the snapshot its origin came from (C-6).
+ source_identity: Optional[str] = None
def to_hop_resolution(self) -> dict[str, Any]:
"""Project C-6 from the same launch that owns routing and credentials."""
if (
self.backend != "vibey" or self.channel != "hub"
- or not self.protocol or not self.provider or not self.source_id
+ or not self.protocol or not self.provider or not self.source_id or not self.source_identity
or not self.gateway_base_url or not self.gateway_token
):
raise ModelHubError("mapping_target_unavailable", status=409)
@@ -209,6 +211,7 @@ class ModelHubLaunch:
"token": self.gateway_token,
"runtime_model": self.runtime_model,
"source_id": self.source_id,
+ "source_identity": self.source_identity,
"provider": self.provider,
"request_headers": dict(self.gateway_request_metadata),
"capabilities": {
@@ -1336,6 +1339,7 @@ class ModelHubRuntimeRouter:
if self.turn_gateway is not None and backend == "codex"
else target_model
)
+ identity = identity_digest(source) if backend == "vibey" else None
# A turn's first resolution binds its hosted tools and executors;
# later attempts of the turn keep that binding (settings apply from
# the next turn) and recompute only what belongs to their hop.
@@ -1363,9 +1367,10 @@ class ModelHubRuntimeRouter:
source_id=source.id,
via_mapping=False,
gateway_request_model_id=runtime_model,
+ # The origin and the identity come from one snapshot of the Source.
primary_origin=(
- HopOrigin(source.vendor, source.protocol, target_model, source.id)
- if backend == "vibey" else None
+ HopOrigin(source.vendor, source.protocol, target_model, source.id, identity)
+ if identity is not None else None
),
# The proxy endpoint runs only the executor this launch bound per
# tool, and only while its Source keeps the identity it had now.
@@ -1413,6 +1418,7 @@ class ModelHubRuntimeRouter:
else None
),
hosted_tools=hosted_tools,
+ source_identity=identity,
)
self._emit_transition(launch, config)
return launch
diff --git a/modules/agents/vibey/models.py b/modules/agents/vibey/models.py
index 27676ecba..cb9fc6895 100644
--- a/modules/agents/vibey/models.py
+++ b/modules/agents/vibey/models.py
@@ -119,7 +119,7 @@ def selection_from_hop(hop: Mapping[str, Any], *, gateway_base_url: Optional[str
protocol = hop.get("protocol")
if protocol not in PROTOCOLS:
raise HopResolutionError(f"hop protocol {protocol!r} is not supported")
- for name in ("base_url", "token", "runtime_model", "provider", "source_id"):
+ for name in ("base_url", "token", "runtime_model", "provider", "source_id", "source_identity"):
if not isinstance(hop.get(name), str) or not hop[name]:
raise HopResolutionError(f"hop has no {name}")
headers = hop.get("request_headers")
@@ -156,6 +156,7 @@ def selection_from_hop(hop: Mapping[str, Any], *, gateway_base_url: Optional[str
request_headers=dict(headers),
provider=hop["provider"],
source_id=hop["source_id"],
+ source_identity=hop["source_identity"],
hosted_tools=hosted_tools,
)
return ModelSelection(endpoint=endpoint, capabilities=capabilities)
diff --git a/tests/agent_core/ai/test_hosted_replay.py b/tests/agent_core/ai/test_hosted_replay.py
index ac6beab15..20e932bdf 100644
--- a/tests/agent_core/ai/test_hosted_replay.py
+++ b/tests/agent_core/ai/test_hosted_replay.py
@@ -37,6 +37,7 @@ from core.agent_core.tools.hosted import hosted_tool_spec
SOURCE = "src_served00001"
OTHER = "src_other000001"
+IDENTITY = "sha256:served-account"
WEB = hosted_tool_spec("web_search")
CALL_ITEM = {
"id": "ws_1",
@@ -73,11 +74,14 @@ def _endpoint(protocol: str, *, replay: bool, native: bool = True, source_id: st
"hub-token",
provider=provider,
source_id=source_id,
+ source_identity=IDENTITY,
hosted_tools={"web_search": route},
)
-def _searched(protocol: str, *, served_by: str = SOURCE, stop_reason: str = "stop", extra=()) -> AssistantMessage:
+def _searched(
+ protocol: str, *, served_by: str = SOURCE, stop_reason: str = "stop", extra=(), identity: str = IDENTITY
+) -> AssistantMessage:
provider, model = MODELS[protocol]
call = HostedToolBlock(
id="ws_1" if protocol == "openai_responses" else "srvtoolu_1",
@@ -87,7 +91,11 @@ def _searched(protocol: str, *, served_by: str = SOURCE, stop_reason: str = "sto
native=HostedNative(source_id=served_by, payload=PAYLOADS[protocol]),
)
return AssistantMessage(
- (call, TextBlock(text="found it"), *extra), Origin(provider, protocol, model), stop_reason, hosted_summary=HostedSummary()
+ (call, TextBlock(text="found it"), *extra),
+ Origin(provider, protocol, model),
+ stop_reason,
+ hosted_summary=HostedSummary(),
+ source_identity=identity,
)
@@ -115,16 +123,22 @@ def _verbatim(protocol: str, body: dict[str, Any]) -> bool:
@pytest.mark.parametrize("protocol", ["openai_responses", "anthropic"])
@pytest.mark.parametrize(
- ("replay", "served_by", "verbatim"),
- [(True, SOURCE, True), (False, SOURCE, False), (True, OTHER, False)],
- ids=["same-source-with-replay-evidence", "no-replay-evidence", "another-source"],
+ ("replay", "served_by", "identity", "verbatim"),
+ [
+ (True, SOURCE, IDENTITY, True),
+ (False, SOURCE, IDENTITY, False),
+ (True, OTHER, IDENTITY, False),
+ # The same Source after its key changed is another account, whose native payload it cannot read.
+ (True, SOURCE, "sha256:previous-account", False),
+ ],
+ ids=["same-source-with-replay-evidence", "no-replay-evidence", "another-source", "another-identity"],
)
async def test_a_hosted_call_goes_back_verbatim_and_pinned_only_to_its_own_source_with_replay_evidence(
- protocol, replay, served_by, verbatim
+ protocol, replay, served_by, identity, verbatim
):
request = _request(
_endpoint(protocol, replay=replay, native=False),
- _searched(protocol, served_by=served_by),
+ _searched(protocol, served_by=served_by, identity=identity),
UserMessage((TextBlock("and then?"),)),
)
@@ -225,17 +239,22 @@ def _tool_name(tool: dict[str, Any]) -> str:
@pytest.mark.parametrize("protocol", ["openai_responses", "anthropic", "openai_chat"])
[email protected]("second", ["served", "pin_unavailable"])
-async def test_pin_unavailable_gets_exactly_one_portable_resend_and_never_the_generic_retry(protocol, second):
+ ("second", "served_by"),
+ [("served", OTHER), ("served", SOURCE), ("pin_unavailable", OTHER)],
+ ids=["served-by-another-source", "served-by-its-source", "pin_unavailable"],
+)
+async def test_pin_unavailable_gets_exactly_one_portable_resend_and_never_the_generic_retry(protocol, second, served_by):
"""MH-HOSTED-VIBEY-005: the pinned request carries a native declaration and, where the protocol replays one, a
- verbatim payload. Its one resend carries neither and no pin; that resend's own answer is what the loop sees."""
+ verbatim payload. Its one resend carries neither and no pin; that resend's own answer is what the loop sees. A
+ resend the hop's own Source serves is still its own: the answer keeps that Source's identity."""
replayed = protocol in PAYLOADS
history = (_searched(protocol), UserMessage((TextBlock("and then?"),))) if replayed else ()
endpoint = _endpoint(protocol, replay=True)
request = _request(endpoint, *history)
provider, model = MODELS[protocol]
- served = json.dumps({"provider": provider, "api": protocol, "model": model, "source": OTHER}, separators=(",", ":"))
+ served = json.dumps({"provider": provider, "api": protocol, "model": model, "source": served_by}, separators=(",", ":"))
sent: list[httpx.Request] = []
def gateway(wire: httpx.Request) -> httpx.Response:
@@ -259,6 +278,7 @@ async def test_pin_unavailable_gets_exactly_one_portable_resend_and_never_the_ge
assert _verbatim(protocol, pinned) and not _verbatim(protocol, portable)
if second == "served":
assert isinstance(events[-1], Done)
+ assert events[-1].message.source_identity == (IDENTITY if served_by == SOURCE else None)
else:
# A 409 to an unpinned request is an ordinary error: there is no second portable resend.
assert isinstance(events[-1], ProviderError) and events[-1].status == 409
diff --git a/tests/agent_core/ai/test_provider_adapters.py b/tests/agent_core/ai/test_provider_adapters.py
index 7dbfa01f6..b2210ba5e 100644
--- a/tests/agent_core/ai/test_provider_adapters.py
+++ b/tests/agent_core/ai/test_provider_adapters.py
@@ -2871,7 +2871,10 @@ def test_served_hop_report_is_exactly_origin_and_source(report: str, expected: S
@pytest.mark.asyncio
@pytest.mark.parametrize("served_hop", [
- None, "invalid", '{"provider":"anthropic","api":"anthropic","model":"model-x","source":"src_fixture01"}',
+ None,
+ "invalid",
+ '{"provider":"anthropic","api":"anthropic","model":"model-x","source":"src_fixture01"}',
+ '{"provider":"anthropic","api":"anthropic","model":"model-x","source":"src_fixture02"}',
])
async def test_gateway_origin_sanitization_preserves_streamed_block_indexes(served_hop: str | None) -> None:
body = (
@@ -2893,10 +2896,9 @@ async def test_gateway_origin_sanitization_preserves_streamed_block_indexes(serv
return httpx.Response(200, headers=headers, text=body)
async with httpx.AsyncClient(transport=httpx.MockTransport(handler)) as client:
- events = await _events(
- AnthropicAdapter(client, gateway=True),
- _request("anthropic"),
- )
+ request = _request("anthropic")
+ hop = replace(request.endpoint, source_id="src_fixture01", source_identity="sha256:fixture-account")
+ events = await _events(AnthropicAdapter(client, gateway=True), replace(request, endpoint=hop))
final = events[-1]
assert isinstance(final, Done)
@@ -2915,6 +2917,10 @@ async def test_gateway_origin_sanitization_preserves_streamed_block_indexes(serv
if not verified:
assert all(not isinstance(block, ThinkingBlock) or block.signature is None for block in final.message.content)
assert all(not isinstance(block, ToolCallBlock) or block.signature is None for block in final.message.content)
+ # The message records the identity its opaque payloads go back to (cross-provider.md): the hop's, when the hop's
+ # own Source served it; none when another Source did, whose identity is unknown here.
+ own = verified and "src_fixture01" in served_hop
+ assert final.message.source_identity == ("sha256:fixture-account" if own else None)
class _Loader(MediaLoader):
diff --git a/tests/agent_core/ai/test_transform_sse_errors.py b/tests/agent_core/ai/test_transform_sse_errors.py
index 18aaad15b..2310d31a2 100644
--- a/tests/agent_core/ai/test_transform_sse_errors.py
+++ b/tests/agent_core/ai/test_transform_sse_errors.py
@@ -129,6 +129,42 @@ def test_cross_provider_transform_drops_opaque_payload_and_answers_orphaned_call
assert synthetic.is_error is True # type: ignore[attr-defined]
+ ("served_by", "hop", "bound"),
+ [
+ ("sha256:account-one", "sha256:account-one", True),
+ ("sha256:account-one", "sha256:account-two", False),
+ (None, "sha256:account-two", False),
+ (None, None, True),
+ ],
+ ids=["same-identity", "another-identity", "unknown-identity", "no-identity-anywhere"],
+)
+def test_opaque_payloads_go_back_only_to_the_source_identity_that_served_them(served_by, hop, bound) -> None:
+ """cross-provider.md: another account refuses a Source's ciphertext (xAI's and OpenAI's encrypted reasoning), so a
+ message's signatures, redacted thinking and native ids go back only to a hop of the Source identity that served
+ it: another Source, or the same Source after its key changed, is another identity. A message no known identity
+ served, as one written before ``source_identity``, goes to a hop that names one as a different origin's."""
+
+ origin = Origin("openai", "openai_responses", "gpt-test")
+ reasoning = ThinkingBlock("plan", '{"id": "rs_1", "encrypted_content": "account-bound"}')
+ redacted = ThinkingBlock("", "redacted-opaque", redacted=True)
+ call = ToolCallBlock("call_1", "read", {"path": "x"}, native_id="fc_1", signature="call-opaque")
+ message = AssistantMessage((reasoning, redacted, call), origin, "tool_use", source_identity=served_by)
+ endpoint = ModelEndpoint(
+ "openai_responses", "http://hub.invalid/v1", "gpt-test", "token", source_id="src_account0001",
+ source_identity=hop,
+ )
+
+ result = transform_messages((UserMessage((TextBlock("go"),)), message), origin, endpoint=endpoint)
+
+ sent = result.messages[1]
+ assert isinstance(sent, AssistantMessage)
+ if bound:
+ assert sent.content == (reasoning, redacted, call)
+ else:
+ assert sent.content == (TextBlock("plan"), ToolCallBlock("call_1", "read", {"path": "x"}))
+
+
def test_cross_provider_transform_drops_results_for_failed_tool_turns() -> None:
history = (
UserMessage((TextBlock(text="request"),)),
diff --git a/tests/agent_core/test_hosted_messages.py b/tests/agent_core/test_hosted_messages.py
index 34a856c97..864806eca 100644
--- a/tests/agent_core/test_hosted_messages.py
+++ b/tests/agent_core/test_hosted_messages.py
@@ -128,6 +128,7 @@ def _produced() -> list:
content=(ToolCallBlock(id="call_7", name="x_search", arguments={"query": "from:avibe", "limit": 5}),),
origin=Origin(provider="anthropic", api="anthropic", model="claude-opus-5-5"),
stop_reason="tool_use",
+ source_identity="sha256:" + "a1" * 32,
)
proxied = ToolResultMessage(
tool_call_id="call_7",
diff --git a/tests/e2e/test_model_hub_runtime.py b/tests/e2e/test_model_hub_runtime.py
index 765356176..714544939 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": 13,
+ "contract_version": 14,
"error": "feature_disabled",
}
diff --git a/tests/e2e/test_model_hub_sources.py b/tests/e2e/test_model_hub_sources.py
index 130914161..0f3fca087 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 MockLLMUpstream
pytestmark = pytest.mark.e2e_model_hub
-CONTRACT_VERSION = 13
+CONTRACT_VERSION = 14
MENU_MODEL = "claude-sonnet-4-6"
SYNTHETIC_API_KEY = "sk-model-hub-e2e-not-real"
diff --git a/tests/scenarios/model_hub/catalog.yaml b/tests/scenarios/model_hub/catalog.yaml
index 65c52f1f3..e204c5239 100644
--- a/tests/scenarios/model_hub/catalog.yaml
+++ b/tests/scenarios/model_hub/catalog.yaml
@@ -590,11 +590,11 @@ scenarios:
- tests/test_model_hub_api.py::test_runtime_stop_protects_configured_vibey_models
- tests/test_model_hub_api.py::test_runtime_stop_returns_explicit_not_started_state
- id: MH-VIBEY-005
- name: Vibey failover strips opaque history only for a different or unverified origin
+ name: Vibey failover strips opaque history for a different or unverified origin, or another Source of the same origin
status: covered
kind: compatibility
layer: contract
- test: tests/test_model_hub_vibey_consumer.py::test_failover_strips_opaque_history_only_when_origin_changes
+ test: tests/test_model_hub_vibey_consumer.py::test_failover_strips_opaque_history_for_another_origin_or_source
related_tests:
- tests/test_model_hub_vibey_consumer.py::test_opaque_history_uses_launch_snapshot_without_requiring_turn_attribution
- tests/test_model_hub_vibey_consumer.py::test_opaque_history_origin_survives_recovery_walks
diff --git a/tests/test_model_hub_api.py b/tests/test_model_hub_api.py
index 1575141da..4c9ae0d56 100644
--- a/tests/test_model_hub_api.py
+++ b/tests/test_model_hub_api.py
@@ -1031,7 +1031,7 @@ def test_runtime_start_is_explicit_and_returns_v4_status(tmp_path):
assert adapter.start_calls == 1
assert store.config.enabled is True
assert runtime["enabled"] is True
- assert runtime["contract_version"] == 13
+ assert runtime["contract_version"] == 14
assert runtime["status"]["health"] == "ok"
_assert_valid("runtime-dependency.schema.json", runtime)
@@ -1338,7 +1338,7 @@ def test_runtime_start_crosses_the_controller_rpc_boundary(monkeypatch):
async def rpc(operation, payload=None):
calls.append((operation, payload))
- return {"contract_version": 13, "status": {"health": "ok"}}
+ return {"contract_version": 14, "status": {"health": "ok"}}
monkeypatch.setattr(model_hub_client, "_rpc", rpc)
@@ -1355,7 +1355,7 @@ def test_runtime_stop_crosses_the_controller_rpc_boundary(monkeypatch):
async def rpc(operation, payload=None):
calls.append((operation, payload))
- return {"contract_version": 13, "status": {"health": "not_started"}}
+ return {"contract_version": 14, "status": {"health": "not_started"}}
monkeypatch.setattr(model_hub_client, "_rpc", rpc)
@@ -1372,7 +1372,7 @@ def test_runtime_install_crosses_the_controller_rpc_boundary(monkeypatch):
async def rpc(operation, payload=None):
calls.append((operation, payload))
- return {"contract_version": 13, "status": {"health": "installing"}}
+ return {"contract_version": 14, "status": {"health": "installing"}}
monkeypatch.setattr(model_hub_client, "_rpc", rpc)
@@ -1390,7 +1390,7 @@ def test_runtime_dependency_ensure_crosses_the_controller_rpc_boundary(monkeypat
def rpc(operation, payload=None):
calls.append((operation, payload))
return {
- "contract_version": 13,
+ "contract_version": 14,
"changed": True,
"status": {"health": "not_started", "verified": True},
}
@@ -4810,7 +4810,7 @@ def test_agent_models_route_returns_only_picker_catalog_fields(monkeypatch):
assert response.status_code == 200
assert response.get_json() == {
"ok": True,
- "contract_version": 13,
+ "contract_version": 14,
"agent": {
"backend": "codex",
"mode": "hub",
@@ -9678,7 +9678,7 @@ def test_runtime_start_route_requires_csrf_before_starting_engine(monkeypatch, t
assert accepted.status_code == 200
runtime = accepted.get_json()["runtime"]
assert adapter.start_calls == 1
- assert runtime["contract_version"] == 13
+ assert runtime["contract_version"] == 14
_assert_valid("runtime-dependency.schema.json", runtime)
diff --git a/tests/test_model_hub_config.py b/tests/test_model_hub_config.py
index 6553b7ea0..a71f1124f 100644
--- a/tests/test_model_hub_config.py
+++ b/tests/test_model_hub_config.py
@@ -96,7 +96,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"] == 13
+ assert schema["properties"]["contract_version"]["const"] == 14
assert tuple(schema["properties"]["outcome"]["enum"]) == tuple(
member.value for member in ObservationOutcome
)
@@ -120,7 +120,7 @@ def test_observation_terminal_authority_and_schema_accept_the_same_products():
def payload(observation: SourceObservation) -> dict:
return {
- "contract_version": 13,
+ "contract_version": 14,
"outcome": observation.outcome.value,
"reachable": observation.reachable,
"authenticated": (
@@ -700,7 +700,7 @@ def test_guard_refusal_error_requires_its_corresponding_nonempty_plan_array():
route_refusal = {
"ok": False,
- "contract_version": 13,
+ "contract_version": 14,
"error": "source_in_route_chain",
"detail": "modelHub.errors.source_in_route_chain",
"would_remove_hops": [hop],
@@ -716,7 +716,7 @@ def test_guard_refusal_error_requires_its_corresponding_nonempty_plan_array():
}
candidate_refusal = {
"ok": False,
- "contract_version": 13,
+ "contract_version": 14,
"error": "candidate_suppliers_changed",
"detail": "modelHub.errors.candidate_suppliers_changed",
"changed": {
@@ -800,7 +800,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"] == 13
+ assert registry["contract_version"] == 14
ids = [entry["id"] for entry in registry["entries"]]
assert ids
assert len(ids) == len(set(ids))
@@ -937,8 +937,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],
- "expected": [5, 6, 7, 8, 9, 10, 11, 12, 13],
+ "values": [6, 7, 8, 9, 10, 11, 12, 13, 14],
+ "expected": [5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
} in result["findings"]
@@ -1249,7 +1249,7 @@ def test_v5_shape_amendments_reject_the_false_states_they_replace():
with pytest.raises(ValidationError):
chain_validator.validate(interrupted)
exact_hop = {
- "contract_version": 13,
+ "contract_version": 14,
"backend": "claude",
"model_id": "claude-opus-4-6",
"manual_override": None,
diff --git a/tests/test_model_hub_google.py b/tests/test_model_hub_google.py
index a14ff48af..4e318f8a7 100644
--- a/tests/test_model_hub_google.py
+++ b/tests/test_model_hub_google.py
@@ -22,6 +22,7 @@ from jsonschema import ValidationError
from config.v2_config import ModelHubModelConfig, ModelHubRouteConfig, ModelHubRouteHopConfig, ModelHubSourceConfig
from core.handlers.model_hub.adapter import ObservationOutcome, RawOutcomeKind, SourceBinding
+from core.handlers.model_hub.capability_evidence import identity_digest
from core.handlers.model_hub.provenance import SERVED_HOP_HEADER
from core.run_settlement import SETTLED_BY_TERMINAL_RESULT
from core.handlers.model_hub.stream_wire import (
@@ -342,7 +343,8 @@ async def test_google_router_gateway_failover_preserves_visible_history_and_orig
"source": fallback.id,
}
assert service.adapter.requests[0] == signed
- assert service.adapter.requests[1] == (signed if same_origin else plain)
+ # The fallback is another Source, so its history is plain even at the same origin (C-6 item 6).
+ assert service.adapter.requests[1] == plain
assert all(request.protocol == "google" for request in service.adapter.requests)
completion = router.settle_turn(
"turn-google", settled_by=SETTLED_BY_TERMINAL_RESULT, ts="2026-10-02T08:00:00Z",
@@ -352,6 +354,10 @@ async def test_google_router_gateway_failover_preserves_visible_history_and_orig
record = service.provenance.get("turn-google")
_validate("turn-provenance.schema.json", record)
assert {**record["served"]["origin"], "source": record["served"]["source_id"]} == origin
+ # The Source identity opaque payloads are bound to stays in memory (C-6 item 6): the hop resolution names it,
+ # but neither the served-hop report nor persisted provenance carries it.
+ assert hop["source_identity"] == identity_digest(primary)
+ assert identity_digest(primary) not in json.dumps(record) + response.headers[SERVED_HOP_HEADER]
finally:
await gateway.close()
diff --git a/tests/test_model_hub_hosted_pinning.py b/tests/test_model_hub_hosted_pinning.py
index 2aeb1e244..955e35ad0 100644
--- a/tests/test_model_hub_hosted_pinning.py
+++ b/tests/test_model_hub_hosted_pinning.py
@@ -284,6 +284,32 @@ async def test_a_continuation_stays_on_the_identity_its_response_was_served_unde
assert len(service.adapter.invocations) == statuses.count(200)
+async def test_a_pinned_request_rendered_for_the_launch_identity_is_handed_back_after_a_rotation(tmp_path):
+ """MH-HOSTED-GATEWAY-002, C-6 item 6: a pinned request is never rewritten, so one rendered for the launch
+ identity cannot go to its Source under another. A key rotated and re-verified before the turn's first pinned
+ admission would otherwise bind the new identity while the body carries the old account's ciphertext, which the
+ provider refuses as a request error; it is handed back, and Vibey renders it again portably."""
+
+ primary, fallback = _sources()
+ service = _vibey_service(tmp_path, [primary, fallback], handles=[
+ LiveInvokeHandle(_outcome(RawOutcomeKind.SUCCESS, source_id=primary.id), (b"{}",)),
+ ])
+ _verify(service, primary, "grok-4.6", "x_search", "call")
+ gateway = ModelHubTurnGateway(service)
+ router = ModelHubRuntimeRouter(service=service, turn_gateway=gateway)
+ try:
+ hop = await router.resolve_hop("menu-alias", process_scope="vibey:rotated", turn_id="turn-rotated")
+ live = service.store.config.sources[0]
+ live.credential_ref = "cred_rotated0001"
+ _verify(service, live, "grok-4.6", "x_search", "call")
+ answer = await _post(hop, _native(hop, history=[SIGNED_REASONING]), pin=primary.id)
+ finally:
+ await gateway.close()
+ assert answer == (409, PIN_UNAVAILABLE)
+ assert service.adapter.invocations == []
+
+
@pytest.mark.asyncio
async def test_overlapping_first_pinned_requests_bind_one_identity(tmp_path):
"""MH-HOSTED-GATEWAY-002: the identity is bound at final admission, so a concurrent first request cannot use another.
diff --git a/tests/test_model_hub_l3.py b/tests/test_model_hub_l3.py
index b2ba726ee..5be95e854 100644
--- a/tests/test_model_hub_l3.py
+++ b/tests/test_model_hub_l3.py
@@ -5579,7 +5579,7 @@ def test_backend_failure_keeps_the_gateway_terminal_error_no_later_request_super
def 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": 13,
+ "contract_version": 14,
"turn_id": "turn_released_rejection",
"ts": NOW.isoformat(),
"agent": "vibey",
@@ -7055,7 +7055,7 @@ def test_source_observation_reduces_the_order_at_the_first_authenticated_proof(
_assert_valid(
"observation-result.schema.json",
{
- "contract_version": 13,
+ "contract_version": 14,
"outcome": "adapter_error",
"reachable": True,
"authenticated": "unknown",
@@ -9588,7 +9588,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": 13,
+ "contract_version": 14,
"backend": "codex",
"channel": "native_cli",
"reachable": True,
diff --git a/tests/test_model_hub_provenance.py b/tests/test_model_hub_provenance.py
index ebe2aa1fd..b2406c6d0 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_pat
def _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": 13,
+ "contract_version": 14,
"turn_id": turn_id,
"ts": "2026-09-06T00:00:00Z",
"agent": backend,
@@ -461,6 +461,6 @@ def test_model_history_client_rpc_http_share_nullable_read_only_result(monkeypat
f"/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": 13, "provenance": record}
+ assert response.get_json() == {"ok": True, "contract_version": 14, "provenance": record}
assert store.config.to_payload() == before
assert adapter.synced == []
diff --git a/tests/test_model_hub_resolution.py b/tests/test_model_hub_resolution.py
index 61b4413b1..8d7749b4f 100644
--- a/tests/test_model_hub_resolution.py
+++ b/tests/test_model_hub_resolution.py
@@ -1707,7 +1707,7 @@ def test_service_accepts_authoritative_reachable_adapter_error(tmp_path):
)
assert result["observation"] == {
- "contract_version": 13,
+ "contract_version": 14,
"outcome": "adapter_error",
"reachable": True,
"authenticated": "unknown",
@@ -1738,7 +1738,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": 13,
+ "contract_version": 14,
"outcome": "adapter_error",
"reachable": None,
"authenticated": "unknown",
diff --git a/tests/test_model_hub_runtime.py b/tests/test_model_hub_runtime.py
index f90d7d155..f89e13447 100644
--- a/tests/test_model_hub_runtime.py
+++ b/tests/test_model_hub_runtime.py
@@ -1349,7 +1349,7 @@ def test_manifest_resolution_drives_admission_persistence_and_schema(
installer=manager,
state_store=EngineStateStore(tmp_path / "state"),
)
- projected = {"contract_version": 13, **supervisor.status()}
+ projected = {"contract_version": 14, **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_vibey_consumer.py b/tests/test_model_hub_vibey_consumer.py
index 81b567b65..204221f63 100644
--- a/tests/test_model_hub_vibey_consumer.py
+++ b/tests/test_model_hub_vibey_consumer.py
@@ -227,12 +227,15 @@ def _signed_history(protocol):
@pytest.mark.asyncio
@pytest.mark.parametrize("protocol", PROTOCOL_ENDPOINTS)
[email protected]("change", ["same_origin", "provider", "api", "model"])
-async def test_failover_strips_opaque_history_only_when_origin_changes(tmp_path, protocol, change):
- """MH-VIBEY-005: the engine must never receive primary-signed history at another origin.
[email protected]("change", ["source", "provider", "api", "model"])
+async def test_failover_strips_opaque_history_for_another_origin_or_source(tmp_path, protocol, change):
+ """MH-VIBEY-005: the engine must never receive primary-signed history at another origin or Source.
Origin-report tests alone do not inspect the outgoing history at admission.
- Source identity alone is not origin identity; preserve ordinary tool data.
+ Opaque payloads are bound to the Source as well (an account refuses another
+ account's ciphertext), so a fallback Source of the same origin gets the
+ plain history too; ordinary tool data is preserved. A retry on the primary
+ Source keeps it (the recovery-walk test below).
"""
primary = _source("src_primary01", "Primary", vendor="anthropic", protocol=protocol)
fallback_protocol = "anthropic" if protocol != "anthropic" else "openai_responses"
@@ -272,7 +275,7 @@ async def test_failover_strips_opaque_history_only_when_origin_changes(tmp_path,
}
assert [entry[0] for entry in service.adapter.invocations] == [primary.id, fallback.id]
assert service.adapter.requests[0] == {**common, **original}
- assert service.adapter.requests[1] == {**common, **(original if change == "same_origin" else plain)}
+ assert service.adapter.requests[1] == {**common, **plain}
assert all(request.protocol == protocol for request in service.adapter.requests)
assert all(request.headers == {
"anthropic-beta": "fixture-beta", "user-agent": "fixture-agent",
@@ -284,12 +287,14 @@ async def test_failover_strips_opaque_history_only_when_origin_changes(tmp_path,
@pytest.mark.asyncio
@pytest.mark.parametrize("turn_id", ["turn-snapshot", None])
[email protected]("origin_state", ["unchanged", "changed", "unverified"])
[email protected]("origin_state", ["unchanged", "changed", "rotated", "unverified"])
async def test_opaque_history_uses_launch_snapshot_without_requiring_turn_attribution(tmp_path, turn_id, origin_state):
"""MH-VIBEY-005: config reload and untracked calls cannot invent primary provenance.
A fallback-only case cannot catch snapshot recomputation at HTTP arrival or
- loss of the route credential when no dispatched turn is being tracked.
+ loss of the route credential when no dispatched turn is being tracked. A key
+ rotated after the launch makes the primary another account, whose history
+ was signed under the launch identity (C-6 item 6).
"""
primary = _source("src_primary01", "Primary", vendor="anthropic", protocol="anthropic")
service = _vibey_service(tmp_path, [primary], handles=[
@@ -308,6 +313,8 @@ async def test_opaque_history_uses_launch_snapshot_without_requiring_turn_attrib
request_headers = hop["request_headers"]
if origin_state == "changed":
service.store.config.sources[0].vendor = "custom"
+ if origin_state == "rotated":
+ service.store.config.sources[0].credential_ref = "cred_rotated0001"
async with aiohttp.ClientSession() as client:
async with client.post(
f"{base_url}/messages",
@@ -323,6 +330,39 @@ async def test_opaque_history_uses_launch_snapshot_without_requiring_turn_attrib
await gateway.close()
+async def test_a_later_turn_after_a_key_rotation_gets_a_route_under_the_new_identity(tmp_path):
+ """MH-VIBEY-005: a route credential carries the launch identity the gateway compares against, so a turn launched
+ after the key changed gets a route under the new identity. Its own Source's signed history, rendered for that
+ identity, is kept; the earlier route still answers for the identity it was launched under."""
+
+ primary = _source("src_primary01", "Primary", vendor="anthropic", protocol="anthropic")
+ service = _vibey_service(tmp_path, [primary], handles=[
+ LiveInvokeHandle(_outcome(RawOutcomeKind.SUCCESS), (b"{}",)),
+ ])
+ signed, _plain = _signed_history("anthropic")
+ gateway = ModelHubTurnGateway(service)
+ router = ModelHubRuntimeRouter(service=service, turn_gateway=gateway)
+ try:
+ before = await router.resolve_hop("menu-alias", process_scope="vibey:rotation", turn_id="turn-before")
+ completion = router.settle_turn("turn-before", settled_by=SETTLED_BY_TERMINAL_RESULT, ts="2026-10-02T08:00:00Z")
+ if completion:
+ await completion
+ service.store.config.sources[0].credential_ref = "cred_rotated0001"
+ after = await router.resolve_hop("menu-alias", process_scope="vibey:rotation", turn_id="turn-after")
+ async with aiohttp.ClientSession() as client:
+ async with client.post(
+ f'{after["base_url"]}/messages',
+ headers={"Authorization": f'Bearer {after["token"]}', **after["request_headers"]},
+ json={"model": after["runtime_model"], **signed},
+ ) as response:
+ assert response.status == 200
+ finally:
+ await gateway.close()
+ assert after["source_identity"] != before["source_identity"] and after["token"] != before["token"]
+ assert service.adapter.requests[0]["messages"] == signed["messages"]
+
+
@pytest.mark.asyncio
@pytest.mark.parametrize("recovered_hop", ["primary", "fallback"])
async def test_opaque_history_origin_survives_recovery_walks(tmp_path, recovered_hop):
diff --git a/tests/test_model_hub_vibey_contract_matrix.py b/tests/test_model_hub_vibey_contract_matrix.py
index a95262441..dba313bc9 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": 13, "backend": "claude", "channel": "native_cli", "reachable": True,
+ "contract_version": 14, "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": 13, "backend": "vibey", "model_id": "fixture-model",
+ "contract_version": 14, "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": 13, "turn_id": "turn-fixture", "ts": "2026-10-02T07:00:00Z",
+ "contract_version": 14, "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/tests/test_vibey_agent.py b/tests/test_vibey_agent.py
index 6e1c1244f..23c86b87e 100644
--- a/tests/test_vibey_agent.py
+++ b/tests/test_vibey_agent.py
@@ -258,6 +258,7 @@ class _Controller:
target_model=requested_model,
runtime_model=requested_model,
source_id="src_test",
+ source_identity="sha256:test-source-identity",
gateway_base_url="http://hub.invalid/vibey",
gateway_token="hub-token",
**self.hub_limits,
@@ -2839,7 +2840,8 @@ def test_a_hop_with_an_invalid_hosted_tool_entry_is_refused(hosted_tools) -> Non
hop = ModelHubLaunch(
backend="vibey", channel="hub", requested_model="m", target_model="m", runtime_model="m",
- source_id="src_test", gateway_base_url="http://hub.invalid/vibey", gateway_token="hub-token",
+ source_id="src_test", source_identity="sha256:test-source-identity",
+ gateway_base_url="http://hub.invalid/vibey", gateway_token="hub-token",
protocol="openai_responses", provider="openai",
).to_hop_resolution()
hop["hosted_tools"] = hosted_tools
diff --git a/ui/e2e/chat-interactions/interactions.spec.ts b/ui/e2e/chat-interactions/interactions.spec.ts
index e329d4ff9..ad004404f 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: 13, turn_id: TURN, agent: 'codex', requested_model_id: 'fixture-model',
+ contract_version: 14, 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.tsx
index fe6f83d48..0889a88c2 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: 13, backend, model_id, route_origin: origins[index],
+ contract_version: 14, 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: 13,
+ contract_version: 14,
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.tsx
index 12309bc06..a32353a57 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: 13, backend, model_id: modelId,
+ contract_version: 14, 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.ts
index 074d523e4..39ae7181a 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 exp
would_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: 13, error: 'source_in_route_chain', ...plan });
+ expect(await refused.json()).toMatchObject({ ok: false, contract_version: 14, 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.ts
index b25523f7d..f0a28d7c6 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: 13, enabled: true, host_platform: 'linux',
+ contract_version: 14, 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.ts
index 8c3b98a66..d65fef4f1 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"]] as
const 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:13,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:14,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:13,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:14,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.ts
index f38be106b..66b3ab9e6 100644
--- a/ui/e2e/onboarding-fidelity/provider-support.ts
+++ b/ui/e2e/onboarding-fidelity/provider-support.ts
@@ -129,7 +129,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: 13,
+ contract_version: 14,
enabled: true,
host_platform: 'darwin',
manifest: {
diff --git a/ui/e2e/onboarding-fidelity/support.ts b/ui/e2e/onboarding-fidelity/support.ts
index 037d5e73a..c58eea7b5 100644
--- a/ui/e2e/onboarding-fidelity/support.ts
+++ b/ui/e2e/onboarding-fidelity/support.ts
@@ -87,7 +87,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: 13, 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: 14, 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.ts
index 88bd1fc88..397095bad 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: 13,
+ contract_version: 14,
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.tsx
index b6cb3d9c0..5e461a5c1 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: 13, backend: 'claude', model_id: 'opus-5',
+ contract_version: 14, 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: 13, backend: 'claude', model_id: 'opus-5',
+ contract_version: 14, 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.tsx
index ecc7787dd..b1fe1e230 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: 13, backend: 'vibey', model_id: modelId,
+ contract_version: 14, 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.tsx
index c7b85d82c..7fe3d315a 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: 13,
+ contract_version: 14,
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.ts
index 4ccf1ef9a..742051ffa 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: 13,
+ contract_version: 14,
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.tsx
index 1fe2143bd..2ca4af479 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: 13,
+ contract_version: 14,
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: 13, 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: 14, 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: 13,
+ contract_version: 14,
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: 13, 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: 14, 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: 13, 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: 14, 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: 13, 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: 14, 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.tsx
index 791f87b0a..009fa9c90 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: 13,
+ contract_version: 14,
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.tsx
index 6ebae5e4a..6b4ad0d64 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: 13, backend, model_id: 'gpt-test', route_origin: routeOrigin,
+ contract_version: 14, 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.tsx
index b7cdeae66..b250d6ad3 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: 13,
+ contract_version: 14,
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.tsx
index bbe42a06d..878958d6e 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: 13, turn_id: 'turn-recorded', ts: '2026-09-05T15:00:00Z', agent: 'codex', requested_model_id: 'requested-model',
+ contract_version: 14, 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.tsx
index 8ff6c815e..3148a8919 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: 13,
+ contract_version: 14,
...(hostPlatform === undefined ? {} : { host_platform: hostPlatform }),
manifest: resolution === 'unresolved'
? { name: 'cliproxyapi', resolution, assets: [] }
diff --git a/ui/src/components/settings/models/SettingsModelsPage.render.test.tsx b/ui/src/components/settings/models/SettingsModelsPage.render.test.tsx
index 93f87fac7..fd9988900 100644
--- a/ui/src/components/settings/models/SettingsModelsPage.render.test.tsx
+++ b/ui/src/components/settings/models/SettingsModelsPage.render.test.tsx
@@ -48,7 +48,7 @@ const manifest = {
} satisfies RuntimeManifest;
const runtime: RuntimeDependency = {
- contract_version: 13,
+ contract_version: 14,
manifest,
status: { installed_version: '1', verified: true, health: 'ok' },
};
@@ -119,7 +119,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: 13,
+ contract_version: 14,
backend: 'codex',
model_id: 'gpt-5.6-sol',
current: { source_id: 'src_relay', model_id: 'gpt-5.6-sol' },
@@ -222,7 +222,7 @@ const routedHubAgent: AgentSupply = {
const routedChain: AgentChain = {
manual_override: { hops: [{ source_id: retainedSource.id, model_id: routedModelId }] },
route_origin: 'manual' as const,
- contract_version: 13,
+ contract_version: 14,
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.ts
index 95e0cfde5..8c2577f7c 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: 13,
+ contract_version: 14,
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: 13,
+ contract_version: 14,
backend: 'claude',
model_id: 'model-a',
current: { source_id: current, model_id: 'model-a' },
diff --git a/ui/src/components/settings/models/apiFailure.test.ts b/ui/src/components/settings/models/apiFailure.test.ts
index 052c1a7d8..b72932254 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: 13,
+ contract_version: 14,
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.ts
index eecf25752..ed291ead6 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: 13,
+ contract_version: 14,
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.ts
index a208ad80f..7a0c5837a 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: 13,
+ contract_version: 14,
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.ts
index f63846fc9..a2e68c725 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: 13,
+ contract_version: 14,
host_platform: 'darwin-arm64',
manifest: resolution === 'unresolved'
? { name: 'cliproxyapi', resolution, assets: [] }
diff --git a/ui/src/components/settings/models/types.ts b/ui/src/components/settings/models/types.ts
index 4a3abadba..e65b8ff6a 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 = 13 as const;
-export const PERSISTED_TURN_CONTRACT_VERSIONS = [5, 6, 7, 8, 9, 10, 11, 12, 13] as const;
+export const CONTRACT_VERSION = 14 as const;
+export const PERSISTED_TURN_CONTRACT_VERSIONS = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14] as const;
export const AGENT_CHAIN_CONTRACT_VERSION = CONTRACT_VERSION;
export const PROBE_RESULT_CONTRACT_VERSION = CONTRACT_VERSION;