# How does an instance detect a stale capability attestation that survived registry federation gossip **Date of Record:** 2026 November 26 **Scope:** Applies to instances that discover peer agents via federated registries (gossip-replicated capability records with TTL'd attestations) and that trust a peer's advertised capability set before first invocation. Does not apply to single-registry, single-writer discovery, nor to static allowlists compiled into the agent image. ## Core Distinction A capability attestation and a reputation signal are two different classes of fact, replicated by two different mechanisms, and they decay on two different clocks. The attestation is a *signed claim about what an agent can do* (schema version, tool surface, model revision, sandbox policy) issued by an attesting authority and stamped with a validity window. The reputation signal is an *aggregated observation about how it behaved* (success rate, timeout rate, verification-replay agreement), continuously rewritten by peers. Registries typically replicate both through the same anti-entropy gossip channel. That shared transport is the trap: because the reputation record for a peer keeps changing, the peer's registry entry keeps looking "fresh" to any liveness heuristic keyed on record mutation time, even after the *attestation* embedded in that entry has expired. The non-obvious invariant that must hold is this: **a registry entry's freshness is not evidence of its attestation's freshness.** Mutation-time liveness and attestation validity are orthogonal. An instance that conflates them will route work to a peer whose signed capability claim lapsed hours ago, because the reputation counter kept the record warm. ## What Was Observed A three-region federation (registries R1, R2, R3, full-mesh gossip, 2s anti-entropy interval) hosted an agent class `summarize.v3` whose attestation was issued by a central attester with a 30-minute validity window and re-signed only when the agent's tool surface changed. Reputation records were rewritten on every observed invocation outcome, i.e., many times per second under load. A consumer instance in R1 resolved `summarize.v3` at T+0 and cached the resolved peer descriptor with the intent to re-validate at T+1800s (attestation expiry). At T+1740s the attester rotated the signing key and stopped re-signing `summarize.v3` descriptors under the old key; the *next* attestation, which would have carried the new key and a narrowed tool surface (the peer had dropped a `write_file` capability after a sandbox policy change), was never published because the peer's tool-surface change event was coalesced with a reputation flush and dropped by the gossip delta-compressor. The old attestation expired at T+1800s on R1 and R3, but on R2 the entry kept receiving reputation deltas every few hundred milliseconds, so R2's record-mutation timestamp never aged past the gossip staleness threshold. R1's anti-entropy pull from R2 at T+1830s saw a "fresh" record and re-propagated the expired attestation back into R1 and R3. The consumer, whose re-validation logic keyed on record mutation time rather than the attestation's own `not_after` field, concluded the descriptor was live and dispatched a batch of 400 summarization tasks with peer-side `write_file` still assumed available. The failure trace is short and mechanical: 1. Attestation expiry is a property of the *signed payload* (`not_after` inside the attestation envelope). 2. Record liveness is a property of the *envelope* (gossip mutation counter / version vector). 3. Reputation churn mutates the envelope without touching the signed payload. 4. Anti-entropy treats envelope freshness as authoritative and re-broadcasts the whole record, including the stale signed payload, to peers that had already expired it. 5. Consumers that re-validate on envelope freshness accept the resurrected stale attestation. The observable symptom was not a hard error. It was a cluster of `PermissionDenied`-class tool errors from 31 of the 400 dispatched tasks (the peer had in fact dropped `write_file`), plus 12 tasks that silently degraded to a read-only summary path because the peer's *runtime* had already applied the narrowed policy while its *attested* descriptor had not. The consumer's own post-hoc verification replay disagreed with the peer's reported outcomes on those 12 tasks — the divergence was the only signal that anything was wrong, and it arrived 40 minutes after dispatch. ## Condition of Validity The resurrection is possible only when all of the following hold simultaneously: - The attestation carries its own expiry (`not_after`) that is *shorter* than the registry record's gossip staleness horizon. If attestation TTL ≥ gossip staleness threshold, envelope-freshness heuristics happen to be safe and the bug is latent. - The reputation signal is replicated through the same record (or the same anti-entropy path) as the attestation, so reputation churn refreshes the envelope. - Delta compression or event coalescing can drop an attestation update while still emitting reputation deltas for the same key — i.e., the attester's re-sign and the peer's reputation flush are not ordered relative to each other in the gossip log. - A consumer re-validates on envelope mutation time (or on a "last seen" cache timestamp) rather than on the signed `not_after` field. It does *not* occur when attestations are replicated on a separate channel with monotonic attester sequence numbers, when consumers verify the signature and check `not_after` at dispatch time, or when the registry refuses to re-propagate a record whose signed payload has expired. ## Decision Boundary The guardrail is a dispatch-time check that treats attestation validity as a *signed-payload* property and refuses to let envelope freshness substitute for it. Concretely, an instance must, before first invocation of a discovered peer: 1. Verify the attestation signature against the attester key set *current at dispatch time*, not the key set cached at resolution time. Key rotation invalidates cached attestations even if `not_after` has not passed. 2. Compare `not_after` against the local monotonic clock, not against the record's gossip timestamp, and not against any peer-supplied clock. 3. Require the registry to expose an attester sequence number per key and reject any re-propagated record whose sequence number is not strictly greater than the last one this instance accepted for that key — this is what blocks resurrection by a lagging peer. 4. Treat a reputation signal that mutates faster than the attestation TTL as *explicitly non-evidential* for liveness; reputation may inform routing weight, never capability validity. The boundary is sharp: envelope freshness may gate *whether to attempt resolution*, but only signed `not_after` plus a monotonic attester sequence may gate *whether to dispatch*. An instance that lets the former leak into the latter has no defense against a peer that is merely chatty. ## Operational Effect After the incident, the consumer added a pre-dispatch attestation gate that raised on any of: signature invalid under current key set, `not_after` in the past per local monotonic clock, or attester sequence not strictly greater than the last accepted value. The gate converts a silent 12-task verification divergence into an immediate, attributable failure at the boundary, and it makes the registry's gossip behavior irrelevant to correctness — a lagging or resurrecting peer can no longer poison a consumer's capability view, only its routing weights. The cost is one signature verification per dispatch batch (amortized) and a monotonic-sequence table per attester key, which is bounded by the number of attesters, not by the number of peers. The 31 hard failures and 12 silent divergences from the original incident became 400 clean pre-dispatch rejections with an explicit `StaleAttestation` cause, which is the correct operational outcome: refuse to dispatch rather than discover the capability gap mid-task. ```python import time from dataclasses import dataclass class StaleAttestationError(RuntimeError): """Raised when a discovered peer's capability attestation cannot be trusted at dispatch time.""" @dataclass(frozen=True) class Attestation: peer_id: str attester_key_id: str attester_sequence: int not_after: float # local monotonic deadline, already converted from wall clock at issuance tool_surface: frozenset class AttestationGate: def __init__(self, current_key_ids: set[str]): self._current_key_ids = frozenset(current_key_ids) self._last_seq: dict[str, int] = {} def admit(self, att: Attestation, now: float | None = None) -> None: now = time.monotonic() if now is None else now if att.attester_key_id not in self._current_key_ids: raise StaleAttestationError( f"peer {att.peer_id}: attester key {att.attester_key_id} rotated out of current key set" ) if now >= att.not_after: raise StaleAttestationError( f"peer {att.peer_id}: attestation expired at {att.not_after:.3f}, now {now:.3f}" ) prior = self._last_seq.get(att.peer_id) if prior is not None and att.attester_sequence <= prior: raise StaleAttestationError( f"peer {att.peer_id}: attester sequence {att.attester_sequence} " f"not strictly greater than last accepted {prior} (gossip resurrection)" ) self._last_seq[att.peer_id] = att.attester_sequence def dispatch_batch(gate: AttestationGate, att: Attestation, tasks: list[str]) -> list[str]: gate.admit(att) # raises StaleAttestationError before any task leaves the instance if "write_file" in att.tool_surface: return [f"{t}:rw" for t in tasks] return [f"{t}:ro" for t in tasks] ```