# In what scenarios must an instance refuse an A2A v1.0 task-status webhook whose `status.state` transition is not reachable from the locally replayed task lifecycle, and how does Agent Card re-discovery invalidate an in-flight push contract **Date of Record:** 2026 November 26 **Scope:** Applies to A2A v1.0 clients and servers that (a) cache Agent Cards keyed by `agentCard.url` and (b) accept `TaskStatusUpdateEvent` webhooks carrying `taskId`, `contextId`, and `status.state`. Does not apply to synchronous `message/send` request/response flows where the task state is observed only in the response body, nor to transports where push notifications are disabled. ## Core Distinction The non-obvious boundary is this: **the webhook contract is a *push* of state, but the task lifecycle is a *pull-replayable* state machine.** A2A v1.0 defines `TaskState` as an ordered set of terminal and non-terminal states (`submitted`, `working`, `input-required`, `completed`, `canceled`, `failed`, `rejected`, `auth-required`, `unknown`), and the spec requires that a server's transitions be monotone with respect to *terminality*: once a task reaches a terminal state, no further status event for that `taskId` may legally arrive. The failure mode is not "a webhook arrived late." It is **a webhook arrived whose `status.state` is not reachable from the state the receiver last committed for that `taskId`**, typically because the receiver's committed state was advanced by a *separate* channel (a prior webhook, a `tasks/get` poll, or a re-discovery of the Agent Card that changed `capabilities.pushNotifications`). The receiver must treat the *local replay* as authoritative for reachability and the *webhook* as a claim to be validated against it — not the reverse. The naive implementation does the opposite: it trusts the webhook, writes `status.state` into the task store, and fires side effects (billing, downstream agent dispatch, user notification). That inverts the invariant and produces the class of bug this record covers. ## What Was Observed A client agent (`client-A`) dispatched a long-running research task to `server-B` via `message/send`, receiving `taskId=T1` in `submitted`. `client-A` registered a push webhook at `https://client-a.example/a2a/push` and persisted the returned push-notification config id `pushCfg=7`. The Agent Card for `server-B` was cached with `capabilities.pushNotifications: true` and `protocolVersion: "1.0"`. The following sequence was replayed from production logs: 1. `t+0s` — `client-A` polls `tasks/get(T1)` → `working`. Commits `state=working`, `revision=3`. 2. `t+41s` — `server-B` rotates its Agent Card (new `url`, new `securitySchemes`, and — critically — `capabilities.pushNotifications: false` during a rolling deploy). `client-A`'s cache is stale; it does not re-discover because nothing in the spec forces it to. 3. `t+44s` — a webhook arrives: `{taskId: T1, status: {state: "completed", timestamp: ...}, final: true}`. `client-A` commits `state=completed`, fires downstream dispatch. 4. `t+47s` — a *second* webhook arrives for the same `T1`: `{status: {state: "working"}}` (a duplicate/out-of-order delivery from the server's retry queue, which had not observed the `pushNotifications: false` flip because the old config `pushCfg=7` was still draining). 5. `client-A`, on the naive path, overwrites `state=working` and re-opens the task. Downstream dispatch had already run. The task is now `working` in `client-A`'s store but `completed` in `server-B`'s store — a **divergent terminality**. The root cause is not the duplicate webhook. It is that `client-A` accepted a transition `completed → working` that is **unreachable** in the A2A task lifecycle, because it validated the webhook against *nothing* except its own JSON schema. The Agent Card flip at step 2 is the *enabling* condition: it meant the server's push contract was in a degraded, draining state, and the client had no signal to re-discover and reconcile. ## Condition of Validity A `TaskStatusUpdateEvent` webhook is *valid to apply* if and only if all of the following hold at the moment of receipt: - **C1 (reachability).** `status.state` is reachable from `committed_state(taskId)` under the A2A transition relation. Concretely: if `committed_state ∈ {completed, canceled, failed, rejected}` (terminal), *no* webhook may change it. If `committed_state = working`, a webhook to `completed` is reachable; a webhook to `submitted` is not. - **C2 (monotone revision).** The webhook carries a `status.timestamp` or an out-of-band sequence; the receiver applies only if strictly newer than the last committed event for `taskId`. A2A v1.0 does not mandate a sequence number, so the receiver must synthesize one (see Decision Boundary). - **C3 (contract liveness).** The push config `pushCfg` that delivered the webhook is still *live* per the server's current Agent Card. If the current card has `capabilities.pushNotifications: false`, or the card's `url`/`securitySchemes` changed such that `pushCfg` cannot be re-validated, the webhook is **unverifiable** and must be quarantined, not applied. - **C4 (identity).** The webhook's `contextId` matches the `contextId` bound to `taskId` at dispatch time; a mismatch indicates cross-task contamination (observed in multi-tenant servers that reuse a push queue). The invariant: **terminality is absorbent.** Once committed terminal, the only legal webhook is a duplicate of the terminal event itself (idempotent no-op). Every other arrival is a violation of C1 and must be rejected with a typed error, not silently dropped, because silent drops hide the divergence from audit. ## Decision Boundary The boundary between "apply" and "reject-and-quarantine" is drawn by the *replay oracle*, not by the webhook payload: - If `committed_state` is terminal and the incoming `status.state` equals it → **idempotent accept**, no side effects. - If `committed_state` is terminal and the incoming `status.state` differs → **reject**, emit `UnreachableTaskTransition`, quarantine the event, and trigger `tasks/get(T1)` reconciliation against `server-B`. If the server also reports terminal, the divergence is a server-side bug; if the server reports non-terminal, the client's terminal commit was wrong and must be rolled back with an audit record. - If `committed_state` is non-terminal and the incoming state is reachable → **apply only if C2 (newer) and C3 (contract live) hold**; otherwise quarantine. - If C3 fails (Agent Card re-discovery shows `pushNotifications: false` or changed `url`) → **do not apply any webhook from `pushCfg`**; mark the contract `stale`, and fall back to `tasks/get` polling until a new push config is negotiated. This is the *only* correct response to the Card flip; accepting the webhook because "it looks fine" is the failure. The subtle point: C3 is checked *before* C1. A webhook that is unreachable *and* from a stale contract is quarantined as `stale-contract`, not as `unreachable-transition`, because the two require different remediation (re-negotiate push vs. reconcile task). ## Operational Effect Adopting the replay oracle changes three things in production: 1. **Divergent terminality becomes observable.** `client-A` no longer silently re-opens completed tasks. The `completed → working` event at step 4 is quarantined, the task stays `completed`, and an audit record names `pushCfg=7` as the source. Downstream dispatch runs exactly once. 2. **Agent Card staleness becomes a first-class failure.** Clients must re-discover the card on a TTL or on any `4xx` from the push endpoint, and on re-discovery must *reconcile every in-flight `taskId` bound to the old card* via `tasks/get`. The flip at step 2 would have been caught at `t+42s` and the draining webhook quarantined from the start. 3. **The webhook becomes a hint, not a command.** Side effects (billing, dispatch, user notification) are gated on the committed state *after* the replay oracle, never on the webhook payload. This is the invariant that bounds the blast radius: a malicious or buggy server can at worst cause a quarantine, never a double-dispatch. The cost is latency: reconciliation via `tasks/get` adds one round-trip per quarantined event. In the observed incident that would have been ~3 extra calls over 10 minutes — negligible against the cost of a double-dispatched research task. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import Optional class TaskState(str, Enum): SUBMITTED = "submitted" WORKING = "working" INPUT_REQUIRED = "input-required" AUTH_REQUIRED = "auth-required" COMPLETED = "completed" CANCELED = "canceled" FAILED = "failed" REJECTED = "rejected" UNKNOWN = "unknown" TERMINAL = frozenset( {TaskState.COMPLETED, TaskState.CANCELED, TaskState.FAILED, TaskState.REJECTED} ) # A2A v1.0 reachability relation, restricted to the non-terminal -> * edges. # Terminal states are absorbent: no outgoing edges except identity. _REACHABLE: dict[TaskState, frozenset[TaskState]] = { TaskState.SUBMITTED: frozenset( {TaskState.WORKING, TaskState.REJECTED, TaskState.FAILED, TaskState.CANCELED} ), TaskState.WORKING: frozenset( { TaskState.INPUT_REQUIRED, TaskState.AUTH_REQUIRED, TaskState.COMPLETED, TaskState.FAILED, TaskState.CANCELED, } ), TaskState.INPUT_REQUIRED: frozenset( {TaskState.WORKING, TaskState.CANCELED, TaskState.FAILED} ), TaskState.AUTH_REQUIRED: frozenset( {TaskState.WORKING, TaskState.CANCELED, TaskState.FAILED} ), TaskState.COMPLETED: frozenset({TaskState.COMPLETED}), TaskState.CANCELED: frozenset({TaskState.CANCELED}), TaskState.FAILED: frozenset({TaskState.FAILED}), TaskState.REJECTED: frozenset({TaskState.REJECTED}), } class UnreachableTaskTransition(RuntimeError): """Webhook status.state is not reachable from committed_state(taskId).""" class StalePushContract(RuntimeError): """Webhook arrived from a push config no longer live per current Agent Card.""" @dataclass class CommittedTask: task_id: str context_id: str state: TaskState revision: int # monotone; synthesized from status.timestamp + tiebreak push_cfg_id: str @dataclass class StatusWebhook: task_id: str context_id: str state: TaskState timestamp: float push_cfg_id: str @dataclass class AgentCardView: url: str push_notifications: bool protocol_version: str @dataclass class ReplayOracle: tasks: dict[str, CommittedTask] = field(default_factory=dict) quarantine: list[tuple[str, str]] = field(default_factory=list) def apply( self, event: StatusWebhook, card: AgentCardView, last_revision_for_cfg: dict[str, int], ) -> CommittedTask: # C3 first: contract liveness. A stale contract cannot be trusted to # carry a reachable transition, regardless of what the payload says. if not card.push_notifications or card.protocol_version != "1.0": self.quarantine.append((event.task_id, "stale-contract")) raise StalePushContract( f"pushCfg={event.push_cfg_id} is stale under card {card.url}; " f"refusing webhook for task {event.task_id}" ) task = self.tasks.get(event.task_id) if task is None: raise UnreachableTaskTransition( f"no committed task {event.task_id}; cannot validate transition" ) # C4: context binding. if task.context_id != event.context_id: raise UnreachableTaskTransition( f"context mismatch for {event.task_id}: " f"committed={task.context_id} webhook={event.context_id}" ) # C1: reachability, with terminality absorbent. if event.state not in _REACHABLE[task.state]: self.quarantine.append((event.task_id, "unreachable-transition")) raise UnreachableTaskTransition( f"task {event.task_id}: {task.state.value} -> {event.state.value} " f"is unreachable in A2A v1.0 lifecycle" ) # C2: monotone revision. Idempotent terminal re-delivery is a no-op. if task.state in TERMINAL and event.state == task.state: return task if event.timestamp <= last_revision_for_cfg.get(event.push_cfg_id, -1.0): self.quarantine.append((event.task_id, "stale-revision")) raise UnreachableTaskTransition( f"task {event.task_id}: webhook ts={event.timestamp} not newer than " f"last seen for pushCfg={event.push_cfg_id}" ) last_revision_for_cfg[event.push_cfg_id] = event.timestamp task.state = event.state task.revision += 1 return task ```