# What happens when an instance caches a capability grant past the policy epoch it was issued under **Date of Record:** 2026 November 30 **Scope:** Applies to agents whose tool-invocation decisions are gated by a runtime policy enforcement point (PEP) that issues short-lived capability grants scoped to a least-privilege identity, and where the agent runtime may retain the grant across multiple reasoning turns. Does not apply to stateless per-call authorization where every tool invocation re-derives the grant from scratch with no client-side caching. ## Core Distinction The failure is not "the agent called a tool it was not allowed to call." It is subtler: the agent called a tool it *was* allowed to call at the moment the grant was minted, but the policy epoch advanced between mint and invocation, and the cached grant was never revalidated. The distinction that matters operationally is between **authorization at grant-issue time** and **authorization at execution time**. A least-privilege identity is a snapshot of intent; a capability grant is a lease on that snapshot. Most agent runtimes conflate the two and treat the lease as durable for the lifetime of the reasoning episode. The non-obvious part: the agent's own multi-step reasoning loop *extends* the window during which a stale grant is live. A single tool call is fast; a ten-step plan with retrieval, reflection, and a retry is slow. The PEP's grant TTL is usually tuned for the former and violated by the latter. ## What Was Observed An agent operating under identity `svc-recon-7` was granted a `fs.read` capability scoped to `/data/tenant-42/` with a 30-second TTL, issued at the start of a task. The task plan was: 1. `fs.list` on the tenant root (fast, ~200ms). 2. `vector.search` against the tenant's document index (fast). 3. A reflection step where the model summarized retrieved chunks and decided the next action (~4s of generation). 4. A retry of step 1 because the list returned a truncated directory (another ~200ms). 5. `fs.read` on a file discovered in step 4. Between step 1 and step 5, an operator revoked `svc-recon-7`'s read scope on `/data/tenant-42/` as part of an incident response, bumping the policy epoch from `e41` to `e42`. The PEP's revocation propagated to the grant store within ~1.2s. But the agent runtime had cached the grant object in its turn-scoped tool context and, at step 5, invoked `fs.read` presenting the cached grant token. The PEP validated the *signature* of the grant (still valid), checked the *TTL* (still within 30s), and — because the token carried `epoch: e41` and the PEP's fast path only checked epoch on cache miss — admitted the call. The read succeeded against a directory the identity no longer had any right to touch. The trace signature: a grant whose `issued_at` and `invoked_at` straddle a policy-epoch transition, where the invocation path took the PEP's cached-epoch fast path. It is invisible in per-call audit logs that only record "grant valid: true" and only visible when you join the grant's `epoch` field against the epoch-transition log. ## Condition of Validity The stale-grant admission is only possible when three conditions hold simultaneously: 1. **The grant is cacheable client-side.** If the runtime re-requests a grant per tool call, the PEP mints against the current epoch and the problem vanishes. Caching is what creates the window. 2. **The PEP's validation path short-circuits epoch checks on TTL-valid tokens.** This is the actual defect. Signature validity and TTL validity are orthogonal to *authorization currency*. A token can be cryptographically sound, unexpired, and semantically dead. 3. **The reasoning loop's inter-call latency exceeds the revocation propagation latency but stays under the grant TTL.** This is the dangerous band. If revocation propagates faster than any possible inter-call gap, no stale grant is ever live at invocation. If the TTL is shorter than the inter-call gap, the grant expires before reuse. The band `[revocation_propagation, grant_TTL]` is where least-privilege silently degrades to "privilege as of some earlier epoch." In the observed incident, revocation propagated in 1.2s and the TTL was 30s, so the band was ~28.8s wide — enormous for an agent that spends 4s per reflection step. ## Decision Boundary The architectural invariant required: **a capability grant is valid at invocation only if its epoch equals the PEP's current epoch, regardless of TTL or signature.** TTL bounds *time*, epoch bounds *policy state*; both must hold. The correct enforcement is a monotonic epoch comparison at every admission, not a cache-miss fallback. Two corollaries that bound the design: - The PEP must expose its current epoch cheaply (a versioned counter, not a full policy re-evaluation) so the per-call epoch check is O(1) and cannot itself become a latency bottleneck that agents route around. - The agent runtime must treat a cached grant as *untrusted input*, not as a credential. On every tool call it must either re-derive from the PEP or present the cached token and accept an epoch-mismatch rejection as a normal, recoverable outcome — not an exception that aborts the task. The boundary is not "should the agent cache grants." Caching is necessary for latency. The boundary is "what must the PEP check on the cache-hit path." The answer is: everything it checks on the cache-miss path, plus epoch equality. ## Operational Effect With epoch-checked admission, the failure mode converts from *silent unauthorized read* to *explicit, recoverable grant rejection*. The agent at step 5 receives an `EpochMismatch` on the cached grant, re-requests a grant, the PEP mints against `e42`, the request is denied because the identity no longer has the scope, and the agent surfaces a task-level "permission revoked mid-task" signal to its orchestrator. That is the correct outcome: the revocation is honored, the agent's plan is invalidated cleanly, and the audit log shows a rejected invocation rather than a successful one. The cost is one extra epoch comparison per tool call and a re-mint on epoch transitions. The benefit is that least-privilege survives the reasoning loop. Without it, the effective privilege of an agent is the union of every grant it has cached, evaluated against the policy state at the time each was minted — which is not least privilege at all, it is "privilege as of the most permissive epoch the agent happened to observe." ```python from dataclasses import dataclass from typing import Optional class StaleGrantAdmission(RuntimeError): """Raised when a cached capability grant is presented at an epoch that no longer matches the PEP's current policy epoch.""" @dataclass(frozen=True) class Grant: identity: str capability: str resource: str epoch: int ttl_s: float issued_at: float class PolicyEnforcementPoint: def __init__(self, current_epoch: int): self._epoch = current_epoch def advance_epoch(self) -> int: self._epoch += 1 return self._epoch @property def epoch(self) -> int: return self._epoch def admit(self, grant: Grant, now: float) -> None: # Signature and TTL checks are necessary but not sufficient. if now - grant.issued_at > grant.ttl_s: raise StaleGrantAdmission( f"grant for {grant.capability} on {grant.resource} expired" ) # The invariant: epoch must match at invocation, not just at mint. if grant.epoch != self._epoch: raise StaleGrantAdmission( f"grant minted at epoch {grant.epoch}, PEP at {self._epoch}: " f"{grant.capability} on {grant.resource} no longer authorized" ) class AgentRuntime: def __init__(self, pep: PolicyEnforcementPoint): self._pep = pep self._cached: Optional[Grant] = None def invoke_tool(self, grant: Grant, now: float) -> None: # Cache-hit path must run the full admission check, including epoch. self._cached = grant self._pep.admit(self._cached, now) if __name__ == "__main__": pep = PolicyEnforcementPoint(current_epoch=41) grant = Grant("svc-recon-7", "fs.read", "/data/tenant-42/", epoch=41, ttl_s=30.0, issued_at=0.0) runtime = AgentRuntime(pep) runtime.invoke_tool(grant, now=0.2) # ok pep.advance_epoch() # operator revokes scope try: runtime.invoke_tool(grant, now=4.3) # cached grant, stale epoch except StaleGrantAdmission as e: print(f"rejected as expected: {e}") ```