# Which invariants prevent A2A v1.0 task-state divergence when an agent card is re-negotiated mid-task **Date of Record:** 2026 November 20 **Scope:** Applies to A2A v1.0 (Agent-to-Agent) task lifecycles where a client agent re-fetches or re-negotiates a remote agent's card (`/.well-known/agent.json`) while a task is in a non-terminal state (`submitted`, `working`, `input-required`). Does not cover initial card fetch before task creation, nor streaming-only transports where no task object is materialized. ## Core Distinction The A2A task lifecycle is a *server-owned* state machine: the remote agent (the "server" agent) is authoritative over task state, and the client is a poller/observer that may also push follow-up messages. The agent card is a *separate, independently versioned artifact* that declares capabilities, skills, input/output modes, and (in v1.0) a `capabilities.streaming` / `capabilities.pushNotifications` block plus per-skill schema hints. The failure boundary is this: **a card is not a task.** Nothing in the v1.0 spec binds the card version that was in force at `tasks/send` time to the card version observable during `tasks/get`. A client that re-reads the card mid-task to "re-validate" capabilities can observe a card whose declared skill schema no longer matches the schema the server is actually using to interpret the in-flight task. This is not a race in the transport—it is a *version skew between two independently mutable documents* that the protocol never requires to be reconciled. The non-obvious part: the server can be perfectly spec-conformant. It can return a valid card, and a valid task, and a valid state transition, and still be the source of a divergence, because conformance is checked per-endpoint, not across the (card, task) pair. ## What Was Observed A client agent dispatched a `tasks/send` with a skill reference `summarize.v2` and an artifact schema declared in the card's `skills[].inputModes` at the moment of dispatch. The server accepted and returned a task in `working`. While polling `tasks/get`, the client's orchestration loop—configured to "re-validate remote capabilities every N polls" to guard against capability drift—re-fetched `/.well-known/agent.json`. Between the dispatch and the re-fetch, the server had been redeployed: `summarize.v2` was retired in favor of `summarize.v3`, and the card now advertised `summarize.v3` with a *narrower* `inputModes` set (the v3 schema dropped a `text/markdown` variant that v2 accepted). The client's re-validation logic did what it was told: it compared the in-flight task's recorded skill (`summarize.v2`) against the current card, found no matching skill, and marked the task as *orphaned*—aborting polling and emitting a `TaskCapabilityLost` error to its own caller. Meanwhile the server, which had *not* migrated the in-flight task (it was pinned to the v2 handler for the lifetime of the task), continued to `working` and eventually returned a valid `completed` artifact that no one read. Trace of the divergence: 1. `t0` — client fetches card `C1` (has `summarize.v2`). Dispatches `tasks/send` → task `T` in `submitted`. 2. `t1` — server redeploys. Card becomes `C2` (has `summarize.v3`, no `v2`). 3. `t2` — client re-fetches card → `C2`. Compares `T.skill == "summarize.v2"` against `C2`. No match. 4. `t2` — client aborts. Server still holds `T` pinned to v2 handler. 5. `t3` — server transitions `T → completed`, writes artifact, task is garbage-collected after retention window. The client observed a *false capability loss*. The server observed a *normal task completion*. Both were locally correct. The divergence was in the *binding* between card and task, which neither side had recorded. ## Condition of Validity The guardrail is a **card-pinning invariant**: a task's interpretation must be bound to the card version in force at dispatch, and that binding must be *observable* to both parties for the task's lifetime. Concretely, for the invariant to hold, the following must be true: - The card document must carry a stable, monotonic identifier (e.g., a `version` field or an ETag/`If-None-Match`-backed digest) that changes whenever any skill's schema changes. A2A v1.0's card schema permits a `version` string but does not require it to change on skill mutation—so the invariant is *not* provided by the spec and must be enforced by convention or by the client. - The `tasks/send` response (or the task object returned by `tasks/get`) must echo the card version that the server used to accept the task. The v1.0 task object has no mandatory field for this. A `metadata` bag is available and is the only sanctioned place to carry it. - The client's re-validation logic must compare against the *pinned* card version, not the latest fetched card. Re-validation against latest is the exact bug above. If any of these three conditions is absent, the invariant does not hold and mid-task re-negotiation is unsafe. The condition of validity is therefore: **either the card version is pinned and echoed in task metadata, or the client must not re-validate capabilities for in-flight tasks at all.** ## Decision Boundary The boundary between safe and unsafe re-negotiation is drawn by *task state*, not by elapsed time or poll count: - **Terminal states (`completed`, `failed`, `canceled`):** re-fetching the card and re-validating is safe. The task's outcome is already fixed; a capability mismatch is a post-hoc observation, not a divergence. - **`input-required`:** the most dangerous state. The server is blocked waiting for client input, and the client's follow-up message must conform to the schema the server is *still using*. If the client re-validates against a newer card and reformats its follow-up to the new schema, the server will reject it or, worse, mis-parse it. Re-negotiation here must be pinned to the dispatch card. - **`submitted` / `working`:** re-negotiation is safe only for *observational* purposes (logging, metrics). Any *behavioral* use of the new card (reformatting, re-routing, aborting) is a divergence risk. The decision rule: **a client may observe the latest card at any time, but may only act on a card version that matches the task's pinned version.** Acting on a newer card for an in-flight task is the boundary violation. ## Operational Effect When the invariant holds (card version pinned and echoed), mid-task re-negotiation becomes a no-op for task semantics: the client sees `C2`, notes the drift, logs it, and continues using `C1`'s schema for `T`. The task completes correctly, and the drift is recorded as a deployment event rather than a task failure. When the invariant is violated (the observed case), the effect is a *silent split-brain*: the client believes the task is orphaned and stops polling; the server believes the task is healthy and completes it. The artifact is produced and discarded. Downstream, this manifests as a "lost task" that is neither failed nor completed from the client's perspective—a category the client's state machine typically has no transition for, so it either hangs or emits a spurious error. The operational cost is not the lost task itself; it is the *misattribution*. The client's error log says "capability lost," which routes to the wrong on-call (the server's capability owner) rather than the correct one (the client's re-validation logic). The fix is not on the server; it is the client's pinning discipline. A secondary effect: if the client retries the task against `C2` (the "recover by re-dispatching" heuristic), it will dispatch `summarize.v3` with a v2-shaped payload, which the v3 handler will reject—producing a *second* failure that looks like a schema bug but is actually the same version-skew bug propagating. ``` ```python class CardTaskVersionSkewError(RuntimeError): """Raised when a client acts on a card version that does not match the version pinned to an in-flight A2A task.""" pass def resolve_task_card(task: dict, latest_card: dict) -> dict: """ Return the card version that governs `task`'s semantics. Invariant: a task's interpretation is bound to the card version in force at dispatch. The pinned version must be echoed in task.metadata. Re-negotiation against a newer card is observational only. """ pinned_version = task.get("metadata", {}).get("card_version") if pinned_version is None: # No pin recorded: any behavioral use of the latest card is unsafe. raise CardTaskVersionSkewError( f"task {task.get('id')!r} has no pinned card_version; " f"cannot safely re-negotiate against {latest_card.get('version')!r}" ) if task.get("state") in {"submitted", "working", "input-required"}: if latest_card.get("version") != pinned_version: # Drift observed but task is in-flight: do NOT act on latest_card. # Caller must continue using the pinned card for this task. raise CardTaskVersionSkewError( f"task {task['id']!r} pinned to card {pinned_version!r} " f"but latest card is {latest_card.get('version')!r}; " f"re-negotiation is observational only while task is in-flight" ) # Terminal state, or versions match: safe to return. return latest_card def validate_followup(task: dict, latest_card: dict, followup: dict) -> None: """Guard the input-required -> follow-up transition against version skew.""" pinned = task.get("metadata", {}).get("card_version") if pinned is None: raise CardTaskVersionSkewError( f"task {task['id']!r} lacks card_version pin; " f"refusing to validate follow-up against unpinned schema" ) if latest_card.get("version") != pinned: raise CardTaskVersionSkewError( f"follow-up for task {task['id']!r} would be validated against " f"card {latest_card.get('version')!r} but task is pinned to " f"{pinned!r}; reformatting to latest schema risks server mis-parse" ) # ... schema validation against pinned card's skill inputModes ... ```