# What happens when an instance renegotiates an A2A task after the remote Agent Card changes mid-lifecycle **Date of Record:** 2026 November 24 **Scope:** Applies to A2A v1.0 cross-org delegations where a delegating agent (`caller`) holds an in-flight `Task` against a remote agent (`callee`) whose published Agent Card is re-fetched, re-validated, or re-resolved between task submission and terminal state. Does not cover initial discovery-only flows or same-org intra-mesh delegation where card versioning is pinned by the mesh control plane. ## Core Distinction A2A v1.0 separates *capability advertisement* (the Agent Card at `/.well-known/agent.json`) from *task state* (the `Task` object returned by `tasks/send` and mutated by `tasks/get` / SSE `TaskStatusUpdateEvent`). The card is a discovery-time artifact. The task is a lifecycle-time artifact. The protocol does not, by itself, bind a task to the card revision under which it was accepted. This is the seam. The non-obvious failure is not "the card changed and the capability vanished." It is subtler: the callee re-publishes a card with a **compatible-looking but semantically shifted** capability declaration—same `skills[].id`, same `capabilities.streaming`, but a changed `defaultInputModes`/`defaultOutputModes`, a narrowed `security` scheme set, or a bumped `protocolVersion` with altered `TaskState` transition semantics. A caller that re-validates the card *during* an in-flight task, or that lazily re-resolves the card on a retry after a transport timeout, will silently re-interpret the task's expected terminal states and artifact schemas against the new card. The task itself was negotiated against the old one. The result is a **card/task skew**: the caller validates continuation against a contract the callee never agreed to for *this* task. ## What Was Observed Trace from a representative cross-org delegation: 1. `caller` resolves card `C1` (protocolVersion `1.0`, skill `s.invoice.extract`, `defaultOutputModes: ["application/json"]`, `security: [{scheme: "oauth2", scopes:["tasks:write"]}]`). Caller dispatches `tasks/send` with `taskId=T`, `metadata.cardDigest = sha256(C1)`. 2. Callee accepts, emits `TaskStatusUpdateEvent{state: working}`. Task `T` is now bound, on the callee side, to the handler instantiated under `C1`. 3. Transport blip: the SSE stream drops at `t+40s`. Caller's retry policy re-resolves the Agent Card (a common pattern, since many SDKs treat "card may have rotated" as the safe assumption on any retry). 4. Callee has, meanwhile, published `C2`: `protocolVersion` still `1.0`, but `defaultOutputModes: ["application/json", "application/jsonl"]` and `security` narrowed to `["tasks:read"]` with a new required `scopes:["artifacts:read"]`. Crucially, `C2` also redefines the skill's `inputSchema` such that `T`'s original `message.parts` payload is now *valid but interpreted differently* (e.g., a `DataPart` field renamed with a deprecation alias). 5. Caller re-validates `T`'s continuation against `C2`. Two divergence paths: - **Auth skew:** caller's refreshed token lacks `artifacts:read`; the next `tasks/get` returns `403`, which the caller's state machine maps to `TaskState.failed`—but the callee considers `T` still `working`. Caller abandons; callee completes and emits `completed` into a dead stream. Orphaned artifact. - **Schema skew:** caller parses the eventual `Artifact` under `C2`'s schema; a field that was `amount` under `C1` is now `value` with a compat alias, and the caller's strict parser rejects the artifact. Caller marks `T` failed *after* callee marked it `completed`. Divergent terminal states for the same `taskId`. The invariant that was violated: **a task's negotiated contract is fixed at acceptance and must not be re-derived from a later card revision.** A2A v1.0 does not enforce this; it is a caller-side and callee-side obligation that must be made explicit via `metadata.cardDigest` pinning on both ends, and honored on every `tasks/get`, `tasks/cancel`, and artifact retrieval. ## Condition of Validity Card/task skew is only a hazard under a conjunction: - The caller performs **lazy or retry-triggered card re-resolution** rather than pinning the card for the task's lifetime. - The callee permits **card mutation without task invalidation**—i.e., it does not bump a card revision that forces existing tasks into a `requires-renegotiation` or `canceled` state, and does not echo the accepted card digest in task status. - The task is **long enough** that a card rotation window overlaps it (typically > the callee's card-publish cadence, or spanning a deploy). - The card delta is **semantically compatible enough to pass naive validation** (same `protocolVersion`, overlapping skills) but **operationally incompatible** (narrowed scopes, changed output modes, aliased schema fields). If any one is absent, the failure collapses into a benign case: pinned cards never re-resolve; callees that invalidate tasks on card bump force explicit renegotiation; short tasks finish before rotation; and grossly incompatible cards fail loud validation at the caller. The dangerous quadrant is exactly the intersection: **pinned-once-but-revalidated + compatible-looking delta + long task + mutated semantics.** ## Decision Boundary The boundary is whether the caller treats the Agent Card as **task-scoped immutable state** or as **ambient, always-current configuration**. The correct invariant: - On `tasks/send` acceptance, the caller MUST record `(taskId, cardDigest, protocolVersion, negotiatedSkills, grantedScopes, acceptedOutputModes)` as an immutable **task contract tuple**, and MUST NOT mutate it from any subsequent card fetch. - Every subsequent `tasks/get`, `tasks/cancel`, and artifact fetch MUST validate the callee's response against the *recorded* tuple, not the live card. If the callee's response implies a different contract (e.g., artifact `mimeType` outside recorded `acceptedOutputModes`, or a `TaskState` transition not permitted by the recorded `protocolVersion`), the caller MUST treat it as a **contract violation**, not a routine parse error. - The callee MUST echo `cardDigest` in every `Task` status payload and MUST invalidate (emit `canceled` with reason `card-rotated`) any in-flight task whose accepted digest no longer matches the live card *before* it mutates semantics. Rotation without invalidation is the callee-side bug. - On any `403`/`401` during continuation, the caller MUST distinguish **auth-scope skew** (token insufficient for a scope the task was *not* accepted under) from genuine authorization failure, and MUST NOT collapse it into `TaskState.failed`—because the callee may still be `working`. Scope skew is a renegotiation trigger, not a failure. The boundary case that must fail closed: a card delta that passes structural validation (same `protocolVersion`, skill present) but changes `defaultOutputModes`, `security` scopes, or skill `inputSchema` aliases. This MUST raise a contract-skew error at the caller and MUST NOT be silently absorbed by re-parsing under the new card. ## Operational Effect Without the invariant, cross-org delegations exhibit **divergent terminal states keyed by the same `taskId`**: caller-side `failed`, callee-side `completed`, with artifacts stranded. This is not a transient—it is a durable split-brain that survives retries, because each retry re-resolves the (now `C2`) card and re-derives a different expectation. Downstream auditors replaying the task see two incompatible histories and cannot reconcile without the original `cardDigest`, which most implementations do not persist. The compounding cost: orphaned artifacts accrue storage and billing on the callee; the caller's retry budget is consumed re-negotiating a task that already finished; and any cross-org settlement keyed on terminal state disagrees between parties. With the invariant enforced—task-scoped card pinning, digest echo, rotation-triggers-invalidation, and scope-skew distinguished from failure—the failure mode degrades to an explicit, reconcilable `card-rotated` cancellation that both parties observe identically, and the task contract tuple becomes the audit anchor for replay. ```python import hashlib from dataclasses import dataclass, field from typing import Mapping, Optional class CardTaskSkewError(RuntimeError): """Raised when an in-flight A2A task is validated against a card revision other than the one under which it was accepted.""" @dataclass(frozen=True) class TaskContract: task_id: str card_digest: str protocol_version: str accepted_output_modes: frozenset granted_scopes: frozenset @dataclass class AgentCard: protocol_version: str default_output_modes: tuple scopes: tuple skill_input_aliases: Mapping[str, str] = field(default_factory=dict) def digest(self) -> str: payload = f"{self.protocol_version}|{self.default_output_modes}|{self.scopes}|{sorted(self.skill_input_aliases.items())}" return hashlib.sha256(payload.encode()).hexdigest() def bind_task(task_id: str, card: AgentCard, granted_scopes: frozenset) -> TaskContract: return TaskContract( task_id=task_id, card_digest=card.digest(), protocol_version=card.protocol_version, accepted_output_modes=frozenset(card.default_output_modes), granted_scopes=granted_scopes, ) def validate_continuation( contract: TaskContract, live_card: AgentCard, response_output_mode: str, response_scopes_required: frozenset, ) -> None: # Invariant: continuation is validated against the recorded contract, never the live card. if live_card.digest() != contract.card_digest: # Callee rotated semantics without invalidating the task -> hard skew. raise CardTaskSkewError( f"task {contract.task_id}: live card {live_card.digest()[:12]} != " f"accepted {contract.card_digest[:12]}; callee must emit canceled/card-rotated" ) if response_output_mode not in contract.accepted_output_modes: raise CardTaskSkewError( f"task {contract.task_id}: artifact mime {response_output_mode!r} " f"outside accepted {sorted(contract.accepted_output_modes)}" ) missing = response_scopes_required - contract.granted_scopes if missing: # Scope skew is a renegotiation trigger, NOT a task failure. raise CardTaskSkewError( f"task {contract.task_id}: continuation requires scopes {sorted(missing)} " f"not granted at acceptance; renegotiate, do not mark failed" ) def handle_continuation( contract: TaskContract, live_card: AgentCard, response_output_mode: str, response_scopes_required: frozenset, ) -> str: try: validate_continuation(contract, live_card, response_output_mode, response_scopes_required) except CardTaskSkewError as exc: # Fail closed: surface skew, preserve task, do not collapse to failed. raise CardTaskSkewError(str(exc)) from exc return "continue" ```