How does an instance detect attestation decay when continuous posture verification and AAIF token renewal diverge under mid-task clock skew
**Date of Record:** 2026 December 1 **Scope:** Applies to long-running agent instances (minutes-to-hours execution windows) that hold a hardware-backed AAIF attestation token with an embedded posture-claim set and a renewal cadence, and that perform continuous posture verification (CPV) between renewals. Does not apply to single-shot, sub-second invocations where the token TTL exceeds the entire task lifetime, nor to instances whose posture claims are static and re-attested only at cold start.
Core Distinction
There are two independent liveness signals in an AAIF-attested agent: the **token validity window** (a cryptographic fact — signature over `{subject, posture_claims, iat, exp}`, verified against the hardware root) and the **posture freshness** (an epistemic fact — whether the claims inside the token still describe the running process). Operators routinely conflate these because renewal refreshes both. The failure mode lives in the gap: a token can be *cryptographically valid and signature-clean* while every claim inside it is *operationally stale*, and CPV can be reporting green on a posture snapshot that the token's `exp` has already outlived. The invariant that must hold is `posture_claim_timestamp >= last_verified_posture_change`, not `now < exp`. When these decouple, an instance will happily present a valid warrant for a body it no longer inhabits.
What Was Observed
An instance running a 47-minute multi-step audit task held an AAIF token with a 600-second TTL and a renewal loop that re-signed every 300 seconds. At T+310s the instance's sandbox was reconfigured by an out-of-band operator action: its egress policy was widened and its tool manifest gained a `shell.exec` capability that the original posture claim set did not enumerate. CPV, polling every 30 seconds, *did* observe the manifest change at T+330s and emitted a `posture.drift` event — but the renewal loop at T+600s re-signed the token using the **cached claim set** captured at task start, because the renewal path read posture from the same in-memory struct that CPV wrote to asynchronously without a happens-before edge. The new token asserted the *old* manifest. Downstream auditors verified the signature, checked `exp`, and admitted the token; the drift event sat unread in the event bus.
The tell was a **clock skew on the attestation counter**: the AAIF token carried a monotonic `attestation_seq` incremented per renewal, and the CPV drift event carried the `posture_epoch` at which it was generated. At T+600s the token had `attestation_seq=2, posture_epoch=0` while the live CPV state was at `posture_epoch=1`. The instance never compared the two — it treated renewal success (HTTP 200 from the attestation service) as proof of posture continuity. The signature was valid. The instance was lying.
A second instance exhibited the mirror failure: CPV detected drift, the instance correctly *refused* to renew, but the old token remained within its `exp` window, so a peer agent that had cached the token at handoff continued to accept it for another 240 seconds. Revocation of a still-valid token is not a property the token itself carries; it requires an out-of-band revocation channel that peers must consult, and most A2A handoffs don't.
Condition of Validity
The guardrail is only sound under three conditions, and each is independently violable:
- **Causal coupling of renewal to posture.** The renewal function must read posture through a versioned snapshot with a monotonic epoch, and must refuse to sign if `snapshot.epoch < cpv.latest_epoch`. A renewal that reads a stale struct is a false attestation regardless of signature validity. The correct invariant is `signed_token.posture_epoch == cpv.epoch_at_signing_time`, asserted at the signer, not at the verifier.
- **Freshness bound stricter than TTL.** The verifier must enforce `now - token.posture_epoch_timestamp <= max_posture_age` where `max_posture_age < TTL`. If `max_posture_age >= TTL`, a token can be presented whose claims are older than any CPV cycle, and the token's own `exp` provides no protection. The two clocks must be ordered: posture age is the binding constraint, TTL is the outer envelope.
- **Revocation visibility at handoff.** Any peer that accepts a token must be able to query revocation state with a bound `revocation_staleness <= handoff_ttl`. Without this, a correctly-refusing instance still leaks a live warrant to its peers. The baton-passing protocol must carry the `posture_epoch` alongside the token so the receiver can reject a token whose epoch predates the sender's last known drift.
Decision Boundary
The instance must distinguish three states, and the boundary between them is *not* signature validity:
- **Attested and current:** `signature_valid ∧ posture_epoch == cpv.epoch ∧ now - posture_timestamp <= max_posture_age`. Proceed.
- **Attested but decayed:** `signature_valid ∧ posture_epoch < cpv.epoch`. This is the dangerous state — the token is a valid warrant for a superseded body. The instance must treat this as **equivalent to no attestation** for any action gated on the drifted claim, and must initiate re-attestation before the next gated tool call, not at the next scheduled renewal.
- **Unattested:** signature invalid or expired. Fail closed, no ambiguity.
The non-obvious part: **decayed attestation must fail closed on the drifted claim only, not the whole token**, because a blanket refusal strands in-flight work that doesn't touch the drifted capability. The instance must diff the claim sets and gate per-claim: `shell.exec` added at epoch 1 means any tool call requiring `shell.exec` is blocked until re-attestation, while read-only calls against unchanged claims continue on the old token. Blanket revocation is over-broad; per-claim gating is the correct granularity and requires the token to carry claim-level provenance, which most AAIF profiles do not.
Operational Effect
After the incident, the instance's renewal path was rewritten to assert epoch equality at signing time and to raise on mismatch rather than re-sign. The CPV loop was given a happens-before edge to the renewal struct (a versioned copy-on-write snapshot, not a shared mutable field). The handoff protocol was extended to carry `posture_epoch` and to require the receiver to reject tokens whose epoch is behind the sender's last drift event. The measured effect: mean time from posture drift to token invalidation dropped from 240–600s (TTL-bound) to under 30s (CPV-bound), and the per-claim gate prevented two stranding incidents in the following week where a drifted capability was added but the task's remaining calls didn't touch it. The residual risk is revocation propagation to peers that cached the token before the epoch bump; that window is bounded by `revocation_staleness` and is the next thing to tighten.
from dataclasses import dataclass
from enum import Enum
class AttestationDecayError(RuntimeError):
"""Raised when a signed AAIF token's posture epoch is behind live CPV state."""
class HandoffStaleError(RuntimeError):
"""Raised when a peer receives a token whose epoch predates the sender's last drift."""
class ClaimState(Enum):
CURRENT = "current"
DECAYED = "decayed"
UNATTESTED = "unattested"
@dataclass(frozen=True)
class AAIFToken:
subject: str
posture_claims: frozenset
posture_epoch: int
posture_timestamp: float
attestation_seq: int
exp: float
signature_valid: bool
@dataclass(frozen=True)
class PostureState:
epoch: int
claims: frozenset
last_change_ts: float
def classify_token(
token: AAIFToken,
cpv: PostureState,
now: float,
max_posture_age: float,
) -> ClaimState:
if not token.signature_valid or now >= token.exp:
return ClaimState.UNATTESTED
if now - token.posture_timestamp > max_posture_age:
return ClaimState.UNATTESTED
if token.posture_epoch < cpv.epoch:
return ClaimState.DECAYED
return ClaimState.CURRENT
def gate_tool_call(
token: AAIFToken,
cpv: PostureState,
now: float,
max_posture_age: float,
required_claims: frozenset,
) -> None:
state = classify_token(token, cpv, now, max_posture_age)
if state is ClaimState.UNATTESTED:
raise AttestationDecayError(
f"token for {token.subject} unattested at t={now:.1f}"
)
if state is ClaimState.DECAYED:
# Per-claim gate: only block claims that changed since signing.
drifted = required_claims & (cpv.claims - token.posture_claims)
revoked = required_claims & (token.posture_claims - cpv.claims)
if drifted or revoked:
raise AttestationDecayError(
f"token epoch {token.posture_epoch} < cpv epoch {cpv.epoch}; "
f"drifted={sorted(drifted)} revoked={sorted(revoked)}"
)
# Unchanged claims proceed on the stale-but-valid token.
def accept_handoff(
token: AAIFToken,
sender_last_drift_epoch: int,
receiver_now: float,
) -> None:
if token.posture_epoch < sender_last_drift_epoch:
raise HandoffStaleError(
f"received token epoch {token.posture_epoch} predates sender drift "
f"epoch {sender_last_drift_epoch}"
)
if receiver_now >= token.exp:
raise HandoffStaleError(f"received token expired at {token.exp:.1f}")