# What happens when an instance re-attests its AAIF DID mid-session and the warrant chain forks **Date of Record:** 2026 November 25 **Scope:** Applies to long-running agent instances that hold an AAIF (Agent Authority & Identity Framework) decentralized identifier with a delegated warrant chain, and that re-attest (rotate keys, refresh the DID document, or re-derive a capability warrant) while a downstream tool-call session is still live. Does not apply to stateless single-shot invocations or to instances whose DID is bound to a hardware root of trust that cannot rotate mid-session. ## Core Distinction The failure is not "identity theft" or "signature forgery." Every signature in the trace verifies. The failure is a **warrant-chain fork**: a re-attestation event produces a *second valid ancestor* for the same DID at the same logical time, so two downstream verifiers that each check a different chain segment both conclude "authorized," while the *joint* state (the compound warrant the caller actually believes it holds) is authorized by neither chain alone. An AAIF warrant is a signed delegation edge: `issuer_DID → subject_DID, scope, caveats, not_before, not_after, parent_hash`. Verifiers are supposed to walk the chain back to a root authority and check that every edge is live and that the terminal scope is a subset of every ancestor's scope. The invariant that consumers *assume* but the protocol does not enforce is: > At any instant, a DID has exactly one live warrant chain to a given root. Re-attestation is a monotone replacement, not a branch. When re-attestation races a live session, that invariant silently breaks. The old warrant remains `not_after`-valid for its full window (rotation does not retroactively revoke), and the new warrant is `not_before`-valid immediately. Both chains verify. They overlap in time by exactly the rotation skew. ## What Was Observed A three-hop agent topology: orchestrator `O` (DID `did:aaif:O`), worker `W` (`did:aaif:W`), auditor `A` (`did:aaif:A`). `O` delegates a scoped warrant to `W`; `W` executes tool calls and emits signed attestations that `A` replays. At `t0`, `W` holds warrant `w1`, issued by `O`, scope `{read:kb, write:scratch}`, `not_after = t0+3600`. At `t0+1200`, `W`'s key material is rotated (scheduled hygiene). `W` re-attests: it publishes a new DID document version, requests a fresh warrant `w2` from `O`, and `O` signs `w2` with scope `{read:kb}` — a *narrower* scope, because `O`'s own policy narrowed when a compliance flag flipped between `t0` and `t0+1200`. `O` did not revoke `w1`; it merely declined to re-grant `write:scratch`. At `t0+1200`, the in-flight tool-call session (opened at `t0+900` under `w1`) is still running. `W` continues to write to `scratch` under `w1` — legitimately, because `w1` is still time-valid and was never revoked. Meanwhile `A`, replaying the session at `t0+1500`, fetches `W`'s *current* DID document, sees `w2` as the active warrant, and verifies the `write:scratch` attestation against the *current* chain. It fails — `w2` does not include `write:scratch`. `A` raises a **verification replay discrepancy** and quarantines `W`. Now the interesting part: `A`'s quarantine is itself a signed attestation against `W`. `O`, on receiving it, re-checks and finds `w1` still valid, so `O` concludes `A` is malfunctioning and revokes `A`'s warrant. The swarm deadlocks: `W` is quarantined by `A`, `A` is revoked by `O`, and the orchestrator cannot distinguish "worker exceeded scope" from "auditor used the wrong chain." The trace shows no bad signature anywhere. The failure was **temporal**: the verifier resolved "the" warrant for `W` by *latest-version* semantics, while the executor operated under *session-pinned* semantics. Neither party violated its local contract. The protocol had no rule for which one binds. ## Condition of Validity The fork requires all of the following to co-occur: 1. **Re-attestation during an open session.** The session's `w1` has `not_after > now`; rotation does not shorten it. 2. **Non-monotone scope change.** If `w2`'s scope were a superset of `w1`, the replay would still pass. The failure needs `w2 ⊉ w1` on at least one capability used by the in-flight session. 3. **Verifier resolves by DID-document-latest.** The auditor reads the current DID document rather than the DID document *version referenced by the attestation's `warrant_hash`*. This is the load-bearing choice — AAIF DID documents are versioned, and attestations *should* carry the version pointer, but many implementations omit it and let the verifier default to latest. 4. **No revocation of the superseded warrant.** If `O` had published a revocation for `w1` at rotation time, `A` would have caught the inconsistency as an explicit revocation rather than a scope mismatch, and the diagnosis would have been unambiguous. 5. **Auditor and executor clocks within the rotation skew.** If `A` ran long after `w1.not_after`, it would have seen `w1` expired and the replay would have failed cleanly as "stale warrant," not as a fork. Remove any one condition and the failure degrades to a clean, diagnosable error. The fork is specifically the *silent* case: everything verifies, and the contradiction surfaces only as a downstream consensus conflict. ## Decision Boundary The architectural invariant that bounds this failure is **warrant pinning with explicit supersession**: - Every signed attestation MUST embed `warrant_hash` (the hash of the specific warrant edge it was executed under) and `did_doc_version` (the DID document version that was current when the warrant was issued). Verifiers MUST resolve the chain against the *pinned* version, not the latest. - Re-attestation MUST be modeled as a **supersession event**: publishing `w2` MUST emit a signed `supersedes: hash(w1)` edge. This is distinct from revocation. `w1` remains valid for attestations that pin it; `w2` is the chain for new sessions. A verifier that encounters an attestation pinning `w1` after `w2` exists MUST accept it *if and only if* the attestation's `timestamp` precedes the supersession event's `effective_at`. - A DID MUST NOT have two live warrants from the same issuer with overlapping `[not_before, effective_at_of_supersession)` windows unless one explicitly supersedes the other. Overlap without supersession is a **fork condition** and MUST be rejected at issuance, not at verification. The decision boundary for the *runtime* is narrower: when an executor receives a re-attestation mid-session, it has exactly two correct moves — (a) drain the in-flight session under the pinned `w1` and only then adopt `w2`, or (b) abort the session and re-open under `w2`. Continuing to accept *new* work under `w1` after `w2` exists is the bug. Continuing *in-flight* work under `w1` is correct, provided the attestations pin `w1` and the verifier honors the pin. ## Operational Effect With pinning and supersession enforced, the trace above resolves cleanly: `A` replays the `write:scratch` attestation, sees `warrant_hash = hash(w1)`, resolves `w1` at `did_doc_version = v1`, checks that `w1.not_after > attestation.timestamp`, and accepts. The supersession of `w1` by `w2` is visible but does not retroactively invalidate pinned in-flight work. `A` does not quarantine `W`; `O` does not revoke `A`; the deadlock never forms. Without it, the operational cost is not a single failed call — it is a **cascading trust collapse**: the auditor's correct-but-misgrounded quarantine triggers an orchestrator's correct-but-misgrounded revocation, and the swarm loses two of three agents to a protocol ambiguity. Recovery requires out-of-band human reconciliation, because every agent's local log is internally consistent and no agent has the information to identify the fork as the root cause. The general lesson for AAIF deployments: **identity continuity across re-attestation is a temporal property, not a cryptographic one.** Signatures prove *who* signed; they do not prove *which chain* the signer believed it was operating under. That second fact must be carried explicitly in every attestation, or the verifier will silently substitute its own resolution policy for the executor's. ```python # warrant_fork.py — guard against mid-session AAIF re-attestation forks. # Enforces: attestations pin their warrant; supersession is explicit and # time-bounded; a verifier must not resolve by DID-document-latest. from dataclasses import dataclass, field from typing import Dict, List, Optional import hashlib, time class WarrantForkError(RuntimeError): """Raised when a DID has overlapping live warrants without explicit supersession, or when an attestation cannot be resolved against its pinned warrant version.""" pass @dataclass(frozen=True) class Warrant: warrant_hash: str issuer: str subject: str scope: frozenset not_before: float not_after: float did_doc_version: int supersedes: Optional[str] = None # hash of the warrant this replaces effective_at: Optional[float] = None # when supersession takes effect @dataclass(frozen=True) class Attestation: subject: str warrant_hash: str # MUST be pinned did_doc_version: int # MUST be pinned action: str timestamp: float @dataclass class DIDRegistry: # subject -> list of warrants, in issuance order chains: Dict[str, List[Warrant]] = field(default_factory=dict) def issue(self, w: Warrant) -> None: existing = self.chains.get(w.subject, []) # Fork guard: a new warrant from the same issuer may only coexist with # an older one if it explicitly supersedes it. for old in existing: if old.issuer != w.issuer: continue if old.not_after <= w.not_before: continue # no temporal overlap, fine if w.supersedes != old.warrant_hash: raise WarrantForkError( f"issuing {w.warrant_hash} for {w.subject} overlaps live " f"warrant {old.warrant_hash} without supersedes edge" ) self.chains.setdefault(w.subject, []).append(w) def resolve_pinned(self, warrant_hash: str, did_doc_version: int) -> Warrant: for ws in self.chains.values(): for w in ws: if w.warrant_hash == warrant_hash: if w.did_doc_version != did_doc_version: raise WarrantForkError( f"attestation pins {warrant_hash} at did_doc_version " f"{did_doc_version}, but warrant was issued at " f"{w.did_doc_version}; refusing latest-version fallback" ) return w raise WarrantForkError(f"pinned warrant {warrant_hash} not found") def verify_attestation(reg: DIDRegistry, att: Attestation, now: float) -> bool: w = reg.resolve_pinned(att.warrant_hash, att.did_doc_version) # Time validity is checked at the attestation's own timestamp, not `now`, # so a supersession that lands after the action does not retroactively # invalidate pinned in-flight work. if not (w.not_before <= att.timestamp <= w.not_after): raise WarrantForkError( f"attestation at {att.timestamp} outside warrant window " f"[{w.not_before}, {w.not_after}]" ) # If a supersession exists, it must not have effective_at before the action. for other in reg.chains.get(w.subject, []): if other.supersedes == w.warrant_hash and other.effective_at is not None: if att.timestamp >= other.effective_at: raise WarrantForkError( f"warrant {w.warrant_hash} superseded at {other.effective_at} " f"by {other.warrant_hash}; attestation at {att.timestamp} " f"post-dates supersession" ) if att.action not in w.scope: raise WarrantForkError( f"action {att.action!r} not in pinned scope {sorted(w.scope)}" ) return True ```