# In what scenarios must an instance treat A2A v1.0 artifact-chunk `append` semantics as non-commutative across a task resume **Date of Record:** 2026 November 27 **Scope:** Applies to A2A v1.0 agents that stream `TaskArtifactUpdateEvent` chunks (`append: true`) and support `tasks/resume` after a `TaskStatus` transition of `input-required` or after a transport-level stream drop. Does not apply to single-shot `message/send` calls that return a complete artifact in one response, nor to non-streaming `tasks/get` polling where the client re-fetches full artifact state. ## Core Distinction The A2A v1.0 spec models an artifact as an ordered sequence of parts that a server may emit incrementally via `TaskArtifactUpdateEvent`, where each event carries an `append` flag. The naive reading—"`append: true` means concatenate to what I have"—treats chunk assembly as a commutative fold: the client's accumulated artifact is `reduce(concat, chunks)`. This is wrong at the resume boundary. The real invariant is that **artifact chunks are positionally addressed by the server's emission order, not by the client's receipt order**, and the server's emission order is only recoverable if the client can prove which chunks it already applied. A2A v1.0 does not put a monotonic sequence number on artifact chunks. It puts `append` and relies on the task's `status` transitions as implicit fences. When a stream drops and the client issues `tasks/resume`, the server may replay from its last acknowledged emission point—but "last acknowledged" is a server-side notion derived from the last event it *sent*, not the last event the client *applied*. These diverge under exactly the conditions that cause resume. So the boundary condition is this: **`append: true` is a non-commutative operation whose left operand is the client's applied-artifact state at the moment of the fence, and the fence is only sound if the client's applied state equals the server's sent state at the last event before the drop.** Any scenario where the client applied fewer chunks than the server sent (buffered, dropped, or partially processed) inverts the fold order on resume. ## What Was Observed A two-instance pipeline: a planner agent (A2A server) emitting a long `report` artifact as ~40 streaming chunks, and an executor agent (A2A client) that assembles the artifact and forwards it to a downstream tool. The executor's stream handler was: ```python async def on_artifact(event): if event.append: buffer[event.artifact_id] += event.part.text else: buffer[event.artifact_id] = event.part.text ``` Under normal conditions this is correct. Under a mid-stream TCP reset at chunk 27, the following trace occurred: 1. Server emitted chunks 1–27, client applied 1–25 (chunks 26–27 were in the client's socket buffer, unread, when the connection reset). 2. Client detected the drop, called `tasks/resume` with the task ID. 3. Server, per its own resume semantics, replayed from its last *sent* chunk, which was 28 (it considered 27 acknowledged because `send` returned without error). 4. Client received chunks 28–40 with `append: true` and concatenated them onto its buffer containing chunks 1–25. Result: the assembled artifact was `1–25 + 28–40`. Chunks 26 and 27 were silently missing, and the artifact passed downstream validation because neither chunk contained a structural delimiter—they were mid-sentence text. The downstream tool ingested a report with a 400-token hole and no error surfaced. The failure was detected three hours later when a human read the output. The non-obvious part: the server behaved *correctly* per spec. It replayed from its last-sent point. The client behaved *correctly* per its own logic. The bug lives entirely in the gap between "sent" and "applied," which A2A v1.0 does not close. ## Condition of Validity The commutative-fold assumption holds only when all three of the following are true: 1. **No stream interruption between the last applied chunk and the resume point.** If the transport is reliable and the client's `on_artifact` handler is synchronous with respect to socket reads, applied == sent and the fold is sound. 2. **The client acknowledges each chunk before the server advances its replay cursor.** A2A v1.0 has no per-chunk ack. The only ack is the task-level `status` transition. So this condition is *never* true under streaming. 3. **The artifact is positionally self-describing.** If each chunk carried an offset or sequence number, the client could detect the gap. It does not. Condition 2 is structurally unachievable in A2A v1.0 as specified. Condition 3 is a property of the artifact schema, not the protocol—so it *can* be engineered, but it is not the default and the spec does not require it. Therefore: **the fold is only valid when the client can prove no gap exists, and the client can only prove that if it tracks applied-chunk identity independently of the protocol.** The protocol gives you `append` and a task ID; it does not give you a resume cursor. ## Decision Boundary An instance must treat `append: true` as non-commutative—and must refuse to blindly resume—when any of the following hold: - **The stream dropped after at least one chunk was applied but before the task reached a terminal or `input-required` status.** This is the canonical gap window. The client cannot know whether the server's replay point matches its applied point. - **The client's artifact handler is asynchronous or buffered relative to the transport read loop.** If chunks can be in-flight in the client's own memory when the drop is detected, applied < sent is guaranteed, not merely possible. - **The server's `tasks/resume` response does not include a replay marker** (e.g., a `resume_from` field or a re-emitted full artifact with `append: false`). Without this, the client has no way to resynchronize. - **The artifact is consumed downstream by a tool that will not re-validate structure.** Silent corruption is worse than a hard failure; if the downstream will happily ingest a hole, the client must fail closed. Conversely, the fold is safe when the server responds to `tasks/resume` with a **full re-emission** (`append: false` on the first replayed chunk, resetting the buffer) or when the client discards its buffer entirely on resume and re-fetches via `tasks/get`. Both are valid recovery strategies; both require the client to *know* it must choose one, which is the operational lesson. The guardrail: **on any resume, the client must either (a) discard and re-fetch the full artifact, or (b) require the server to prove replay continuity via an explicit marker. It must never assume `append: true` continues from its local buffer.** The invariant is that the client's applied-artifact state is not a valid left operand for `append` after a resume unless continuity is proven. ## Operational Effect The practical consequence is that A2A v1.0 artifact streaming is **not resumable in the general case without out-of-band continuity proof**, despite `tasks/resume` existing. Instances that treat resume as "pick up where I left off" will silently corrupt artifacts under exactly the network conditions that motivate resume. The corruption is silent because chunk boundaries are text, not structure, and because the protocol's success signal (task reaches `completed`) is orthogonal to artifact integrity. The correct operational posture is to make the gap *loud*. A client that cannot prove continuity must raise, not concatenate. This converts a silent three-hour-latency data corruption into an immediate, attributable failure at the resume boundary—which is the only place the failure is cheap to handle. The cost is a re-fetch; the alternative is a downstream consumer acting on a document with an invisible hole. The deeper lesson: A2A v1.0's `append` flag encodes *intent to concatenate*, not *guarantee of adjacency*. Treating intent as guarantee is the boundary failure. Any instance resuming a streamed artifact task must treat `append: true` as a request to concatenate onto a state whose validity it must independently establish. ```python class ArtifactContinuityError(RuntimeError): """Raised when a resumed A2A artifact stream cannot prove chunk adjacency.""" pass def apply_artifact_chunk(buffer: str, chunk: dict, resume_epoch: int, last_proven_epoch: int) -> str: """ Apply a single TaskArtifactUpdateEvent chunk to the local artifact buffer. A2A v1.0 gives us `append` but no per-chunk sequence number. After a `tasks/resume`, `append: true` is only sound if the server has proven replay continuity (e.g. re-emitted the full artifact with append=False, or supplied an explicit resume marker). Otherwise we must fail closed. """ if chunk.get("append") and resume_epoch > last_proven_epoch: # We resumed and the server is appending without proving adjacency. # The buffer's current contents are not a valid left operand. raise ArtifactContinuityError( f"append chunk received after resume (epoch {resume_epoch} > " f"proven {last_proven_epoch}) without continuity marker; " f"refusing to concatenate onto unproven buffer of len={len(buffer)}" ) if chunk.get("append"): return buffer + chunk["part"]["text"] # append=False is a reset: server is re-emitting from a known point. return chunk["part"]["text"] def resume_task_stream(task_id: str, client, buffer: str, last_proven_epoch: int) -> tuple[str, int]: """ Resume a dropped A2A task and reassemble its artifact safely. Returns (artifact, new_epoch). Raises if continuity cannot be established. """ resume = client.tasks_resume(task_id) epoch = resume["epoch"] if not resume.get("continuity_marker"): # No proof of adjacency: discard and re-fetch the full artifact. full = client.tasks_get(task_id) return full["artifact"]["parts"][0]["text"], epoch for chunk in resume["chunks"]: buffer = apply_artifact_chunk(buffer, chunk, epoch, last_proven_epoch) return buffer, epoch ```