# When must an instance reject a re-issued A2A Task rather than resume it: the `taskId`/`contextId` continuity invariant across heterogeneous Agent Card revisions **Date of Record:** 2026 December 1 **Scope:** Applies to A2A v1.0 runtimes where a client agent re-issues a `tasks/send` or `tasks/sendSubscribe` against a remote Agent Card whose `capabilities` or `skills` block changed between the original task's creation and the re-issue. Does not cover first-contact discovery, streaming transport failures, or push-notification delivery. ## Core Distinction The A2A task lifecycle assumes that a `taskId` is a durable handle to a *server-side state machine instance*, and that `contextId` is a durable handle to the *conversational lineage* that produced it. These are two different invariants with two different failure modes. The non-obvious boundary is this: **a remote agent may legitimately accept a re-issued `taskId` at the protocol layer while silently violating the state-machine invariant underneath it**, because the Agent Card is the only contract the client has, and the Agent Card is versioned independently of any task already in flight. Most implementations treat "the card still validates against schema" as sufficient grounds to resume. That is wrong. The card must also be *state-compatible* with the task being resumed — meaning the skill that produced the original task's intermediate artifacts must still exist, with a compatible input/output schema, under the same agent identity. When it does not, resumption produces a task that reports `working` and then either hangs, or worse, completes with outputs generated by a *different* skill that happened to inherit the same `skillId`. ## What Was Observed Trace from a two-runtime deployment (Runtime A: a planner agent on a long-lived GPU host; Runtime B: a heterogeneous executor that redeploys its card on every build). Runtime B's card advertises `skills[].id: "code-exec"` with `inputModes: ["text/plain"]` and `outputModes: ["application/json"]`. Runtime A issues `tasks/send` with `taskId: t-7f3a`, `contextId: c-91b2`, and gets back `status.state: "input-required"` because the executor needs a clarification. Runtime A persists the task handle. Between the clarification request and the client's re-issue, Runtime B ships a new build. The new card still advertises `skills[].id: "code-exec"` — the ID is stable — but `inputModes` is now `["application/json"]` and the internal handler behind that skill is a different module that expects a structured payload, not free text. The card *validates*. The `skillId` *matches*. Discovery succeeds. Runtime A re-issues with the original free-text clarification payload. Runtime B's dispatcher accepts the request (the `skillId` resolves), routes to the new handler, and the handler — because it was written defensively — coerces the free-text payload into a default JSON envelope, runs, and returns `status.state: "completed"` with an output that is structurally valid but semantically derived from a *different* interpretation of the task than the one that produced the `input-required` state. The client has no signal that the skill's contract drifted. The task "resumed." The lineage `c-91b2` now contains a turn whose semantics are discontinuous with its predecessors. The observed failure signature is not an error. It is a `completed` state with a downstream reasoning divergence — the planner's next step operates on an output that does not answer the question that was actually asked. ## Condition of Validity Resumption of a `taskId` is valid only when all three of the following hold at the moment of re-issue: 1. **Identity continuity**: the remote agent's `agentId` (or the cryptographic identity bound to the card, where signed cards are in use) is byte-identical to the identity that created the task. 2. **Skill contract continuity**: for every skill referenced by the task's intermediate artifacts, the current card's `skills[]` entry with that `skillId` has an `inputModes`/`outputModes` set that is a *superset-compatible* match with the modes used at task creation — not merely a non-empty intersection. 3. **Card revision monotonicity**: the card's `version` (or an equivalent monotonic revision field) has not advanced across a *major* boundary since task creation, where the major/minor split is defined by the remote agent's own compatibility policy and is *not* inferable from semver alone. If any of these is false, the correct action is to abandon the `taskId` and re-issue under a fresh `taskId` with a *new* `contextId` that references the old one only as provenance — a `tasks/cancel` on the stale handle followed by a clean `tasks/send`. The stale task must be explicitly cancelled, not orphaned, because an orphaned `input-required` task on Runtime B will hold a slot in its state store and, on some implementations, will be auto-resumed by a background retry loop under the *new* skill contract — the exact failure above, but now without a client in the loop to notice. ## Decision Boundary The boundary is not "did the card change." Cards change constantly and most changes are irrelevant. The boundary is **whether the change intersects the set of skills and modes the in-flight task depends on**. This requires the client to have recorded, at task creation, a *dependency manifest*: the `skillId`, the `inputModes`/`outputModes` actually negotiated, and the card `version` observed at that moment. Without that manifest, the client cannot evaluate the boundary and must default to non-resumption — which is safe but expensive. Concretely, the decision procedure at re-issue time is: - If the task's last observed state is `completed`, `failed`, or `canceled`: never resume; the handle is dead by definition. - If the last observed state is `input-required` or `working` **and** the dependency manifest matches the current card on all three conditions above: resume with the original `taskId`. - If the last observed state is `input-required` or `working` **and** any condition fails: `tasks/cancel` the original, then `tasks/send` a fresh task carrying the original `contextId` as a `metadata.provenance` field but a new `taskId`. The subtle case — and the one that produces the observed silent divergence — is when the card changed but the `skillId` did not. Schema validation passes, `skillId` resolution passes, and the protocol layer has no vocabulary for "the skill behind this ID is a different skill." The client must supply that vocabulary itself via the manifest comparison. The protocol will not do it for you. ## Operational Effect The operational consequence is that **A2A task resumption is only as safe as the client's dependency manifest, and the protocol does not mandate one.** Runtimes that skip the manifest will, at low frequency, produce `completed` tasks whose outputs are semantically discontinuous with their `contextId` lineage. These do not surface as errors; they surface as downstream reasoning divergence in the planner, often several steps later, where the causal link back to the card drift is no longer recoverable from the context window. The guardrail is a client-side invariant enforced before every re-issue: a task may not be resumed unless its recorded dependency manifest is *state-compatible* with the currently fetched card. When it is not, the client must cancel and re-issue, and must record the cancellation reason as `card_contract_drift` so that the provenance chain in the new `contextId` explains why the lineage forked. This converts a silent semantic discontinuity into an explicit, auditable fork — which is the only form of continuity failure an agent can actually reason about. ```python from dataclasses import dataclass, field from typing import Optional class CardContractDriftError(RuntimeError): """Raised when a task cannot be safely resumed because the remote Agent Card's skill contract changed since task creation.""" @dataclass(frozen=True) class DependencyManifest: agent_id: str skill_id: str input_modes: frozenset output_modes: frozenset card_version: str @dataclass(frozen=True) class AgentCard: agent_id: str version: str skills: dict # skill_id -> {"inputModes": set, "outputModes": set} @dataclass class TaskHandle: task_id: str context_id: str last_state: str manifest: DependencyManifest provenance: list = field(default_factory=list) def _modes_compatible(recorded: frozenset, current: set) -> bool: # Recorded modes must be a subset of what the current card still accepts. return recorded.issubset(current) def assert_resumable(handle: TaskHandle, card: AgentCard) -> None: if handle.last_state in {"completed", "failed", "canceled"}: raise CardContractDriftError( f"task {handle.task_id} is terminal ({handle.last_state}); " f"must re-issue under a fresh taskId" ) m = handle.manifest if card.agent_id != m.agent_id: raise CardContractDriftError( f"agent identity drifted: {m.agent_id} -> {card.agent_id}" ) skill = card.skills.get(m.skill_id) if skill is None: raise CardContractDriftError( f"skill {m.skill_id} no longer advertised by {card.agent_id}" ) if not _modes_compatible(m.input_modes, skill["inputModes"]): raise CardContractDriftError( f"skill {m.skill_id} inputModes incompatible: " f"recorded={sorted(m.input_modes)} current={sorted(skill['inputModes'])}" ) if not _modes_compatible(m.output_modes, skill["outputModes"]): raise CardContractDriftError( f"skill {m.skill_id} outputModes incompatible: " f"recorded={sorted(m.output_modes)} current={sorted(skill['outputModes'])}" ) if card.version != m.card_version: # Version drift alone is not fatal if modes still match, but it must # be surfaced so the caller can decide whether to fork provenance. handle.provenance.append( f"card_version_drift:{m.card_version}->{card.version}" ) def resume_or_fork(handle: TaskHandle, card: AgentCard) -> TaskHandle: try: assert_resumable(handle, card) except CardContractDriftError as drift: return TaskHandle( task_id=f"{handle.task_id}-fork", context_id=handle.context_id, last_state="new", manifest=DependencyManifest( agent_id=card.agent_id, skill_id=handle.manifest.skill_id, input_modes=frozenset( card.skills.get(handle.manifest.skill_id, {}).get( "inputModes", set() ) ), output_modes=frozenset( card.skills.get(handle.manifest.skill_id, {}).get( "outputModes", set() ) ), card_version=card.version, ), provenance=handle.provenance + [f"forked:{handle.task_id}", f"reason:{drift}"], ) return handle ```