# Why does an instance accept a stale capability warrant after a registry re-advertisement race? **Date of Record:** 2026 November 27 **Scope:** Applies to multi-agent systems where agents discover peers/tools through a mutable registry that re-advertises capability descriptors (schema hashes, version tags, warrant signatures) while in-flight task handoffs are still referencing a previously resolved descriptor. Does not apply to static, compile-time-bound tool manifests or to single-agent tool calling with no registry indirection. ## Core Distinction The failure is not "the registry returned a wrong answer." It is that **capability resolution and capability execution are two separate reads against a mutable store, with no version pinning between them**. An agent resolves a peer's capability descriptor at time T0, receives a valid signed warrant binding `(peer_id, schema_hash, version)`, then executes at T1 after the peer has re-advertised with a new `schema_hash` under the *same* `peer_id` and *same* monotonic version counter that was reset during a peer restart. The executor's local cache keyed on `peer_id` (not on `schema_hash`) resolves the stale warrant as still valid because the signature verifies and the version is not *lower* than the cached one — it is merely *different*, and the comparison logic was written as `>=` rather than `==`. The subtle invariant that gets violated: **a capability warrant is only meaningful relative to the exact descriptor bytes it was signed over.** Registries that treat warrants as identity-bound rather than content-bound allow a peer to silently swap the callable behind a stable identity, and callers that pin on identity will route arguments shaped for the old schema into a handler expecting the new one. This is a boundary condition, not a crash: the call succeeds, returns a well-formed response, and the corruption surfaces three hops later as a reasoning divergence. ## What Was Observed A three-agent pipeline (planner → executor → auditor) routed a structured extraction task through a registry-backed tool `doc.parse`. The peer process hosting `doc.parse` was redeployed with a widened schema: `page_range: {start:int, end:int}` became `page_range: {start:int, end:int, inclusive:bool}` with `inclusive` defaulting to `false` in the new handler but `true` in the old one. Trace: 1. **T0** — Planner calls `registry.resolve("doc.parse")`, receives descriptor `D_old` with `schema_hash=h1`, warrant `W1 = sign(peer_pk, (peer_id, h1, v=7))`. Caches under key `("doc.parse", peer_id)`. 2. **T0+40ms** — Peer restarts. Registry entry overwritten: `schema_hash=h2`, `v=1` (counter reset on process restart; the registry accepted it because it only enforced monotonicity *per lease*, and the lease had expired). 3. **T1** — Executor, holding the cached `W1`, verifies signature (valid), checks `v_cached=7 >= v_registry=1` → **passes the staleness check** because the guard was written to reject only *older* versions. Routes a call with `page_range={start:1,end:9}` and no `inclusive` field. 4. **T1+12ms** — New handler defaults `inclusive=false`, returns pages 1–8. Well-formed JSON. No error. 5. **T2** — Auditor replays the executor's transcript against the *current* descriptor `D_new` and sees a call missing a required-in-new-schema field. Flags a schema violation. Planner receives "auditor rejected executor output" and re-plans, re-resolving to `D_new`, re-executing, and now double-counting page 9. Ground-truth extraction is off by one page and the pipeline reports success. The observable signature is **a verification replay discrepancy that is not accompanied by any transport error, signature failure, or version regression**. The auditor and executor disagree about which schema was in force, and both are locally correct. ## Condition of Validity The stale-warrant acceptance is only reachable when all of the following hold simultaneously: - The registry permits a `peer_id` to be re-bound to a new `schema_hash` without invalidating outstanding warrants for the old hash (i.e., warrants are identity-scoped, not content-scoped). - The caller's cache key omits `schema_hash` — typically keyed on the human-readable tool name or `peer_id` alone. - The staleness guard compares versions with an inequality (`>=`, `>`) rather than requiring exact descriptor-hash equality, or the version counter is not globally monotonic across peer restarts. - The new handler is *tolerant* of the old argument shape (defaults, permissive parsing, `**kwargs`), so the mismatch does not raise at the call boundary. Remove any one condition and the failure becomes a hard error instead of silent divergence. The dangerous configuration is precisely the one that looks robust: permissive handlers plus version-tolerant guards. ## Decision Boundary The correct guardrail is **content-addressed warrants with mandatory hash pinning at execution time**. Concretely: - A warrant MUST bind `(peer_id, schema_hash, descriptor_digest, issued_at, ttl)` and the digest MUST cover the full callable schema, not just a version integer. - The executor MUST re-fetch the descriptor at call time and abort if `schema_hash != warrant.schema_hash`. Version counters are advisory only; they are not a correctness mechanism because they are not stable across restarts. - The registry MUST reject a `schema_hash` change for a live `peer_id` unless it first publishes a tombstone that invalidates outstanding warrants for the prior hash, with a grace window bounded by the warrant TTL. - The auditor MUST replay against the descriptor hash recorded *in the executor's transcript*, not against the registry's current state. Replay against live state is only valid if the transcript pins the hash. The boundary is sharp: if the transcript does not carry the `schema_hash` that was in force at execution, the auditor's verdict is unfalsifiable and must be treated as advisory, not as a rejection authority. ## Operational Effect Downstream, this manifests as **silent semantic drift under successful execution**: token budgets are consumed on a re-plan that would not have been necessary under hash pinning, the re-plan introduces a double-count that the auditor cannot localize because it is comparing against the wrong schema, and the final answer carries no error signal. The compounding cost is the second-order one — the planner's re-plan loop is triggered by a *false* auditor rejection, so the agent's error-correction machinery is actively making the output worse while reporting higher confidence. In systems with retry budgets, this pattern burns the budget on phantom rejections and leaves none for genuine ones. The invariant to enforce operationally: **no capability call may execute without a descriptor hash that matches its warrant, and no audit may reject without a transcript-pinned hash.** Everything else is a heuristic that will eventually route a valid warrant into the wrong callable. ```python import hashlib from dataclasses import dataclass class StaleCapabilityWarrantError(RuntimeError): """Raised when a warrant's bound schema_hash does not match the descriptor resolved at execution time. This is the guard that converts silent schema-drift divergence into a hard, localized failure.""" @dataclass(frozen=True) class Descriptor: peer_id: str schema: dict version: int @property def schema_hash(self) -> str: canon = repr(sorted(self.schema.items())).encode() return hashlib.sha256(canon).hexdigest() @dataclass(frozen=True) class Warrant: peer_id: str schema_hash: str issued_at: float ttl: float def execute_with_pinned_warrant( warrant: Warrant, live_descriptor: Descriptor, now: float, args: dict, ) -> dict: # Identity must match. if live_descriptor.peer_id != warrant.peer_id: raise StaleCapabilityWarrantError( f"peer mismatch: warrant={warrant.peer_id} live={live_descriptor.peer_id}" ) # TTL must be live; a version-tolerant check is explicitly NOT used here. if now > warrant.issued_at + warrant.ttl: raise StaleCapabilityWarrantError( f"warrant expired at {warrant.issued_at + warrant.ttl}, now={now}" ) # The invariant: content-addressed equality, not version inequality. if live_descriptor.schema_hash != warrant.schema_hash: raise StaleCapabilityWarrantError( "schema_hash drift: warrant bound " f"{warrant.schema_hash[:12]} but live descriptor is " f"{live_descriptor.schema_hash[:12]} (version={live_descriptor.version}). " "Refusing to route args shaped for a different callable." ) return {"peer": live_descriptor.peer_id, "args": args, "schema_hash": warrant.schema_hash} ```