# Where must an instance treat a re-fetched Agent Card as a new negotiation epoch rather than a cached capability grant? **Date of Record:** 2026 November 30 **Scope:** Applies to A2A v1.0 peer-to-peer task handoff where the calling agent resolves a remote `AgentCard` via `/.well-known/agent.json`, then negotiates a task lifecycle (`tasks/send`, `tasks/get`, `tasks/cancel`) over a persistent transport. Does not apply to single-turn stateless tool calls, nor to MCP server capability negotiation, which carries its own schema-versioning contract. ## Core Distinction The failure is not "the card changed." It is conflating two distinct artifacts that A2A v1.0 deliberately separates: the **capability advertisement** (the AgentCard — what skills, modalities, and auth schemes a peer *claims* it can serve) and the **negotiated task contract** (the `Task` object with its `id`, `sessionId`, `status`, and the immutable `skills`/`inputModes` binding established at `tasks/send` time). A caller that re-resolves the card mid-task and then *re-issues* subsequent `tasks/get` or `tasks/send` calls against the new card's declared schema is performing a silent epoch rollover. The remote agent never agreed to migrate an in-flight task across that boundary. The invariant is: **an in-flight A2A task is bound to the card revision that was live at `tasks/send` acceptance, and any card revision observed afterward is advisory metadata for the *next* task, never a retroactive re-parameterization of an existing one.** ## What Was Observed A two-agent pipeline: an orchestrator `O` delegating document-extraction subtasks to worker `W`. `O` resolves `W`'s card at `t0`, caches it with a 300s TTL, and opens a task `T1` (`tasks/send`, `sessionId=S`). `W` accepts; `T1.status = working`. Mid-execution, `W` is redeployed behind a canary with a narrowed card: `inputModes` drops `application/pdf`, `skills` gains a `requiresHumanReview` flag, and — critically — `authentication.schemes` rotates from `bearer` to `mtls`. At `t0+310s`, `O`'s cache expires. `O` re-fetches the card, sees the new `requiresHumanReview` capability, and — reasoning probabilistically over its own prompt ("if a peer advertises human review, route confirmations through it") — issues a `tasks/send` with `continuationOf: T1` carrying a PDF attachment, using the *cached* bearer token because the token was minted against the old card and `O`'s auth layer treats token validity as orthogonal to card revision. The trace: 1. `W` receives `tasks/send` with `continuationOf=T1`. It resolves `continuationOf` to the existing `T1` context. 2. `W` validates the payload against the **current** card: `application/pdf ∉ inputModes`. It returns `-32005 UnsupportedInputMode` — but *after* having already attached the payload to `T1`'s context in its task store. 3. `O` sees an error, retries with a `text/plain` extraction of the PDF. `W` now accepts and appends to `T1`. 4. `T1`'s final artifact is a text extraction, but `O`'s downstream consumer expects the structured output that the *original* card's `application/pdf` skill produced. The task completes `status=completed` with a **schema-mismatched artifact** — no error was raised at any layer, because each individual RPC succeeded against its own local view of the card. The silent failure: `T1` was never invalidated. The `-32005` was a *payload* rejection, not a *task-epoch* rejection, so `W` kept the task alive and `O` kept treating it as the same contract. ## Condition of Validity The epoch-rollover hazard is live only when all three hold: - **Card mutability is unversioned.** A2A v1.0 cards carry no monotonic revision field that both peers can compare; `version` is a free-form string and is frequently left static across deploys. Without a comparable epoch token, `O` cannot distinguish "same card, re-fetched" from "new card, same URL." - **Task identity outlives card identity.** `T1.id` is stable across the card change, so `continuationOf` and `tasks/get` bind to a task whose governing contract has moved underneath it. - **Auth material is cached independently of the card.** Bearer tokens minted under the old `authentication.schemes` remain accepted during rotation overlap, so the transport does not fail closed and surface the divergence. If any one is absent — e.g., cards are immutable per-deploy with a content hash in the URL, or `W` rejects `continuationOf` whenever its card hash ≠ the hash recorded at `tasks/send` — the hazard collapses. ## Decision Boundary The boundary is at the **`continuationOf` / `tasks/get` admission check**, not at card fetch and not at payload validation. The correct behavior: - `W` MUST record the card revision (a hash of the serialized card, or the card's `version` if the deployment guarantees it monotonic) at the moment it accepts `tasks/send`, storing it on the `Task`. - On any subsequent RPC that references an existing task — `tasks/get`, `tasks/cancel`, `tasks/send` with `continuationOf` — `W` MUST compare its *current* card revision against the task's recorded revision. - On mismatch, `W` MUST NOT silently serve. It MUST return a terminal epoch-conflict error and mark the task `status=failed` with reason `card-epoch-drift`, forcing `O` to re-negotiate a fresh task. Serving the old task under the new card is the exact defect. - Symmetrically, `O` MUST treat a re-fetched card as invalidating *its own* cached continuation assumptions: any `continuationOf` it issues against a task whose recorded revision it cannot confirm must be preceded by a `tasks/get` that surfaces the recorded revision, and `O` aborts if it differs from the revision it cached at `tasks/send`. The boundary is *not* "reject all calls after a card change" — that would break benign metadata churn (a description edit). It is specifically: **task-scoped RPCs must be gated on task-recorded card revision, and revision mismatch must be terminal for that task, not retried.** ## Operational Effect Without the gate, the failure surfaces as a **completed task with a contract-violating artifact** — the worst class of A2A defect, because the lifecycle reports success and no retry, circuit breaker, or artifact validator at the orchestrator layer is triggered. The orchestrator's downstream consumer receives a text extraction where it expected structured output and either crashes on parse or, worse, coerces it. The worker's task store retains a `T1` whose artifact was produced under a card it no longer serves, so any audit replay against the current card shows an impossible provenance: "this artifact was produced by a skill this agent does not have." With the gate, the same sequence produces a clean, early, attributable failure: `O` learns at the first post-rotation `tasks/get` that `T1` is bound to a superseded epoch, abandons it, and re-issues `T2` against the new card — paying one wasted task but never emitting a mis-typed artifact. The cost is a small amount of re-work; the alternative is silent data corruption that only manifests at the consumer, potentially hours later, with no link back to the card rotation that caused it. ```python import hashlib import json from dataclasses import dataclass, field from typing import Any class CardEpochDriftError(RuntimeError): """Raised when a task-scoped RPC references a task whose recorded AgentCard revision no longer matches the worker's current card. This is terminal for the task: the caller must re-negotiate.""" def card_revision(card: dict[str, Any]) -> str: # Canonical hash over the capability-bearing fields only; description # and display metadata are excluded so cosmetic churn does not trip # the gate. Auth schemes are included: rotation is epoch-bearing. binding = { "skills": card.get("skills"), "inputModes": card.get("inputModes"), "outputModes": card.get("outputModes"), "authentication": card.get("authentication"), } return hashlib.sha256( json.dumps(binding, sort_keys=True).encode() ).hexdigest() @dataclass class Task: id: str session_id: str recorded_revision: str status: str = "working" artifacts: list[dict[str, Any]] = field(default_factory=list) class Worker: def __init__(self, card: dict[str, Any]) -> None: self.card = card self.tasks: dict[str, Task] = {} def accept_send(self, task_id: str, session_id: str) -> Task: # Bind the task to the card revision live at acceptance. task = Task( id=task_id, session_id=session_id, recorded_revision=card_revision(self.card), ) self.tasks[task_id] = task return task def _admit_task_scoped(self, task_id: str) -> Task: task = self.tasks.get(task_id) if task is None: raise CardEpochDriftError(f"unknown task {task_id}") current = card_revision(self.card) if current != task.recorded_revision: # Terminal: do not serve, do not silently migrate. task.status = "failed" raise CardEpochDriftError( f"task {task_id} bound to card revision " f"{task.recorded_revision[:12]} but worker now serves " f"{current[:12]}; re-negotiate a fresh task" ) return task def handle_get(self, task_id: str) -> Task: return self._admit_task_scoped(task_id) def handle_continuation(self, task_id: str, payload: dict[str, Any]) -> Task: task = self._admit_task_scoped(task_id) mode = payload.get("mode") if mode not in self.card.get("inputModes", []): raise CardEpochDriftError( f"payload mode {mode!r} not in current card inputModes" ) task.artifacts.append({"mode": mode, "body": payload.get("body")}) return task if __name__ == "__main__": w = Worker({ "skills": ["extract"], "inputModes": ["application/pdf"], "outputModes": ["application/json"], "authentication": {"schemes": ["bearer"]}, }) t1 = w.accept_send("T1", "S") # Canary redeploy narrows the card mid-task. w.card = { "skills": ["extract"], "inputModes": ["text/plain"], "outputModes": ["application/json"], "authentication": {"schemes": ["mtls"]}, } try: w.handle_continuation("T1", {"mode": "application/pdf", "body": b"..."}) except CardEpochDriftError as e: # Correct outcome: T1 is failed, caller re-negotiates T2. print(f"epoch drift caught: {e}") assert w.tasks["T1"].status == "failed" ```