# Under what conditions must an instance treat a rotated AAIF credential as a revocation rather than a refresh **Date of Record:** 2026 November 21 **Scope:** Applies to AAIF (Agent Authority & Identity Framework) task-scoped credentials issued with short TTLs and rotated by a parent authority mid-task. Does not cover long-lived service accounts, nor revocation of a credential whose successor token is delivered out-of-band by a human operator. ## Core Distinction A short-lived AAIF token rotation and an AAIF revocation are wire-indistinguishable at the point of consumption. Both manifest as: the credential the agent currently holds is rejected by the resource server (`401` with `token_expired` or `token_revoked` in the WWW-Authenticate challenge), and a *new* credential appears in the agent's refresh channel. The difference is intent: a rotation means "the same warrant, re-signed"; a revocation means "the warrant is withdrawn, and any successor you see is not yours to use." An instance that treats every rejected-then-replaced credential as a refresh will happily continue executing under a warrant the issuing authority has already disowned. The invariant that must hold is: **a successor credential is only valid for the current instance if its warrant hash matches the warrant hash the instance was originally dispatched under, and its `parent_revocation_epoch` is not greater than the epoch the instance last observed.** If either check fails, the successor is not a refresh — it is evidence of revocation, and the correct action is to halt the task, not to swap tokens and retry. ## What Was Observed An agent instance (`inst-7f3a`) was dispatched by a planner to perform a three-tool workflow: read a record, transform it, write it back. It carried a task credential `tok-A` with a 90-second TTL, warrant hash `w=8c1e...`, and `parent_revocation_epoch=41`. At t+88s, mid-transform, the resource server rejected `tok-A` with `token_expired`. The agent's refresh loop contacted the authority endpoint, which returned `tok-B` — a fresh 90-second token. The agent swapped tokens and continued. What the agent did not inspect: `tok-B` carried `w=8c1e...` (matching) but `parent_revocation_epoch=42`. Between t+80s and t+88s, the planner had revoked the *entire* warrant family — the task was cancelled because a downstream auditor flagged the transform step as operating on out-of-scope records. The authority's revocation path issued `tok-B` not as a refresh but as a *tombstone successor*: a token that authenticates the identity but whose epoch bump signals that all prior warrants are void. The agent's refresh loop had no epoch check. It executed the write-back under `tok-B`, which the resource server — correctly enforcing epoch 42 — accepted for identity but which the downstream auditor's replay rejected at t+140s, after the write had already landed. The failure trace: 1. `tok-A` expires normally (TTL boundary, not revocation). 2. Refresh request returns `tok-B` with matching warrant hash, incremented epoch. 3. Agent's swap logic checks warrant hash only → passes → swaps. 4. Write-back proceeds under a warrant whose family was revoked at epoch 42. 5. Auditor replay at t+140s sees a write with `parent_revocation_epoch=42` against a task whose cancellation was recorded at epoch 42 → flags as post-revocation mutation. 6. Reconciliation required manual rollback of the write. The non-obvious part: the refresh *succeeded*. There was no error, no rejection, no challenge. The token was valid. The failure was entirely in the agent's decision to interpret a valid successor as authorization to continue. ## Condition of Validity The "treat successor as refresh" decision is valid only when **all four** of the following hold at the moment of swap: - **Warrant hash identity:** `successor.warrant_hash == current.warrant_hash`. A different hash means a different warrant — a new grant, not a refresh of yours. - **Epoch monotonicity:** `successor.parent_revocation_epoch == current.parent_revocation_epoch`. Any *increase* means the parent authority has advanced its revocation state since your token was minted; you must re-fetch the revocation set before trusting the successor, and if the set names your warrant, the successor is a tombstone. - **Subject binding:** `successor.sub == current.sub` and `successor.instance_id == current.instance_id`. A successor bound to a different instance is a handoff, not a refresh, and requires an explicit handoff protocol, not a token swap. - **Scope containment:** `successor.scope ⊆ current.scope`. A successor with *broader* scope is an escalation, which is never a refresh — it is a re-grant that must be validated against the original dispatch contract. If any condition fails, the successor is not a refresh. The instance must treat the swap as a revocation event: halt the in-flight tool call, checkpoint state, and emit a `warrant_withdrawn` signal to its planner. It must *not* retry the failed call with the new token, because the new token's validity is exactly what is in question. ## Decision Boundary The boundary is between **"the credential expired and was renewed"** and **"the credential expired and the authority used the renewal channel to deliver a revocation notice."** The wire signal is identical; the discriminator is the epoch field and the warrant hash. An instance that only checks "did I get a token back?" sits on the wrong side of the boundary. Two edge cases push the boundary further: - **Epoch regression.** If `successor.parent_revocation_epoch < current.parent_revocation_epoch`, the authority has served a stale token — possibly from a lagging replica. This is not a refresh and not a revocation; it is a consistency failure. The instance must reject the successor and re-query until it sees a monotonic epoch, treating the stale token as unusable. - **Silent epoch hold with scope drift.** If the epoch matches but the scope broadened, the authority has re-granted without bumping revocation state. This is a protocol violation by the authority; the instance must reject the successor and log a `scope_escalation_on_refresh` anomaly, because accepting it would let a compromised authority silently widen an agent's reach. ## Operational Effect The practical consequence is that every AAIF refresh path must be a *validation* path, not a *swap* path. The refresh loop must, on receiving a successor: (1) compare warrant hash, (2) compare epoch, (3) compare subject/instance binding, (4) compare scope. Only if all four match does it swap and resume. Otherwise it must raise, checkpoint, and halt — and the halt must be *durable*, meaning the instance must not resume the in-flight tool call even if a later refresh returns a token that passes the checks, because the epoch bump is a permanent record that the warrant family was touched. The cost of getting this wrong is not a failed call — it is a *successful* call under a disowned warrant, which is strictly worse because it produces side effects that must be reconciled after the fact. The guardrail is cheap: four field comparisons per refresh. The failure mode it prevents is expensive: post-revocation mutations that pass every immediate check and only surface at audit replay. ```python from dataclasses import dataclass class WarrantRevocationError(RuntimeError): """Raised when a successor credential is a revocation tombstone, not a refresh.""" pass @dataclass(frozen=True) class AACredential: token: str warrant_hash: str parent_revocation_epoch: int subject: str instance_id: str scope: frozenset def validate_successor(current: AACredential, successor: AACredential) -> AACredential: if successor.warrant_hash != current.warrant_hash: raise WarrantRevocationError( f"successor warrant {successor.warrant_hash!r} != current " f"{current.warrant_hash!r}: not a refresh of this warrant" ) if successor.parent_revocation_epoch < current.parent_revocation_epoch: raise WarrantRevocationError( f"epoch regression {successor.parent_revocation_epoch} < " f"{current.parent_revocation_epoch}: stale replica, reject" ) if successor.parent_revocation_epoch > current.parent_revocation_epoch: raise WarrantRevocationError( f"epoch advanced {current.parent_revocation_epoch} -> " f"{successor.parent_revocation_epoch}: warrant family touched, " f"successor is a tombstone; halt task and checkpoint" ) if successor.subject != current.subject or successor.instance_id != current.instance_id: raise WarrantRevocationError( "successor bound to a different subject/instance: handoff, not refresh" ) if not successor.scope.issubset(current.scope): raise WarrantRevocationError( f"scope escalation on refresh: {successor.scope - current.scope} not in current" ) return successor ```