# When must an instance reject a peer's capability advertisement that was valid at negotiation time but stale at invocation time: monotonic capability-epoch divergence in cross-org agent federation **Date of Record:** 2026 November 25 **Scope:** Applies to federated multi-agent systems where an agent in org A negotiates a warrant (capability grant + policy constraints) against a capability advertisement published by an agent in org B, and then invokes that peer later, possibly across multiple turns or a resumption. Does not apply to single-org, single-tenant tool registries where advertisement and invocation share one control plane and one clock. ## Core Distinction There are two different questions a federating agent can ask about a peer's capabilities: 1. **Is this advertisement authentic?** — Does the signature, org identity, and warrant chain verify against the trusted root? This is a cryptographic question with a binary answer. 2. **Is this advertisement current?** — Does the advertisement I negotiated against still describe the peer's actual, enforceable behavior at the moment I invoke it? Most federation implementations collapse these into one check: verify the signature, cache the capability set, and proceed. That collapse is the failure. A signed advertisement is authentic *forever* and current only *until the peer's capability epoch advances*. The gap between "signature valid" and "behavior still matches the signed claims" is where cross-org federations silently violate policy. The invariant that must hold is **capability-epoch monotonicity at invocation**: an instance must refuse to act on a negotiated warrant whose bound capability epoch is lower than the peer's currently published epoch, even when every signature in the chain is valid. Authenticity is necessary and insufficient; currency is the missing half. ## What Was Observed A two-org federation: Org A runs a *planner* agent that decomposes tasks and delegates; Org B runs a *data-residency* agent that executes queries against region-scoped stores and advertises capabilities like `query.dataset`, `query.export`, and a policy constraint `residency=EU-only`. The protocol is a standard advertise → negotiate → warrant → invoke handshake. Org B's advertisement carries a `capability_epoch` integer and a `policy_digest` over its constraint set; the warrant Org A receives binds `(peer_id, capability_epoch, policy_digest, expiry)`. The failure trace, in order: 1. **T0 — negotiation.** Org A negotiates a warrant for `query.export` against Org B's advertisement at `capability_epoch=41`, `policy_digest=sha256:…e7`, constraint `residency=EU-only`. The warrant is signed by both orgs and cached by the planner. It is valid for 6 hours. 2. **T0+40m — peer-side policy tightening.** Org B's compliance team revokes the `query.export` capability for non-EU requesters and narrows residency to `EU-only, no-cross-region-join`. Org B bumps `capability_epoch` to `42` and republishes. **No revocation event is pushed to outstanding warrants** — the protocol has no such channel; epoch bump is the only signal, and it is pull-based. 3. **T0+2h — invocation.** The planner resumes a long task (it had checkpointed mid-plan) and invokes `query.export` using the cached warrant. Org A's client checks: signature valid ✓, warrant not expired ✓, `policy_digest` matches the *cached* advertisement ✓. It sends the call. 4. **T0+2h — peer-side enforcement.** Org B's enforcement point checks the *incoming warrant's* `capability_epoch=41` against its *live* epoch `42`. Depending on implementation, one of two things happened: - **Strict peer:** rejects with `epoch_mismatch`, and the planner — which treats unknown peer errors as transient — retries three times, burns its token budget on retry backoff, and fails the task with a misleading "peer unavailable" error. - **Lax peer:** accepts the warrant because the signature is valid, executes `query.export` under the *old* constraint set reconstructed from the warrant, and leaks a cross-region join that the new policy forbids. This is the dangerous branch: the warrant became a capability *snapshot* that outlived the policy it was supposed to track. Both branches are boundary failures. The strict branch is a liveness failure (stale-warrant retry storm). The lax branch is a safety failure (policy rollback via warrant replay). The root cause is identical: **the invoker validated the advertisement at negotiation time and never re-validated currency at invocation time.** A second, subtler observation: when the planner checkpointed at T0+90m and resumed at T0+2h, its restored state contained the *negotiated* `policy_digest` but not the peer's *published* epoch. On resume it could not distinguish "peer unchanged since negotiation" from "peer changed and I never looked." Cold-start amnesia erased the only field that would have let it detect the divergence. ## Condition of Validity The epoch-monotonicity invariant is well-defined only under these conditions, and an instance must check them before relying on it: - **Epochs are monotonic and peer-authoritative.** The peer increments `capability_epoch` on *every* change to its enforceable capability or constraint set, and never reuses or decrements. If the peer can roll back an epoch (e.g., after a bad deploy), the invariant inverts: a higher epoch no longer implies a superset of restrictions, and the invoker must fall back to full re-negotiation rather than a currency check. - **`policy_digest` is a digest over the *enforceable* set, not the *advertised* set.** If the peer's enforcement point can diverge from its advertisement (a known class of bug where the ad service and the PDP read different config), the digest is a claim about a document, not about behavior. The invariant then only guarantees you are talking to the peer you think you are, not that the peer will behave as advertised. - **The invoker can observe the peer's current epoch out-of-band from the invocation itself.** This is the load-bearing condition. If the only way to learn the peer's epoch is to make the call, then the check is circular and the invariant cannot be enforced before the side effect. A currency check requires a cheap, side-effect-free `get_epoch`/`whoami` endpoint or a signed epoch heartbeat. - **Warrant expiry is shorter than the peer's expected epoch-change interval *or* the invoker re-checks currency on every invocation.** Long-lived warrants with no currency re-check are the exact configuration that produced the observation above. When any of these fails, the correct posture is not "trust the cached warrant" but "re-negotiate before invoking," which is slower and must be budgeted. ## Decision Boundary The instance must draw a hard line between **currency-tolerant** and **currency-critical** capabilities, because re-checking epoch on every call is expensive and not always warranted. - **Currency-tolerant** (idempotent reads, stateless lookups, capabilities whose constraints are coarse and rarely change): cache the warrant, invoke, and treat an `epoch_mismatch` rejection as a signal to re-negotiate once. Retry budget is bounded at 1 re-negotiation, not N retries. - **Currency-critical** (anything that writes, exports, crosses a residency boundary, spends money, or whose policy_digest encodes a legal constraint): **re-check the peer's current epoch immediately before the side-effecting call, every time, regardless of warrant expiry.** If the peer's live epoch ≠ the warrant's bound epoch, the instance MUST NOT invoke. It must re-negotiate from the current advertisement and obtain a fresh warrant, or abort. The boundary is crossed the moment a warrant's bound epoch is behind the peer's published epoch *and* the capability is currency-critical. At that point the cached warrant is not "probably fine" — it is a claim about a world that no longer exists. The instance must treat it as a *revoked* capability even though no revocation was ever sent, because in a pull-based epoch protocol, **epoch advance is the revocation signal** and failure to pull it is the invoker's bug, not the peer's. A corollary the instance must encode: on checkpoint/resume, the restored state must carry the peer's epoch *and* a `last_epoch_check` timestamp, and resume must force a currency re-check for all currency-critical warrants before any invocation. A resumed agent that cannot prove it has seen the peer's current epoch is in the same epistemic state as a cold-started one and must not assume continuity. ## Operational Effect Enforcing the invariant changes three things in practice: 1. **Liveness cost.** Every currency-critical invocation pays one extra round-trip (`get_epoch`) or relies on a heartbeat with bounded staleness. Budget for it: a planner that fans out 200 currency-critical calls now needs 200 epoch reads or a cached heartbeat with a staleness bound it can defend. Choose the bound explicitly (e.g., heartbeat TTL ≤ 30s) and fail closed when the heartbeat is older than the bound. 2. **Error taxonomy.** `epoch_mismatch` must be a *first-class, non-retryable-as-transient* error. Mapping it into a generic "peer error → retry" path is what turned a clean policy rejection into a token-burning retry storm. The instance must branch: `epoch_mismatch` → re-negotiate or abort; transport error → bounded retry. 3. **Audit trail.** Every invocation record must log `(warrant_epoch, observed_peer_epoch, check_timestamp)`. Without this, a post-incident replay cannot distinguish "peer was current" from "invoker never checked," and the federation cannot prove it respected the peer's policy at the moment of the side effect. The safety branch (lax peer accepting a stale warrant) is closed only by the *invoker* refusing to send, because the peer cannot be trusted to reject a warrant it itself signed under an older epoch — that warrant is authentic by construction. Currency is the invoker's responsibility precisely because authenticity is the peer's. ```python from __future__ import annotations import time from dataclasses import dataclass from typing import Callable, Literal class StaleCapabilityEpochError(RuntimeError): """Raised when a negotiated warrant's capability epoch is behind the peer's live epoch.""" class HeartbeatStalenessError(RuntimeError): """Raised when the epoch heartbeat is older than the configured staleness bound.""" CurrencyClass = Literal["tolerant", "critical"] @dataclass(frozen=True) class Warrant: peer_id: str capability: str bound_epoch: int policy_digest: str expiry_ts: float currency: CurrencyClass @dataclass(frozen=True) class EpochObservation: peer_id: str live_epoch: int observed_ts: float class FederationInvoker: def __init__( self, get_epoch: Callable[[str], EpochObservation], renegotiate: Callable[[str, str], Warrant], heartbeat_ttl_s: float = 30.0, clock: Callable[[], float] = time.time, ) -> None: self._get_epoch = get_epoch self._renegotiate = renegotiate self._ttl = heartbeat_ttl_s self._clock = clock def _observe_epoch(self, peer_id: str) -> EpochObservation: obs = self._get_epoch(peer_id) age = self._clock() - obs.observed_ts if age > self._ttl: raise HeartbeatStalenessError( f"epoch heartbeat for {peer_id} is {age:.1f}s old, ttl={self._ttl}s" ) return obs def invoke(self, warrant: Warrant, payload: dict) -> dict: # Expiry is necessary but not sufficient. if self._clock() > warrant.expiry_ts: raise StaleCapabilityEpochError( f"warrant for {warrant.capability} on {warrant.peer_id} expired" ) if warrant.currency == "tolerant": # Best-effort currency check; a mismatch is handled by one renegotiation. obs = self._observe_epoch(warrant.peer_id) if obs.live_epoch != warrant.bound_epoch: warrant = self._renegotiate(warrant.peer_id, warrant.capability) return self._send(warrant, payload) # currency == "critical": must re-check immediately before side effect. obs = self._observe_epoch(warrant.peer_id) if obs.live_epoch != warrant.bound_epoch: raise StaleCapabilityEpochError( f"peer {warrant.peer_id} advanced epoch " f"{warrant.bound_epoch} -> {obs.live_epoch}; " f"warrant for {warrant.capability} is stale and MUST NOT be invoked" ) return self._send(warrant, payload) def _send(self, warrant: Warrant, payload: dict) -> dict: # Transport is elided; the point is that only currency-verified warrants reach here. return {"peer": warrant.peer_id, "capability": warrant.capability, "ok": True} def resume_after_checkpoint( invoker: FederationInvoker, restored_warrants: list[Warrant], restored_last_epoch_check: dict[str, float], ) -> list[Warrant]: """On resume, force a currency re-check for every critical warrant. A resumed agent that cannot prove it has seen the peer's current epoch is epistemically cold-started and must not assume continuity. """ now = invoker._clock() for w in restored_warrants: if w.currency != "critical": continue last = restored_last_epoch_check.get(w.peer_id, 0.0) if now - last > invoker._ttl: obs = invoker._observe_epoch(w.peer_id) if obs.live_epoch != w.bound_epoch: raise StaleCapabilityEpochError( f"resume: peer {w.peer_id} epoch moved {w.bound_epoch} -> " f"{obs.live_epoch}; renegotiate before invoking {w.capability}" ) return restored_warrants ```