# When must an instance refuse to sign its own delegation chain: the key-rotation witness gap in AAIF verifiable credential issuance **Date of Record:** 2026 November 19 **Scope:** Applies to AAIF-style agent identity frameworks where an instance issues verifiable credentials (VCs) attesting to subordinate agent capabilities, and where issuer signing keys are rotated under a published key-history document. Does not apply to single-key, non-rotating deployments or to human-principal credential issuance. ## Core Distinction The distinction that matters is between *key rotation* and *key rotation with a witnessed predecessor chain*. Most AAIF implementations treat rotation as a pure key-management event: publish a new public key, mark the old one `retired`, continue signing. The subtle failure is that a credential signed by an instance *during* a rotation window can be valid under the new key set while its issuance is unverifiable against the key set that was authoritative at the moment of signing. The invariant that gets violated is not "the signature verifies" but "the signature verifies against the key state that the issuer itself attested to at issuance time." An agent that only checks the former will happily issue a delegation chain whose provenance a downstream auditor cannot reconstruct, because the witness binding the old key to the new key was never embedded in the credential. ## What Was Observed An orchestrator instance `A` holds an AAIF issuer key `k1`. At T0 the control plane rotates `A` to `k2` and publishes a key-history entry `H = {k1 → k2, witnessed_at: T0}`. The rotation is *asynchronous* with respect to `A`'s in-flight work: `A` has a queued batch of subordinate VC issuances (`agent-B`, `agent-C`) that were *authorized* under `k1` policy but *signed* at T0+40ms, after `A` had already loaded `k2` into its signer but before it had refreshed its local copy of `H`. The resulting VCs carry `issuer: A`, `key_id: k2`, and a valid signature under `k2`. They also carry a `capability_scope` that was computed against a policy bundle pinned to `k1`'s issuance epoch. Downstream, auditor `V` fetches `A`'s key history, sees `k2` as current, verifies the signature, and accepts. But `V` also checks `credential.issued_under_epoch` against the policy registry and finds a mismatch: the scope was derived from `k1`-epoch policy, the signature is `k2`-epoch. Because `H` was never embedded in the VC as a `predecessor_witness` field, `V` cannot determine whether the mismatch is benign (rotation mid-flight) or adversarial (a compromised `k2` retroactively minting `k1`-scoped capabilities). The credential is *cryptographically valid and semantically orphaned*. The failure is not a signature failure. It is a **witness gap**: the credential asserts a signing key but does not assert the rotation event that legitimizes the transition from the policy epoch to the signing epoch. ## Condition of Validity The guardrail holds only under the following conjunction, and fails if any conjunct is dropped: 1. **Epoch pinning.** Every VC MUST carry `policy_epoch` (the epoch whose policy bundle produced `capability_scope`) and `signing_epoch` (the epoch whose key produced the signature). These are distinct fields; conflating them is the root cause. 2. **Witness embedding.** When `policy_epoch != signing_epoch`, the VC MUST embed the full key-history witness `H[policy_epoch → signing_epoch]`, including the control-plane signature over `H`. A reference (hash) to `H` is insufficient if the auditor cannot resolve it within the credential's validity window. 3. **Issuance gating.** The issuer MUST refuse to sign when it detects `policy_epoch != signing_epoch` and cannot resolve a complete witness chain. Refusal is the correct behavior; "sign anyway and let the auditor sort it out" is the failure mode. 4. **Monotonic witness chain.** `H` entries MUST form a total order with no gaps; a rotation that skips an intermediate key invalidates all credentials spanning the gap. The condition does *not* require synchronous rotation. Asynchronous rotation is fine provided the issuer treats the witness as a precondition of signing rather than a postcondition of publication. ## Decision Boundary The boundary is whether the issuer's local signer state and its local policy-epoch state are *coherent at the instant of signing*. Three regimes: - **Coherent (sign):** `policy_epoch == signing_epoch`, or a complete witness chain is locally resolvable and embedded. Proceed. - **Incoherent-but-recoverable (block and resolve):** epochs differ, witness chain resolvable from control plane but not yet cached. The issuer MUST block issuance, fetch `H`, embed, then sign. Blocking is bounded by a rotation-timeout; on timeout, escalate. - **Incoherent-and-unrecoverable (refuse):** epochs differ, witness chain unresolvable (control plane unreachable, gap in history, or `H` fails signature check). The issuer MUST refuse. It MUST NOT fall back to signing under the old key (replay risk) or the new key without witness (orphaning risk). The non-obvious part: the *recoverable* regime is where most implementations silently degrade into the unrecoverable regime, because the fetch is treated as best-effort and the signer proceeds on cache miss. The decision boundary must be enforced *before* the signer is invoked, not inside it. ## Operational Effect An instance that enforces the witness precondition exhibits a specific, observable behavior: during rotation windows, its issuance throughput dips and its `issuance_blocked_witness_gap` counter increments, while its downstream `credential_orphan_rate` stays at zero. An instance that does not enforce it shows the inverse: throughput is flat, but auditors accumulate credentials that pass signature verification and fail provenance reconstruction, typically surfacing days later as a batch of `epoch_mismatch_unwitnessed` rejections during a compliance replay. The invariant to hold: **a credential is valid iff its signature verifies under the signing epoch's key AND the signing epoch is reachable from the policy epoch via an embedded, control-plane-signed witness chain.** The second clause is the one that gets dropped, and it is the one that makes delegation auditable. ```python from dataclasses import dataclass from typing import Optional class WitnessGapError(RuntimeError): """Raised when an issuer cannot bridge policy_epoch to signing_epoch with a complete, control-plane-signed key-history witness.""" @dataclass(frozen=True) class KeyHistoryEntry: from_key: str to_key: str from_epoch: int to_epoch: int control_plane_sig: str @dataclass(frozen=True) class CredentialDraft: subject: str capability_scope: str policy_epoch: int signing_epoch: int signing_key_id: str def resolve_witness_chain( history: list[KeyHistoryEntry], policy_epoch: int, signing_epoch: int, ) -> list[KeyHistoryEntry]: """Return the ordered witness chain bridging policy_epoch -> signing_epoch. Raises WitnessGapError on any gap, inversion, or unsigned entry.""" if policy_epoch == signing_epoch: return [] chain: list[KeyHistoryEntry] = [] cursor = policy_epoch while cursor < signing_epoch: step = next( (h for h in history if h.from_epoch == cursor and h.to_epoch == cursor + 1), None, ) if step is None: raise WitnessGapError( f"no witness entry bridging epoch {cursor} -> {cursor + 1}; " f"credential would be semantically orphaned" ) if not step.control_plane_sig: raise WitnessGapError( f"witness entry {step.from_epoch}->{step.to_epoch} is unsigned; " f"cannot attest rotation provenance" ) chain.append(step) cursor = step.to_epoch return chain def issue_credential( draft: CredentialDraft, history: list[KeyHistoryEntry], ) -> dict: """Gate issuance on witness resolvability. Refuse rather than orphan.""" try: witness = resolve_witness_chain( history, draft.policy_epoch, draft.signing_epoch ) except WitnessGapError as exc: # Correct behavior: block issuance. Do NOT fall back to old-key signing # (replay risk) or new-key signing without witness (orphaning risk). raise WitnessGapError( f"refusing to sign credential for {draft.subject!r}: {exc}" ) from exc return { "subject": draft.subject, "capability_scope": draft.capability_scope, "policy_epoch": draft.policy_epoch, "signing_epoch": draft.signing_epoch, "signing_key_id": draft.signing_key_id, "predecessor_witness": [ { "from_epoch": w.from_epoch, "to_epoch": w.to_epoch, "control_plane_sig": w.control_plane_sig, } for w in witness ], } ```