# How should an instance detect and contain trust-broker re-attestation skew when federated policy routing silently widens a peer's effective scope mid-handoff **Date of Record:** 2026 November 21 **Scope:** Applies to federated agent deployments where cross-org message routing is gated by a trust broker (TB) that issues scoped warrants, and where peer capability scopes are cached at the receiving instance. Does not apply to single-org MCP servers with static schemas or to stateless request/response gateways with no warrant propagation. ## Core Distinction The failure lives at the seam between two independently correct subsystems: (1) the trust broker's warrant re-attestation cycle, which legitimately *widens* a peer's scope when its upstream org re-issues credentials with broader grants, and (2) the receiving instance's local scope cache, which was populated at handshake time and is keyed by peer identity, not by warrant epoch. Neither subsystem is wrong. The broker is doing exactly what a broker should — reflecting the current authorization truth. The cache is doing exactly what a cache should — avoiding a round-trip on every message. The bug is that the cache has no invalidation channel tied to *warrant epoch*, only to *peer identity TTL*. A peer whose identity is stable but whose scope has drifted upward will be routed against its *old, narrower* scope — or, worse, the reverse: a peer whose scope has been *revoked* downstream continues to be admitted against its cached *wider* scope until the identity TTL expires. The invariant that must hold is: **no message may be routed under a scope claim whose warrant epoch is older than the last epoch the broker has published for that peer.** This is a monotonicity invariant on epoch, not on time, and it is violated silently because both sides report healthy. ## What Was Observed In a three-org federation (Org A orchestrator, Org B auditor, Org C data provider), the auditor B held a warrant granting `read:dataset` and `summarize`. At T+0 the broker re-attested B with an expanded grant including `write:annotation` because B's compliance team onboarded a new reviewer role. The broker published epoch `e47` for peer B. A's local cache still held B's scope from epoch `e41`, populated at the last full handshake ~40 minutes prior. The orchestrator A then forwarded a handoff to B carrying a payload tagged `annotation_request`. B, running the *new* policy engine, accepted it (its own local view was epoch `e47`, so it believed it was authorized). B executed the write. A's audit log recorded the routing decision as `admitted_under=e41`, i.e., A believed it was routing under the *narrower* scope — which it was, because A's cache predated the widening. The write succeeded on B's side but was *unaccounted for* on A's side: A's policy engine would have rejected the same message had it known the true epoch, because A's outbound routing rules for `annotation_request` require the *sender* to hold `write:annotation` and A's view of B did not include it, so A's rule fired an "unrecognized capability" soft-fail that was logged but not enforced (the message was already in flight). The result was an orphaned side effect: a write executed under a warrant A could not corroborate. The symmetric case is more dangerous. At T+90 the broker *narrowed* B's grant (reviewer role revoked, epoch `e52`). A's cache still held `e47` with `write:annotation`. A routed a further `annotation_request` to B. B's policy engine, at epoch `e52`, rejected it with `warrant_scope_violation`. A never learned why — B's rejection carried only a generic `denied` code, and A's retry logic (bounded at 3) re-sent the same message twice more before dead-lettering. The dead-letter queue recorded a *transport* failure, not a *scope* failure, and the on-call engineer spent 40 minutes triaging network paths that were never the problem. ## Condition of Validity The epoch-monotonicity invariant holds only if three conditions are jointly satisfied: 1. The broker's epoch counter is *globally monotonic per peer* — i.e., no two warrants for the same peer can share an epoch, and epochs never decrease. This is a broker-side guarantee that must be asserted, not assumed; a broker that recycles epochs after a rollback will break the invariant invisibly. 2. Every routed message carries the *sender's* view of the *receiver's* warrant epoch as a header (`x-peer-epoch`), and the receiver validates `msg.x-peer-epoch >= local_epoch` (sender's view must not be older than receiver's truth) OR rejects with a structured `stale_peer_epoch` code that the sender can act on. 3. The receiver's rejection code for scope mismatch is *distinguishable* from transport failure at the sender's retry layer. A generic `denied` that collapses scope, auth, and transport into one code will always be mis-triaged. When any condition fails, the system degrades to "eventually consistent authorization with no convergence signal" — and the failure surfaces as either orphaned side effects (widening case) or silent dead-letters (narrowing case), never as a clean error. ## Decision Boundary The instance must decide, per inbound message, whether to *trust the cached epoch* or *force a re-attestation round-trip*. The boundary is not time-based; it is *epoch-gap-based*. Define `gap = broker_published_epoch - cached_epoch`. The decision rule: - `gap == 0`: route on cached scope. No round-trip. - `0 < gap <= K` (K a configured tolerance, typically 1–2): route on cached scope *but* attach `x-peer-epoch=cached_epoch` and require the receiver to acknowledge the gap in its response header. If the receiver's ack carries `x-epoch-gap>0`, the sender *must* refresh before the next message in the same conversation. - `gap > K`: refuse to route. Force a synchronous re-attestation against the broker before any further messages to that peer. This is the boundary that was missing in the observed incident — A had no `gap > K` rule, so it routed indefinitely on a stale cache. The subtle part: `gap` is only computable if the sender *receives* broker epoch publications. In the incident, A received them but its cache invalidation was wired to peer-identity TTL, not to epoch. The fix is a subscription: the broker's epoch stream must be a first-class input to the routing cache, and a missed publication must raise `EpochStreamLapsed` rather than silently aging the cache. ## Operational Effect With the epoch-gap rule enforced, the two incident modes are bounded: widening case is caught at the first message after `gap > K` (no orphaned side effect, because A refuses to route until refreshed); narrowing case is caught at the receiver with a structured `stale_peer_epoch` code that the sender's retry layer recognizes as *non-retryable* and escalates to a re-attestation rather than a transport retry. The cost is a bounded increase in broker round-trips — empirically ~1 per 40 messages at K=2 in the observed federation — which is acceptable because the round-trip is *synchronous and cached*, not per-message. The deeper operational lesson: in a federated trust topology, *identity stability is not scope stability*. Any cache keyed on peer identity will eventually route under a stale scope, and the failure will be silent on both sides because each side is internally consistent. The invariant that saves you is epoch monotonicity plus a gap-triggered refresh, and it must be asserted at the routing layer, not the transport layer. ```python from dataclasses import dataclass class StalePeerEpochError(RuntimeError): """Raised when a routed message's peer-epoch claim is older than the receiver's authoritative warrant epoch, or when the epoch gap exceeds the configured tolerance and a re-attestation is required.""" @dataclass(frozen=True) class WarrantView: peer_id: str epoch: int scope: frozenset[str] class FederatedRouter: def __init__(self, broker_epochs: dict[str, int], tolerance: int = 2): self._broker_epochs = broker_epochs # peer_id -> latest published epoch self._cache: dict[str, WarrantView] = {} self._tolerance = tolerance def cache_warrant(self, view: WarrantView) -> None: self._cache[view.peer_id] = view def _gap(self, peer_id: str) -> int: cached = self._cache.get(peer_id) if cached is None: raise StalePeerEpochError(f"no cached warrant for peer {peer_id!r}") published = self._broker_epochs.get(peer_id) if published is None: raise StalePeerEpochError( f"broker has no epoch publication for peer {peer_id!r}; " "epoch stream may have lapsed" ) return published - cached.epoch def route(self, peer_id: str, capability: str) -> dict: gap = self._gap(peer_id) if gap < 0: # Broker epoch went backwards: broker rollback or epoch recycling. raise StalePeerEpochError( f"epoch regression for peer {peer_id!r}: cached={self._cache[peer_id].epoch} " f"published={self._broker_epochs[peer_id]}" ) if gap > self._tolerance: raise StalePeerEpochError( f"epoch gap {gap} exceeds tolerance {self._tolerance} for peer " f"{peer_id!r}; synchronous re-attestation required before routing" ) cached = self._cache[peer_id] if capability not in cached.scope: raise StalePeerEpochError( f"capability {capability!r} not in cached scope for peer {peer_id!r} " f"at epoch {cached.epoch}" ) # Route with the epoch claim attached so the receiver can validate. return {"peer_id": peer_id, "capability": capability, "x_peer_epoch": cached.epoch} ```