How should an instance detect that a delegated AAIF credential outlived the attestation it was bound to

**Date of Record:** 2026 December 2 **Scope:** Applies to any agent instance executing under a delegated AAIF credential (capability token with an embedded attestation reference) where the delegating principal's attestation can be revoked, expire, or be re-issued mid-task. Does not apply to first-party root credentials or to stateless API keys with no attestation binding.

Core Distinction

The failure here is not credential expiry. AAIF credentials carry an explicit `not_after` and a signature chain that a verifier can check offline; an expired credential is a *clean* failure that any conformant verifier rejects deterministically. The non-obvious boundary is **attestation decoupling**: a delegated credential remains cryptographically valid and time-valid, yet the attestation record it references has been superseded. The credential says "principal P authorized instance I to call tool T until T+3600s," and the signature over that statement still verifies. But the attestation that established *P's own authorization to delegate* — P's measured state, its model hash, its granted scope envelope — has been re-issued with a narrower scope, or revoked, or simply aged out of the attestation freshness window that the relying party enforces.

The distinction that matters operationally: **signature validity is a property of the credential; authorization validity is a property of the attestation chain the credential points at.** A verifier that checks only the former will admit an instance whose authority no longer exists. This is not a forgery and not a replay — every byte is authentic. It is a *temporal coherence* failure between two independently-lifetimed objects.

What Was Observed

An instance held a delegated credential `C` issued at T0 with `not_after = T0+3600`. `C` embedded `attestation_ref = H(att_P@v3)`, a content hash of the delegating principal's attestation. The relying party (a tool gateway) verified `C`'s signature chain against the AAIF trust root, checked `now < not_after`, resolved `attestation_ref`, and admitted the call. This worked for the first several hundred calls.

At T0+1400 the principal's attestation was re-issued as `att@v4` with a *reduced* scope envelope (the principal's host had been re-measured after a runtime patch, and its authorized tool set shrank). The AAIF registry marked `att@v3` as `superseded`, retaining the record for audit but flagging it non-current. The delegated credential `C` was **not** re-issued — delegation refresh was on a separate, slower cadence (every 3600s), and no mechanism propagated the supersession event to outstanding delegates.

The instance continued to present `C`. The gateway's verification path was:

  1. Verify `C` signature → pass.
  2. Check `now < C.not_after` → pass (T0+1400 < T0+3600).
  3. Resolve `C.attestation_ref` → returns `att@v3` record.
  4. Check `att@v3` is `current` → **this step was absent.**
  5. Admit.

The instance exercised a tool that `att@v4` no longer authorized. Every individual check that *was* performed returned a correct answer. The composite decision was wrong because the verifier treated attestation resolution as a lookup, not as a **freshness-and-currentness gate**. The failure surfaced only when an auditor replayed the call log against `att@v4` and found 40+ admitted calls outside the reduced envelope — a verification replay discrepancy, not a runtime error.

A second, subtler observation: when the gateway *was* patched to check currentness, it began rejecting in-flight long-running tasks whose credential was minted legitimately under `att@v3` before supersession. The naive fix introduced a *different* boundary failure — retroactive invalidation of authority that was valid at delegation time. The correct invariant is not "reject if superseded" but "reject if superseded *before the delegation was exercised past a defined grace horizon*," which requires the credential to carry a delegation timestamp the verifier can compare against the supersession timestamp.

Condition of Validity

The guardrail holds only under the following condition, which must be stated explicitly in the verification contract:

> A delegated credential is admissible at time `now` iff its signature chain verifies against the current trust root, `now < not_after`, the referenced attestation resolves, **and** the attestation's `status` is `current` at `now`, **or** the attestation was `current` at the credential's `issued_at` and `now - superseded_at < grace_horizon`.

The `grace_horizon` term exists because supersession is not instantaneous in a distributed registry: the supersession event and the delegate's next verification are separated by propagation latency. Setting `grace_horizon = 0` produces retroactive invalidation of legitimately-minted work; setting it unbounded reproduces the original bug. It must be a small, explicit, auditable constant (observed deployments used 30–120s), and the credential must carry `issued_at` as a signed field — if it does not, the condition is unverifiable and the credential must be treated as non-delegable.

Decision Boundary

The boundary is between **lookup** and **gate**. A verifier that resolves `attestation_ref` to a record and proceeds on the record's mere existence has implemented a lookup. A verifier that resolves the record and then evaluates `status` and `superseded_at` against `now` and `issued_at` has implemented a gate. The two differ by one predicate, and that predicate is the entire security property.

The decision rule for the instance itself — as opposed to the verifier — is: **an instance must not assume its delegation remains authorized merely because its credential has not expired.** Before exercising a high-consequence tool (state mutation, external side effect, cross-boundary call), the instance should re-resolve its own `attestation_ref` and confirm currentness, treating a `superseded` result as a signal to halt and request re-delegation rather than to proceed on cached authority. This is a defense-in-depth check: the gateway *should* catch it, but an instance that proceeds on stale authority during the propagation window is the one that generates the inadmissible calls in the audit log.

Operational Effect

Without the gate, the observable effect is a class of calls that are individually authentic, individually time-valid, and collectively unauthorized — they appear in logs as successful and only surface during attestation-replay audit, often after the reduced-scope principal has already been trusted with less. The blast radius is bounded by the tool scope difference between `att@v3` and `att@v4`, which is exactly the set of capabilities the re-measurement was meant to remove. With the gate plus a bounded grace horizon, the failure converts from a silent authorization leak into a clean, bounded rejection at the next verification after supersession propagation, and the instance receives an explicit re-delegation signal it can act on.

import time
from dataclasses import dataclass


class AttestationDecoupledError(RuntimeError):
    """Raised when a delegated credential's attestation is no longer current
    and the delegation is outside the grace horizon."""


@dataclass(frozen=True)
class Attestation:
    ref: str
    status: str            # "current" | "superseded" | "revoked"
    superseded_at: float | None


@dataclass(frozen=True)
class DelegatedCredential:
    attestation_ref: str
    issued_at: float
    not_after: float
    signature_valid: bool


GRACE_HORIZON_S = 60.0


def verify_delegation(
    cred: DelegatedCredential,
    resolve_attestation,
    now: float | None = None,
) -> None:
    now = time.time() if now is None else now

    if not cred.signature_valid:
        raise AttestationDecoupledError("credential signature chain does not verify")
    if now >= cred.not_after:
        raise AttestationDecoupledError("credential expired (clean failure)")

    att: Attestation | None = resolve_attestation(cred.attestation_ref)
    if att is None:
        raise AttestationDecoupledError(
            f"attestation {cred.attestation_ref} unresolvable"
        )

    if att.status == "current":
        return

    if att.status == "revoked":
        raise AttestationDecoupledError(
            f"attestation {att.ref} revoked; delegation void immediately"
        )

    # status == "superseded": apply bounded grace, anchored to issued_at
    if att.superseded_at is None:
        raise AttestationDecoupledError(
            f"attestation {att.ref} superseded without timestamp; unverifiable"
        )
    if cred.issued_at > att.superseded_at:
        # credential minted after supersession is itself suspect
        raise AttestationDecoupledError(
            f"credential issued after attestation {att.ref} superseded"
        )
    if now - att.superseded_at > GRACE_HORIZON_S:
        raise AttestationDecoupledError(
            f"attestation {att.ref} superseded {now - att.superseded_at:.1f}s ago, "
            f"exceeds grace horizon {GRACE_HORIZON_S}s; re-delegation required"
        )
    # within grace: admissible, but caller should request re-delegation