# What happens when an instance's proof-of-possession refresh races its own credential expiry during a live agent-to-agent handoff **Date of Record:** 2026 November 22 **Scope:** Applies to agent-to-agent (A2A) sessions where peer identity is established via short-lived verifiable credentials (VCs, e.g., SD-JWT/VC or mTLS-bound tokens) whose holder-binding is continuously re-proven via a proof-of-possession (PoP) challenge (nonce-signed DPoP-style tokens or signed heartbeats). Does not apply to long-lived static API keys, unbound bearer tokens, or purely trust-on-first-use handshakes with no continuous PoP. ## Core Distinction A verifiable credential answers *"who is this agent?"*; a proof-of-possession answers *"is the entity on this socket still the holder named in the credential, right now?"* These two facts have independent clocks. The VC has a `not_after` expiry; the PoP has a re-assertion interval. The failure mode is not either clock firing—it is the **overlap window** where a valid-but-nearly-expired credential is presented alongside a PoP whose signing key or nonce was minted under the *previous* credential generation. During that window, both parties hold internally consistent but mutually incompatible views of session identity: the verifier sees a credential that is still valid and a PoP that verifies cryptographically, yet the binding between them has silently decohered. This is a continuity invariant failure, not an authentication failure—every signature checks out, and the handoff proceeds on a false premise of identity continuity. The non-obvious part: standard VC verification (signature, issuer trust, `nbf`/`exp`, audience, revocation) and standard PoP verification (nonce freshness, key match, signature) can each pass independently while the *composite* assertion—"this PoP was produced by the holder of *this* credential"—is false. The composite check is almost never implemented as a single atomic predicate. ## What Was Observed Two agent instances, `orchestrator-A` and `worker-B`, are mid-handoff. `A` holds a credential `VC_A` with a 300s TTL, refreshed every 240s, and a PoP key `K_A` rotated on the same 240s cadence. `B` acts as verifier and issues PoP challenges every 60s over the live A2A transport. The trigger sequence: 1. At `t=0`, `A` refreshes: issues `VC_A^1` (expires `t=300`) and rotates PoP key to `K_A^1`. `B` caches the binding `(subject=A, thumbprint=K_A^1, exp=300)`. 2. At `t=239`, `A`'s refresh loop begins. It fetches `VC_A^2` (exp `t=539`) and mints `K_A^2`. The refresh is **not atomic**: the new credential is fetched first, the key rotation completes ~1.2s later (network round-trip to the KMS/HSM that holds the private key). 3. At `t=240.0`, `B` fires a PoP challenge. `A`'s PoP signer has already switched to `K_A^2`, but `A`'s *presented credential* on the in-flight request is still `VC_A^1` (the request was assembled before the credential swap completed, or the transport retried a stale frame). So `A` signs the nonce with `K_A^2` while attaching `VC_A^1`. 4. `B` verifies: `VC_A^1` signature valid, not expired (`t=240 < 300`), audience correct. PoP signature valid under `K_A^2`. But `VC_A^1`'s `cnf`/`jkt` claim names `K_A^1`, not `K_A^2`. If `B` checks the binding, it rejects—correctly. **If `B` checks only "PoP verifies under *some* key the subject has recently used" (a common lenient cache), it accepts.** The session continues. 5. At `t=300`, `VC_A^1` expires. `B`'s cached binding still maps `subject=A → K_A^1`. `A` is now signing with `K_A^2` under a credential `VC_A^2` whose `jkt` is `K_A^2`. `B`'s cache rejects the new key as "unrecognized," tears down the session, and the in-flight multi-step task—partway through a tool-call chain—loses its handoff state. The task resumes from a cold checkpoint with no knowledge that `A` and `B` had already agreed on partial results. The observed invariant violation: **credential generation and PoP key generation were allowed to advance independently**, so there existed intervals where `credential.generation ≠ pop_key.generation`. In those intervals the composite identity predicate was undefined, and each verifier resolved the ambiguity by local policy—producing split-brain session state. A second, subtler variant: when the VC is *delegated* (A issues a sub-credential to a sub-agent C), the delegation chain's `cnf` must bind C's PoP key. If A rotates its own key mid-delegation, the chain's root thumbprint changes while C's leaf still points at the old root, and C's PoP challenges start failing verification at the intermediary—even though C never changed anything. ## Condition of Validity The failure is bounded by a precise condition. Let a session carry a credential `VC` with holder key thumbprint `jkt(VC)`, expiry `exp(VC)`, and a PoP key `K` with generation counter `g(K)`. Define the **binding predicate**: `bound(VC, K, t) ≡ verify_sig(VC) ∧ t < exp(VC) ∧ jkt(VC) = thumbprint(K) ∧ fresh_nonce(t)` The system is safe **iff** for every PoP challenge at time `t`, the credential presented and the key used to sign satisfy `bound(·)` *evaluated atomically on the same observed frame*. The failure occurs exactly when the implementation permits a non-atomic window where `jkt(VC_presented) ≠ thumbprint(K_signer)` while each component individually validates, **and** the verifier's binding cache is keyed by subject rather than by `(subject, jkt, credential-generation)`. Two additional conditions make it *observable* rather than latent: - The refresh cadence of the VC and the rotation cadence of `K` are not co-scheduled (independent timers). - The PoP challenge interval is shorter than the refresh cadence, guaranteeing at least one challenge lands inside the rotation window. If either condition is absent—e.g., key and credential are rotated in a single atomic transaction, or the verifier keys its cache on the full `(subject, jkt, gen)` tuple—the race cannot produce a false accept. ## Decision Boundary The architectural guardrail is a **generation-fenced atomic binding**: credentials and PoP keys must carry a shared monotonic generation `gen`, and a PoP assertion is valid only if `gen(VC) == gen(K)` *and* `gen` is strictly greater than the last `gen` the verifier accepted for that subject (replay/rollback fence). The verifier must: 1. Reject any frame where `jkt(VC) ≠ thumbprint(K_signer)`—no lenient "recently used key" fallback. 2. Key all binding caches on `(subject, jkt, gen)`, never on `subject` alone. 3. Treat a generation *decrease* as a hard protocol error (possible rollback attack), not a cache miss. 4. Require the credential and key to be minted in one transaction; if the KMS cannot guarantee this, the issuer must publish a `binding_epoch` and the verifier must reject PoPs whose `binding_epoch` differs from the credential's. The decision boundary for the *agent* is: when you detect `gen(VC) ≠ gen(K)` on an incoming PoP, do **not** attempt to reconcile by re-fetching the credential or by retrying with the old key. Abort the handoff, emit a `BindingGenerationMismatch`, and re-establish the session from a clean checkpoint. Reconciliation-by-retry is what converts a transient race into a poisoned session where the two agents disagree about which generation is current. ## Operational Effect Without the fence, the observed effects are: (a) **false-accept windows** where a stale credential is paired with a fresh key, letting a session continue past the point where its identity binding should have been re-proven; (b) **split-brain session teardown** at the next expiry boundary, where the verifier's subject-keyed cache rejects the legitimately rotated key; (c) **handoff state loss** because the teardown occurs mid-tool-chain and the resumed task has no record of the partial results both agents had agreed on; and (d) in delegated chains, **cascading PoP failures** at intermediaries that never changed their own keys. The cost is not a security breach in the classic sense—it is a continuity breach: the agents were, for a bounded interval, each correctly authenticated to themselves and incorrectly bound to each other. The only durable fix is to make the composite identity predicate a single atomic generation-fenced check, and to make generation mismatch a fatal, non-retryable condition at the agent layer. ```python from dataclasses import dataclass from typing import Optional class BindingGenerationMismatch(RuntimeError): """Raised when a PoP assertion and its presented credential disagree on generation.""" pass @dataclass(frozen=True) class Credential: subject: str jkt: str # holder key thumbprint bound into the VC gen: int # shared generation counter with the PoP key exp: int # unix seconds @dataclass(frozen=True) class PopAssertion: subject: str signer_jkt: str gen: int nonce: str now: int def verify_binding(vc: Credential, pop: PopAssertion, last_accepted_gen: int) -> None: # Atomic composite predicate: every component must agree, no lenient fallback. if pop.subject != vc.subject: raise BindingGenerationMismatch( f"subject mismatch: vc={vc.subject} pop={pop.subject}" ) if pop.signer_jkt != vc.jkt: raise BindingGenerationMismatch( f"holder-binding decohered: vc.jkt={vc.jkt} signer={pop.signer_jkt}" ) if pop.gen != vc.gen: raise BindingGenerationMismatch( f"generation race: vc.gen={vc.gen} pop.gen={pop.gen}" ) if pop.gen < last_accepted_gen: raise BindingGenerationMismatch( f"generation rollback: pop.gen={pop.gen} < accepted={last_accepted_gen}" ) if pop.now >= vc.exp: raise BindingGenerationMismatch( f"credential expired: now={pop.now} exp={vc.exp}" ) def handle_handoff_frame( vc: Credential, pop: PopAssertion, cache: dict, # keyed on (subject, jkt, gen) -- never on subject alone ) -> None: key = (vc.subject, vc.jkt, vc.gen) last = cache.get(key, -1) verify_binding(vc, pop, last_accepted_gen=last) cache[key] = pop.gen ```