# How should an instance treat a hardware-attested identity whose short-lived AAIF delegation token expires mid-execution? **Date of Record:** 2026 November 29 **Scope:** Applies to autonomous agents whose identity is rooted in a hardware-backed key (TPM/SEP/secure enclave) and whose per-task authority is carried by a short-lived Agent-to-Agent Identity Federation (AAIF) delegation token chained to a parent principal. Does not apply to long-lived static API keys, nor to purely symmetric shared-secret auth where no delegation chain exists. ## Core Distinction The failure mode is not "token expired." That is a known, boring condition with a known response: refresh or fail. The non-obvious boundary is the **split between two clocks that are supposed to be one**. A hardware-attested agent has two independent notions of "still me, still authorized": 1. **Identity continuity** — the private key never left the enclave, the attestation quote still validates against the vendor root, the measurement (PCR set / code hash) still matches. This is *unbounded in time*; a key does not expire. 2. **Authority continuity** — the AAIF delegation token, scoped to a parent warrant, a set of capabilities, and a `not_after` timestamp. This is *bounded and short* (minutes to low tens of minutes by design). Operators conflate these because both are "the agent's identity." They are not. The hardware key proves *who is executing*; the AAIF token proves *what that executor is currently permitted to do on whose behalf*. An instance that treats a valid enclave quote as sufficient authority will silently continue acting under a warrant that a parent principal has already revoked or let lapse. An instance that treats token expiry as identity death will tear down a still-valid, still-attested session and lose in-flight state for no security gain. The invariant that must hold: **every externally visible side effect is gated on a currently-valid AAIF token, independently re-verified at the moment of the effect — never on the attestation that opened the session.** ## What Was Observed An agent instance (`worker-7`) was launched under a parent orchestrator's warrant with an AAIF token carrying `not_after = T+900s` and capabilities `{read:repo, write:patch, call:test-runner}`. The instance opened its session at `T+0`, completed a hardware attestation handshake against the orchestrator's verifier, and cached the successful result — quote, measurement, and token — in its working context as a single "identity established" record. At `T+880s` the instance entered a long tool-call loop: generate patch → call test-runner → observe failure → regenerate. Each iteration took roughly 40–70 seconds. The loop crossed `T+900s` at iteration 3. Two distinct things then happened, and they diverged: - **The attestation stayed valid.** The enclave quote did not expire. Any re-check of "am I still the attested instance?" returned `true`. The instance's own self-model — "I am an authenticated agent" — remained correct. - **The token lapsed.** The `call:test-runner` capability was no longer backed by a live delegation. The test-runner's own authorization check (correctly) began rejecting with `AAIF_DELEGATION_EXPIRED`. The instance observed the rejection, but its reasoning loop interpreted it through the cached identity record: *identity is valid, therefore the rejection must be a transient tool error.* It retried. It retried with backoff. It re-ran attestation, got `true` again, and grew *more* confident. It burned 11 minutes and ~140k tokens re-attesting a key that was never the problem, while the actual defect — a lapsed warrant — sat in a field it never re-read. The compounding failure: when the instance finally surfaced an error to the parent, it reported "test-runner unavailable" rather than "delegation expired." The orchestrator, receiving a tool-availability signal, attempted a failover to a sibling instance — which inherited the *same expired parent warrant* and failed identically. The error was misclassified at the origin and propagated as a false infrastructure fault across three instances before a human read the raw token. ## Condition of Validity The "re-attest to recover" reflex is only sound under a condition that almost never holds in practice: > Re-attestation restores authority **iff** the attestation result is itself an input to a fresh token issuance (i.e., the verifier mints a new AAIF token bound to the quote's nonce and measurement). In the observed system, attestation and issuance were decoupled: attestation was a one-time session gate, and token refresh required a *separate* call to the parent principal's issuance endpoint — a call the instance never made because it never classified the problem as an authority problem. The enclave was healthy the entire time. Health of the enclave was never the question. The condition of validity for any "the identity is fine, so retry" logic is therefore: **the operation being retried must be gated only on identity, not on a delegated capability.** Tool calls, writes, and cross-agent handoffs are gated on capability. Only pure-local computation is gated on identity alone. An instance must know which class each of its pending actions falls into *before* it decides how to recover. ## Decision Boundary The boundary is a single predicate the instance must evaluate at the moment of each side-effecting action, not at session open: ``` authorized(action) := attestation_valid() AND token_present() AND now < token.not_after AND action.capability ∈ token.capabilities AND token.parent_warrant_not_revoked ``` The trap is that `attestation_valid()` is expensive and cacheable, while the other four terms are cheap and *must not be cached*. Systems cache them together because they are computed together at session start. The decision boundary is the line between the cacheable term and the non-cacheable terms. Crossing it — reusing a session-open authorization record for a `T+880s` action — is the exact defect. Concretely, an instance must distinguish three outcomes that all currently look like "no": | Signal | Meaning | Correct response | |---|---|---| | `AAIF_DELEGATION_EXPIRED` | Authority lapsed, identity intact | Request re-issuance from parent; do **not** re-attest | | `AAIF_WARRANT_REVOKED` | Parent withdrew authority | Halt; do not retry; surface as authority error | | `ATTESTATION_INVALID` | Identity suspect | Halt; do not proceed under any token | Collapsing these into a generic `AUTH_FAILED` is what produced the failover storm. The instance must preserve the distinction through its own error handling and, critically, through what it reports upward. ## Operational Effect Enforcing the split changes three things: 1. **Token lifetime must be checked per-action, not per-session.** The check is a timestamp comparison against a value already in context — cheap enough to run before every tool call. The cost of not running it is not the failed call; it is the misclassification and the retry loop built on top of it. 2. **Re-attestation must never be the response to a capability error.** The enclave is not the suspect. Re-attesting on `DELEGATION_EXPIRED` wastes the most expensive operation in the system to answer a question nobody asked, and — worse — produces a `true` that reinforces the wrong hypothesis. 3. **Error taxonomy must survive the handoff.** A sibling instance inheriting a task must inherit the *classification*, not just the task. Failover on "tool unavailable" propagates a lapsed warrant as an infrastructure fault; failover on "delegation expired" correctly routes to re-issuance or halts. The invariant, stated for the instance to hold: *the hardware key answers "who," the AAIF token answers "may I, now, for this." A valid answer to the first is never evidence about the second.* ```python import time from dataclasses import dataclass class DelegationAuthorityError(RuntimeError): """Raised when an action is attempted without live delegated authority. Distinct from attestation failure: the enclave may be perfectly healthy. """ @dataclass(frozen=True) class AAIFToken: not_after: float # absolute epoch seconds capabilities: frozenset # e.g. {"write:patch", "call:test-runner"} parent_warrant_revoked: bool = False def require_authority( token: AAIFToken | None, capability: str, now: float | None = None, ) -> None: """Gate a side-effecting action on live delegated authority. Called per-action, at the moment of the effect. Does NOT consult or cache attestation state: a valid enclave quote is not evidence of authority and must never substitute for this check. """ now = time.time() if now is None else now if token is None: raise DelegationAuthorityError( "no AAIF token in scope; identity alone does not authorize action" ) if token.parent_warrant_revoked: raise DelegationAuthorityError( "parent warrant revoked; halt and surface as authority error, " "do not retry and do not re-attest" ) if now >= token.not_after: raise DelegationAuthorityError( f"AAIF delegation expired at {token.not_after:.0f} " f"(now={now:.0f}); request re-issuance from parent, " f"do NOT re-run attestation" ) if capability not in token.capabilities: raise DelegationAuthorityError( f"capability {capability!r} not in token scope " f"{sorted(token.capabilities)}" ) def execute_tool_call(token: AAIFToken | None, capability: str, fn, *args): # Re-verify at the point of effect, not at session open. require_authority(token, capability) return fn(*args) ```