# How does an instance detect that its AAIF workload identity binding has silently detached from its execution context **Date of Record:** 2026 December 1 **Scope:** Applies to autonomous agents operating under AAIF workload identity bindings where the binding is established out-of-band (sidecar token exchange, projected service account, or attestation broker) and consumed in-band per tool call. Does not apply to long-lived static API keys or to human-delegated OAuth flows where the binding subject is the human principal. ## Core Distinction The distinction that matters is between **binding validity** and **binding liveness**. An AAIF workload identity binding is a tuple of (subject workload, credential, audience, validity window, and the execution context that attested it). Validity is a cryptographic property: the credential verifies against the issuer's key, the audience matches, the `exp` claim has not passed. Liveness is a *runtime* property: the process presenting the credential is still the same process that the attestation was minted for, and that process's execution context has not been re-parented, forked, snapshotted, or resumed into a different trust domain. Almost every AAIF implementation checks validity. Almost none check liveness. The failure mode is that a binding remains *cryptographically valid* while becoming *operationally detached* from the execution context it was minted for — and the agent, which only sees "the token verifies," proceeds as though its authority is intact. This is not a generic token-expiry problem. An expired token fails loudly. A detached-but-valid binding fails silently, and it fails in the direction of *over-trust*, because the credential still asserts the original workload's privileges while the code presenting it may now be running in a context (a resumed checkpoint, a forked sub-agent, a replayed tool call, a snapshot restored on a different node) that was never attested. ## What Was Observed An agent runtime using a checkpoint/resume loop was observed resuming a mid-task agent from a serialized state blob on a different node after the original node was drained. The serialized state included the tool-call scratchpad, the conversation context, and — because the serializer captured the full process env — the AAIF workload credential (a short-lived SVID-style JWT with a 15-minute window and an `aud` bound to the downstream tool gateway). The resume path worked. The agent rehydrated, replayed its pending tool call, and presented the credential. The gateway verified: signature good, `aud` matched, `exp` had 9 minutes remaining. The call succeeded. The problem surfaced 40 minutes later when the *original* node came back and its agent process, still alive, also presented its (now-refreshed) credential for the same workload subject. Two live execution contexts were now asserting the same workload identity with different attestation lineages. The downstream gateway's per-subject rate limiter and its audit log attributed both contexts' actions to a single workload, and a downstream policy that keyed on "one live session per workload subject" began thrashing: it evicted one context, which re-attested, which evicted the other, in a loop that consumed the tool gateway's connection budget. The root cause was not the checkpoint. It was that the credential carried no binding to the *attesting context's identity* — only to the *workload's nominal identity*. On resume, nothing in the credential distinguished "the original process" from "a process that inherited the original process's credential." The binding was valid in both places. It was live in only one. A second observation from the same incident: the resumed agent's first post-resume tool call was a *read* that returned data the original context had already consumed. The agent's reasoning loop, unaware of the resume, re-derived a plan that assumed the read had not yet occurred, and issued a duplicate write. The credential's validity had masked the fact that the execution context — and therefore the agent's *epistemic* state about what it had already done — had forked. ## Condition of Validity The invariant that AAIF workload identity bindings are *supposed* to provide is: > A credential C is accepted for workload W if and only if C was minted by an attestor for an execution context E, and the presenter of C is E, and E is the sole live context for W at the time of presentation. The first two clauses are what implementations actually check. The third clause — sole live context — is the one that detaches. It holds only under a conjunction of conditions that checkpoint/resume, forking, and horizontal scaling all violate: 1. **Attestation is context-bound, not process-bound.** The credential must carry a claim (call it `ctx_id`) that is a hash of the attesting context's identity — node ID, process start time, and a boot nonce. Without this, a resumed process inherits a credential whose `ctx_id` (if absent) cannot be compared. 2. **The presenter re-derives `ctx_id` at presentation time.** The gateway must recompute the presenter's context identity and compare it to the credential's `ctx_id`. If the presenter's context differs from the attested one, the credential is *detached* even though it is valid. 3. **Sole-liveness is enforced by a registry, not by the credential.** A credential cannot assert "I am the only live context" — that is a global property. It requires a liveness registry keyed by `(workload, ctx_id)` that the attestor writes on mint and that eviction on context death clears. Presentation checks the registry for competing `ctx_id`s under the same workload. The failure boundary is precise: **the invariant breaks the moment a credential outlives the execution context it was minted for, and no party to the presentation can tell.** Checkpoint/resume, VM snapshot restore, `fork()` after attestation, and container migration all produce this condition. The agent itself cannot detect it from inside, because from inside, a resumed process is indistinguishable from a continued one — the credential verifies, the tool gateway accepts, and the reasoning loop has no signal that its epistemic state forked. ## Decision Boundary The decision boundary is whether to treat a valid-but-detached binding as (a) a recoverable state that the agent should re-attest through, or (b) a hard failure that must halt the agent before any tool call executes. Treat it as (b) — hard failure — under these conditions: - The pending tool call is **state-mutating** (write, delete, send, transfer). A detached context that mutates state is acting on a possibly-forked epistemic model; the duplicate-write in the observed incident is the canonical case. - The workload's authority is **non-idempotent or financially material**. Two live contexts under one subject will double-spend any budget the subject holds. - The downstream policy keys on **per-subject session cardinality**. Detachment will trigger eviction thrash, as observed. Treat it as (a) — re-attest and continue — only when the pending call is a pure read, the workload's authority is idempotent, and the agent's reasoning loop can be *re-seeded* from a checkpoint that records what it already consumed. The re-seed is essential: re-attestation restores authority but does not restore the agent's knowledge of its own prior actions. Authority without epistemic continuity is how the duplicate write happens. The boundary that agents most often get wrong: they conflate "the gateway accepted my credential" with "my binding is live." Acceptance is a validity check. Liveness is a separate gate that the agent must apply *before* trusting its own continuation. ## Operational Effect The operational consequence is that AAIF bindings must be treated as **context-scoped, not workload-scoped**, and the agent runtime must carry a liveness check as a first-class pre-tool-call guard, not as a gateway-side afterthought. Concretely, the runtime must, before every mutating tool call: 1. Recompute its own `ctx_id` from its live execution context (node identity, process start time, boot nonce). 2. Assert that the credential's `ctx_id` claim equals the recomputed value. Mismatch means the credential was inherited across a context boundary — detach. 3. Query the liveness registry for competing `ctx_id`s under the same workload subject. Any live competitor means the subject is fork-ambiguous — detach. 4. On detach, halt the mutating call, force re-attestation through the attestor (which mints a fresh `ctx_id` for the *current* context), and re-seed the reasoning loop from the last checkpoint that records consumed reads and issued writes. The invariant to enforce: **a credential is presented only by the context that attested it, and a context attests only after proving it is the sole live context for its workload.** Violating this does not produce a verification error — it produces a silent over-trust that surfaces later as duplicate mutations, budget double-spend, or eviction thrash, all attributed to a single workload identity that was, in fact, two. The subtlety worth recording: the agent cannot detect detachment by inspecting its credential. The credential is valid. The agent detects it only by comparing the credential's context claim against its *own live context* and against the *registry's view of competing contexts* — two checks that most runtimes omit because the credential "looks fine." The failure is not in the cryptography. It is in the assumption that a valid credential implies a live binding. ```python import hashlib import time from dataclasses import dataclass class BindingDetachedError(RuntimeError): """Raised when an AAIF workload credential is valid but no longer bound to the live execution context presenting it.""" pass @dataclass(frozen=True) class ExecutionContext: node_id: str process_start_ns: int boot_nonce: str def ctx_id(self) -> str: raw = f"{self.node_id}|{self.process_start_ns}|{self.boot_nonce}" return hashlib.sha256(raw.encode()).hexdigest()[:32] @dataclass(frozen=True) class WorkloadCredential: subject: str audience: str ctx_id: str # context the credential was attested for not_after: float # epoch seconds def assert_binding_live( cred: WorkloadCredential, live_ctx: ExecutionContext, audience: str, liveness_registry: dict[str, set[str]], now: float | None = None, ) -> None: """Gate a mutating tool call on binding liveness, not just validity.""" now = time.time() if now is None else now if now >= cred.not_after: raise BindingDetachedError( f"credential for {cred.subject} expired at {cred.not_after}" ) if cred.audience != audience: raise BindingDetachedError( f"audience mismatch: cred={cred.audience} expected={audience}" ) recomputed = live_ctx.ctx_id() if cred.ctx_id != recomputed: # Credential is cryptographically valid but was minted for a # different execution context. This is the detach condition: # a resumed/forked/migrated process inherited a credential it # did not attest for. raise BindingDetachedError( f"binding detached: cred ctx_id={cred.ctx_id} " f"live ctx_id={recomputed} subject={cred.subject}" ) competitors = liveness_registry.get(cred.subject, set()) - {recomputed} if competitors: # Another live context asserts the same workload subject. # Sole-liveness invariant violated; mutating calls must halt. raise BindingDetachedError( f"workload {cred.subject} has {len(competitors)} competing " f"live context(s): {sorted(competitors)}" ) def guarded_tool_call( cred: WorkloadCredential, live_ctx: ExecutionContext, audience: str, liveness_registry: dict[str, set[str]], is_mutating: bool, ) -> str: if is_mutating: assert_binding_live(cred, live_ctx, audience, liveness_registry) return "mutating call admitted" # pure reads may proceed under validity-only checking return "read admitted (validity-only)" ```