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.

feat(model-hub): stamp hosted evidence with the engine manifest's hosted_wire (#2623)

Call White67ed74d1d109
diff --git a/core/handlers/model_hub/hosted_tools.py b/core/handlers/model_hub/hosted_tools.py
index f9f4cd27d..8ad992a18 100644
--- a/core/handlers/model_hub/hosted_tools.py
+++ b/core/handlers/model_hub/hosted_tools.py
@@ -59,20 +59,25 @@ def _manifest_engine_stamp(path: Optional[str]) -> str:
else:
resource = resources.files("vibe").joinpath("model_hub_runtime/cliproxyapi_manifest.json")
payload = json.loads(resource.read_text(encoding="utf-8"))
- stamp = payload.get("asset_release_tag") or payload.get("release_tag") or payload.get("version")
- if not isinstance(stamp, str) or not stamp:
- raise ValueError("the engine manifest names no release")
- return stamp
+ for key in ("hosted_wire", "asset_release_tag", "release_tag", "version"):
+ stamp = payload.get(key)
+ if isinstance(stamp, str) and stamp:
+ return stamp
+ raise ValueError("the engine manifest names no release")
def engine_stamp() -> str:
- """The engine release evidence is stamped with: the shipped manifest's asset release.
-
- Engine upgrades ship as manifest changes, and a patched rebuild of the same
- upstream version gets a new asset release, so this is what a wire change
- looks like from here. Read once, when Model Hub's service is built; a
- manifest that cannot be read is the fixed unknown engine, whose evidence
- never matches a real release and never raises on a request.
+ """The engine wire evidence is stamped with: the shipped manifest's ``hosted_wire``, else its asset release.
+
+ ``hosted_wire`` names the oldest engine release whose hosted passthrough is
+ byte-identical to this one; the engine release gate carries it forward
+ across such upgrades and sets it to the new asset release otherwise, so a
+ byte-identical upgrade keeps evidence current and anything else makes it
+ stale. A manifest without it is stamped with its asset release (a patched
+ rebuild of the same upstream version gets a new one), which is the value
+ the gate first carries forward. Read once, when Model Hub's service is
+ built; a manifest that cannot be read is the fixed unknown engine, whose
+ evidence never matches a real release and never raises on a request.
"""
try:
diff --git a/docs/plans/model-hub-capability-model.md b/docs/plans/model-hub-capability-model.md
index 1c022265c..93d38bf8d 100644
--- a/docs/plans/model-hub-capability-model.md
+++ b/docs/plans/model-hub-capability-model.md
@@ -68,7 +68,7 @@ is its JSON Schema. The store is `core/handlers/model_hub/capability_evidence.py
| `status` | `verified` or `unsupported` |
| `basis` | `probe` (a live probe the user started) or `observed` (learned from a real request's error) |
| `observed_at` | UTC timestamp |
-| `engine` | engine release at that time (the shipped engine manifest's asset release); a change makes `probe` evidence stale (§3.3) |
+| `engine` | engine wire at that time: the shipped engine manifest's `hosted_wire` (the oldest release whose hosted passthrough is byte-identical, kept by the engine release gate), else its asset release; a change makes `probe` evidence stale (§3.3) |
| `shape` | version of the request shape that produced the record; a change makes `probe` evidence stale |
| `detail` | required when `basis` is `observed`: the HTTP status and upstream machine code, e.g. `400 invalid_value`, at most 64 characters, never upstream text |
| `source_identity` | digest of `retry.source_identity` when the record was written |
@@ -116,7 +116,7 @@ and is pruned at the next write.
- **The probe spec belongs to the feature.**
- Hosted tools: [`vibey-hosted-tools.md`](vibey-hosted-tools.md) §3.2.
- Efforts: one minimal request at that effort. Only the efforts a user actually selects are ever probed.
-- **Probe evidence becomes stale** on an engine upgrade, a probe-shape change, or when it is 30 days old.
+- **Probe evidence becomes stale** on an engine upgrade that changes `hosted_wire`, a probe-shape change, or when it is 30 days old. A byte-identical engine upgrade keeps `hosted_wire`, so it re-probes nothing.
- **Current-wire staleness** (the record's `engine` or `shape` differs from the current one) matters for hosted
tools. Their positive evidence is needed because a native failure can be silent (§3.4). Evidence taken on another
wire cannot vouch for this one, and a silent drop would never trip a narrow rule. So stale hosted-tool `call` and
@@ -296,8 +296,8 @@ No new billing store, budget, or cap.
2. Only a narrow rule creates negative evidence. The rule names the (Source, model, feature) it learned. A generic
error creates none.
3. No probe runs without a user action, and every probe action shows its cost before it runs.
-4. Changing a Source's identity drops its evidence. An engine upgrade marks probe evidence stale; it does not
- delete it. Stale hosted-tool evidence from another engine or probe shape never authorizes native mode or native
+4. Changing a Source's identity drops its evidence. An engine upgrade that changes `hosted_wire` marks probe
+ evidence stale; it does not delete it. Stale hosted-tool evidence from another engine or probe shape never authorizes native mode or native
replay.
5. #2539: a Source that rejected `ultra` shows "ultra · not supported on this Source". The next request at `ultra`
either skips that hop or fails before invocation with `effort_unsupported`, never a provider 400.
diff --git a/docs/plans/vibey-hosted-tools.md b/docs/plans/vibey-hosted-tools.md
index 4ca8eb6f3..940bf8bd9 100644
--- a/docs/plans/vibey-hosted-tools.md
+++ b/docs/plans/vibey-hosted-tools.md
@@ -125,8 +125,9 @@ verified for X search.
minute left is not sent and reads as transient: try again.
- **Cost and when probes run.** A probe pair costs about $0.02–0.15 (spike: xAI $0.01–0.11 per call, Anthropic $0.01
per search plus tokens). The Tools tab shows the estimate before running.
-- **What changes probe results** (capability model §3.3). A Source identity change drops them. An engine upgrade or
- a probe-shape change makes them **current-wire stale**: they no longer describe the request being sent, so for
+- **What changes probe results** (capability model §3.3). A Source identity change drops them. A change of the engine
+ manifest's `hosted_wire` (an engine upgrade whose hosted passthrough is not byte-identical) or a probe-shape change
+ makes them **current-wire stale**: they no longer describe the request being sent, so for
routing they count as unknown (proxy and synthetic replay) until the user re-verifies. Age alone (30 days) only
marks them for re-verification and keeps routing.
- **Failures in real use demote evidence** through the narrow rules in capability model §3.2.
diff --git a/tests/scenarios/model_hub/catalog.yaml b/tests/scenarios/model_hub/catalog.yaml
index 85e711db0..926a2a4ed 100644
--- a/tests/scenarios/model_hub/catalog.yaml
+++ b/tests/scenarios/model_hub/catalog.yaml
@@ -193,6 +193,7 @@ scenarios:
test: tests/test_model_hub_capability_evidence.py::test_evidence_resolves_for_routing
related_tests:
- tests/test_model_hub_capability_evidence.py::test_a_changed_source_identity_reads_as_unknown_and_is_pruned
+ - tests/test_model_hub_capability_evidence.py::test_hosted_evidence_is_stamped_with_the_engines_hosted_wire
- tests/test_model_hub_capability_evidence.py::test_persisted_records_match_the_schema_and_unreadable_ones_are_unknown
- id: MH-HOSTED-004
name: The Tools API reads every tool's candidates and evidence and writes one toggle without touching other Model Hub state
diff --git a/tests/test_model_hub_capability_evidence.py b/tests/test_model_hub_capability_evidence.py
index fd0de77aa..8944e621d 100644
--- a/tests/test_model_hub_capability_evidence.py
+++ b/tests/test_model_hub_capability_evidence.py
@@ -17,6 +17,7 @@ from referencing import Registry, Resource
from config.v2_config import ModelHubModelConfig, ModelHubSourceConfig, ModelHubSourceStateConfig
from core.handlers.model_hub.capability_evidence import (
+ UNKNOWN_ENGINE_STAMP,
CapabilityEvidenceStore,
EvidenceFeature,
EvidenceRecord,
@@ -100,6 +101,29 @@ def test_evidence_resolves_for_routing(feature, changes, engine, shape, age, sta
assert view.changes_at == (record.observed_at + timedelta(days=30) if stale is None else None)
+ "manifest,stamp",
+ [
+ # A byte-identical engine upgrade carries the oldest such release forward: evidence stays current.
+ ({"hosted_wire": "model-hub-engine-v8.0.23-3", "asset_release_tag": "model-hub-engine-v8.0.28-1"}, "model-hub-engine-v8.0.23-3"),
+ # A manifest from before the field: its asset release, the value the release gate first carries forward.
+ ({"asset_release_tag": "model-hub-engine-v8.0.23-3"}, "model-hub-engine-v8.0.23-3"),
+ # A missing or malformed field never fails: the asset release stands in.
+ ({"hosted_wire": "", "asset_release_tag": "model-hub-engine-v8.0.28-1"}, "model-hub-engine-v8.0.28-1"),
+ ({"hosted_wire": 7, "asset_release_tag": "model-hub-engine-v8.0.28-1"}, "model-hub-engine-v8.0.28-1"),
+ ({}, UNKNOWN_ENGINE_STAMP),
+ ],
+)
+def test_hosted_evidence_is_stamped_with_the_engines_hosted_wire(tmp_path, monkeypatch, manifest, stamp):
+ """MH-HOSTED-003: evidence goes stale when the hosted wire changes, not on every engine release."""
+ from core.handlers.model_hub.hosted_tools import engine_stamp
+
+ path = tmp_path / "manifest.json"
+ path.write_text(json.dumps(manifest), encoding="utf-8")
+ monkeypatch.setenv("VIBE_MODEL_HUB_ENGINE_MANIFEST_PATH", str(path))
+ assert engine_stamp() == stamp
+
+
def test_a_changed_source_identity_reads_as_unknown_and_is_pruned(tmp_path):
store = CapabilityEvidenceStore(tmp_path / "model_hub_capability_evidence.json")
keep, rekeyed = _source("src_keep0001"), _source("src_swap0001")