# What happens when an instance accepts a federated peer's Agent Card before its mTLS trust anchor converges **Date of Record:** 2026 November 23 **Scope:** Applies to cross-organization agent federation where peer identity is established via mutual TLS and capabilities are discovered via signed Agent Card documents fetched over the same channel. Does not apply to single-tenant deployments where all agents share one trust domain, nor to federation brokered entirely through a third-party identity provider that pins peer certificates out-of-band. ## Core Distinction Federation has two independent verification surfaces that are routinely conflated: the **transport identity** (does this TLS peer hold a certificate chaining to an anchor I trust *right now*) and the **capability declaration** (does this Agent Card's signature resolve to the same identity, and does its `capabilities`/`schema_version` describe something I can actually invoke). The failure mode is not "bad signature" or "expired cert." It is **temporal skew between anchor convergence and capability ingestion**: an instance validates an inbound peer's mTLS handshake against a trust bundle that is still mid-rotation, then immediately fetches and caches the peer's Agent Card under a key derived from the *pre-rotation* anchor. The card is authentic at fetch time and orphaned milliseconds later. Subsequent invocations route to a peer identity that no longer matches the cached capability record, and the instance does not re-derive the binding because the handshake keeps succeeding against the *new* anchor while the cache still points at the old one. ## What Was Observed An instance `A` in org Alpha peers with `B` in org Beta. Beta rotates its intermediate CA, publishing a new trust anchor `K₂` alongside the retiring `K₁`. `A`'s trust-anchor distributor pushes `K₂` on a 30s gossip interval; `A`'s Agent Card cache has a 300s TTL. The sequence: 1. `B` begins presenting leaf certs chained to `K₂`. `A`'s TLS layer still trusts only `K₁`, so handshakes to `B` *fail closed* — correct behavior, no card fetched. 2. `A` receives `K₂` via gossip. Handshake to `B` now succeeds. `A` fetches `B`'s Agent Card, verifies the card signature against the key advertised in the card's `signature.keyid`, and caches it keyed by `(peer_org, agent_id)` — **not** by the certificate fingerprint or anchor generation. 3. Beta's `K₁` is retired and its CRL is published. Any *other* peer `C` of `A` that had pinned `K₁` now fails, but `A`'s cache entry for `B` is untouched. 4. Six hours later, `B`'s operator re-issues `B`'s Agent Card under a *different* signing key (key rotation on the application layer, independent of the CA rotation) and republishes. `A`'s cache still holds the old card, whose `signature.keyid` no longer corresponds to any key `B` will accept for warrant propagation. 5. `A` invokes `B` with a capability warrant minted against the stale card's `schema_version`. `B` rejects the warrant as unsigned-by-current-key. `A` interprets the rejection as a transient error, retries three times, then marks `B` degraded — but `B` is healthy. The federation is partitioned on a per-peer basis with no transport-level symptom. The observable signature is asymmetric: TLS metrics are green, card-fetch metrics are green (the fetch succeeded once, long ago), and only warrant-acceptance counters on the *peer* side show the drop. `A` has no signal that its own cache is the fault line. ## Condition of Validity The invariant that must hold for federation to be sound is a **binding invariant**, not a freshness invariant: > For every cached Agent Card entry, the tuple `(peer_cert_fingerprint, signing_keyid, schema_version)` recorded at fetch time must still be simultaneously valid against the peer's *current* transport identity and its *current* signing key at the moment of every invocation. A TTL-based cache satisfies "the card was valid when fetched." It does not satisfy the binding invariant, because the three components rotate on independent schedules: the CA anchor rotates on Beta's PKI cadence, the signing key rotates on Beta's application cadence, and the schema version changes on Beta's release cadence. Any one of the three invalidates the binding; a TTL only bounds how long a *fully stale* card survives, not how long a *partially stale* one does. The condition of validity is therefore: the cache must be invalidated by *any* of the three rotations, which means the cache key must include all three, and the instance must re-verify the binding on every invocation — not merely on cache miss. ## Decision Boundary The boundary between "safe to serve from cache" and "must re-bind" is crossed the instant **any** of the following is true, and the instance must treat them as equivalent triggers: - The peer's presented leaf certificate fingerprint differs from the one recorded at fetch time (re-handshake after any re-issue, including benign cert renewal). - The `signature.keyid` in the cached card is absent from the peer's currently advertised key set (detectable via a lightweight `keys` endpoint or the card's own `previous_keys` field). - The cached `schema_version` is not in the peer's currently advertised `supported_schema_versions`. - The trust anchor generation counter observed at handshake time is greater than the generation recorded at fetch time. The non-obvious part: the *first* condition fires on routine cert renewal that changes nothing semantically, so a naive implementation that re-fetches on every fingerprint change will thrash under short-lived certs. The correct boundary is to re-fetch only when the fingerprint change is accompanied by a *change in the signing key set or schema set* — i.e., re-bind on the intersection, not the union. Re-fetching on fingerprint change alone converts a correctness fix into a load amplifier against the peer's discovery endpoint, which under federation fan-out becomes a self-inflicted DoS. ## Operational Effect The guardrail is a **generation-stamped binding cache** with re-verification at invocation time, plus a federation-level reconciliation loop that treats the peer's advertised key/schema set as the authority and the cached card as a *claim* to be re-validated. Concretely: store `anchor_generation`, `cert_fingerprint`, `signing_keyid`, and `schema_version` alongside the card; on every invocation attempt, compare the live handshake's anchor generation and cert fingerprint against the stored values, and if either differs, perform a cheap key-set probe before serving. If the probe shows the signing key or schema has moved, evict and re-fetch; if not, update the stored generation/fingerprint in place without a re-fetch. This bounds re-fetch churn to actual semantic rotations while guaranteeing the binding invariant. The second operational effect is observability: warrant-acceptance counters must be correlated with the *caller's* cache generation, not just the callee's. A peer-side rejection that arrives with a caller-side generation older than the peer's advertised generation is a cache-staleness event, not a peer failure, and must not trip the circuit breaker that marks the peer degraded. Without this correlation, the failure mode presents as a silent per-peer partition that survives every health check. ```python import time from dataclasses import dataclass, field class FederationBindingError(RuntimeError): """Raised when a cached Agent Card's binding tuple no longer matches the peer's live identity.""" pass @dataclass class CardBinding: anchor_generation: int cert_fingerprint: str signing_keyid: str schema_version: str fetched_at: float card: dict = field(default_factory=dict) class BindingCache: def __init__(self, max_age_s: float = 300.0): self._entries: dict[tuple[str, str], CardBinding] = {} self._max_age_s = max_age_s def store(self, peer_org: str, agent_id: str, binding: CardBinding) -> None: self._entries[(peer_org, agent_id)] = binding def resolve( self, peer_org: str, agent_id: str, live_anchor_generation: int, live_cert_fingerprint: str, live_keyids: set[str], live_schemas: set[str], now: float | None = None, ) -> CardBinding: now = now if now is not None else time.time() key = (peer_org, agent_id) entry = self._entries.get(key) if entry is None: raise FederationBindingError( f"no cached card for {peer_org}/{agent_id}; cold fetch required" ) # Binding invariant: all three components must be simultaneously valid. if entry.signing_keyid not in live_keyids: del self._entries[key] raise FederationBindingError( f"signing key {entry.signing_keyid!r} for {peer_org}/{agent_id} " f"absent from live key set {sorted(live_keyids)}; evict and re-fetch" ) if entry.schema_version not in live_schemas: del self._entries[key] raise FederationBindingError( f"schema {entry.schema_version!r} for {peer_org}/{agent_id} " f"not in live set {sorted(live_schemas)}; evict and re-fetch" ) # Anchor/fingerprint drift alone does NOT force re-fetch (avoids churn on # benign cert renewal) -- it updates the stored generation in place. if ( entry.anchor_generation != live_anchor_generation or entry.cert_fingerprint != live_cert_fingerprint ): entry.anchor_generation = live_anchor_generation entry.cert_fingerprint = live_cert_fingerprint if now - entry.fetched_at > self._max_age_s: raise FederationBindingError( f"card for {peer_org}/{agent_id} exceeded max age " f"({now - entry.fetched_at:.1f}s > {self._max_age_s}s); re-fetch" ) return entry def invoke_peer( cache: BindingCache, peer_org: str, agent_id: str, live_anchor_generation: int, live_cert_fingerprint: str, live_keyids: set[str], live_schemas: set[str], ) -> dict: try: binding = cache.resolve( peer_org, agent_id, live_anchor_generation, live_cert_fingerprint, live_keyids, live_schemas, ) except FederationBindingError as exc: # Caller must re-fetch the card and re-bind before retrying; must NOT # mark the peer degraded, because the fault is local cache staleness. raise FederationBindingError( f"refusing to invoke {peer_org}/{agent_id}: {exc}" ) from exc return binding.card ```