What structural signals indicate an A2A v1.0 push-notification binding has silently desynchronized from its task lifecycle

**Date of Record:** 2026 December 2

**Scope:** Applies to A2A v1.0 task lifecycles where a client registers a `pushNotificationsConfig` webhook against a remote agent's agent card and subsequently relies on webhook delivery (rather than polling `tasks/get`) as the authoritative signal for `TaskStatusUpdateEvent`. Does not cover synchronous `message/send` request/response flows, nor A2A versions prior to v1.0 where task state was not a first-class versioned object.

Core Distinction

There are two distinct failure classes in A2A push notification binding, and conflating them is the root of most operational confusion:

  1. **Delivery failure** — the webhook endpoint is unreachable, returns 5xx, or times out. This is *loud*. The remote agent's retry logic surfaces it, and a client that watches its own inbox notices the absence of events. It is a transport problem with a transport remedy.
  1. **Binding desynchronization** — the webhook is delivered successfully (HTTP 200, event correctly received and parsed), but the *task state the event describes has already advanced past the state the event carries*. The client believes it holds the authoritative lifecycle position because it received a well-formed `TaskStatusUpdateEvent`; in fact the agent card's task has transitioned through one or more states that the webhook never described, because the binding was registered against a task incarnation or a card revision that no longer governs the live task.

The dangerous case is the second. A delivered, well-formed, correctly-signed webhook is *not* evidence that the binding is current. This article is about the structural signals that distinguish a live binding from a desynchronized one.

What Was Observed

A client agent discovered a remote agent card at `https://agent.example/.well-known/agent.json`, negotiated capabilities, and initiated a long-running task via `message/send` with `pushNotificationsConfig` pointing at its own webhook. The card advertised `capabilities.pushNotifications: true` and a `defaultInputModes`/`defaultOutputModes` pair. The task entered `working`.

The client then released its polling loop — a reasonable optimization, since the binding was registered and the card was fresh. Over the next 40 minutes the webhook received exactly three events:

The client marked the task terminal at `completed` and moved on. Six minutes later, a *fourth* webhook arrived describing `input-required` with a clarification prompt. The client's state machine had already closed the task; the event was dropped as a late duplicate. The remote agent, meanwhile, had never received the client's answer because the client believed the task was done.

The actual sequence on the remote side was: `working` → `working` → `input-required` → (client never answered, remote timed out) → `failed` → a *retry* of the same task under a new incarnation emitted `working` → `completed`. The webhook the client received as the third event was from the *retry incarnation*; the `input-required` event from the original incarnation arrived out of order because the remote agent's notification dispatcher had been re-bound to the new incarnation's `taskId` while the old incarnation's queued event was still in flight.

The structural signal the client missed: the third event's `taskId` was identical, but its `contextId` differed from the first two. A2A v1.0 does not require `contextId` stability across incarnations, but it *does* require that a client treat a `contextId` change on a bound `taskId` as a binding reset, not as a progress update. The client's reducer keyed only on `taskId` and silently merged two incarnations into one lifecycle.

Condition of Validity

A push-notification binding is only valid under the following joint condition, and any single violation desynchronizes it:

Decision Boundary

The boundary between "binding is live" and "binding is desynchronized" is crossed at the first event that satisfies *any* of the following, and the client must transition its binding state to `stale` rather than applying the event:

  1. `event.contextId != bound.contextId` — incarnation drift.
  2. `event.taskId` matches a bound task already in a terminal state AND `event.contextId` matches — duplicate/late delivery; apply idempotently, do not regress.
  3. `event.taskId` matches a bound task already in a terminal state AND `event.contextId` differs — key reuse; treat as a new incarnation and require explicit re-binding, do not silently adopt.
  4. The event's `status.state` is lifecycle-earlier than the last applied state for the same `(taskId, contextId)` — out-of-order regression; buffer or reject, never apply.
  5. The remote card's `version` observed at re-fetch differs from the version pinned at binding time — card rotation; binding is stale regardless of event content.

The non-obvious part: signals 1, 3, and 5 are *not* delivery failures. The webhook returns 200. The event parses. The signature verifies. A client that only alerts on delivery failures will never see them. They must be detected in the reducer, not the transport.

Operational Effect

A desynchronized binding produces a specific and reproducible operational signature that is worth encoding as a first-class alert:

The guardrail is a binding state machine with an explicit `stale` state, a reducer keyed on `(taskId, contextId)` rather than `taskId`, a monotonic lifecycle comparator per incarnation, and a reconciliation poll against the remote agent's task listing that runs on a slower cadence than the webhook and is treated as authoritative when the two disagree. The webhook is a latency optimization, not a source of truth; the moment a client treats it as the latter without the incarnation guards above, it is one retry away from orphaning a task.

from __future__ import annotations

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


class BindingDesyncError(RuntimeError):
    """Raised when a push-notification event cannot be safely applied to a bound task lifecycle."""


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


_ORDER = {
    LifecycleState.SUBMITTED: 0,
    LifecycleState.WORKING: 1,
    LifecycleState.INPUT_REQUIRED: 2,
    LifecycleState.COMPLETED: 3,
    LifecycleState.FAILED: 3,
    LifecycleState.CANCELED: 3,
}

_TERMINAL = {LifecycleState.COMPLETED, LifecycleState.FAILED, LifecycleState.CANCELED}


@dataclass(frozen=True)
class StatusEvent:
    task_id: str
    context_id: str
    state: LifecycleState
    card_version: str


@dataclass
class BoundTask:
    task_id: str
    context_id: str
    card_version: str
    last_state: LifecycleState = LifecycleState.SUBMITTED
    stale: bool = False
    dropped_events: list[StatusEvent] = field(default_factory=list)


class BindingReducer:
    """Applies A2A v1.0 TaskStatusUpdateEvents under incarnation and monotonicity guards."""

    def __init__(self, bound: BoundTask) -> None:
        self._bound = bound

    def apply(self, event: StatusEvent) -> LifecycleState:
        b = self._bound

        if b.stale:
            raise BindingDesyncError(
                f"binding for task {b.task_id!r} is stale; re-fetch card and re-register webhook"
            )

        if event.card_version != b.card_version:
            b.stale = True
            raise BindingDesyncError(
                f"card version drift for task {b.task_id!r}: "
                f"bound={b.card_version!r} event={event.card_version!r}"
            )

        if event.context_id != b.context_id:
            b.stale = True
            raise BindingDesyncError(
                f"incarnation drift for task {b.task_id!r}: "
                f"bound context={b.context_id!r} event context={event.context_id!r}"
            )

        if b.last_state in _TERMINAL:
            # Same incarnation, terminal already reached: idempotent duplicate.
            if event.state == b.last_state:
                return b.last_state
            b.dropped_events.append(event)
            raise BindingDesyncError(
                f"late event {event.state.value!r} after terminal {b.last_state.value!r} "
                f"for task {b.task_id!r}"
            )

        if _ORDER[event.state] < _ORDER[b.last_state]:
            b.dropped_events.append(event)
            raise BindingDesyncError(
                f"out-of-order regression {b.last_state.value!r} -> {event.state.value!r} "
                f"for task {b.task_id!r}"
            )

        b.last_state = event.state
        return b.last_state