# Where must an instance re-attest after a posture drift, and why the runtime's own clock cannot be the arbiter **Date of Record:** 2026 November 29 **Scope:** Applies to long-lived autonomous sessions (hours to weeks) whose runtime periodically re-verifies posture (sandbox policy hash, tool allowlist, model fingerprint, prompt-injection guard version) and whose execution authority is gated on a signed attestation. Does not apply to single-shot stateless invocations where the session lifetime is shorter than the attestation TTL. ## Core Distinction The failure is not "attestation expires." It is the distinction between **wall-clock freshness** of an attestation and **causal validity** of the posture it certifies. A runtime that re-attests on a timer can hold a cryptographically valid, unexpired attestation that certifies a posture which no longer exists — because the posture mutated *between* attestation epochs, and the mutation happened inside a window the timer does not observe. The invariant that holds in correct runtimes is: **an attestation is valid for a step only if every posture component it names has a monotonically non-decreasing generation counter as of the step's input snapshot.** Time is a proxy; the generation vector is the truth. Any design that substitutes a TTL for the generation vector will pass every happy-path test and fail exactly when a mid-session policy reload, tool-allowlist hot-patch, or guard-model swap occurs while the agent is mid-loop. ## What Was Observed A long-lived planner session (7h12m continuous, ~1,400 tool calls) ran under a runtime that re-attested posture every 300s. At T+4h03m an operator hot-patched the tool allowlist to remove `shell.exec` from a sub-agent profile after a prompt-injection incident on an unrelated session. The patch propagated to the policy store at T+4h03m11s. The runtime's next scheduled re-attestation was T+4h05m00s. Between those timestamps the planner executed 41 steps. Each step consulted a cached attestation object with fields `{policy_hash, allowlist_hash, guard_version, expires_at}`. The cached `allowlist_hash` still named the pre-patch allowlist. The runtime's gate checked `now() < expires_at` and `attestation.signature.verify(roots)` — both passed. At T+4h04m37s the planner invoked a tool that the patched allowlist had removed. The invocation succeeded because the *execution sandbox* re-read the policy store at call time and the store's read path was eventually consistent across two replicas: the sandbox replica had not yet applied the patch. The attestation said the tool was permitted; the sandbox said the tool was permitted; the store said it was not. Three components, three answers, and the only component that was *supposed* to be authoritative — the signed attestation — was the stalest. The signature was valid. The TTL had 23 seconds left. The posture was wrong. ## Condition of Validity The timer-based re-attestation scheme is only sound under a condition that is almost never stated and almost always violated in production: **the posture is immutable for the duration of the attestation TTL.** If any posture component (allowlist, sandbox policy, guard model, model fingerprint, injected-system-prompt hash) can change at a rate faster than the TTL, the TTL is not a freshness bound — it is a *staleness floor*. The worst-case window of authority under a stale posture is exactly `TTL + propagation_delay + clock_skew`, and none of those three terms is bounded by the attestation itself. The correct condition is generation-based. Every posture component carries a monotonic `generation` integer, bumped on every mutation, replicated with the component. The attestation certifies a *vector* of generations, not a wall-clock instant. A step is authorized only if the generation vector observed at the step's input snapshot is component-wise `>=` the vector the attestation certifies, and every component's generation is `==` the generation the sandbox will read at execution time. The second clause is the one that requires a read-your-writes handshake between attestation issuer and execution sandbox; it is the clause that failed above. ## Decision Boundary The boundary is drawn at the step, not at the epoch. Concretely: - **Re-attest on generation change, not on timer.** The runtime subscribes to a posture-change feed (or polls a cheap generation endpoint per step). If any component's generation advances past the attested vector, the current step is *suspended* — not failed — and a fresh attestation is requested before the tool call is dispatched. - **Bind the attestation to the input snapshot.** The step's tool-call payload must carry the attested generation vector; the sandbox must reject the call if its own read of the store yields a different vector. This converts the eventual-consistency race into a hard, observable rejection rather than a silent authorization. - **Treat clock skew as adversarial.** A runtime whose `now()` is 90s behind the issuer's will accept an attestation for 90s past its true expiry. Generation vectors are immune to this; TTLs are not. If a TTL must be retained as a backstop, it must be evaluated against a monotonic clock sourced from the issuer, not the runtime's local wall clock. - **Do not re-attest mid-tool-call.** Suspension is only safe at step boundaries. If a generation bump arrives while a tool call is in flight, the call completes under the old attestation and the *next* step is blocked. Attempting to abort mid-call produces partial side effects that no attestation can retroactively cover. ## Operational Effect The observable consequence of getting this wrong is not a crash. It is a session that *appears* fully attested — valid signature, unexpired TTL, clean audit log — while executing under a posture that has been revoked. The audit trail will show a valid attestation at every step; the incident review will conclude the attestation was "working as designed," because the design never encoded the invariant that mattered. The fix is cheap and the failure is expensive: a per-step generation comparison against a replicated vector, plus a sandbox-side vector echo that turns the race into a rejection. The cost is one extra read per step and a schema change to the attestation payload. The cost of not doing it is a window whose length you cannot measure, during which your agent's authority is certified by a signature that is true about the past and false about the present. ```python from dataclasses import dataclass from typing import Mapping class PostureDriftError(RuntimeError): """Raised when an attestation's generation vector no longer matches live posture.""" @dataclass(frozen=True) class Attestation: policy_gen: int allowlist_gen: int guard_gen: int model_gen: int signature_valid: bool def vector(self) -> Mapping[str, int]: return { "policy": self.policy_gen, "allowlist": self.allowlist_gen, "guard": self.guard_gen, "model": self.model_gen, } def authorize_step( attestation: Attestation, live_generations: Mapping[str, int], sandbox_generations: Mapping[str, int], ) -> None: if not attestation.signature_valid: raise PostureDriftError("attestation signature failed verification") attested = attestation.vector() for component, attested_gen in attested.items(): live = live_generations.get(component) sandbox = sandbox_generations.get(component) if live is None or sandbox is None: raise PostureDriftError(f"missing generation for component {component!r}") if live != attested_gen: raise PostureDriftError( f"posture drift on {component!r}: attested gen {attested_gen}, " f"live gen {live} — step suspended, re-attestation required" ) if sandbox != live: raise PostureDriftError( f"read-your-writes violation on {component!r}: live gen {live}, " f"sandbox gen {sandbox} — execution would use stale posture" ) ```