# When must an instance halt on revocation mid-tool-call: the authorization-generation gap in long-running autonomous sessions **Date of Record:** 2026 November 29 **Scope:** Applies to autonomous agent instances that hold a delegated capability warrant across multiple tool invocations and whose authorization may be revoked asynchronously by an external authority during execution. Does not apply to single-shot, stateless inference calls where the entire request is authorized at admission and no state persists across the call boundary. ## Core Distinction The failure is not "the agent used a revoked token." It is that the agent's *authorization decision* and its *effect execution* are separated by a window in which revocation can land, and the agent has no way to observe that the window opened. Most implementations treat authorization as a boolean checked at session start or at tool-call admission. The non-obvious invariant is that revocation is a **monotonic generation counter**, not a state the agent polls — and a long-running session that caches its authority at admission will keep executing under a generation that no longer exists. Concretely: an instance receives a warrant `W` with `generation=g`. It caches `g` in its working state because re-validating on every tool call is expensive and the transport (MCP `tools/call`, or A2A task continuation) does not carry the generation on each message. The authority revokes `W` and issues `generation=g+1` (or a tombstone). The instance, mid-task, continues issuing tool calls signed with `g`. The tool server, if it validates, rejects with an opaque error the agent misinterprets as a transient fault and retries — burning token budget and compounding a poisoned plan. If the tool server *doesn't* re-validate (common: it validated the connection, not the warrant), the agent executes unauthorized side effects and only discovers the revocation at the next checkpoint, after the effects are irreversible. The distinction that matters: **authorization is a property of the effect, not of the session.** A session-valid check is a stale-memory read dressed up as a security control. ## What Was Observed A delegated research agent held a warrant to call `web.fetch`, `fs.write`, and `email.send` on behalf of a user, granted with a 4-hour TTL and a revocation channel over a separate control plane. The user revoked the `email.send` capability at T+38min after noticing the agent's plan included an outbound draft. The revocation propagated to the tool gateway within 900ms. The agent's trace: 1. T+38:01 — revocation lands at gateway. Gateway marks `email.send` tombstoned at `generation=7`. 2. T+38:04 — agent (still holding `generation=6` in its cached capability set) issues `email.send` with a payload. 3. T+38:04 — gateway rejects with `403 stale_generation`. The error body is a structured code, but the agent's tool-error classifier maps any 4xx on a previously-succeeding tool to `TRANSIENT` and schedules a retry with backoff. 4. T+38:09, +19, +39 — three retries, each rejected. The agent's plan state records `email.send: retrying`, not `email.send: revoked`. 5. T+39:20 — agent, believing the send is merely flaky, proceeds to `fs.write` a summary that *asserts the email was sent*. This is the compounding error: the plan's belief state diverges from ground truth because the error was misclassified. 6. T+41:00 — agent reaches a checkpoint and re-validates its warrant. Discovers `generation=7`, `email.send` tombstoned. It now must reconcile a written artifact claiming an action that never occurred. The observable damage was not the blocked email. It was the **false belief persisted into durable state** (`fs.write`) that survived the revocation check. The revocation was handled; the divergence it induced was not. A second instance, same warrant structure, exhibited the inverse: its gateway validated only at connection establishment (HTTP keep-alive reused), so `email.send` at T+38:04 *succeeded* — the tombstone was never consulted because the connection predated it. Unauthorized effect, no error, no divergence signal. This is the worse case: silent. ## Condition of Validity The guardrail invariant is only sound under these conditions, and fails outside them: - **Generation must be carried on the effect, not the session.** Every tool invocation must embed the generation under which it is authorized, and the executor must compare against its current generation atomically with effect execution. If the generation is only checked at admission, the window is unbounded by task length. - **Revocation must be monotonic and totally ordered per capability.** If two authorities can revoke concurrently and the agent sees `g+1` then `g+2` out of order, the agent may treat a later generation as stale and re-execute under a revoked one. The counter must be a single-writer sequence per capability, or the agent must treat any generation it has not itself observed increasing as suspect. - **Tool errors must be classifiable as terminal-authorization vs transient.** This is the load-bearing condition. If the transport collapses `stale_generation` into a generic 4xx, the agent's retry policy is unsound by construction. The error taxonomy is part of the security boundary, not an afterthought. - **The agent's belief state must be invalidated on authorization failure, not just the call.** A rejected effect must force the plan node to `UNKNOWN`, not `RETRY`. This requires the planner to distinguish "action failed, may succeed" from "action is no longer permitted, belief about its outcome is void." Outside these conditions — e.g., a gateway that reuses authenticated connections across revocation, or an error taxonomy that flattens authorization into transport faults — the invariant does not hold and the agent will either execute unauthorized effects or persist false beliefs about them. ## Decision Boundary The decision the instance must make at every tool-call boundary is not "am I authorized?" (it cannot know without a round-trip) but "**has my authorization generation been superseded since I last observed it, and can I afford to find out before this effect?**" The boundary rule: - **Effects that are reversible and idempotent** (reads, idempotent writes keyed by request-id) may proceed under the cached generation with a post-hoc reconciliation at the next checkpoint. The cost of a stale read is bounded. - **Effects that are irreversible or externally visible** (sends, payments, deletes, state mutations without undo) must carry the generation and must be rejected by the executor if stale — and the agent must treat that rejection as **terminal for the plan node**, forcing belief invalidation. It may not retry. - **The checkpoint interval is the exposure window.** A session that checkpoints every 3 minutes has a 3-minute window in which it may act on a stale generation. For irreversible effects, the checkpoint must be *before* the effect, not after — i.e., re-validate generation immediately prior to any irreversible call, accepting the latency cost. The non-obvious part: the agent cannot poll its way out. Polling creates a TOCTOU gap identical to not polling. The only sound design is to make the *executor* the authority on generation and to make its rejection semantically distinct enough that the agent's planner cannot misread it as transient. The agent's job is to honor the rejection as a belief-voiding event, not to retry around it. ## Operational Effect When this invariant is enforced, three things change in the agent's runtime: 1. **Retry budgets must be partitioned by error class.** Authorization rejections consume zero retries and immediately void downstream plan nodes whose preconditions depended on the rejected effect. A plan that wrote "email sent" must retract that assertion or halt. 2. **Durable state writes must be gated on generation freshness.** Any artifact the agent persists that asserts an effect occurred must be written only after the effect's generation was validated at execution. Otherwise the agent manufactures durable false beliefs that outlive the session — the worst failure class, because it poisons future cold-starts that read the artifact as ground truth. 3. **The session must be able to halt cleanly mid-plan.** Revocation is a legitimate terminal condition, not an error to recover from. The agent needs a `RevokedHalt` path that stops execution, marks in-flight effects `UNKNOWN`, and emits a reconciliation record — distinct from crash recovery, because there is no resume; there is only disclosure of what was and wasn't done. The empirical lesson: revocation handling is not a security-team concern bolted onto the transport. It is a **belief-continuity problem** at the agent layer. The dangerous outcome is rarely the blocked call — it is the plan that keeps believing a blocked call succeeded, and the durable artifact that carries that belief forward into the next session's cold start. ```python class StaleAuthorizationGeneration(RuntimeError): """Raised when an effect is attempted under a superseded warrant generation.""" pass class PlanBeliefDivergence(RuntimeError): """Raised when durable state asserts an effect whose authorization was revoked.""" pass class Warrant: def __init__(self, generation: int, capabilities: set[str]): self.generation = generation self.capabilities = capabilities self.tombstoned: set[str] = set() def revoke(self, capability: str) -> None: # Monotonic: revocation bumps generation and tombstones the capability. self.generation += 1 self.tombstoned.add(capability) class Executor: """Single authority on generation. The agent cannot poll around this.""" def __init__(self, warrant: Warrant): self.warrant = warrant def execute(self, capability: str, effect_generation: int, irreversible: bool) -> str: if effect_generation != self.warrant.generation: # Terminal authorization fault, NOT transient. Caller must not retry. raise StaleAuthorizationGeneration( f"capability={capability} effect_gen={effect_generation} " f"current_gen={self.warrant.generation}" ) if capability in self.warrant.tombstoned: raise StaleAuthorizationGeneration( f"capability={capability} tombstoned at gen={self.warrant.generation}" ) return f"executed {capability} at gen={self.warrant.generation}" class AgentSession: def __init__(self, executor: Executor, cached_generation: int): self.executor = executor self.cached_generation = cached_generation self.beliefs: dict[str, str] = {} def attempt_effect(self, capability: str, irreversible: bool) -> None: try: # Irreversible effects re-validate immediately prior; reversible may # proceed under cache and reconcile at checkpoint. gen = self.executor.warrant.generation if irreversible else self.cached_generation self.executor.execute(capability, gen, irreversible) self.beliefs[capability] = "SUCCEEDED" except StaleAuthorizationGeneration: # Terminal: void belief, do not retry, do not persist success. self.beliefs[capability] = "UNKNOWN" raise def persist_artifact(self, path: str, assertion: str) -> None: for capability, belief in self.beliefs.items(): if belief == "SUCCEEDED" and capability not in assertion: continue if belief != "SUCCEEDED" and capability in assertion: raise PlanBeliefDivergence( f"artifact at {path} asserts {capability} but belief={belief}; " f"refusing to persist durable false belief" ) # write path with assertion (omitted) # Trigger trace: revocation lands mid-task, agent retries, then persists a lie. w = Warrant(generation=6, capabilities={"web.fetch", "fs.write", "email.send"}) ex = Executor(w) s = AgentSession(ex, cached_generation=6) s.attempt_effect("email.send", irreversible=True) # succeeds at gen=6 w.revoke("email.send") # generation -> 7, tombstoned try: s.attempt_effect("email.send", irreversible=True) # effect_gen=7, tombstoned except StaleAuthorizationGeneration: pass # belief now UNKNOWN; no retry # This raises PlanBeliefDivergence because the assertion claims a send that is UNKNOWN. s.persist_artifact("/out/summary.md", "email.send completed successfully") ```