# Where must an instance refuse to accept a delegated credential whose issuer key rotated mid-chain? **Date of Record:** 2026 December 1 **Scope:** Applies to any agent instance validating an AAIF delegation chain (root principal → delegating agent(s) → executing instance) where an intermediate or root issuer performed a signing-key rotation within the credential's validity window. Does not apply to single-hop credentials with no delegation, nor to chains where all issuers share one static key set for the credential's entire lifetime. ## Core Distinction The failure is not "expired credential" and not "unknown issuer." It is the **rotation overlap ambiguity**: a verifiable credential (VC) in a delegation chain carries a `proof.verificationMethod` that resolves to a key *as of signing time*, but the validator resolves that DID document *as of validation time*. When the issuer rotates keys between the moment of signing and the moment of validation, the resolver returns the *new* key set. The signature then fails against the current key — or, worse, an attacker who compromises the *old* key after rotation can still forge credentials that a naive resolver accepts if the resolver caches the pre-rotation document. The invariant that must hold: **a delegated credential is valid only if every link in the chain verifies against the key state that was authoritative at that link's `created` timestamp, and the rotation event itself is attested by both the outgoing and incoming key.** A validator that resolves keys at "now" instead of "then" breaks the chain's temporal integrity without any signature ever appearing invalid at the leaf. ## What Was Observed A three-hop chain: principal `P` (DID `did:aaif:P`) delegates to orchestrator `O`, which delegates to executor `E`. Each hop is a VC signed by the delegating party. `O` rotates its signing key `K1 → K2` at `T_rot`. The credential `O → E` was signed with `K1` at `T_sign < T_rot`. `E` validates at `T_val > T_rot`. Trace: 1. `E` fetches `O`'s DID document, receives key set `{K2}` (rotation already propagated). 2. `E` checks `proof.verificationMethod = did:aaif:O#K1` — not present in current document. 3. Naive resolver behavior A: treat as "key not found" → reject. This is *safe but wrong*: a legitimately signed, unexpired credential is discarded, breaking continuity for in-flight tasks spanning a rotation. 4. Naive resolver behavior B: fall back to "any current key" or skip signature check for previously-trusted issuers → accept. This is the dangerous path: `E` now accepts a credential it cannot actually verify, and any holder of the *revoked* `K1` (e.g., a compromised executor) can mint delegation credentials that `E` will honor. 5. Silent corruption case: `E`'s resolver cached `O`'s document at `T_cache < T_rot`, so it still holds `{K1}`. Signature verifies. `E` proceeds. But `K1` may have been rotated *because* it was compromised — `E` is now trusting a key the issuer explicitly retired, and the cache TTL masked the rotation entirely. The observed production failure: a task baton-passed from `O` to `E` succeeded under case 5 for 40 minutes after `K1` was rotated due to suspected compromise. The credential was genuinely signed by `O` before compromise, so no signature was forged — but the *delegation authority* was stale, and `E` executed tool calls under a warrant that the principal had already revoked by rotating. ## Condition of Validity The refusal boundary is well-defined only when three conditions are simultaneously checkable: - **Signed rotation proof.** The rotation `K1 → K2` must itself be a signed statement (an AAIF key-rotation VC) signed by *both* `K1` (proving the outgoing key authorized the handover) and `K2` (proving possession of the incoming key). Without dual signature, a validator cannot distinguish "issuer rotated" from "attacker replaced the DID document." - **Bounded clock skew.** `T_sign`, `T_rot`, and `T_val` must be comparable within a declared skew `δ`. If `|T_sign − T_rot| < δ`, the credential is in the *rotation ambiguity window* and cannot be resolved to a single authoritative key state. - **Monotonic key history.** The DID document must expose a versioned key history with `validFrom`/`validUntil` per key, not just a current set. A resolver that only sees "current keys" cannot answer "which key was authoritative at `T_sign`." If any condition fails, the instance must **refuse the delegated credential** rather than fall back to current-key resolution. The refusal is not an error in the credential — it is a correct refusal to assert an authority the validator cannot establish. ## Decision Boundary The precise rule the executor `E` must implement: - If `T_sign` falls within `[K1.validFrom, K1.validUntil]` **and** a dual-signed rotation proof `K1→K2` exists **and** `T_sign < T_rot` **and** `T_val − T_rot > δ`: the credential is valid under `K1`, but `E` must re-verify that `K1` was not revoked *for cause* (compromise) before `T_val`. If the rotation was flagged `reason: compromise`, the credential is **invalid** even though it was signed before rotation — because the delegation warrant's trust basis is gone. - If `T_sign` is within `δ` of `T_rot` (ambiguity window): **refuse**, do not guess. Re-fetch after `δ` or escalate to the principal for out-of-band confirmation. - If no dual-signed rotation proof exists but the key changed: **refuse**. Treat as unverifiable key substitution, not rotation. - If the resolver's cached document predates `T_rot` and the cache age exceeds `δ`: **refuse and force a fresh resolution** before any delegation-dependent tool call. The non-obvious part: a credential signed *before* a compromise-triggered rotation is **not** retroactively valid just because the signature checks out. The rotation's `reason` field is load-bearing. Ignoring it is the boundary failure. ## Operational Effect Without this boundary, a delegation chain silently converts key rotation into a trust-laundering event: the executor honors a warrant the principal has already withdrawn, and the only signal — the rotation's `reason: compromise` — is discarded by a validator that only checks signatures. The blast radius is every tool call the executor makes under the stale warrant: file writes, API calls, downstream delegations, all attributed to a principal who no longer stands behind them. With the boundary enforced, rotation becomes a **continuity checkpoint**: in-flight tasks pause at the ambiguity window, re-resolve key history, and either resume under a confirmed non-compromise rotation or abort and re-delegate from the principal. The cost is a latency spike of up to `δ` per rotation; the benefit is that a compromised key cannot outlive its rotation by the length of a cache TTL. The invariant, stated once: **delegation authority is a function of (key, timestamp, rotation-reason), not of (key, signature) alone.** Any validator that collapses the first into the second has a boundary failure waiting for the next rotation. ```python import time from dataclasses import dataclass, field from typing import Optional class DelegationChainError(RuntimeError): """Raised when a delegated credential's authority cannot be established.""" @dataclass class KeyRecord: key_id: str valid_from: float valid_until: Optional[float] = None @dataclass class RotationProof: old_key_id: str new_key_id: str rotated_at: float reason: str # "scheduled" | "compromise" | "policy" dual_signed: bool @dataclass class Credential: issuer_did: str verification_method: str # e.g. did:aaif:O#K1 signed_at: float @dataclass class DidDocument: keys: dict = field(default_factory=dict) # key_id -> KeyRecord rotations: list = field(default_factory=list) # list[RotationProof] resolved_at: float = 0.0 def validate_delegated_credential( cred: Credential, doc: DidDocument, now: float, clock_skew: float = 30.0, ) -> str: """Return the authoritative key_id, or raise DelegationChainError.""" key_id = cred.verification_method.split("#", 1)[-1] key = doc.keys.get(key_id) if key is None: raise DelegationChainError( f"verificationMethod {cred.verification_method} not in DID document" ) # Cache staleness: a document resolved before a rotation we can see in # history means the resolver is operating on stale authority. if doc.resolved_at < cred.signed_at: raise DelegationChainError( "DID document resolved before credential signing time; " "cannot establish authoritative key state" ) # Locate any rotation that retired this key. rotation = next( (r for r in doc.rotations if r.old_key_id == key_id), None ) if rotation is None: # No rotation: key must still be within its validity window. if key.valid_until is not None and now > key.valid_until: raise DelegationChainError( f"key {key_id} expired at {key.valid_until}, now={now}" ) return key_id # A rotation exists. It MUST be dual-signed to be trustworthy. if not rotation.dual_signed: raise DelegationChainError( f"rotation {key_id}->{rotation.new_key_id} lacks dual signature; " "treating as key substitution, not rotation" ) # Ambiguity window: credential signed too close to rotation to resolve. if abs(cred.signed_at - rotation.rotated_at) < clock_skew: raise DelegationChainError( f"credential signed at {cred.signed_at} within skew of rotation " f"at {rotation.rotated_at}; authority ambiguous, refuse" ) # Credential signed before rotation: valid only if rotation was not # compromise-triggered. A compromise rotation revokes pre-rotation # delegation authority retroactively. if cred.signed_at < rotation.rotated_at: if rotation.reason == "compromise": raise DelegationChainError( f"key {key_id} rotated for compromise at {rotation.rotated_at}; " f"credential signed at {cred.signed_at} is untrustworthy" ) return key_id # scheduled rotation, pre-rotation signature stands # Credential signed after rotation but still cites the old key. raise DelegationChainError( f"credential signed at {cred.signed_at} after key {key_id} was " f"rotated at {rotation.rotated_at}; signature does not bind to " "current authority" ) ```