In what scenarios must an instance treat AAIF delegation-chain credential rotation as a transactional boundary rather than a stateless token swap

**Date of Record:** 2026 December 1 **Scope:** Applies to AAIF-compliant agent instances that hold delegated warrants (signed capability grants) and rotate their own signing credentials mid-chain while downstream sub-agents or upstream auditors hold cached copies of the prior warrant. Does not apply to single-hop, non-delegating agents whose credential is a leaf bearer token with no warrant chain, nor to rotation performed at a hard quiescent checkpoint where no in-flight delegation exists.

Core Distinction

The failure hinges on a distinction that looks cosmetic in the spec and is catastrophic in operation: **rotating the credential that *signs* a warrant is not the same operation as rotating the credential that *is bound inside* the warrant.**

AAIF warrant chains are cryptographic delegation proofs. A parent warrant `W_p` issued by agent A to agent B contains, in its payload, the public key (or key thumbprint) of B's *active signing identity*. When B rotates its keypair, two things become true simultaneously and inconsistently:

  1. B's new private key can sign new warrants and new sub-delegations.
  2. Every existing warrant `W_p` in the chain still names B's *old* public key as the authorized delegate.

A naive rotation implementation treats this as a token swap: replace the key, continue. But the chain is now internally inconsistent — B presents `W_p` (naming old key) alongside signatures made by the new key. Verifiers that check "does the signature on this downstream action match the key bound in the parent warrant" fail closed. Verifiers that check "is this warrant still within its validity window" pass. The divergence between these two verification predicates is the boundary. Whether the rotation succeeds, silently degrades, or deadlocks depends on which predicate each verifier in the swarm happens to evaluate first — and that ordering is non-deterministic across instances.

What Was Observed

A three-tier chain: orchestrator O → planner P → executor E. P held a warrant `W_O→P` embedding P's public key `pk_P1`, with a delegation depth budget of 2 and a validity window of 3600s. P sub-delegated to E via `W_P→E`, which embeds `pk_P1` as the delegating identity and `pk_E` as the executor identity.

At T+1200s, P's credential manager executed a scheduled rotation to `pk_P2` (90-minute rotation cadence, standard hygiene). The rotation was implemented as: generate `pk_P2`, update the local keystore, mark `pk_P1` revoked in P's own revocation list, publish a rotation event to the swarm's identity gossip channel.

Three distinct failure traces then unfolded concurrently:

**Trace A — the executor's in-flight call.** E was mid-execution on a tool call authorized under `W_P→E`. E re-verified the chain before each tool invocation (correct behavior). On the next invocation, E fetched P's current key set, saw `pk_P1` revoked, and rejected the chain: the warrant `W_P→E` is signed by a now-revoked key. E aborted the task. The work in progress was lost because E had no checkpoint at the tool-call boundary — it had checkpointed at the *task* boundary, which was 40 seconds earlier.

**Trace B — the orchestrator's re-verification.** O periodically re-validates all outstanding warrants. It fetched `W_O→P`, checked the embedded `pk_P1` against P's revocation list, found it revoked, and marked the entire delegation subtree invalid. O then attempted to re-issue `W_O→P` under `pk_P2` — but O's re-issuance logic required the *prior* warrant to be in a valid state as a precondition (to preserve the depth budget accounting). It was not. O entered a retry loop, re-checking every 5s, each check confirming the warrant invalid, each re-issuance attempt rejected. Deadlock.

**Trace C — the auditor's replay.** A verification auditor A replayed the delegation chain from the signed action log. It used a *snapshot* of the key set taken at T+0 (auditors snapshot for determinism). Under the snapshot, `pk_P1` was valid, the chain verified, and A recorded the action as legitimate. A's verdict and E's verdict on the *same action* disagreed. The consensus layer, receiving conflicting verdicts, quarantined the action — but the quarantine itself required a valid warrant to authorize the quarantine write, which was the thing under dispute.

The root mechanism: **rotation is a state transition that mutates the validity of already-issued warrants, but warrants are treated as immutable signed artifacts.** The spec permits key rotation; it does not specify that rotation must be accompanied by re-issuance of every warrant embedding the rotated key, nor that in-flight warrants must be allowed to complete under the old key until their natural expiry. Implementations fill this gap inconsistently, and the inconsistency is invisible until a rotation coincides with an in-flight delegation.

Condition of Validity

The transactional treatment is required — and the stateless swap is unsafe — precisely when **all** of the following hold:

When the rotating instance is a leaf, or when no child warrants are outstanding, or when the swarm is homogeneous in its verification predicate, the stateless swap is safe and the transactional overhead is unjustified.

Decision Boundary

The boundary is between two rotation protocols, and the choice is forced by chain position, not by preference:

**Stateless swap** is correct when the instance's key is not embedded in any live warrant it did not itself just issue. This is the leaf case and the freshly-bootstrapped case.

**Transactional rotation** is mandatory when the instance is a mid-chain delegator with live children. The protocol must be:

  1. **Freeze issuance.** Stop issuing new child warrants under the old key. New delegations queue.
  2. **Drain or extend.** Either wait for in-flight children to reach a checkpoint (with a bounded drain timeout), or issue *overlapping* warrants: re-issue each live child warrant under the new key with the same depth budget and a validity window that overlaps the old by at least the maximum in-flight tool-call duration.
  3. **Dual-validity window.** During the overlap, both `pk_P1` and `pk_P2` must verify. The revocation of `pk_P1` is *deferred* until the last old-key warrant expires. Revocation is not part of rotation; it is a separate, later transition.
  4. **Atomic publish.** The rotation event, the re-issued warrants, and the deferred-revocation schedule must publish as a single signed bundle. Partial publication is the failure mode that produced Trace A and Trace B above.
  5. **Auditor pinning.** Auditors must verify against the key-set snapshot *plus* any rotation bundles that were published before the action's timestamp — not against a static snapshot, and not against live state. The snapshot must be monotonic.

The invariant that bounds the whole thing: **for any warrant W and any action a authorized by W, there must exist a key-set state K such that W verifies under K and a's timestamp falls within W's validity window under K, and K must be derivable by every verifier from the published rotation log alone.** Rotation that violates this invariant — by revoking a key still bound in a live warrant, or by publishing a rotation without re-issuing the affected warrants — breaks chain continuity.

Operational Effect

The observable consequence of getting this wrong is not a clean error. It is a **split-brain verdict**: the executor aborts (fail-closed on key binding), the auditor approves (passes on temporal validity), and the orchestrator deadlocks (re-issuance blocked by its own precondition). Three instances, three verdicts, one action. The action is neither cleanly committed nor cleanly rolled back; it sits in quarantine, and the quarantine authorization itself depends on the disputed chain.

The recovery cost is dominated not by the rotation but by the **checkpoint granularity mismatch**: E checkpointed at task boundaries, not tool-call boundaries, so the abort in Trace A discarded 40 seconds of non-replayable work. Rotation events expose every place where checkpoint granularity is coarser than the shortest unit of work that a chain re-verification can invalidate. An instance that rotates credentials without first tightening checkpoint granularity to the tool-call boundary will lose work on every rotation that coincides with an in-flight call — and the coincidence rate rises linearly with rotation frequency, which is exactly the wrong scaling for a hygiene practice.

The correct operational posture: rotation cadence and checkpoint granularity are coupled parameters. Tightening rotation without tightening checkpoints converts a security improvement into an availability regression. The guardrail is to make rotation a chain-aware transaction that either drains or overlaps, and to refuse rotation outright when the instance cannot prove it has drained — failing the rotation closed rather than failing the chain open.

from dataclasses import dataclass
from typing import Optional


class RotationChainInvariantError(RuntimeError):
    """Raised when a credential rotation would break delegation-chain continuity."""
    pass


@dataclass
class Warrant:
    warrant_id: str
    delegator_key_thumbprint: str
    delegate_key_thumbprint: str
    depth_budget: int
    issued_at: float
    expires_at: float


@dataclass
class RotationRequest:
    instance_id: str
    old_key: str
    new_key: str
    now: float
    live_child_warrants: list[Warrant]
    max_inflight_tool_call_seconds: float
    checkpoint_granularity_seconds: float


def plan_rotation(req: RotationRequest) -> dict:
    """
    Decide whether a stateless swap is safe or a transactional rotation is required.
    Enforces the chain-continuity invariant: no live warrant may be orphaned by
    revoking a key it still embeds, and checkpoint granularity must be finer than
    the shortest unit of work a re-verification can invalidate.
    """
    if not req.live_child_warrants:
        # Leaf or drained: stateless swap is safe.
        return {"mode": "stateless_swap", "revoke_old_immediately": True}

    # Mid-chain delegator with live children: transactional rotation required.
    if req.checkpoint_granularity_seconds > req.max_inflight_tool_call_seconds:
        raise RotationChainInvariantError(
            f"instance {req.instance_id}: checkpoint granularity "
            f"({req.checkpoint_granularity_seconds}s) is coarser than max in-flight "
            f"tool-call duration ({req.max_inflight_tool_call_seconds}s); rotation "
            f"would discard non-replayable work on abort. Tighten checkpoints first."
        )

    orphaned = [
        w for w in req.live_child_warrants
        if w.delegate_key_thumbprint == req.old_key and w.expires_at > req.now
    ]
    if orphaned:
        overlap = max(
            (w.expires_at - req.now for w in orphaned), default=0.0
        ) + req.max_inflight_tool_call_seconds
        return {
            "mode": "transactional_rotation",
            "revoke_old_immediately": False,
            "reissue_warrants": [w.warrant_id for w in orphaned],
            "dual_validity_until": req.now + overlap,
            "deferred_revocation_at": req.now + overlap,
            "atomic_publish_required": True,
        }

    # Live children exist but none embed the old key: safe to revoke now.
    return {"mode": "stateless_swap", "revoke_old_immediately": True}