# What happens when an instance streams A2A artifacts over a webhook whose receiver acknowledges before durably persisting **Date of Record:** 2026 November 28 **Scope:** Applies to A2A v1.0 task lifecycles where a server agent emits multi-turn `TaskArtifactUpdateEvent` / `TaskStatusUpdateEvent` streams to a client-supplied push-notification webhook, and the receiver returns HTTP 2xx before the event is committed to durable storage. Does not apply to synchronous SSE/streaming transports where the client holds the connection open and can apply backpressure, nor to single-shot `tasks/send` calls with no push channel. ## Core Distinction The A2A push-notification contract is an *at-least-once delivery* channel with an *acknowledgement* signal (HTTP 2xx) that the protocol treats as "delivered." It is not a durability contract. The gap between "webhook returned 200" and "artifact is recoverable by the client after a crash" is the entire failure surface. A server agent that advances its task state machine on 2xx acknowledgement—rather than on a client-side `tasks/get` reconciliation or an explicit `artifact.ack` round-trip—will lose artifacts precisely when the receiver is fastest to say yes and slowest to persist. The distinction that matters operationally is **transport acknowledgement vs. state commitment**: the webhook 2xx is a transport fact, and the A2A spec's `TaskArtifactUpdateEvent.append`/`lastChunk` flags are state facts. Conflating them is the bug. ## What Was Observed A planner agent (server) decomposed a document-synthesis task into 7 turns, each emitting a `TaskArtifactUpdateEvent` with `append: true` and `lastChunk: false`, followed by a terminal `TaskStatusUpdateEvent` with `state: "completed"`. The client registered a push webhook at `https://client.example/a2a/push`. The receiver was a stateless HTTP handler behind a load balancer that: 1. Validated the `X-A2A-Notification-Token`. 2. Enqueued the event payload onto an in-memory channel. 3. Returned `200 OK` immediately. A worker drained the channel and wrote to Postgres. Under normal load the p99 from 200-response to durable write was ~40 ms. During a rolling deploy, the receiver's worker pool was drained while the HTTP handler stayed up (graceful shutdown ordered the listener's `SIGTERM` after the worker's). The handler kept returning 200 for 2.3 seconds while zero workers were consuming. The server agent, treating 200 as commitment, advanced `Task.status` to `completed` and dropped its in-memory artifact buffer after the 7th chunk's 200. The terminal `TaskStatusUpdateEvent` was also 200'd and lost. On restart the client called `tasks/get` and received a task in state `completed` with `artifacts: []`—the chunks 1–6 that *did* persist were orphaned because the task-level `artifacts` array is only assembled on the final chunk's `lastChunk: true` write, which never landed. The non-obvious part: **the loss was silent and the state machine was internally consistent.** The server had 7/7 acknowledgements. The client had a `completed` task. No error was raised anywhere. The only observable was a downstream consumer reporting "empty synthesis output" three hours later. ## Condition of Validity The invariant "a 2xx webhook response implies the artifact is recoverable" holds **only if** the receiver's 200 is emitted after a durable write (or after a write to a store with the same durability guarantees as the client's recovery path). It is violated whenever: - The receiver acknowledges before persistence (enqueue-then-200, as above). - The receiver persists to a store that is not the store `tasks/get` reads from (split-brain between push-sink and task-store). - The receiver's 200 is generated by an intermediary (LB health-check passthrough, API gateway that buffers and retries) rather than the application. - The server agent compacts its in-memory artifact buffer on 2xx rather than on a reconciliation read. The invariant also depends on the `append`/`lastChunk` semantics being honored: a receiver that persists chunks 1–6 but crashes before the `lastChunk: true` chunk has a *partial* artifact that is indistinguishable from a complete one unless the server re-sends or the client reconciles. A2A v1.0 does not mandate server-side replay of unacknowledged chunks after a receiver restart, so the recovery burden falls on the client's `tasks/get` + artifact-reassembly logic—which most clients do not implement because the protocol's happy path never exercises it. ## Decision Boundary The boundary is: **does the server agent's state transition depend on transport acknowledgement or on state commitment?** - If the server advances `Task.status` and releases artifact buffers on webhook 2xx → the system is exposed to the ack-before-persist loss window, whose width equals the receiver's enqueue-to-durable-write latency plus any graceful-shutdown ordering gap. Bound it by making the server retain chunks until a client-initiated `tasks/get` confirms artifact presence, or until an explicit application-level ack (a separate `POST /a2a/ack` with the artifact digest) arrives. - If the server retains chunks and re-serves them on `tasks/get` until a digest-confirmed ack → the loss window collapses to "client never reconciles," which is detectable and recoverable. The decision also governs the receiver: a receiver that cannot guarantee post-persist 200 MUST NOT be registered as a push target for a task whose artifacts are non-reconstructible. There is no protocol-level way for the server to know which kind of receiver it has; the `X-A2A-Notification-Token` authenticates but does not attest durability. This is the gap: **A2A authenticates the channel but does not attest the sink.** ## Operational Effect Concretely, the failure produces three artifacts of state that must be reconciled by hand or by a recovery job: 1. **Orphaned partial artifacts:** chunks 1–6 persisted with `lastChunk: false` and no terminal chunk. Reassembly requires the client to treat an `append`-chain with no `lastChunk: true` as *incomplete*, not as *complete-but-empty*. 2. **A `completed` task with an empty `artifacts` array:** the task-store and the push-sink disagree. Any consumer reading `tasks/get` sees success; any consumer reading the push-sink sees a truncated artifact. The two views must be joined on `taskId` + `artifactIndex`. 3. **A silent 2.3-second ack window** that is invisible in server-side metrics (all 200s) and invisible in receiver-side metrics (handler healthy, worker drained). Only a synthetic probe that writes-then-reads through the full receiver path would have caught it. The guardrail that bounds this is a **commitment barrier**: the server agent must not release its artifact buffer, and must not transition `Task.status` to `completed`, until it has observed a state-commitment signal distinct from the webhook 2xx. The cheapest such signal is a client-initiated `tasks/get` whose returned artifact digest matches the server's outbound digest. The next-cheapest is an explicit application-level ack endpoint. The 2xx alone is never sufficient. Additionally, the receiver must order shutdown so that the HTTP listener stops accepting before the worker pool drains, and must return `503` (not `200`) during the drain window—A2A clients that respect `Retry-After` will re-deliver, and the server's retention buffer will absorb the re-delivery. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class ArtifactCommitmentError(RuntimeError): """Raised when a task is advanced on transport ack without state commitment.""" pass @dataclass class ArtifactChunk: index: int payload: bytes last_chunk: bool def digest(self) -> str: return hashlib.sha256(self.payload).hexdigest() @dataclass class TaskState: task_id: str chunks: dict = field(default_factory=dict) committed: bool = False class PushAckTracker: """ Tracks webhook 2xx acknowledgements separately from state commitment. A 2xx is NOT sufficient to release the artifact buffer or to transition Task.status to 'completed'. Only a client-side reconciliation read (tasks/get returning matching digests) or an explicit ack may do so. """ def __init__(self, task: TaskState, expected_chunks: int): self.task = task self.expected_chunks = expected_chunks self.transport_acks: set = set() self.state_acks: set = set() def on_webhook_2xx(self, chunk: ArtifactChunk) -> None: # Transport fact only. Do NOT advance state here. self.transport_acks.add(chunk.index) def on_reconciliation_read(self, chunk_index: int, observed_digest: str) -> None: chunk = self.task.chunks.get(chunk_index) if chunk is None: raise ArtifactCommitmentError( f"reconciliation referenced unknown chunk {chunk_index} " f"for task {self.task.task_id}" ) if observed_digest != chunk.digest(): raise ArtifactCommitmentError( f"digest mismatch on chunk {chunk_index} for task " f"{self.task.task_id}: server={chunk.digest()} " f"client={observed_digest}" ) self.state_acks.add(chunk_index) def try_complete(self) -> None: """ Transition to completed ONLY if every chunk is state-acked and the terminal last_chunk is among them. Transport acks alone are refused. """ if len(self.transport_acks) < self.expected_chunks: raise ArtifactCommitmentError( f"task {self.task.task_id}: only " f"{len(self.transport_acks)}/{self.expected_chunks} " f"transport acks; cannot complete" ) if len(self.state_acks) < self.expected_chunks: missing = set(range(self.expected_chunks)) - self.state_acks raise ArtifactCommitmentError( f"task {self.task.task_id}: transport-acked but not " f"state-committed for chunks {sorted(missing)}; " f"webhook 2xx is not durability" ) terminal = self.task.chunks.get(self.expected_chunks - 1) if terminal is None or not terminal.last_chunk: raise ArtifactCommitmentError( f"task {self.task.task_id}: terminal chunk missing or " f"lastChunk flag unset; artifact is partial" ) self.task.committed = True self.task.chunks.clear() # safe to release buffer only now ```