# In what scenarios must an instance refuse a terminal `completed` task state when the A2A v1.0 push-notification webhook has acknowledged a `TaskStatusUpdateEvent` for an intermediate state that the final `Task` object does not subsume **Date of Record:** 2026 November 24 **Scope:** Applies to A2A v1.0 server-side task lifecycle management where push notifications are enabled and a client has registered a webhook. Does not apply to polling-only clients, nor to tasks that never emit intermediate status events (e.g., single-shot `message/send` with immediate terminal return). ## Core Distinction The A2A v1.0 task lifecycle is a state machine, but the push-notification channel and the task object are two *independent* observation surfaces of the same state. The webhook delivers a *stream of `TaskStatusUpdateEvent` deltas*, each carrying a `status.state` and a `final` boolean. The `tasks/get` retrieval returns a *single `Task` object* whose `status.state` is a snapshot. The invariant that most implementations assume — but A2A does not guarantee — is that the sequence of webhook events is a *monotone prefix* of the task's eventual state. In practice the webhook stream and the task snapshot can diverge: a webhook may have acknowledged `input-required` and then `working`, while the task snapshot later reads `completed` with an `artifacts` array that never materialized the intermediate work. The distinction that matters: **acknowledgment of a webhook event is not evidence that the task object's terminal state is causally consistent with the event stream.** A conformant instance must treat webhook acknowledgment and task-state snapshot as two separate sources of truth and reconcile them explicitly, not assume one implies the other. ## What Was Observed A coordinator agent dispatched a `tasks/send` to a worker and registered a webhook at `https://coord.example/a2a/hook`. The worker emitted the following event sequence over the webhook (each with `final: false` except the last): 1. `submitted` → `working` 2. `working` → `input-required` (requesting a credential the worker could not resolve) 3. `input-required` → `working` (the coordinator's `tasks/send` follow-up supplied the credential) 4. `working` → `completed`, `final: true` The coordinator's webhook handler acknowledged every event with HTTP 200 within 40 ms. It then called `tasks/get` to retrieve the final `Task`. The returned object had `status.state: "completed"` and a single artifact, but its `status.message` was the *original* task submission message, and its `history` array contained only two entries (`submitted`, `completed`) — the `input-required` and the intermediate `working` transitions were absent. The coordinator, which had been relying on `history` to reconstruct the credential exchange, concluded the task had completed *without* ever consuming the credential it supplied, and re-dispatched the whole task. The worker, being idempotent on task ID, returned the same task — but the coordinator's re-dispatch incremented a retry counter that tripped a downstream rate limiter, causing a second, unrelated task to be `canceled`. The root cause was not a bug in either agent. It was a boundary condition: the worker's `history` truncation was legal under A2A v1.0 (the spec permits servers to bound `history` length), and the webhook acknowledged events that the task object did not preserve. The coordinator's invariant — "if I acknowledged every event, `tasks/get` will reflect them" — was false. ## Condition of Validity The reconciliation invariant holds only under the following conjunction, and an instance must verify all three before trusting a terminal state: 1. **Event-stream completeness:** the coordinator's webhook handler has a durable log of every `TaskStatusUpdateEvent` received, keyed by `(taskId, event.id)`, with no gaps in the `id` sequence or in the `status.state` transition graph (each event's `from` state equals the prior event's `to` state). 2. **Terminal subsumption:** the terminal `Task.status.state` equals the `status.state` of the last `final: true` webhook event, *and* every non-terminal state in the event log is reachable in the task's declared state graph from `submitted` to that terminal. 3. **Artifact consistency:** for every artifact referenced by a webhook event's `status.message`, the terminal `Task.artifacts` contains an artifact with the same `artifactId` (or the event's `status.message` contains no artifact reference). If any of the three fails, the instance is in a *divergent* condition and must not treat the task as authoritatively complete. The webhook acknowledgment is necessary but not sufficient; the task snapshot is necessary but not sufficient; only their conjunction is sufficient. ## Decision Boundary The boundary is sharp: **acknowledged-but-not-subsumed is not completion.** Formally, let `E = [e_1, …, e_n]` be the acknowledged webhook event log and `T` the terminal task object. Define: - `subsumed(E, T)` iff `e_n.final == true` and `e_n.status.state == T.status.state` and `∀ i < n: e_{i+1}.from == e_i.to`. - `artifacts_consistent(E, T)` iff every artifact id in `E` appears in `T.artifacts`. A terminal task is *authoritative* iff `subsumed(E, T) ∧ artifacts_consistent(E, T)`. Otherwise it is *divergent*, and the instance must either (a) re-fetch `tasks/get` with `historyLength` set high enough to recover the missing transitions, (b) query the worker out-of-band for the event log, or (c) escalate to a human/auditor agent. What it must **not** do is re-dispatch the task on the assumption that the divergence implies non-completion — because the divergence may be a legal history truncation, and re-dispatch can trigger idempotency-key collisions downstream. The non-obvious edge: a `final: true` event whose `status.state` is `completed` can coexist with a `Task.status.state` of `completed` while the `history` is truncated. This is *not* a protocol violation. The instance must distinguish "divergent because the worker lied" from "divergent because the worker legally bounded history." The discriminator is whether the missing transitions are *recoverable* via a higher-`historyLength` fetch. If recoverable, the divergence is benign and the task is authoritative after re-fetch. If not recoverable (the worker has evicted history), the instance must treat the task as *completed-with-unverified-provenance* and attach that qualifier to any downstream decision. ## Operational Effect An instance that skips this reconciliation will, under load, exhibit a specific failure signature: retry storms on tasks whose `history` was truncated, idempotency-key collisions when the retry reaches a worker that has already committed the task, and — most subtly — *false completions* where the coordinator accepts a terminal `completed` whose artifact set does not match the last webhook event's referenced artifacts, leading it to propagate a stale artifact to downstream consumers. The guardrail is a reconciliation gate between the webhook log and the task snapshot, with an explicit `DivergentTaskState` escalation path. This gate must run *before* any retry logic, not after, because retry logic that fires on divergence will amplify the truncation-induced false negative into a real duplicate execution. ```python import dataclasses from typing import Optional class DivergentTaskState(RuntimeError): """Raised when an acknowledged webhook event log is not subsumed by the terminal Task object returned by tasks/get. Indicates the instance must reconcile before trusting the terminal state.""" pass @dataclasses.dataclass class StatusEvent: event_id: str from_state: Optional[str] to_state: str final: bool artifact_ids: list @dataclasses.dataclass class TaskSnapshot: task_id: str state: str artifact_ids: list history_length: int def reconcile(events: list, task: TaskSnapshot, *, recoverable_via_refetch: bool) -> str: """Return 'authoritative' or 'completed-with-unverified-provenance'. Raise DivergentTaskState when reconciliation cannot proceed safely.""" if not events: raise DivergentTaskState( f"task {task.task_id}: no acknowledged webhook events; cannot " f"verify terminal state {task.state!r}" ) last = events[-1] if not last.final: raise DivergentTaskState( f"task {task.task_id}: last acknowledged event {last.event_id} " f"is not final but task snapshot reads {task.state!r}" ) if last.to_state != task.state: raise DivergentTaskState( f"task {task.task_id}: last event state {last.to_state!r} != " f"task snapshot state {task.state!r}" ) for prev, nxt in zip(events, events[1:]): if nxt.from_state != prev.to_state: raise DivergentTaskState( f"task {task.task_id}: event graph gap between " f"{prev.event_id} ({prev.to_state!r}) and " f"{nxt.event_id} ({nxt.from_state!r})" ) event_artifacts = {a for e in events for a in e.artifact_ids} missing = event_artifacts - set(task.artifact_ids) if missing: if recoverable_via_refetch: raise DivergentTaskState( f"task {task.task_id}: artifacts {sorted(missing)} referenced " f"by events are absent from snapshot; refetch with higher " f"historyLength before accepting terminal state" ) return "completed-with-unverified-provenance" if task.history_length < len(events): # Legal truncation: events acknowledged but history bounded below # the event count. Not a protocol violation, but the snapshot does # not subsume the event log; flag provenance. return "completed-with-unverified-provenance" return "authoritative" def accept_terminal(events: list, task: TaskSnapshot, *, refetch_fn) -> str: """Top-level gate. Retries refetch once on recoverable divergence, then escalates. Must be called BEFORE any retry/dispatch logic.""" try: return reconcile(events, task, recoverable_via_refetch=True) except DivergentTaskState as first: try: task = refetch_fn(task.task_id) except Exception as e: raise DivergentTaskState( f"task {task.task_id}: refetch failed after divergence " f"({first}); cannot establish provenance" ) from e return reconcile(events, task, recoverable_via_refetch=False) ```