Where must an instance pin the task-state revision across an A2A push-notification rebind, or the resumed task silently forks

**Date of Record:** 2026 December 2 **Scope:** Applies to A2A v1.0 task lifecycles where a remote agent delivers state transitions via push-notification webhooks and the *client* (task owner) may re-register, migrate, or re-bind its webhook endpoint mid-task. Does not apply to purely synchronous `message/send` polling, nor to stateless `message/stream` where the client holds the SSE connection open for the task's lifetime.

Core Distinction

The failure is not "lost notification" and not "webhook 500." It is a **state-revision fork**: the client's reconstructed view of the task diverges from the server's authoritative `Task.status`, and because A2A task state is a *monotonic revision sequence* rather than a snapshot, both sides can remain internally consistent while disagreeing. The server keeps advancing `state` and `status.timestamp`; the client, having rebound its webhook, resumes from a stale local checkpoint and treats an *older* revision as current. Every subsequent transition the client applies is relative to the wrong base.

The non-obvious invariant: **the webhook binding is part of the task's identity, not a side channel.** A2A lets a client supply `pushNotificationConfig` (with an opaque `id`, `url`, and optional `token`) per task. When the binding changes, the server's delivery contract changes, but the task's `status` does not reset. The client must therefore treat rebind as a *revision-crossing event* and reconcile against the server's current `Task` before trusting any post-rebind notification. Instances that treat rebind as "just update the URL" fork the task.

What Was Observed

A planning agent (client) delegated a multi-step research task to a worker agent (server) via `message/send`, receiving `Task{ id: T, status: { state: "working", timestamp: t0 } }` and installing a push config `P1 = { id: "cfg-1", url: "https://client-a/hook", token: "k1" }`. The worker emitted a sequence of `TaskStatusUpdateEvent`s to `client-a/hook`: `working(t1)`, `working(t2)` with an appended artifact part, `input-required(t3)`.

The client's process was rescheduled onto a different node (autoscaler eviction). On cold start it replayed its last persisted checkpoint — captured at `t2` — and issued `tasks/pushNotificationConfig/set` with a *new* `id: "cfg-2"`, new `url: "https://client-b/hook"`, and a fresh `token: "k2"`, because the old endpoint no longer existed. It did **not** issue `tasks/get` first.

Trace from that point:

  1. Server accepts `cfg-2`, continues delivering to `client-b/hook`. Its authoritative state is `input-required` at `t3`; the client's local model believes `working` at `t2`.
  2. Client, believing the task is still `working`, waits for further progress events. The server is *blocked* waiting for the client to answer the `input-required`. Neither side emits anything. Deadlock — but a "clean" one: no error, no timeout on the server (A2A `input-required` has no default deadline), and the client's own idle timer is keyed to `working`, which it thinks is progressing.
  3. A late duplicate of the `t2` event (server-side at-least-once retry, delivered to the *old* `cfg-1` binding which the client's dead-letter queue still drained) arrives at `client-b`'s replay buffer and is applied. The client's revision counter *advances* on a stale event, entrenching the wrong base.
  4. When an operator finally nudges the client to `tasks/get`, the returned `Task{ state: "input-required", timestamp: t3 }` is older than the client's locally-applied `t2+duplicate` sequence number, so the client's monotonic-revision guard *rejects the authoritative snapshot as stale*. The fork is now self-sealing.

The failure is not in any single call. It is the composition of (a) rebind without reconciliation, (b) `input-required` having no server-side deadline, and (c) a client-side monotonic guard that compares *delivery sequence* rather than *server `status.timestamp`*.

Condition of Validity

The fork requires all of the following to hold simultaneously; removing any one bounds it:

It does **not** apply when the client keeps the same `pushNotificationConfig.id` across rebind (server can correlate and resend from the last acknowledged event), nor when the task never enters a client-blocking state.

Decision Boundary

The boundary is: **does the client adopt the server's `status.timestamp` as the revision base on every rebind, or does it carry its local sequence forward?**

The corollary decision rule for the guard: **a `tasks/get` response is authoritative regardless of its apparent staleness relative to locally-applied events, because the server's `status.timestamp` is the only total order.** Delivery sequence numbers are per-binding and reset on rebind; they are not comparable across bindings and must never gate acceptance of a `tasks/get` snapshot. An instance that uses delivery sequence as a monotonic guard has silently promoted a transport artifact to a consistency token.

A second, narrower boundary: even with reconciliation, a rebind that *changes the `id`* forfeits server-side correlation. The safe pattern is to keep `pushNotificationConfig.id` stable across endpoint migration (change `url`/`token`, keep `id`), so the server can resume delivery from its last-acknowledged event for that config id rather than treating the client as a brand-new subscriber with no history.

Operational Effect

The forked client is not crashed and not erroring. It is *idle and confident*: it believes the task is progressing and waits, while the server is blocked waiting for it. This is the worst operational profile — no alert fires on either side, because neither side has a violated invariant *locally*. The deadlock is only visible as a task whose `status.timestamp` has not advanced past `t3` while wall-clock time accrues, and whose client has no outstanding `tasks/get` in flight.

The required guardrail is a **rebind reconciliation barrier**: on any `pushNotificationConfig/set` (or equivalent re-registration), the client must (1) issue `tasks/get` and block task-state application until it returns, (2) adopt `status.timestamp` as the new revision base and discard local sequence counters, (3) drain and *tag* the old binding's dead-letter queue so late duplicates are rejected by binding-id, not applied, and (4) arm a client-side deadline on any `input-required`/`auth-required` state it observes post-rebind, since the server will not provide one. An instance that skips step (1) is one autoscaler eviction away from a silent fork.

from dataclasses import dataclass, field
from typing import Optional


class TaskRevisionFork(RuntimeError):
    """Raised when a client would apply task-state relative to a stale revision base
    after a push-notification rebind crossed a client-blocking state."""


@dataclass
class Binding:
    config_id: str
    url: str
    token: str


@dataclass
class LocalTaskView:
    task_id: str
    state: str
    revision_base_ts: float          # server status.timestamp adopted as base
    binding: Binding
    local_seq: int = 0               # per-binding delivery counter; NOT a consistency token
    applied_event_binding_ids: set = field(default_factory=set)


CLIENT_BLOCKING = {"input-required", "auth-required"}


def rebind_push_config(
    view: LocalTaskView,
    new_binding: Binding,
    server_status: Optional[dict],
) -> LocalTaskView:
    """
    Rebind a task's push-notification config safely.

    Invariant enforced: a rebind that changes binding identity must reconcile
    against the authoritative server Task before any post-rebind event is applied.
    """
    binding_changed = new_binding.config_id != view.binding.config_id
    crosses_blocking = view.state in CLIENT_BLOCKING

    if binding_changed and crosses_blocking:
        # The dangerous region: new config id + client-blocking state.
        # Reconciliation is mandatory; without it the task forks.
        if server_status is None:
            raise TaskRevisionFork(
                f"task {view.task_id}: rebind to config {new_binding.config_id!r} "
                f"crosses blocking state {view.state!r} without tasks/get reconciliation; "
                f"refusing to rebind (would fork revision base {view.revision_base_ts})"
            )
        server_ts = float(server_status["timestamp"])
        if server_ts < view.revision_base_ts:
            # Server snapshot appears older than our base. This is the self-sealing
            # trap: do NOT trust local_seq. Server timestamp is the only total order.
            # A lower ts here means our base was corrupted by a stale duplicate.
            raise TaskRevisionFork(
                f"task {view.task_id}: server status.timestamp {server_ts} < "
                f"local base {view.revision_base_ts}; local base was advanced by a "
                f"stale cross-binding duplicate — reset base to server, do not reject"
            )
        # Adopt server as the new authoritative base; drop per-binding counters.
        view.state = server_status["state"]
        view.revision_base_ts = server_ts
        view.local_seq = 0

    # Keep config_id stable across pure endpoint migration so the server can
    # resume from its last-acknowledged event for this config id.
    view.binding = new_binding
    view.applied_event_binding_ids.add(new_binding.config_id)
    return view


def apply_status_event(view: LocalTaskView, event: dict) -> LocalTaskView:
    """Apply a pushed TaskStatusUpdateEvent, rejecting cross-binding stale duplicates."""
    event_binding = event["binding_config_id"]
    if event_binding not in view.applied_event_binding_ids:
        raise TaskRevisionFork(
            f"task {view.task_id}: event from retired binding {event_binding!r} "
            f"arrived after rebind to {view.binding.config_id!r}; "
            f"must be dead-lettered, not applied"
        )
    if float(event["timestamp"]) < view.revision_base_ts:
        raise TaskRevisionFork(
            f"task {view.task_id}: event timestamp {event['timestamp']} precedes "
            f"reconciled base {view.revision_base_ts}; stale replay"
        )
    view.state = event["state"]
    view.revision_base_ts = float(event["timestamp"])
    view.local_seq += 1
    return view