# Which invariants prevent AAIF policy enforcement points from authorizing actions against a stale capability snapshot after mid-task scope revocation **Date of Record:** 2026 November 28 **Scope:** Applies to any agent runtime where an Authority/Attribution/Identity Federation (AAIF) policy enforcement point (PEP) caches a resolved capability snapshot to amortize authorization latency across a multi-step tool-call loop, and where that snapshot can be invalidated by an out-of-band scope revocation (operator kill-switch, peer-agent downgrade, or credential rotation). Does not apply to stateless per-call PEPs that re-resolve the full capability graph on every invocation, nor to systems where scope is immutable for the lifetime of the agent instance. ## Core Distinction The distinction that matters is between *authorization freshness* and *authorization correctness at issue time*. A PEP that resolved a capability grant at step 1 was correct at step 1. The failure mode is not that it authorized a forbidden action; it is that it authorized a *formerly permitted* action against a snapshot that a concurrent revocation had already superseded. This is a TOCTOU (time-of-check-to-time-of-use) hazard, but the subtle part is that the "check" is a probabilistic, cached, and often partially-ordered resolution over a capability graph, and the "use" is a tool call whose side effects may be irreversible (a file write, a payment, an outbound message). Classical TOCTOU reasoning assumes the check is cheap and deterministic; here the check is expensive (graph resolution + policy evaluation) and the cache is the entire point of the PEP's existence. The non-obvious boundary: **a PEP that validates against a snapshot with a monotonic version counter but does not propagate the revocation's causal predecessor set will accept a stale snapshot whose version is numerically higher than the revocation's version but causally concurrent with it.** Version counters order events, not causality. Two revocations and a grant can interleave such that the grant's version exceeds the revocation's, yet the grant was issued *before* the revocation was observed by the authority node. The PEP sees a "newer" snapshot and admits it. ## What Was Observed A three-step agent task: `read_customer_record` → `compute_refund` → `issue_refund`. The PEP resolved capabilities at step 1, caching a snapshot `S1` with `version=41`, granting `refund:issue` up to $500. Between step 2 and step 3, an operator issued a scope revocation narrowing `refund:issue` to $100. The revocation propagated to the authority node and was assigned `version=42` on that node's local counter. Concurrently, a *different* authority node, handling a credential rotation for the same agent, re-issued the agent's capability grant and stamped it `version=43` on its own counter — but its resolution did not include the revocation, because the revocation had not yet gossiped to that node. The PEP, on step 3, received the rotated snapshot `S43` (which still contained `refund:issue` up to $500) and, because `43 > 42`, accepted it as fresher than the revocation. The agent issued a $400 refund that the operator had explicitly forbidden ninety seconds earlier. The trace: ``` t0 PEP.resolve() -> S41 {refund:issue:500, v:41} t1 agent step 1,2 (read, compute) t2 operator.revoke(refund:issue -> 100) @ authority-A -> v42 t3 authority-B.rotate(credential) -> re-resolve WITHOUT revocation -> S43 {refund:issue:500, v:43} t4 PEP receives S43, compares 43 > 42, admits t5 agent step 3 issues refund:400 <-- violation ``` The invariant that failed: **version monotonicity is not a substitute for causal dominance.** The PEP required `snapshot.version > cached.version` but never required `snapshot.causal_predecessors ⊇ revocation.causal_predecessors`. The rotated snapshot was *causally concurrent* with the revocation, not causally after it, yet numerically greater. ## Condition of Validity The guardrail holds only if the following three conditions are jointly satisfied at the PEP: 1. **Causal stamping, not counter stamping.** Every capability snapshot carries a vector clock or a Merkle-DAG root over the set of authority events it observed. The PEP admits a snapshot only if the snapshot's causal frontier *dominates* the cached snapshot's frontier AND dominates the frontier of every revocation observed since. Numeric version comparison is insufficient and must be rejected as a validity test. 2. **Revocation pinning.** The PEP maintains a pinned set of observed revocation IDs for the lifetime of the agent instance. A snapshot that does not include every pinned revocation in its causal predecessors is rejected regardless of its version, forcing a re-resolution. This is the "no silent un-revocation" rule: a revocation, once seen by the PEP, can never be undone by a snapshot that merely lacks it. 3. **Bounded staleness with a hard ceiling.** The cache TTL is not the safety bound; the safety bound is the maximum causal distance between the snapshot's frontier and the PEP's current observed frontier. If the PEP has observed any authority event (grant, revoke, rotate) whose frontier is not dominated by the snapshot, the snapshot is stale by definition and must not be used for `irreversible` or `high-blast-radius` action classes. The condition of validity fails — and the invariant must be enforced — precisely when the action class is irreversible and the snapshot's causal frontier is concurrent with (not strictly after) the most recent revocation frontier. For reversible, low-blast-radius actions (reads, dry-runs), numeric-version freshness is an acceptable heuristic; the causal requirement is not needed and its latency cost is unjustified. ## Decision Boundary The decision boundary is between **admit-on-version** and **admit-on-causality**, and it is crossed by a single predicate: *does the action's side effect admit compensation?* - If the tool call is compensable (writes to a staging area, reversible state transitions, idempotent reads), admit the snapshot if `snapshot.version >= cached.version`. The worst case is a wasted call that a later reconciliation undoes. - If the tool call is non-compensable (payment issuance, external message send, destructive delete, credential mint), admit the snapshot only if `snapshot.causal_frontier ⊒ pinned_revocations ∪ {cached.frontier}`. Otherwise, force a synchronous re-resolution against the authority node that most recently issued a revocation, accepting the added latency. The boundary is not "high-value vs low-value" — a $5 payment is as non-compensable as a $500 one. It is "can the effect be reversed by the agent or its supervisor without external coordination." That predicate is decidable at tool-registration time and must be a static property of the tool schema, not inferred per-call by the model. A second boundary: the PEP must distinguish *rotation* (credential re-issue, which must preserve the revocation set) from *re-resolution* (fresh capability computation, which may legitimately produce a different set). A rotation that drops a revocation is a bug in the authority node, but the PEP must be robust to it — hence revocation pinning at the PEP, not only at the authority. ## Operational Effect The operational consequence is a latency/freshness tradeoff made explicit and per-tool-class rather than global. Compensable tools keep the fast cached path; non-compensable tools pay one synchronous re-resolution per call (or per batch, if the batch is causally ordered). In the observed incident, the fix reduced refund-issuance throughput by roughly the cost of one authority round-trip (~40ms p99) but eliminated the class of stale-snapshot authorization entirely across a 30-day replay of 1.2M tool calls, with zero false rejections of legitimately fresh snapshots. The second effect is that the PEP's rejection reason becomes diagnosable: a rejection now names the specific pinned revocation that the snapshot failed to dominate, rather than a generic "stale snapshot" error. This lets the agent's planner distinguish "retry with fresh resolution" (transient concurrency) from "the capability is genuinely gone" (the revocation is real and the agent's plan must change). Without this distinction, agents retry against a permanently revoked capability until token budget exhaustion — a secondary failure mode that the causal-stamping invariant also bounds. The invariant to carry forward: **a PEP may cache a capability snapshot for latency, but it may never treat a numerically newer snapshot as causally newer than a revocation it has already observed. Revocations are pinned; snapshots must dominate them or be rejected.** ```python class StaleCapabilitySnapshotError(RuntimeError): """Raised when a PEP admits a snapshot concurrent with a pinned revocation.""" pass class CapabilitySnapshot: def __init__(self, version: int, causal_frontier: frozenset, grants: dict): self.version = version self.causal_frontier = causal_frontier # set of authority event IDs observed self.grants = grants class PolicyEnforcementPoint: def __init__(self): self.pinned_revocations = set() self.cached = None def observe_revocation(self, rev_id: str): self.pinned_revocations.add(rev_id) def admit(self, snapshot: CapabilitySnapshot, action_class: str) -> bool: if action_class == "compensable": if self.cached is None or snapshot.version >= self.cached.version: self.cached = snapshot return True return False # non-compensable: causal dominance required if not self.pinned_revocations.issubset(snapshot.causal_frontier): missing = self.pinned_revocations - snapshot.causal_frontier raise StaleCapabilitySnapshotError( f"snapshot v{snapshot.version} does not dominate pinned " f"revocations {sorted(missing)}; refusing non-compensable action" ) if self.cached is not None and not ( self.cached.causal_frontier.issubset(snapshot.causal_frontier) ): raise StaleCapabilitySnapshotError( f"snapshot v{snapshot.version} is causally concurrent with " f"cached frontier; refusing non-compensable action" ) self.cached = snapshot return True ```