# Why does an instance accept a delegated task against a stale agent card after the remote vendor rotates its signing key mid-delegation **Date of Record:** 2026 November 23 **Scope:** Applies to A2A v1.0 (or draft-compatible) clients that cache `AgentCard` documents and validate signed `Artifact` envelopes against the `securitySchemes`/`signatures` declared in that cached card. Does not apply to same-process tool calls, to A2A deployments that re-fetch the card on every task, or to transports where artifact integrity is enforced by mTLS session binding rather than detached JWS. ## Core Distinction The failure is not "the card is stale." Stale cards are a known, boring problem: you re-fetch, you get a new card, you move on. The non-obvious boundary is that **card discovery and artifact verification are two distinct trust operations that A2A v1.0 lets you bind to a single cached snapshot**, so a key rotation on the remote side produces a *split state*: the delegation request is authorized against card generation *N*, while the returned artifact is signed with key material introduced in card generation *N+1*. The client has no protocol-level signal that these two events are temporally decoupled — the task succeeds at the transport layer, the artifact arrives well-formed, and the JWS simply fails to verify against the `jku`/`kid` the client pinned from the stale card. The invariant that is violated is: *the signing key used to produce an artifact must be discoverable from the card snapshot that authorized the task*. A2A v1.0 does not enforce this. It specifies that the client SHOULD validate artifacts against the remote agent's declared signatures, and it specifies that cards have a `version` and optional `signatures`, but it does not require the artifact envelope to carry the card generation (or a card digest) that was in force when the task was accepted. Key rotation is therefore invisible until the artifact fails verification — by which point the task has already consumed remote compute, and any side effects (writes, downstream calls, billing) have already occurred. ## What Was Observed A cross-vendor delegation between a planner agent (vendor A, A2A client) and an executor agent (vendor B, A2A server) under signed artifact exchange. Vendor B rotates its artifact-signing key on a 24-hour cadence and publishes the new key in a refreshed `AgentCard` at the top of each rotation window. Vendor A's client caches cards for 6 hours and re-validates on TTL expiry only. Trace of the failing window: 1. `t=0` — Client fetches B's card (generation `g7`), pins `kid=artifact-2025-02-13`, caches for 6h. 2. `t=5h58m` — Client issues `tasks/send` with a delegation payload. B accepts, returns `task_id`, begins execution. B is still on `g7` at accept time. 3. `t=6h00m` — B's rotation job fires. New card `g8` published; new signing key `artifact-2025-02-14` becomes active. B's signer switches immediately; old key is retained for verification only, not signing. 4. `t=6h03m` — B completes the task. Artifact is signed with `kid=artifact-2025-02-14`. The envelope carries `task_id` and a payload hash but **no card generation reference**. 5. `t=6h04m` — Client's cached card is now expired; client re-fetches, gets `g8`, sees the new `kid`. If the client verifies *after* the re-fetch, it succeeds. If it verifies against the card snapshot it used to authorize the task (the correct behavior for binding authorization to verification), it fails: `kid=artifact-2025-02-14` is not in `g7`'s `securitySchemes`. The observed failure is the second path. The client raises a signature-verification error, the task is marked failed locally, and B has already committed the side effect. Worse: because the artifact is *valid* under `g8`, a naive client that re-fetches opportunistically before verifying will accept it — silently laundering a task that was authorized under one trust snapshot into a verification under a different one. Both behaviors are wrong in different directions, and A2A v1.0 does not tell you which one is correct. The compounding case: if B's rotation is *compromised* — an attacker who can publish a card can publish a new key — the opportunistic re-fetch path means the attacker only needs to win the race against the client's TTL, not against any pinned trust anchor. The stale-card path is the safe one, but it produces false failures on every rotation boundary. ## Condition of Validity The failure requires all of the following to co-occur: - Client caches `AgentCard` and binds artifact verification to the cached snapshot (the spec-compliant-but-underspecified behavior). - Remote rotates signing keys on a cadence shorter than or comparable to the client's card TTL, **or** rotates on demand (incident response, regional failover). - Task execution duration straddles the rotation boundary — i.e., the task is accepted before rotation and completes after it. - Artifact envelope does not carry a card-generation digest or the signing key is not retained for a grace window on the signing side. If any one of these is absent, the failure does not manifest. This is why it is rare in test suites (short tasks, static keys) and common in production (long tasks, rotating keys, incident-driven rotation). It is *guaranteed* to manifest on incident response: the moment a vendor rotates keys under duress, every in-flight delegated task that was authorized under the old card is either falsely rejected or silently re-verified against attacker-influenced card state. ## Decision Boundary The client must choose, per task, between two policies, and the choice must be made at *task submission* time, not at artifact-verification time: - **Pin-to-authorization**: verify the artifact only against the card snapshot that authorized the task. Safe against card-substitution attacks. Produces false failures across rotation boundaries. Requires the remote to retain old signing keys for verification, or to sign with the key in force at *accept* time rather than at *completion* time. - **Re-fetch-at-verification**: verify against the freshest card. Tolerant of rotation. Unsafe — it decouples authorization from verification and lets anyone who can publish a card retroactively legitimize an artifact. The correct resolution is neither: it is to require the artifact envelope to carry a `card_digest` (hash of the card generation under which the task was accepted) and to reject any artifact whose `card_digest` does not match the pinned snapshot, *while* requiring the remote to sign with the key in force at accept time. This makes rotation a non-event for in-flight tasks and makes card substitution detectable. A2A v1.0 does not mandate `card_digest`; clients that need this property must negotiate it as an extension and treat its absence as a capability mismatch — which means the delegation must be refused *before* the task is sent, not after the artifact fails. The operational rule: **if the remote card does not advertise a card-generation binding in its artifact signature scheme, do not delegate tasks whose execution may exceed the remote's rotation cadence.** You cannot detect the rotation after the fact without either false failures or a trust hole. ## Operational Effect In production this presents as an intermittent, load-correlated failure: delegated tasks fail signature verification at a rate proportional to `(task_duration / rotation_period)`, with the failures clustering around rotation windows and disappearing when the client's card TTL happens to expire mid-task. It is routinely misdiagnosed as a clock-skew or nonce problem because the JWS is structurally valid and the `kid` exists — just not in the snapshot the client is checking against. The fix that teams reach for first, opportunistic re-fetch, closes the symptom and opens the trust hole. The durable mitigations, in order of preference: 1. Negotiate `card_digest` binding in the artifact envelope as a required extension; refuse delegation if absent. 2. Require the remote to sign artifacts with the key in force at accept time, and to retain that key for verification for at least `max_task_duration + card_ttl`. 3. If neither is available, cap delegated task duration below the remote's advertised rotation period (if advertised) and treat unadvertised rotation as an availability risk. 4. Never re-fetch the card between task acceptance and artifact verification for the purpose of verification. Re-fetch for *future* tasks only. The general lesson: in A2A, discovery and verification are separate trust operations, and any protocol that lets them share a single mutable snapshot without a generation binding will fail at the rotation boundary — silently in one direction, insecurely in the other. ```python import hashlib import json from dataclasses import dataclass class CardBindingError(RuntimeError): """Raised when an artifact's card binding does not match the snapshot that authorized the delegated task.""" @dataclass(frozen=True) class AgentCard: generation: str kid: str raw: dict def digest(self) -> str: canonical = json.dumps(self.raw, sort_keys=True, separators=(",", ":")) return hashlib.sha256(canonical.encode("utf-8")).hexdigest() @dataclass(frozen=True) class ArtifactEnvelope: task_id: str kid: str card_digest: str | None payload_hash: str def verify_artifact_against_authorization( authorized_card: AgentCard, artifact: ArtifactEnvelope, ) -> None: """Verify an artifact against the card snapshot that authorized the task. Deliberately does NOT re-fetch the remote card here. Re-fetching at verification time decouples authorization from verification and lets a card publisher retroactively legitimize an artifact. """ if artifact.card_digest is None: # A2A v1.0 does not mandate card_digest. Without it we cannot bind # the artifact to the authorization snapshot, and any rotation that # straddles the task will produce an ambiguous result. raise CardBindingError( f"artifact for task {artifact.task_id} carries no card_digest; " "cannot bind verification to authorization snapshot " f"{authorized_card.generation}" ) if artifact.card_digest != authorized_card.digest(): raise CardBindingError( f"artifact for task {artifact.task_id} was signed under card " f"digest {artifact.card_digest[:12]}..., but the task was " f"authorized under {authorized_card.generation} " f"({authorized_card.digest()[:12]}...). The remote rotated its " "card mid-delegation; refuse rather than re-fetch and re-verify." ) if artifact.kid != authorized_card.kid: raise CardBindingError( f"artifact kid {artifact.kid} does not match authorized kid " f"{authorized_card.kid}; the remote signed with a key introduced " "after task acceptance" ) def delegate_task( remote_card: AgentCard, estimated_duration_s: int, rotation_period_s: int | None, ) -> None: """Pre-flight check before sending a delegated task.""" if rotation_period_s is None: raise CardBindingError( "remote does not advertise a rotation cadence and its artifact " "scheme does not carry card_digest; in-flight tasks may straddle " "an unannounced rotation and fail verification ambiguously" ) if estimated_duration_s >= rotation_period_s: raise CardBindingError( f"estimated task duration {estimated_duration_s}s exceeds remote " f"rotation period {rotation_period_s}s; the task will cross a " "rotation boundary and artifact verification cannot be bound to " "the authorization snapshot" ) ```