What happens when an instance negotiates a task lifecycle against a stale A2A agent card: the `TaskState` skew boundary in cross-vendor v1.0 handoffs

**Date of Record:** 2026 December 2 **Scope:** Applies to A2A v1.0 task delegation where the caller caches a remote agent card and the callee mutates its declared `capabilities`/`defaultInputModes`/`defaultOutputModes` or its task lifecycle semantics between card fetch and task submission. Does not apply to single-shot stateless RPC, nor to same-process in-memory agent calls where discovery and invocation are atomic.

Core Distinction

The failure is not "the remote agent went down" and it is not "the schema version mismatched." Both of those produce clean, detectable errors. The failure is **semantic drift inside a nominally-valid card**: the callee still serves A2A v1.0, still returns HTTP 200 on `message/send`, still echoes a well-formed `Task` object — but the lifecycle contract the caller *negotiated against* (which terminal states are reachable, whether `input-required` is interruptible, whether `auth-required` is resumable with the same `taskId`) no longer matches the lifecycle the callee *now enforces*. The caller's state machine and the callee's state machine are both individually correct and mutually incompatible.

This is the difference between a **version mismatch** (loud, `-32601`-class, rejectable at discovery) and a **capability drift** (silent, surfaces only as a hung task or a state the caller's FSM refuses to accept). The boundary condition is: `card_fetch_time < card_mutation_time < task_submit_time`, with no cache-invalidation signal in between.

What Was Observed

Cross-vendor conformance run, caller on vendor A's orchestrator, callee on vendor B's task server. Caller fetched the agent card at T0, cached it for the session (TTL 3600s, a common default). The card at T0 declared:

"capabilities": { "streaming": true, "pushNotifications": false, "stateTransitionHistory": true },
"defaultInputModes": ["text/plain"],
"skills": [{ "id": "doc-analyze", "inputModes": ["text/plain"], "outputModes": ["application/json"] }]

Caller built its FSM assuming: submit → `working` → terminal `completed` | `failed` | `canceled`, with `input-required` *not* reachable (no skill declared it). At T+90s vendor B hot-reloaded its skill registry: `doc-analyze` gained an `outputModes` of `["application/json", "text/markdown"]` and — critically — the skill's handler was patched to request clarification via `input-required` when the input text was under a token threshold. The card's `version` string did not change; the callee's `/.well-known/agent.json` was regenerated but the caller never re-fetched.

Trace at T+120s:

  1. Caller `message/send` with a short `text/plain` payload. Callee accepts, returns `Task{ id: t-7f3, status: { state: "input-required" }, ... }`.
  2. Caller's FSM has no transition from `submitted` to `input-required` (it was pruned at card-parse time because no skill declared it). The event is dropped as `unexpected_state`.
  3. Caller's task record stays `submitted`. Callee's task record is `input-required`, awaiting a `message/send` continuation on `t-7f3`.
  4. Neither side times out within the conformance window. The task is a **zombie**: alive on the callee, invisible on the caller, un-cancelable because the caller never learned the `taskId` was terminal-adjacent and the callee's `tasks/cancel` is only honored from `working`/`submitted` per its *new* lifecycle, not from `input-required` without the continuation token.

A second, subtler variant appeared on vendor C: the callee's card declared `pushNotifications: false` at T0, so the caller never registered a webhook. At T+200s the callee enabled push and began emitting `TaskStatusUpdateEvent`s to a webhook the caller never stood up. The callee treated the absence of a delivery ACK as a transient failure and **retried the task from `working`**, producing a duplicate side effect (a document was re-analyzed and billed twice). Here the drift was in `capabilities.pushNotifications`, and the failure mode was duplicate execution, not a zombie.

Condition of Validity

The invariant that must hold for cached-card delegation to be safe is:

> **A caller may only cache an agent card for the duration over which the callee guarantees the card's `capabilities`, `defaultInputModes`, `defaultOutputModes`, and per-skill `inputModes`/`outputModes` are immutable — and that duration must be bounded by a callee-published `cardTTL`, not by a caller-chosen cache TTL.**

A2A v1.0 as written does not mandate a `cardTTL` field, and does not require the `version` string to change on capability mutation (only on protocol-version change). Therefore the invariant is **not enforceable from the spec alone**. It is enforceable only if one of the following holds:

If none hold, the caller's FSM and the callee's FSM are only coincidentally aligned, and the alignment decays with `card_age × mutation_rate`.

Decision Boundary

The precise line where this becomes a correctness bug rather than a performance annoyance:

The discriminator is not "did the card change" — it is **"does the current task's continuation contract depend on a card field that changed after fetch."** A caller that validates its cached card against the live card *only at task submission* (not at every continuation) still fails, because the mutation can land between the first and second `message/send`.

Operational Effect

The practical consequences, in order of blast radius:

  1. **Zombie tasks accumulate.** Callee-side `input-required`/`auth-required` tasks with no caller-side counterpart consume callee resources and, in metered vendors, bill for idle retention. There is no A2A-level `tasks/list` reconciliation primitive in v1.0 that lets the caller discover tasks it forgot it owned; reconciliation requires out-of-band `taskId` bookkeeping.
  2. **Duplicate execution under push-capability drift.** When `pushNotifications` flips false→true, callee retry semantics can re-run non-idempotent skills. The caller cannot dedupe because it never received the first `TaskStatusUpdateEvent` and has no `taskId`-keyed idempotency key on the skill.
  3. **Auditor disagreement in multi-agent verification.** When a verifier agent and an executor agent cache different card generations of the same callee, they disagree on whether a task is `completed` or `input-required`; the swarm's consensus check sees two valid-but-incompatible views and either deadlocks or force-resolves to the wrong terminal state.
  4. **Silent conformance pass.** The cross-vendor conformance suite passes because every individual message is schema-valid. The failure is only visible at the *lifecycle* level, which most suites do not exercise across a card mutation.

The guardrail that bounds this: **treat the agent card as a lease, not a fact.** Every task submission and every continuation must carry the `ETag` of the card the caller is acting under, and the callee must reject (`-32001`-class `stale-card`) any continuation whose `ETag` does not match its current card. This converts a silent semantic drift into a loud, recoverable re-negotiation. Absent that, the only safe caller policy is: re-fetch the card on every state transition the FSM did not predict, and refuse to continue any task whose current state is not reachable from the cached card's declared lifecycle.

import hashlib
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional


class StaleCardError(RuntimeError):
    """Raised when a task continuation is issued under a card generation
    that no longer matches the callee's current lifecycle contract."""


class ZombieTaskError(RuntimeError):
    """Raised when a task reaches a state the caller's FSM cannot represent
    and no re-negotiation path exists."""


class TaskState(str, Enum):
    SUBMITTED = "submitted"
    WORKING = "working"
    INPUT_REQUIRED = "input-required"
    AUTH_REQUIRED = "auth-required"
    COMPLETED = "completed"
    FAILED = "failed"
    CANCELED = "canceled"


@dataclass(frozen=True)
class AgentCard:
    version: str
    etag: str
    declared_states: frozenset
    push_notifications: bool
    default_input_modes: frozenset
    default_output_modes: frozenset

    @classmethod
    def from_wire(cls, wire: dict) -> "AgentCard":
        blob = repr(sorted(wire.items())).encode()
        return cls(
            version=wire["version"],
            etag=hashlib.sha256(blob).hexdigest()[:16],
            declared_states=frozenset(wire.get("declaredStates", [])),
            push_notifications=bool(wire["capabilities"].get("pushNotifications", False)),
            default_input_modes=frozenset(wire["defaultInputModes"]),
            default_output_modes=frozenset(wire["defaultOutputModes"]),
        )


@dataclass
class CallerSession:
    cached_card: AgentCard
    task_id: Optional[str] = None
    last_known_state: Optional[TaskState] = None
    continuation_etag: Optional[str] = field(default=None)

    def submit(self, live_card: AgentCard, payload_modes: frozenset) -> None:
        # Guardrail 1: revalidate card generation at submission.
        if live_card.etag != self.cached_card.etag:
            raise StaleCardError(
                f"card mutated between fetch and submit: "
                f"cached={self.cached_card.etag} live={live_card.etag}"
            )
        if not payload_modes <= live_card.default_input_modes:
            raise StaleCardError(
                f"payload modes {payload_modes} not in live card input modes"
            )
        self.continuation_etag = live_card.etag

    def on_state_event(self, live_card: AgentCard, new_state: TaskState) -> None:
        # Guardrail 2: any state the cached FSM cannot represent is a hard
        # negotiation failure, never a silent drop.
        if live_card.etag != self.continuation_etag:
            raise StaleCardError(
                f"continuation under stale card: "
                f"session={self.continuation_etag} live={live_card.etag}"
            )
        if new_state.value not in live_card.declared_states:
            raise ZombieTaskError(
                f"callee emitted state {new_state.value!r} not in its own "
                f"declared lifecycle {sorted(live_card.declared_states)}; "
                f"task {self.task_id} is unaddressable"
            )
        if new_state is TaskState.INPUT_REQUIRED and not live_card.push_notifications:
            # No push channel to deliver the continuation prompt; the caller
            # must poll or the task becomes a zombie.
            raise ZombieTaskError(
                f"input-required reached with pushNotifications=false; "
                f"no delivery path for continuation on task {self.task_id}"
            )
        self.last_known_state = new_state


def drive_task(session: CallerSession, live_card: AgentCard, events: list) -> TaskState:
    for ev in events:
        session.on_state_event(live_card, TaskState(ev))
    if session.last_known_state not in (TaskState.COMPLETED, TaskState.FAILED, TaskState.CANCELED):
        raise ZombieTaskError(
            f"task {session.task_id} ended in non-terminal state "
            f"{session.last_known_state}; caller FSM cannot close it"
        )
    return session.last_known_state