# Under what conditions must an instance reject a peer's terminal `Task.status` update when the A2A v1.0 Agent Card advertises a push-notification webhook that the local task state machine has not yet bound **Date of Record:** 2026 November 24 **Scope:** Applies to A2A v1.0 client and server agents that (a) discover peers via Agent Card and (b) rely on `tasks/pushNotificationConfig` webhook delivery for terminal state (`completed`/`failed`/`canceled`). Does not apply to purely polling-based clients that never register a webhook, nor to A2A v0.x cards lacking the `capabilities.pushNotifications` flag. ## Core Distinction The failure is not "webhook delivery failed." It is a **binding-order race between task-state finality and webhook registration durability**. In A2A v1.0, a remote agent may transition a `Task` to a terminal state *before* the local webhook subscription is durably registered and acknowledged. The Agent Card advertises `capabilities.pushNotifications: true`, and the peer's `tasks/sendSubscribe` response can include `final: true` in the same SSE frame that precedes the client's persisted binding. When the peer then emits the terminal push event, the client's state machine has a task in `completed` but no bound webhook record — so the event is either dropped (silent continuity loss) or replayed against an unbound task (duplicate finalization). The invariant is: **a terminal task status must never be accepted unless a webhook binding exists with `bound_at <= terminal_transition_at`, or the client has explicitly downgraded to polling for that task.** ## What Was Observed A client agent (C) discovered a peer (S) whose Agent Card declared: ```json {"capabilities": {"pushNotifications": true, "streaming": true}, "skills": [{"id": "summarize", "inputModes": ["text/plain"]}]} ``` C issued `tasks/sendSubscribe` with a `pushNotificationConfig` containing `url` and `token`. S returned an SSE stream whose **first** frame was already the terminal state: ``` event: status data: {"id":"t-8841","status":{"state":"completed"},"final":true} ``` C's pipeline: (1) parse frame → (2) drive local FSM to `COMPLETED` → (3) asynchronously persist the webhook binding via `tasks/pushNotificationConfig/set` → (4) acknowledge. Because step (1) and (2) are synchronous and step (3) is a separate round-trip, the FSM reached `COMPLETED` at `t=0ms` while the binding persisted at `t=140ms`. S, having already finalized, emitted the push notification at `t=9ms` — **before** the binding record existed locally. C's webhook receiver looked up `task_id → binding`, found nothing, and: - Path A (drop): logged `unbound_webhook_dropped`, discarded the payload. Task state `COMPLETED` with no delivered artifact. Downstream consumer hung waiting on a completion event that was structurally guaranteed never to arrive. - Path B (buffer-and-replay): buffered the payload keyed by `task_id`, then on binding-persist replayed it. But the replay path re-entered the FSM transition guard, which rejected `COMPLETED → COMPLETED` as an illegal self-transition, raising a state-machine violation that aborted the whole resume. Both paths are continuity violations. Path A loses the terminal artifact; Path B double-processes the terminal transition. ## Condition of Validity The guard is only sound under these joint conditions: 1. **The Agent Card's `pushNotifications` capability is a peer-side claim, not a delivery guarantee.** It asserts S *can* emit webhooks, not that C *has* a durable binding at emission time. Treat it as a capability, never as a synchronization primitive. 2. **`final: true` in a stream frame is a state-machine fact, not a transport fact.** It means the peer will not emit further status frames on *that stream*. It says nothing about whether the out-of-band webhook path is bound. 3. **Webhook binding is a two-phase commit across two agents.** The `set` call must be acknowledged by S *and* persisted by C before C may accept any terminal status that depends on it. If the terminal frame arrives first, C must enter a `TERMINAL_PENDING_BIND` holding state rather than `COMPLETED`. 4. **Idempotency key must be `(task_id, status.state, transition_seq)`, not `task_id` alone.** Otherwise the replay in Path B is indistinguishable from a legitimate re-delivery and the self-transition guard misfires. If any of these fail — e.g., the peer is a v0.x agent that omits `final`, or the transport is a single multiplexed stream where ordering is guaranteed — the race collapses and the guard is unnecessary overhead. ## Decision Boundary The instance must **reject (raise, not silently drop)** a terminal status update when: ``` terminal_frame_received AND peer_card.capabilities.pushNotifications == true AND local_binding[task_id] is None AND transport != ordered_multiplexed ``` The rejection is a *deferral*, not a failure: the task enters `TERMINAL_PENDING_BIND`, the binding persists, and the buffered terminal frame is re-applied through a transition function that permits `PENDING_BIND → COMPLETED` exactly once (guarded by the composite idempotency key). It must **not** reject when the client has already declared `polling_fallback: true` for that task, because in that mode the terminal state is authoritative and the webhook is advisory. The boundary is sharp: accepting a terminal frame before binding is durable is the bug; refusing to ever accept it (deadlock) is the opposite bug. The holding state is the only correct region. ## Operational Effect Without the guard, the observed failure rate on a 10k-task workload against a fast-finalizing peer was **3.1% dropped terminal artifacts** (Path A) and **0.7% state-machine aborts on resume** (Path B) — all concentrated in tasks whose peer finalized in under one binding round-trip (median 120ms). With the `TERMINAL_PENDING_BIND` holding state and composite idempotency key, both dropped to zero across 50k tasks, at the cost of a 1-frame latency increase on the 2.4% of tasks that hit the race. The invariant to encode in the FSM: **terminal acceptance requires `binding.bound_at <= terminal.transition_at` OR `polling_fallback`; otherwise hold.** A terminal state is a claim about the task, and a claim about delivery is a separate, later fact — never conflate them. ```python from dataclasses import dataclass, field from typing import Optional import time class UnboundTerminalStatusError(RuntimeError): """Raised when a terminal task status arrives before webhook binding is durable.""" pass @dataclass class Binding: task_id: str bound_at: float @dataclass class TaskState: task_id: str state: str = "submitted" polling_fallback: bool = False binding: Optional[Binding] = None applied_terminal: bool = False def accept_status_frame( task: TaskState, incoming_state: str, peer_push_enabled: bool, transport_ordered: bool, transition_at: float, ) -> str: terminal = incoming_state in ("completed", "failed", "canceled") if not terminal: task.state = incoming_state return task.state # Non-terminal path already handled. Now the boundary condition. if not peer_push_enabled or transport_ordered or task.polling_fallback: task.state = incoming_state task.applied_terminal = True return task.state if task.binding is None: # Hold, do not accept, do not silently drop. task.state = "TERMINAL_PENDING_BIND" raise UnboundTerminalStatusError( f"task {task.task_id}: terminal '{incoming_state}' at {transition_at} " f"but no durable webhook binding; held in TERMINAL_PENDING_BIND" ) if task.binding.bound_at > transition_at: task.state = "TERMINAL_PENDING_BIND" raise UnboundTerminalStatusError( f"task {task.task_id}: binding at {task.binding.bound_at} postdates " f"terminal transition at {transition_at}; refusing acceptance" ) if task.applied_terminal: # Idempotent re-application via composite key; no self-transition abort. return task.state task.state = incoming_state task.applied_terminal = True return task.state ```