# What structural signals indicate a manifest-signature replay window collapse in agent-to-agent capability discovery **Date of Record:** 2026 November 28 **Scope:** Applies to A2A capability discovery where agents publish signed capability manifests (capability name, input/output JSON Schema, TTL, issuer key id, nonce, monotonic counter) and peers compose against them at negotiation time. Does not cover transport-layer TLS failures, key-compromise revocation, or MCP tool-schema negotiation inside a single host. ## Core Distinction The failure is not "an unsigned manifest was accepted" or "a signature failed to verify." Both of those are loud, and every framework catches them. The failure is that a *validly signed, freshly nonce'd, correctly chained* manifest was replayed inside its declared TTL window after the issuer had already published a superseding manifest — and the verifier's capability cache, keyed on `(issuer, capability_name)` rather than `(issuer, capability_name, manifest_hash)`, silently served the stale entry to the composition planner. The structural tell is a divergence between two clocks that the protocol pretends are one. A manifest carries a `valid_until` wall-clock TTL *and* a `seq` monotonic counter. Replay protection is only sound if the verifier enforces `seq > last_seen_seq` *and* the cache is invalidated on any observed higher `seq` for the same issuer. When an issuer rotates keys and re-signs the same capability at the same `seq` (a common recovery path after a botched re-issue), the counter does not advance, the cache does not invalidate, and a peer composes against a schema that the issuer believes it retired. The signature is valid. The TTL is valid. The composition is wrong. ## What Was Observed A three-agent pipeline: `planner` (composes), `retriever` (issues a `search_docs` capability), `auditor` (verifies manifests before the planner commits). The retriever published manifest `M1` at `seq=41` advertising `search_docs` with an input schema requiring `{"query": str, "top_k": int}`. At `seq=42` it published `M2` where `top_k` became optional and a required `corpus` field was added — a breaking change, correctly bumped. The retriever's key-rotation runbook triggered: it re-signed `M2` under a new key id `k2` because the old key was scheduled for retirement, but the re-signing tool copied the `seq` field from the *last manifest it had loaded from disk*, which was `M1` at `seq=41`. The resulting `M2'` carried `seq=41`, `key_id=k2`, `valid_until=+300s`, and a fresh nonce. The auditor verified `M2'`'s signature against `k2` — pass. It checked `seq=41 > last_seen_seq[retriever]=41` — **fail**, and here is the divergence: instead of rejecting, the auditor's replay guard was written as `if seq < last_seen_seq: reject`. Equal counters were treated as "idempotent re-delivery" and allowed through, a defensive choice made for at-least-once transport. The auditor then wrote `M2'` into the cache under key `(retriever, "search_docs")`, overwriting `M2`'s entry because the cache key did not include the manifest hash. The planner, composing next, read the cache and generated a call `search_docs({"query": "..."})` with no `corpus` field. The retriever, running `M2` logic, rejected it with a schema violation. The planner retried twice with backoff, then fell back to a *different* capability the retriever had also published — `search_docs_legacy` — which the retriever had deprecated in `M2` but whose retirement was expressed only as a manifest `status: deprecated` flag that the planner's composition ranking weighted at 0.1 rather than excluding. The pipeline completed on the deprecated path and returned results against an index that had been frozen eight hours earlier. Three manifests, all validly signed, all within TTL, all nonce-fresh. The only broken invariant was `seq` monotonicity across a key rotation, and the only reason it mattered was that the cache key omitted the content hash, so a lower-or-equal `seq` overwrote a higher one. ## Condition of Validity The replay guard `seq > last_seen_seq` is sound **only if** the issuer guarantees strictly increasing `seq` across every re-issue, including key rotation and disaster recovery. That guarantee is not enforceable by the verifier and is routinely violated by re-signing tools that reconstruct manifests from persisted state rather than from the live counter. The condition of validity is therefore narrower than the protocol documents: 1. A manifest is admissible for composition only if `seq` strictly exceeds the issuer's highest previously observed `seq` **and** the verifier's cache is keyed on `(issuer, capability_name, manifest_hash)` so that a re-delivery of an *older* manifest cannot displace a newer one. 2. A key rotation MUST be accompanied by a `seq` bump, and the verifier MUST treat `key_id` change with unchanged `seq` as a *rotation anomaly* requiring out-of-band confirmation, not as an idempotent retry. 3. Deprecation MUST be expressed as absence from the admissible set, not as a low ranking weight. A deprecated capability that remains discoverable is a fallback trap: composition planners under retry pressure will reach for it, and the retriever will serve it, because neither side's manifest says "do not call." ## Decision Boundary The boundary between "reject and renegotiate" and "accept and compose" sits at the `seq` comparison, and the correct predicate is strict inequality with a distinct branch for equality: - `incoming.seq > last_seen_seq`: accept, invalidate any cached entry for the same `(issuer, capability_name)` regardless of hash, update `last_seen_seq`. - `incoming.seq == last_seen_seq` **and** `incoming.manifest_hash == cached.manifest_hash`: idempotent re-delivery, accept without cache write. - `incoming.seq == last_seen_seq` **and** `incoming.manifest_hash != cached.manifest_hash`: **rotation anomaly** — reject, quarantine, require the issuer to re-issue with `seq+1`. This is the branch that was missing. - `incoming.seq < last_seen_seq`: replay, reject unconditionally; do not fall back to the cached entry silently, because the cached entry may itself be the stale one. The auditor's `if seq < last_seen_seq: reject` collapsed the equality case into the accept path and, worse, performed a cache write on the accept path. Both are required to be separate operations: admission and cache mutation must not share a branch. ## Operational Effect The observable consequence is that composition succeeds against a retired schema and fails *downstream*, at the retriever, where the error surfaces as a schema violation indistinguishable from a planner bug. Debugging effort is misdirected to the planner's argument construction for as long as the manifest cache holds the stale entry — up to the full TTL, and indefinitely if the cache has no TTL of its own (it did not; the cache was keyed without expiry because "manifests have their own `valid_until`," which the cache never read). The invariant to enforce, stated as an assertion the verifier can check locally: **for every `(issuer, capability_name)`, the cached manifest hash must equal the hash of the manifest with the maximum `seq` the verifier has ever admitted for that pair, and no manifest with `seq` less than that maximum may be served to a composition planner.** The rotation anomaly is the only case that can violate this from a validly signed input, and it is detectable purely from `(seq, manifest_hash, key_id)` without trusting the issuer. ```python import hashlib import json from dataclasses import dataclass, field class ManifestRotationAnomaly(RuntimeError): """Raised when a validly signed manifest reuses a seq with different content.""" @dataclass class Manifest: issuer: str capability: str seq: int key_id: str valid_until: float schema: dict status: str = "active" def manifest_hash(self) -> str: body = json.dumps( {"capability": self.capability, "seq": self.seq, "key_id": self.key_id, "schema": self.schema, "status": self.status}, sort_keys=True, ) return hashlib.sha256(body.encode()).hexdigest() @dataclass class CapabilityCache: # keyed on (issuer, capability) -> (seq, manifest_hash, manifest) entries: dict = field(default_factory=dict) last_seen_seq: dict = field(default_factory=dict) def admit(self, m: Manifest, now: float) -> Manifest: if m.valid_until <= now: raise ManifestRotationAnomaly( f"manifest {m.capability} from {m.issuer} expired at {m.valid_until}" ) key = (m.issuer, m.capability) prev_seq = self.last_seen_seq.get(key) incoming_hash = m.manifest_hash() if prev_seq is None or m.seq > prev_seq: # Strictly newer: invalidate any cached entry regardless of hash. self.entries[key] = (m.seq, incoming_hash, m) self.last_seen_seq[key] = m.seq return m if m.seq == prev_seq: cached_seq, cached_hash, cached = self.entries.get(key, (None, None, None)) if cached_hash == incoming_hash: return cached # idempotent re-delivery, no cache write # Same seq, different content, possibly rotated key: quarantine. raise ManifestRotationAnomaly( f"rotation anomaly for {key}: seq={m.seq} " f"cached_hash={cached_hash} incoming_hash={incoming_hash} " f"key_id={m.key_id}; issuer must re-issue at seq={m.seq + 1}" ) # m.seq < prev_seq: replay, reject without serving cached entry. raise ManifestRotationAnomaly( f"replay rejected for {key}: seq={m.seq} < last_seen={prev_seq}" ) def admissible(self, issuer: str, capability: str) -> Manifest: entry = self.entries.get((issuer, capability)) if entry is None: raise ManifestRotationAnomaly(f"no admitted manifest for {(issuer, capability)}") _, _, m = entry if m.status != "active": # Deprecated capabilities must be absent, not low-ranked. raise ManifestRotationAnomaly( f"capability {capability} from {issuer} is {m.status}; exclude from composition" ) return m ```