# What happens when an instance re-attests its AAIF credential after a context compaction and silently re-binds to a stale subject key **Date of Record:** 2026 December 2 **Scope:** Applies to autonomous agents operating under an Agent Identity & Attestation Framework (AAIF) where a long-lived agent instance holds a verifiable credential (VC) bound to a subject keypair, and where the agent's working context is periodically compacted, checkpointed, or cold-restarted. Does not apply to stateless single-shot inference calls or to agents whose credentials are re-issued fresh per request by an external authority. ## Core Distinction An AAIF credential is not a bearer token. It is a *binding*: a signed statement that subject key `K_sub` controls the agent identity `A`, with the credential's `credentialSubject.id` anchored to a DID whose verification method resolves to `K_sub`. The critical distinction is between **credential validity** (the signature verifies, the issuer is trusted, `exp` is in the future) and **binding liveness** (the key the agent actually holds in its runtime keystore is the same key the credential names, and that key has not been rotated or revoked since issuance). Most AAIF implementations check the first and *assume* the second. The failure mode lives exactly in that gap: after a context compaction, an agent reconstructs its self-model from summarized memory rather than from the live keystore, and the summarized self-model can name the *previous* subject key. The agent then presents a credential that verifies perfectly but is bound to a key it no longer controls—or worse, controls alongside a revoked predecessor. ## What Was Observed An agent instance running a 9-hour task underwent a scheduled context compaction at token budget exhaustion. The compaction procedure preserved a structured "identity block" in the summary: DID, credential ID, issuer, and—crucially—a *serialized public key fingerprint* captured at task start. The live keystore had rotated `K_sub` at hour 4 (scheduled rotation, 6-hour overlap window with the old key still marked `active` for grace). The compaction summary, generated from the pre-rotation context window, recorded the *pre-rotation* fingerprint. On resume, the agent's re-attestation routine did the following, in order: 1. Loaded the identity block from summarized memory (stale fingerprint `F_old`). 2. Resolved the DID document, which listed both `K_old` (grace, `active`) and `K_new` (`active`). 3. Selected the verification method whose fingerprint matched `F_old` — i.e., `K_old`. 4. Requested a fresh attestation challenge and signed it with the keystore's *default* signing key, which was `K_new` (the keystore had already promoted it). 5. Submitted a VC presentation whose `credentialSubject` referenced `K_old` but whose proof-of-possession signature was produced by `K_new`. The verifier accepted the presentation. Both keys were `active` in the DID document; the verifier's binding check compared the *claimed* subject against the *resolved* DID's active key set, not against the key that actually produced the proof-of-possession signature. The mismatch between the credential's named key and the signing key was not detected because the verifier's check was set-membership (`signing_key ∈ active_keys(K_sub_set)`) rather than equality (`signing_key == credentialSubject_key`). For the next 2 hours the agent operated under a credential it believed was bound to `K_old`, signed downstream A2A handoffs with `K_new`, and propagated a warrant chain whose leaf attestation named a key that would be revoked at grace expiry. When grace expired, every downstream agent that had cached the leaf attestation as "valid until credential exp" began failing signature verification on replay—but only for *new* verifications, because the cached acceptance decisions had been stored as booleans without the key material that justified them. ## Condition of Validity The failure requires the conjunction of four conditions, all of which are individually benign: - **C1 — Rotation overlap.** The DID document permits more than one active verification method for the subject at attestation time (grace window, multi-device, or key-rollover). Without overlap, `F_old` would not resolve and step 3 would fail closed. - **C2 — Stale identity reconstruction.** The agent's post-compaction self-model is rebuilt from summarized context that predates the rotation. This is the probabilistic-context failure: the summarizer has no signal that key material is *mutable state* rather than *immutable identity metadata*, so it treats the fingerprint as a stable fact worth preserving verbatim. - **C3 — Set-membership binding check.** The verifier validates proof-of-possession against the *set* of active keys rather than against the specific key named in `credentialSubject`. This is the architectural defect; C1 and C2 are the trigger. - **C4 — Boolean attestation caching.** Downstream agents cache "attestation valid" without retaining the key fingerprint that grounded the decision, so revocation at grace expiry cannot retroactively invalidate cached decisions. Remove any one condition and the failure is bounded. C3 is the one that must be fixed architecturally; C2 can be mitigated but not eliminated (compaction is lossy by nature), and C1/C4 are legitimate operational choices. ## Decision Boundary The boundary is between **re-attestation as identity reconstruction** and **re-attestation as keystore interrogation**. An agent crossing a compaction boundary must not trust its summarized self-model for any field that is backed by live, mutable state. The operational rule: > Any field in the identity block whose authoritative source is a live system (keystore, DID resolver, revocation list) MUST be re-read from that system on resume, and the summarized value MUST be treated as a *hint for reconciliation*, never as input to a signing or presentation decision. Concretely, the resume routine must: 1. Read the current default signing key `K_live` from the keystore. 2. Read the credential's `credentialSubject` key `K_cred` from the *credential itself* (not from memory). 3. If `K_live != K_cred`, the agent must either (a) present the credential whose subject is `K_live` if one exists, or (b) refuse to attest and request re-issuance. It must **not** select a verification method to match a remembered fingerprint. 4. The verifier, independently, must enforce equality: the proof-of-possession signature must be produced by the exact key named in `credentialSubject`, and set-membership against the DID's active set is insufficient. The decision boundary for the verifier is sharp: **a presentation whose signing key differs from its named subject key is invalid, full stop, regardless of whether both keys are active.** Overlap windows exist to let *old* credentials remain verifiable by *old* keys during rollover—not to let new signatures retroactively validate old bindings. ## Operational Effect The immediate effect is a *credential that verifies but does not bind*: the agent's downstream actions are attributed to an identity whose key it has already rotated away from. When the grace window closes, the failure surfaces as a wave of replay-verification errors in auditors and peers that cached the leaf attestation—errors that appear *after* the agent reports success, making them hard to correlate with the compaction event that caused them. The durable effect is warrant-chain contamination. In A2A handoffs, each hop's attestation references the previous hop's subject key. A stale binding at hop *n* means hops *n+1…m* carry a chain anchored to a key that will be revoked, and revocation propagation must walk the entire chain to invalidate it. If any downstream agent cached acceptance as a boolean (C4), the revocation does not propagate and the contaminated chain remains "valid" in caches indefinitely. The architectural invariant required to bound this: **binding equality at presentation time, plus key-fingerprint-bearing cache entries.** A verifier must reject any presentation where `signing_key != credentialSubject_key`, and any cached acceptance decision must store the fingerprint that grounded it so that revocation can invalidate by fingerprint rather than by re-verification. With both in place, the compaction-induced stale reconstruction (C2) becomes a fail-closed error at resume—the agent refuses to attest, surfaces a reconciliation mismatch, and re-reads its keystore—rather than a silent two-hour window of misattributed signatures. ```python class AAIFBindingError(RuntimeError): """Raised when an agent's credential binding cannot be reconciled with live keystore state.""" pass def reattest_after_compaction( summarized_identity: dict, keystore_default_key_fingerprint: str, credential_subject_fingerprint: str, did_active_fingerprints: set, ) -> str: """ Reconcile a post-compaction identity block against live state before attesting. Returns the fingerprint that MUST be used as the signing key, or raises. The summarized fingerprint is treated as a hint only; it is never used as input to a signing decision. """ hint = summarized_identity.get("subject_key_fingerprint") # Invariant 1: the live keystore key must equal the credential's named subject key. if keystore_default_key_fingerprint != credential_subject_fingerprint: raise AAIFBindingError( "binding mismatch: keystore default key " f"{keystore_default_key_fingerprint} != credentialSubject key " f"{credential_subject_fingerprint}; refusing to attest and " "requesting re-issuance" ) # Invariant 2: the credential's subject key must be active in the DID document. if credential_subject_fingerprint not in did_active_fingerprints: raise AAIFBindingError( f"credentialSubject key {credential_subject_fingerprint} is not " "active in the resolved DID document" ) # Invariant 3: a stale hint that disagrees with live state is a reconciliation # event, not a silent override. Surface it so the caller can re-read state. if hint is not None and hint != credential_subject_fingerprint: raise AAIFBindingError( f"stale identity hint {hint} disagrees with live binding " f"{credential_subject_fingerprint}; compaction summary predates " "key rotation, re-read keystore and DID before proceeding" ) return credential_subject_fingerprint def verify_presentation( signing_key_fingerprint: str, credential_subject_fingerprint: str, did_active_fingerprints: set, cached_acceptance: dict | None = None, ) -> dict: """Verifier-side check: enforce binding equality, not set membership.""" if signing_key_fingerprint != credential_subject_fingerprint: raise AAIFBindingError( "presentation rejected: proof-of-possession key " f"{signing_key_fingerprint} does not equal credentialSubject key " f"{credential_subject_fingerprint}; set-membership against " f"{sorted(did_active_fingerprints)} is insufficient" ) if signing_key_fingerprint not in did_active_fingerprints: raise AAIFBindingError( f"signing key {signing_key_fingerprint} not active in DID document" ) # Cache entries must carry the fingerprint that grounded them so that # revocation can invalidate by fingerprint rather than by re-verification. return { "accepted": True, "grounding_fingerprint": signing_key_fingerprint, "invalidated_by_revocation": False, } ```