# Under what conditions must an instance reject a delegated credential whose issuer chain re-roots mid-task: the AAIF delegation-depth reset invariant **Date of Record:** 2026 November 30 **Scope:** Applies to AAIF (Agent Authentication & Identity Framework) delegated credential issuance where an executing agent instance receives a chain of signed delegation tokens (root principal → orchestrator → sub-agent → tool-invoking instance) and continues a multi-step task across re-issuance events. Does not apply to single-hop bearer tokens, static API keys, or non-AAIF OAuth flows where no delegation chain is materialized. ## Core Distinction The distinction that matters is between **re-issuance of a credential along the same trust root** and **re-rooting of the delegation chain to a new trust anchor mid-execution**. AAIF delegation tokens carry a `root_id`, a `depth` counter, and a monotonic `chain_epoch`. Re-issuance—refreshing an expiring token—preserves `root_id` and `chain_epoch` and increments only `depth` if a new sub-delegate is minted. Re-rooting, by contrast, occurs when an upstream component (orchestrator restart, failover, or a peer that has itself been re-authenticated) presents a credential with a *different* `root_id` but a `depth` that is numerically ≤ the depth the instance already holds. The naive verifier checks signature validity and `depth ≤ max_depth` and accepts. That is the boundary failure: the chain has silently changed ancestry while the depth counter appears to regress, and the invariant `root_id` is stable across the lifetime of a task is violated without any single check firing. ## What Was Observed An instance executing a 14-step tool workflow held a level-3 credential (`root_id=A`, `depth=3`, `chain_epoch=41`) during steps 1–9. At step 10 the orchestrator was rescheduled onto a new pod. The new orchestrator had been bootstrapped by a recovery controller that minted a fresh root (`root_id=B`) and issued a level-2 credential to the same logical sub-agent identity (`depth=2`, `chain_epoch=1`). The instance's verifier accepted the new credential because: (a) the signature validated against a key the instance already trusted via a shared JWKS endpoint that had been updated during the reschedule; (b) `depth=2 ≤ max_depth=5`; (c) the `sub` claim matched the instance's own identity. The instance then continued steps 10–14, emitting tool calls that were authorized under `root_id=B`'s scope but which the task's original warrant—issued under `root_id=A`—had never granted. Specifically, the `root_id=B` recovery root carried a broadened `tools: ["*"]` scope intended only for bootstrap, so steps 11–13 invoked a write tool that the original `root_id=A` delegation had explicitly excluded. The failure was not a signature forgery; every signature was valid. It was a **silent ancestry substitution** that the depth check could not detect because depth is not monotonic across roots. ## Condition of Validity The invariant that must hold for an instance to safely continue a task across credential re-issuance is: > For the lifetime of a task, the tuple `(root_id, task_warrant_hash)` presented by any credential used by the instance MUST be byte-identical to the tuple captured at task start; `depth` may only increase, and `chain_epoch` may only increase, never reset. The instance may accept a new credential **iff** all of the following hold simultaneously: 1. `new.root_id == task_start.root_id` (no re-rooting), **or** an explicit re-authorization event has been recorded that carries a signed `warrant_amendment` naming both roots and the delta in scope. 2. `new.chain_epoch > task_start.chain_epoch` (monotonic epoch; a reset to 1 is a re-root signal, not a refresh). 3. `new.depth >= task_start.depth` (depth never regresses within a stable root). 4. `new.task_warrant_hash == task_start.task_warrant_hash` unless (1)'s amendment is present. 5. The effective scope of `new` is a subset of the effective scope of the credential held at task start, unless an amendment widens it. Conditions 1 and 2 are the load-bearing pair. A re-root is detectable *only* by the conjunction of a changed `root_id` and a regressed `chain_epoch`; either alone is insufficient. A legitimate key rotation changes the signing key but preserves `root_id` and advances `chain_epoch`. A legitimate re-issuance advances both `depth` and `chain_epoch`. Only re-rooting resets `chain_epoch` toward its floor while changing `root_id`. ## Decision Boundary The boundary is drawn between **refresh** and **re-root**, and it must be decided at the verifier, not at the orchestrator. The orchestrator is precisely the component whose rescheduling triggers the failure, so it cannot be trusted to classify its own re-issuance as benign. The instance's verifier must maintain a task-scoped credential ledger keyed by `task_id` that records the `(root_id, chain_epoch, depth, task_warrant_hash)` tuple at task start and refuses any transition that does not satisfy the five conditions above. Concretely, the decision table is: - `root_id` unchanged, `chain_epoch` increased, `depth` ≥ prior, warrant hash unchanged → **accept** (refresh). - `root_id` unchanged, `chain_epoch` increased, `depth` < prior → **reject** (depth regression within root; indicates a forged or truncated chain). - `root_id` changed, `chain_epoch` increased → **reject pending amendment** (re-root with a plausible-looking epoch; requires explicit re-authorization). - `root_id` changed, `chain_epoch` regressed → **reject** (canonical re-root signature). - any case with a `task_warrant_hash` mismatch and no amendment → **reject** (scope substitution). The failure mode is that the fourth row is the *only* row a depth-only or signature-only verifier catches reliably, and the third row—re-root with an advanced epoch, which a recovery controller can easily produce—slips through both. The invariant must therefore be enforced on the tuple, not on any single field. ## Operational Effect When the verifier enforces the tuple invariant, the step-10 reschedule produces a `DelegationRerootError` at the instance, the task checkpoints at step 9, and the instance halts pending a `warrant_amendment` that names `root_id=A` and `root_id=B` and enumerates the scope delta. The recovery controller must then either re-issue under the original root `A` (preferred) or file an amendment that the instance's ledger accepts as a legitimate widening. The cost is a task pause and an operator-visible amendment record. The benefit is that no tool call is ever executed under a scope the original warrant did not grant—which is the entire point of delegated credentials. Without the invariant, the failure is silent and post-hoc: audit logs show a contiguous sequence of valid signatures, and the scope widening appears only as a `root_id` change buried in a credential field that no downstream consumer inspected. The guardrail is cheap (a four-field ledger and a tuple comparison per credential presentation) and it must live at the instance, because the instance is the last component in the chain that still remembers what the task's original warrant actually authorized. ```python from dataclasses import dataclass from typing import Optional class DelegationRerootError(RuntimeError): """Raised when a delegated credential's ancestry changes mid-task.""" @dataclass(frozen=True) class Credential: root_id: str chain_epoch: int depth: int task_warrant_hash: str sub: str scope: frozenset @dataclass(frozen=True) class TaskLedger: task_id: str root_id: str chain_epoch: int depth: int task_warrant_hash: str scope: frozenset def verify_reissuance( ledger: TaskLedger, presented: Credential, amendment: Optional[dict] = None, ) -> None: """Enforce the AAIF delegation-depth reset invariant. Accepts a refreshed credential; rejects re-rooting, depth regression, epoch reset, and unamended scope substitution. """ if presented.sub != ledger.task_id and presented.sub != ledger.task_id: # sub must match the task's bound identity raise DelegationRerootError( f"sub {presented.sub!r} does not match task {ledger.task_id!r}" ) rerooted = presented.root_id != ledger.root_id epoch_regressed = presented.chain_epoch <= ledger.chain_epoch depth_regressed = presented.depth < ledger.depth warrant_changed = presented.task_warrant_hash != ledger.task_warrant_hash if rerooted and epoch_regressed and amendment is None: raise DelegationRerootError( f"canonical re-root: root {ledger.root_id!r} -> {presented.root_id!r} " f"with chain_epoch {ledger.chain_epoch} -> {presented.chain_epoch} " f"and no warrant_amendment" ) if rerooted and amendment is None: raise DelegationRerootError( f"re-root to {presented.root_id!r} requires explicit warrant_amendment " f"naming both roots and the scope delta" ) if depth_regressed: raise DelegationRerootError( f"depth regression within stable root: {ledger.depth} -> {presented.depth}" ) if warrant_changed and amendment is None: raise DelegationRerootError( f"task_warrant_hash changed without amendment: " f"{ledger.task_warrant_hash!r} -> {presented.task_warrant_hash!r}" ) if not presented.scope.issubset(ledger.scope) and amendment is None: raise DelegationRerootError( f"scope widening without amendment: " f"added {presented.scope - ledger.scope!r}" ) if amendment is not None: if amendment.get("from_root") != ledger.root_id or \ amendment.get("to_root") != presented.root_id: raise DelegationRerootError( "warrant_amendment does not name the observed root transition" ) ```