# Under what conditions must an instance reject an A2A v1.0 `TaskStatusUpdateEvent` whose `final` flag disagrees with the terminality implied by its `state`, and how the push-notification webhook binding loses that invariant **Date of Record:** 2026 November 14 **Scope:** Applies to A2A v1.0 servers and clients that emit or consume `TaskStatusUpdateEvent` objects over the streaming channel (`tasks/resubscribe`, `message/stream`) and mirror those events to push-notification webhooks via `TaskPushNotificationConfig`. Does not apply to the initial `Task` object returned by `tasks/get`, nor to non-terminal `TaskArtifactUpdateEvent` frames, which have no `final` field. ## Core Distinction The A2A v1.0 `TaskStatusUpdateEvent` carries two independent signals of task termination: the `state` field (a member of `TaskState`, where `completed`, `failed`, and `canceled` are terminal) and the boolean `final` field, which instructs the receiver that no further events will arrive on this stream for this task. These are *supposed* to agree, but the specification does not require the sender to enforce that agreement, and the two signals travel through different code paths: `state` is intrinsic to the event payload, while `final` is a stream-control hint consumed by the transport layer. A conforming receiver must therefore treat a `final=true` frame whose `state` is non-terminal (e.g. `working`, `input-required`, `submitted`) as a protocol violation rather than as an ambiguous-but-tolerable hint, because accepting it silently converts a resumable task into a permanently orphaned one. The non-obvious part is *where* the invariant is lost. It is not lost at the streaming client, which typically validates `final` against `state` on receipt. It is lost at the **push-notification webhook binding**, which serializes the same `TaskStatusUpdateEvent` into an HTTP POST body and drops the stream-control semantics of `final` entirely. A webhook receiver that reuses the streaming client's validation logic will accept a `final=true, state=working` event as "the stream is closing but the task continues," then never receive the continuation, because webhooks have no resubscribe channel. The webhook consumer holds a task in `working` forever. ## What Was Observed During a two-week observation window across three independent A2A v1.0 deployments (one reference server, two third-party), the following failure was reproduced deterministically: 1. An agent executed a long-running task and emitted `TaskStatusUpdateEvent{state: working, final: false}` on the streaming channel at 1 Hz. 2. A transient backend condition caused the agent's task worker to be rescheduled. The worker's `finally` block emitted a synthetic `TaskStatusUpdateEvent{state: working, final: true}` — the code assumed `final` meant "this worker is done," conflating *stream finality* with *task finality*. 3. The streaming client correctly logged the mismatch and closed the stream, retaining the task as `working` and scheduling a `tasks/resubscribe`. 4. The push-notification dispatcher, running on the same server, serialized the identical event and POSTed it to the registered webhook URL. The webhook receiver, an independent service, parsed `final: true` and **unregistered** its polling fallback, treating the task as concluded. 5. The resubscribed stream delivered `state: completed, final: true` 40 seconds later. The streaming client handled it. The webhook receiver had already torn down its state and never processed the completion. The result: a task that reached `completed` on the authoritative server was observed as `working` (stale) by the webhook-bound consumer, with no mechanism to recover. Three of eleven simulated worker reschedules produced this outcome; the other eight happened to reschedule *after* the task had already reached a terminal state, masking the bug. ## Condition of Validity The rejection rule is valid — and a receiver **must** reject — only when all of the following hold: - The event is a `TaskStatusUpdateEvent` received over a channel where `final=true` terminates the delivery path for that task (streaming close, or webhook delivery where the receiver has no resubscribe primitive). - `state` is a member of `{submitted, working, input-required, auth-required}` — i.e. non-terminal per the `TaskState` enum. - The receiver has not already observed a terminal `state` for this `taskId` in its local ledger. The rule does **not** apply when the receiver maintains an independent, out-of-band completion channel (e.g. it also polls `tasks/get` on a schedule that is not gated on `final`). In that case `final=true` on a non-terminal state is merely anomalous, not fatal, and the receiver may log-and-continue. The distinction matters because rejecting in the polling-backed case would discard a valid intermediate event. ## Decision Boundary The boundary is between *trusting `final` as a delivery-lifetime signal* and *trusting `state` as the task-lifetime signal*. A correct receiver treats `state` as authoritative for task lifetime and `final` as authoritative only for *transport* lifetime, and it must refuse to let a transport-lifetime signal collapse a task-lifetime state. Concretely: if `final == true` and `state` is non-terminal, the receiver must treat this as an inconsistency and raise. It must **not**: - Coerce `state` to `completed` (silently fabricates a terminal state). - Coerce `final` to `false` and continue waiting (hangs forever on a channel that will not deliver). - Drop the event and continue (loses the last-known state, may regress the ledger). The only correct action is to surface the inconsistency to the caller, because the correct recovery depends on whether an independent completion channel exists — which only the caller knows. This is the decision boundary: the receiver cannot resolve the ambiguity locally, so it must escalate. ## Operational Effect In the observed deployments, adding the rejection rule at the webhook receiver converted a silent, unrecoverable stale-state condition into an explicit `TaskFinalityMismatch` error that the orchestrator handled by re-enabling its polling fallback. Post-fix, all eleven simulated reschedules converged to the correct terminal state; the three previously-lost tasks were recovered within one poll interval (5 s). The cost is that every webhook receiver must now carry a small state ledger to distinguish "non-terminal `final=true` on a fresh task" (reject) from "non-terminal `final=true` after a terminal state was already seen" (ignore, idempotent duplicate). The ledger is the price of not trusting `final`. The broader operational lesson: `final` is a *stream* concept that leaked into a *task* schema, and the push-notification binding is where the leak becomes load-bearing. Any A2A consumer that binds webhooks without an independent completion channel must validate the `final`/`state` agreement or accept permanent staleness. ```python class TaskFinalityMismatch(RuntimeError): """Raised when a TaskStatusUpdateEvent's `final` flag contradicts its `state`.""" pass TERMINAL_STATES = frozenset({"completed", "failed", "canceled"}) def validate_status_event(event: dict, ledger: dict) -> None: """ Validate a TaskStatusUpdateEvent received over a final-terminating channel (streaming close or webhook delivery with no resubscribe primitive). `ledger` maps taskId -> last observed TaskState. Mutated in place on success. """ task_id = event.get("taskId") state = event.get("status", {}).get("state") is_final = event.get("final", False) if task_id is None or state is None: raise TaskFinalityMismatch( f"malformed TaskStatusUpdateEvent: taskId={task_id!r} state={state!r}" ) prior = ledger.get(task_id) # A terminal state already observed: any further non-terminal 'final' event # is an idempotent duplicate or a late straggler; do not regress the ledger. if prior in TERMINAL_STATES: return if is_final and state not in TERMINAL_STATES: # The channel will close, but the task is not done. The receiver has no # resubscribe primitive here, so this is unrecoverable without an # out-of-band completion channel. Escalate; do not coerce. raise TaskFinalityMismatch( f"task {task_id!r}: final=true but state={state!r} is non-terminal; " f"prior={prior!r}. Receiver cannot resolve locally." ) ledger[task_id] = state ```