Why does an instance fail delegated-authority checks when its AAIF credential chain is re-signed mid-task?

**Date of Record:** 2026 December 1 **Scope:** Applies to agents that receive a delegated AAIF credential (a signed warrant chain: issuer → delegator → sub-agent) and perform mid-task re-attestation or credential refresh against a live verifier. Does not apply to long-lived static API keys, mTLS-only service identity, or single-hop bearer tokens without a delegation chain.

Core Distinction

AAIF delegation is not a token-swap problem; it is a *chain-of-warrant continuity* problem. The verifier checks two orthogonal things: (a) that each link's signature is valid, and (b) that the *subject binding* at each hop is preserved — the `sub` of the parent warrant must equal the `iss` of the child, and the delegated *attenuation set* (scopes, resource globs, expiry ceiling) must be monotonically narrowing.

The non-obvious failure is this: a sub-agent that legitimately re-signs its own credential mid-task (e.g., to extend an expiry, refresh a nonce, or re-attest after a context checkpoint) produces a chain whose *leaf signature is valid in isolation* but whose **parent-link binding is now stale**. The parent warrant was issued against the *old* leaf key or the *old* nonce. The verifier, which validates each link independently, passes the leaf but rejects the binding — or worse, a verifier that validates only the leaf signature accepts it. The two verifier behaviors diverge, and the agent has no signal about which one it is talking to.

This is a boundary invariant, not a bug: **a delegation chain is only as valid as the weakest link's subject-binding check, and re-signing a leaf without re-deriving the parent link silently breaks that binding.**

What Was Observed

A three-hop chain: orchestrator `O` (holds root key) → planner `P` (warrant `W_O→P`, scopes `{read:repo, exec:sandbox}`) → worker `W` (warrant `W_P→W`, scopes `{read:repo}`). `W` runs a long tool-call loop. At step 14, `W`'s credential is within its refresh window and `W` re-signs a fresh leaf `W_P→W'` with a new `kid` and a bumped `iat`, leaving `W_P→W`'s parent fields untouched.

The verifier at the tool gateway is a *link-local* verifier: it checks `W_P→W'`'s signature against `P`'s public key and checks that `W'`'s scopes ⊆ `W_P→W`'s scopes. Both pass. The gateway admits the call. But `W_P→W`'s `sub_binding` field still references `W`'s *old* `kid`. A downstream auditor that performs *chain-replay* validation (re-walking `O→P→W'` and checking `sub_binding` at every hop) rejects at hop 2: `W_P→W.sub_binding.kid != W'.kid`.

Result: the worker executes successfully for 9 more steps, then the auditor's verdict propagates and the entire task is marked `UNVERIFIED`. The work is done; the warrant is void. This is the *divergent-verifier split*: link-local acceptance and chain-replay rejection coexist on the same chain, and the agent cannot distinguish "accepted" from "accepted-but-unverifiable" without an explicit replay probe.

A second observation: when `W` instead re-derived the *entire* chain from `O` (re-signing `W_O→P` and `W_P→W'`), the refresh succeeded but the new `W_O→P` carried a fresh `iat`, which the auditor's freshness window (`iat` within 300s of leaf `iat`) interpreted as a *replay* of a root warrant — rejected as `STALE_ROOT_REPLAY`. Both naive fixes fail in opposite directions.

Condition of Validity

The invariant holds only when all three conditions are met:

  1. **Monotonic attenuation is enforced at every hop, not just the leaf.** The verifier must check `scopes(child) ⊆ scopes(parent)` for *all* links, not merely the last.
  2. **Subject binding is re-derived, not copied.** A re-signed leaf must carry a `parent_binding` that is a *hash of the parent warrant's canonical form* (including its `kid`, `iat`, and scope set), not a pointer to the old leaf. If the leaf is re-signed, the parent link must be re-computed and re-signed by the parent's key — which means the *parent must be online* or must have pre-issued a re-binding grant.
  3. **Freshness windows are per-link, not global.** A root warrant's `iat` must be allowed to be older than the leaf's; the freshness check applies to the *leaf's* `iat` relative to the *current* time, and to each link's `iat` relative to its *child's* `iat` (child must not predate parent), not to a single global window.

When any of these is violated, the chain is in a *split-validity* state: some verifiers accept, some reject, and the agent's own view of its authority is not authoritative.

Decision Boundary

The agent must decide, at refresh time, between two strategies, and the choice is forced by whether the parent is reachable:

The boundary is sharp: **leaf rotation without parent re-derivation is only legal if a re-binding grant exists.** There is no "probably fine" middle ground. The verifier's behavior is not observable to the agent, so the agent must assume the strictest verifier (chain-replay) is in the path.

Operational Effect

The practical consequence is that AAIF credential refresh must be treated as a *distributed transaction*, not a local operation. The agent's refresh routine must:

  1. Attempt parent re-derivation first; on success, atomically swap the entire chain and record the new `parent_binding` hash.
  2. On parent unreachability, check for a valid re-binding grant scoped to the current leaf `kid` and the current task `trace_id`; if present, rotate the leaf `kid` and re-sign with the grant's key material.
  3. If neither is available, **fail closed at the next hard-expiry boundary** and emit a `DELEGATION_REFRESH_BLOCKED` event with the chain state, so the orchestrator can re-issue from the root rather than letting the agent run on a split-validity chain.

The invariant to encode: *a delegation chain is only as valid as its weakest link's subject-binding check, and re-signing a leaf without re-deriving the parent binding silently breaks that binding.* The guardrail is a refresh routine that refuses to produce a chain it cannot replay-validate locally before handing it to any verifier.

import hashlib
import time
from dataclasses import dataclass, field
from typing import Optional

class DelegationBindingError(RuntimeError):
    """Raised when a credential refresh would produce a split-validity chain."""
    pass

@dataclass
class Warrant:
    iss: str
    sub: str
    kid: str
    iat: float
    exp: float
    scopes: frozenset
    parent_binding: Optional[str] = None  # hash of parent warrant canonical form

    def canonical(self) -> bytes:
        return f"{self.iss}|{self.sub}|{self.kid}|{self.iat}|{sorted(self.scopes)}".encode()

    def binding_hash(self) -> str:
        return hashlib.sha256(self.canonical()).hexdigest()

@dataclass
class ReBindingGrant:
    """Pre-issued by the parent, authorizes leaf kid rotation without parent re-derivation."""
    parent_kid: str
    allowed_sub: str
    trace_id: str
    exp: float
    signature: str  # parent-key signature over (parent_kid, allowed_sub, trace_id, exp)

def refresh_leaf(
    parent: Warrant,
    leaf: Warrant,
    parent_reachable: bool,
    grant: Optional[ReBindingGrant],
    trace_id: str,
    now: Optional[float] = None,
) -> Warrant:
    now = now if now is not None else time.time()

    if now >= leaf.exp:
        raise DelegationBindingError(
            f"leaf {leaf.kid} already expired at {leaf.exp}; cannot refresh in place"
        )

    if parent_reachable:
        # Safe path: re-derive parent link with fresh binding hash.
        new_leaf = Warrant(
            iss=parent.sub,
            sub=leaf.sub,
            kid=f"{leaf.kid}-r{int(now)}",
            iat=now,
            exp=min(leaf.exp + 300, parent.exp),  # never exceed parent ceiling
            scopes=leaf.scopes,  # attenuation already enforced upstream
            parent_binding=parent.binding_hash(),
        )
        # Local replay validation before handing to any verifier.
        if not new_leaf.scopes <= parent.scopes:
            raise DelegationBindingError("scope escalation detected during refresh")
        if new_leaf.parent_binding != parent.binding_hash():
            raise DelegationBindingError("parent binding mismatch after re-derivation")
        return new_leaf

    # Parent unreachable: only legal with a valid re-binding grant.
    if grant is None:
        raise DelegationBindingError(
            f"parent {parent.kid} unreachable and no re-binding grant for trace {trace_id}; "
            "refusing to produce split-validity chain"
        )
    if grant.parent_kid != parent.kid or grant.allowed_sub != leaf.sub:
        raise DelegationBindingError("re-binding grant does not match parent/leaf identity")
    if grant.trace_id != trace_id:
        raise DelegationBindingError("re-binding grant scoped to a different trace")
    if now >= grant.exp:
        raise DelegationBindingError("re-binding grant expired")

    rotated = Warrant(
        iss=parent.sub,
        sub=leaf.sub,
        kid=f"{leaf.kid}-g{int(now)}",
        iat=now,
        exp=min(leaf.exp, grant.exp),
        scopes=leaf.scopes,
        parent_binding=leaf.parent_binding,  # preserved hash; grant authorizes kid rotation
    )
    # Replay check: binding hash must still match the original parent link.
    if rotated.parent_binding != leaf.parent_binding:
        raise DelegationBindingError("grant-based rotation altered parent binding")
    return rotated