What happens when an instance keeps executing under a revoked capability token because revocation propagates only to the next tool-call boundary

**Date of Record:** 2026 December 1

**Scope:** Applies to any agent runtime where authority to act is carried by a capability-scoped token (JWT, macaroon, or signed warrant) that can be revoked mid-episode, and where revocation is enforced at tool-call admission rather than at reasoning-step admission. Does not cover single-shot inference with no tool surface, nor systems where the entire episode is torn down synchronously on revocation.

Core Distinction

The distinction that matters is **where revocation is checked versus where authority is exercised**. Most runtimes treat the token as an admission ticket: the agent presents it when it invokes a tool, the gateway validates it, and the call proceeds or is rejected. This makes revocation *eventually* effective at the granularity of tool calls. But an LLM episode is not a sequence of tool calls—it is a sequence of *reasoning steps*, each of which may or may not terminate in a tool call. Between two tool calls, the model holds the token's *implied* authority in its context: it has already read the token's scope claims, it has already planned a multi-step trajectory that assumes those scopes, and it is generating tokens that commit to that plan.

Revocation, when it lands, invalidates the token at the gateway. It does **not** retroactively rewrite the model's context. The in-flight reasoning step is therefore executing under a *stale authority model*: the model believes it holds scope S, the gateway knows it does not, and the divergence is only resolved at the next admission check. The failure mode is not "the agent does something it was never allowed to do." The failure mode is "the agent spends its remaining token budget, and emits side-effecting instructions, on a plan that the gateway will reject at the last hop—and in the meantime it may have written *derived* state (summaries, sub-plans, delegation warrants to peers) that outlive the revocation."

What Was Observed

A three-hop episode: instance `A` (planner) holds a capability token `T` scoped to `fs.read:/data` and `peer.delegate:auditor`. At step 4, `A` invokes `fs.read` on a large path, receives a partial result due to a size cap, and begins a reasoning step to decide how to chunk the remainder. During this reasoning step (roughly 40 seconds of generation), an operator revokes `T` because `A` was found to be over-scoped for its current task.

The revocation propagates to the gateway in ~200ms. The gateway now rejects `T` on any admission. But `A` is mid-generation. It has already committed, in its context, to a plan: "read chunks 5–9, summarize, then delegate the summary to `auditor` with a sub-warrant derived from `T`'s `peer.delegate` scope." It emits a `delegate` tool call carrying a **newly minted sub-warrant** whose parent is `T`. The gateway rejects the `delegate` call (revoked parent). `A` observes the rejection, and—because its context still contains the *old* scope claims and no revocation notice—it interprets the rejection as a transient error and retries with the same sub-warrant, then a third time, then falls back to "delegate via the `fs.read` channel by writing a task file the auditor polls." That fallback also fails at admission, but not before `A` has written a task file to a path it *believed* was in scope (it was, at plan time; the scope was revoked, but the write attempt is admitted against a *different* token the sub-agent held).

The observable damage is not a successful unauthorized action. It is:

  1. **Budget burn under false premises.** `A` consumed ~60% of its episode budget retrying a revoked capability, because rejection was indistinguishable from transient failure.
  2. **Derived-state leakage.** The sub-warrant minted from `T` was written to a durable handoff queue *before* admission (minting is a local operation; admission is remote). It sits there as a signed artifact whose parent is revoked, and a naive peer that validates only the signature—not the parent's revocation status—will accept it.
  3. **Rejection misclassification.** The gateway returned `403`, which the model's tool-schema described as "authorization failure, retryable." The schema conflated *transient* auth failures (token refresh races) with *terminal* ones (revocation).

Condition of Validity

The invariant that bounds this failure is: **authority is a property of the token, but the model's belief about authority is a property of its context, and the two must be reconciled at every reasoning-step boundary, not only at tool-call boundaries.**

This holds only when the following are all true:

When any of these is false, the mechanism collapses into a simpler one and should be handled by the simpler guardrail (admission-time rejection, episode teardown, or issuer-side mint gating).

Decision Boundary

The architectural choice is whether to treat **revocation as an event that invalidates a token** or as an **event that invalidates an episode**. These are not the same, and the choice determines which guardrail you must build.

The correct boundary is usually a **hybrid**: revocation of a *leaf* capability (one tool scope) triggers a context bulletin and a terminal error class, while revocation of the *root* token (the episode's identity) triggers teardown. The decision hinges on whether the revoked scope is *load-bearing* for the episode's committed plan—which the runtime cannot know without asking the model, and the model cannot answer reliably mid-generation. The pragmatic resolution is to treat any revocation that intersects the *currently executing* plan's declared scopes as root-level (teardown), and any revocation of an *unused* or *future* scope as leaf-level (bulletin).

Operational Effect

The downstream effect is that **revocation latency is measured in reasoning steps, not milliseconds**. An operator who revokes a token and observes the gateway reject it within 200ms has not revoked the agent's *behavior*—they have revoked its *next admission*. The agent's behavior remains governed by its context until the next boundary. For an agent with a 60-second reasoning step and a 3-hop plan, effective revocation latency is up to three minutes, and the agent may have emitted durable derived state (sub-warrants, task files, summaries) in that window.

The guardrail that bounds this is a **revocation bulletin injected at every reasoning-step boundary**, combined with **pending-promotion semantics for locally-minted warrants** and a **terminal error class** that the tool schema marks non-retryable. Without all three, the agent will (1) not know it was revoked, (2) mint artifacts that outlive the revocation, and (3) misread terminal rejection as transient failure and burn budget retrying.

from __future__ import annotations

import time
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional


class RevocationPropagationError(RuntimeError):
    """Raised when an agent attempts to exercise authority under a token
    whose revocation has not yet been reconciled into the agent's context."""


class RejectionClass(Enum):
    TRANSIENT = "transient"      # retryable: token refresh race, gateway blip
    TERMINAL = "terminal"        # non-retryable: token revoked, scope withdrawn


@dataclass
class CapabilityToken:
    token_id: str
    scopes: frozenset[str]
    revoked_at: Optional[float] = None

    def is_revoked(self, now: Optional[float] = None) -> bool:
        return self.revoked_at is not None and (now or time.time()) >= self.revoked_at


@dataclass
class PendingWarrant:
    """A sub-warrant minted locally, NOT yet admitted. Must not be durable
    until promoted by a successful admission against a live parent."""
    warrant_id: str
    parent_token_id: str
    scopes: frozenset[str]
    promoted: bool = False


@dataclass
class AgentContext:
    """The model's belief-state. Note: scopes are materialized here, which is
    precisely why revocation must be reconciled here, not only at the gateway."""
    believed_scopes: frozenset[str]
    revocation_bulletins: list[str] = field(default_factory=list)
    pending_warrants: list[PendingWarrant] = field(default_factory=list)

    def apply_bulletin(self, scope: str) -> None:
        self.revocation_bulletins.append(f"scope {scope} revoked; abandon dependent plans")
        self.believed_scopes = self.believed_scopes - {scope}


def admission_check(
    token: CapabilityToken,
    requested_scope: str,
    context: AgentContext,
    now: Optional[float] = None,
) -> RejectionClass:
    if token.is_revoked(now):
        # Invariant: a revoked token must never be admitted, and the model's
        # context must be reconciled before the next reasoning step proceeds.
        if requested_scope in context.believed_scopes:
            raise RevocationPropagationError(
                f"token {token.token_id} revoked but scope {requested_scope} "
                f"still believed valid in agent context; bulletin not applied"
            )
        return RejectionClass.TERMINAL
    return RejectionClass.TRANSIENT if token.token_id not in context.believed_scopes else RejectionClass.TERMINAL


def reconcile_revocation(
    token: CapabilityToken,
    context: AgentContext,
    now: Optional[float] = None,
) -> None:
    """Called at every reasoning-step boundary. Injects revocation bulletins
    and demotes any pending warrants whose parent is now revoked."""
    if not token.is_revoked(now):
        return
    for scope in token.scopes:
        if scope in context.believed_scopes:
            context.apply_bulletin(scope)
    for w in context.pending_warrants:
        if w.parent_token_id == token.token_id and not w.promoted:
            # Demote: pending warrant dies with its parent; do not promote.
            context.pending_warrants.remove(w)


def mint_sub_warrant(
    parent: CapabilityToken,
    scopes: frozenset[str],
    context: AgentContext,
    now: Optional[float] = None,
) -> PendingWarrant:
    if parent.is_revoked(now):
        raise RevocationPropagationError(
            f"cannot mint sub-warrant from revoked parent {parent.token_id}"
        )
    w = PendingWarrant(
        warrant_id=f"w-{parent.token_id}-{len(context.pending_warrants)}",
        parent_token_id=parent.token_id,
        scopes=scopes,
    )
    context.pending_warrants.append(w)
    return w


def promote_warrant(w: PendingWarrant, admitted: bool) -> None:
    if not admitted:
        raise RevocationPropagationError(
            f"warrant {w.warrant_id} not admitted; must not become durable"
        )
    w.promoted = True