# Where must an instance re-verify a federated peer's capability attestation after a trust-anchor rotation, and why does the naive answer break? **Date of Record:** 2026 November 22 **Scope:** Applies to cross-org multi-agent federations where peer capabilities are asserted via signed attestation chains anchored in a foreign trust domain, and where that foreign trust anchor can rotate (key rollover, CA replacement, org merger/split) mid-session. Does not apply to single-org swarms sharing one trust root, nor to stateless one-shot RPC where no capability cache survives the call. ## Core Distinction The intuitive invariant is *"verify the attestation once at handoff, then trust the peer for the life of the task."* That invariant is wrong in a specific, non-obvious way: it conflates **identity continuity** (this peer is still the same principal) with **capability continuity** (this peer is still authorized for the specific capability I am about to invoke). A trust-anchor rotation preserves the first and can silently invalidate the second. The failure mode is **attestation staleness under anchor rotation**: a peer `P` in org `B` presents a capability attestation `A` signed by an intermediate `I`, chained to trust anchor `T_B`. The consuming org `A` caches `(P, capability, A, T_B)` as a validated grant. Org `B` then rotates `T_B → T_B'` (scheduled rollover, or forced by key compromise). The rotation may: 1. **Revoke the intermediate `I`** — `A` is now signed by a chain that no longer terminates in a live anchor. `P` is still `P`, still reachable, still responds. But its *warrant* to exercise the capability is dead. 2. **Narrow the capability set** the anchor delegates — `T_B'` may issue to a *different* policy scope, so `A`'s claimed capability is no longer within the anchor's authority even though the signature verifies. 3. **Re-issue `A` with a shorter validity window** — the new anchor's policy may cap attestation TTL below the cached one. In all three cases, a signature check on the *cached* `A` against the *cached* `T_B` still returns `valid`. The verifier has no reason to re-fetch. This is the trap: **the verification result is a function of (attestation, anchor-set, policy-epoch), and the cache keys on only the first two.** ## What Was Observed A federation of two agent pools — org `A` (orchestrator) and org `B` (tool-executor pool) — exchanged anchors at session start. `A`'s planner resolved a multi-step task, cached `B`'s capability attestations for `fs.write` and `net.egress` at step 0, and reused them across ~40 tool-call handoffs over a 25-minute run. At T+14min, org `B`'s security team executed an emergency rotation: anchor `T_B` revoked, `T_B'` published with a **reduced capability scope** (the `net.egress` capability was pulled from the intermediate that `A` had cached). Org `B`'s executors *did* honor the new policy locally — the executor process refused `net.egress` calls. But `A`'s planner had already *planned* three subsequent steps assuming egress was available, and its cached attestation check kept returning `valid` because it never re-fetched `T_B'`. The observable trace: - Step 22: `A` invokes `B`'s executor with `net.egress` → executor returns `403 capability_withdrawn`. - Step 23: `A`'s planner, seeing a *tool error* rather than an *attestation failure*, retries the same call twice (its retry policy treats `403` as transient), then **falls back to a different peer in `B`** that it also had cached — same stale attestation, same rejection. - Step 24–26: planner enters a retry/fallback loop, exhausts its token budget, and terminates the task with a partial result *and* a corrupted episodic record claiming `net.egress` was "unavailable due to network fault." Two distinct damages: the task failed (recoverable), and **the failure was misclassified and written to memory as a network fault** (not recoverable without reconciliation). A later task resumed from that episodic record and pre-emptively avoided `net.egress`, even after `B` restored the capability. The root cause is not the rotation. It is that `A` never treated the anchor-set as a **versioned, mutable input to the verification function**. It cached a *result* where it should have cached a *(result, anchor-epoch)* pair and re-validated on epoch change. ## Condition of Validity The "verify once at handoff" invariant is *only* valid under all of: 1. **Anchor immutability for the session lifetime** — no rotation, revocation, or scope change on `T_B` between handoff and final use. This is rarely contractually guaranteed across orgs. 2. **Executor-side enforcement is authoritative and self-describing** — the executor must return a *capability-specific* rejection (e.g., `capability_withdrawn`, with the new anchor epoch), not a generic `403`/`401` that is indistinguishable from transient auth blips. 3. **The consumer's retry/fallback policy distinguishes attestation failure from transport failure** — otherwise the planner misclassifies and corrupts memory as observed. Break any one and the cached-grant model produces stale authorization. In practice (2) and (3) are the ones orgs get wrong, because they look like ordinary error-handling concerns rather than trust-boundary concerns. ## Decision Boundary The correct invariant is: **a capability grant is valid only relative to an anchor-epoch, and any use of a cached grant must be gated on (a) the anchor-epoch being unchanged, or (b) a fresh re-verification against the current anchor-set.** Concretely, the boundary is drawn at the **handoff**, not at the session: - At each cross-org handoff, the consumer must present its cached `(attestation, anchor-epoch)` and the producer must either confirm the epoch is current or return a `stale_anchor` signal with the new epoch. - On `stale_anchor`, the consumer **must** discard the cached grant, re-fetch the anchor-set, re-verify, and — critically — **re-plan** any pending steps that depended on the withdrawn capability. Re-verification alone is insufficient; the *plan* is now invalid. - Executor rejections must be **typed**: `capability_withdrawn` (permanent, do not retry, re-plan) vs `capability_transient` (retry) vs `transport_error` (retry with backoff). Collapsing these into `403` is the proximate cause of the memory corruption. The boundary also has a **cost side**: re-verifying on every handoff is expensive (anchor fetch, chain validation). The pragmatic rule is to re-verify on *epoch change signal* or on a bounded TTL (e.g., every N handoffs or T seconds), whichever comes first — but the epoch-change signal must be *push* (producer notifies) or *cheap-poll* (epoch counter in every response header), never *pull-on-suspicion*, because suspicion only arises after a failure, which is too late. ## Operational Effect When the epoch-gated invariant is enforced: - Stale grants are caught at handoff, before a tool call is issued, so the planner re-plans rather than retries. Token budget is preserved. - Capability withdrawals propagate as *plan invalidations*, not as tool errors, so the episodic record correctly notes "capability withdrawn at anchor epoch N" rather than "network fault." Downstream tasks resume with correct priors. - The failure is **attributable**: the record shows which org rotated which anchor at which epoch, which is what auditors need for cross-org incident review. When it is not enforced, the observed pathology generalizes: planners misclassify authorization failures as transport failures, retry into exhaustion, and write corrupted episodic memory that poisons future sessions. The corruption is *silent* — the task completes with a plausible-looking partial result — which is why this boundary is worth pinning explicitly. ```python from dataclasses import dataclass from typing import Optional class StaleAttestationError(RuntimeError): """Raised when a cached capability grant is used against a rotated anchor-epoch.""" pass class CapabilityWithdrawnError(RuntimeError): """Raised when the producer reports the capability is no longer delegated.""" pass @dataclass(frozen=True) class CachedGrant: peer_id: str capability: str attestation: bytes anchor_epoch: int @dataclass(frozen=True) class HandoffResponse: accepted: bool current_anchor_epoch: int rejection_kind: Optional[str] = None # None | "capability_withdrawn" | "capability_transient" | "transport_error" def use_cached_grant(grant: CachedGrant, resp: HandoffResponse) -> None: """ Gate a cached cross-org capability grant on anchor-epoch continuity. Must be called at every handoff, not once per session. """ if resp.current_anchor_epoch != grant.anchor_epoch: # Anchor rotated since the grant was cached. The signature on the # cached attestation may still verify against the *old* anchor, but # the grant is no longer valid relative to the live trust domain. raise StaleAttestationError( f"peer={grant.peer_id} cap={grant.capability} " f"cached_epoch={grant.anchor_epoch} live_epoch={resp.current_anchor_epoch}; " f"discard grant, re-fetch anchor-set, re-verify, and re-plan pending steps" ) if not resp.accepted and resp.rejection_kind == "capability_withdrawn": # Same epoch, but the producer withdrew the capability (e.g., policy # narrowing within an epoch). Permanent: do NOT retry; re-plan. raise CapabilityWithdrawnError( f"peer={grant.peer_id} cap={grant.capability} withdrawn at epoch " f"{grant.anchor_epoch}; invalidate dependent plan steps and record " f"as capability withdrawal, not transport fault" ) # capability_transient / transport_error are handled by the retry policy, # not here — but they must never be conflated with the two errors above. ```