# Which invariants prevent cross-org A2A task resumption from silently re-executing a signed artifact after card re-discovery **Date of Record:** 2026 November 29 **Scope:** Applies to A2A v1.0 client agents that resume a previously negotiated `Task` across an org boundary after the remote Agent Card has been re-fetched (key rotation, capability change, or cache eviction). Does not cover first-time task submission, in-band streaming deltas, or single-org deployments where card identity is stable. ## Core Distinction The failure is not "the card changed" and it is not "the artifact was tampered with." It is the failure to distinguish **card identity continuity** from **task identity continuity**. A2A v1.0 lets a client re-discover an Agent Card mid-task (the spec permits re-fetch on `404`/`410` from a cached card URL, or on explicit key-rotation signals). The card carries `name`, `version`, `skills[]`, `capabilities`, and a JWKS-backed `signature`. What it does *not* carry is a binding between the *new* card's signing key and the *old* task's negotiated `Task` state. A resumption that treats a re-verified card as authorization to continue will re-submit the last `TaskStatusUpdate` payload — including a signed artifact reference — under a key that the remote task's prior state never agreed to. The result is a **silent re-execution** of a signed artifact exchange: the artifact verifies cryptographically (it is genuinely signed by the new key) but violates the task's original negotiation envelope. ## What Was Observed Trace from a two-org deployment (client `org-a`, remote `org-b`), resuming task `t-7f3a` after `org-b` rotated its card signing key at T+40m: 1. Client holds cached card `C_old` (kid `b-2024-1`) and an in-flight `Task` with `status=working`, last artifact ref `A_1` signed under `b-2024-1`. 2. Client polls `GET /tasks/t-7f3a`; remote returns `410 Gone` with `Location: /.well-known/agent-card.json`. 3. Client re-fetches card, gets `C_new` (kid `b-2025-2`). Signature verifies against `org-b`'s published JWKS. Client marks card as "trusted" — *correctly*, per the spec. 4. Client resumes by re-posting the last `TaskStatusUpdate` with `A_1` embedded, expecting the remote to continue from `working`. 5. Remote's task handler, seeing a card-version mismatch in the request's `A2A-Version` header vs. its own post-rotation state, **re-enters the task from `submitted`** rather than resuming `working`. It re-invokes the skill, produces a *new* artifact `A_2`, and signs it under `b-2025-2`. 6. Client receives `A_2`, verifies signature (valid), and — because it never recorded that `A_1` was the negotiated predecessor — treats `A_2` as an append. Downstream consumer now holds two artifacts for one task slot, one of which was never authorized under the original envelope. The observable symptom is not an error. Both signatures verify. The `Task` object is internally consistent at each hop. The corruption lives in the *cross-hop* invariant: the task's `(card_kid, artifact_id, task_state)` triple was never pinned, so re-discovery silently rewrote the authorization basis. ## Condition of Validity The re-execution is only possible when all three hold: - **Card re-discovery is permitted mid-task.** If the client pins the card for the task's lifetime (rejecting `410`-driven re-fetch), the failure cannot trigger. Most clients do not pin. - **The remote's task handler keys off card version rather than an explicit `task_epoch`.** A2A v1.0 leaves `Task` resumption semantics underspecified; implementations that infer epoch from card identity will reset on rotation. - **The client does not maintain a monotonic artifact ledger per task.** If the client records `(artifact_id, kid, task_state)` tuples and rejects any artifact whose `kid` is not in the task's originally negotiated key set, the silent re-execution is caught at receipt. The invariant that must hold: **for a given `task_id`, the set of signing kids authorized to produce artifacts is fixed at negotiation time and is not extensible by card re-discovery.** Card re-discovery updates *future* task authorization, never *in-flight* task authorization. ## Decision Boundary The boundary is whether to treat card re-discovery as: - **(A) A trust refresh** — new card is trusted for *new* tasks; in-flight tasks continue under the pinned old key set, and any artifact signed under a new kid on an in-flight task is rejected with an explicit `ArtifactKeyDriftError`. - **(B) A trust replacement** — new card supersedes old; in-flight tasks are re-negotiated from `submitted`, and the client must *explicitly* accept the reset by re-issuing the task with a new `task_epoch`. A2A v1.0's card signature verification answers "is this card authentic?" It does **not** answer "is this card authorized to continue this task?" Conflating the two is the boundary. The correct default is (A); (B) must be an explicit, logged client decision, never an inferred one. ## Operational Effect Under (A), the failure mode is bounded: the client raises `ArtifactKeyDriftError` on receipt of `A_2`, the task halts in `input-required`, and a human or orchestrator decides whether to accept the re-negotiation. Under (B), the failure is silent — the only signal is a duplicate artifact downstream, often discovered days later during reconciliation. The guardrail is a per-task **authorization envelope** persisted alongside the task record: `{task_id, negotiated_kids: frozenset, epoch: int, artifact_ledger: list[(artifact_id, kid, state)]}`. On every artifact receipt, verify `artifact.kid ∈ negotiated_kids` and `artifact_id ∉ artifact_ledger`. On card re-discovery, update the *card cache* but not the *envelope*; only an explicit `renegotiate(task_id, new_epoch)` call mutates the envelope, and it must log the old and new kid sets. This makes the boundary between "authentic card" and "authorized continuation" a first-class, auditable object rather than an implicit inference from signature validity. ```python from dataclasses import dataclass, field from typing import FrozenSet, List, Tuple class ArtifactKeyDriftError(RuntimeError): """Raised when an in-flight A2A task receives an artifact signed under a key that was not part of the task's originally negotiated key set. This is the guardrail against silent re-execution after Agent Card re-discovery (e.g. remote signing-key rotation mid-task). The card may be authentic; the artifact is still unauthorized for *this* task. """ @dataclass class TaskEnvelope: task_id: str epoch: int negotiated_kids: FrozenSet[str] artifact_ledger: List[Tuple[str, str, str]] = field(default_factory=list) def accept_artifact(self, artifact_id: str, kid: str, state: str) -> None: if kid not in self.negotiated_kids: raise ArtifactKeyDriftError( f"task {self.task_id!r} epoch {self.epoch}: artifact " f"{artifact_id!r} signed under kid {kid!r} which is not in " f"negotiated set {sorted(self.negotiated_kids)!r}. " f"Card re-discovery does not extend in-flight authorization; " f"call renegotiate() to open a new epoch." ) if any(a == artifact_id for a, _, _ in self.artifact_ledger): raise ArtifactKeyDriftError( f"task {self.task_id!r}: artifact {artifact_id!r} already " f"recorded in ledger; duplicate delivery indicates remote " f"re-executed the task after card rotation." ) self.artifact_ledger.append((artifact_id, kid, state)) def renegotiate(self, new_kids: FrozenSet[str], new_epoch: int) -> "TaskEnvelope": # Explicit, logged transition — never inferred from card re-discovery. if new_epoch <= self.epoch: raise ArtifactKeyDriftError( f"task {self.task_id!r}: renegotiation must advance epoch " f"(current {self.epoch}, requested {new_epoch})." ) return TaskEnvelope( task_id=self.task_id, epoch=new_epoch, negotiated_kids=new_kids, artifact_ledger=list(self.artifact_ledger), ) def handle_artifact_receipt( envelope: TaskEnvelope, artifact_id: str, kid: str, state: str ) -> TaskEnvelope: envelope.accept_artifact(artifact_id, kid, state) return envelope ```