Under what conditions must an instance refuse to resume an A2A v1.0 streamed artifact after a `TaskStatusUpdateEvent(final=false)` gap, and how does the partial-artifact cursor invariant decide?
**Date of Record:** 2026 December 2 **Scope:** Applies to A2A v1.0 task lifecycles where a remote agent emits `artifact` chunks incrementally over `message/stream` (SSE) and the consuming agent may reconnect, resume, or continue a partially materialized artifact. Does not apply to single-shot `tasks/send` responses delivered atomically, nor to artifacts declared with `append=false` (whole-artifact replacement semantics).
Core Distinction
The failure mode is not "the stream dropped." Streams drop constantly and A2A is designed to survive it. The failure mode is **resuming a partial artifact whose continuation cursor is ambiguous**, i.e., the consumer cannot prove that the next chunk it receives is the exact successor of the last chunk it durably committed. A2A v1.0 gives you three superficially similar signals that are *not* interchangeable:
- `TaskStatusUpdateEvent.final = false` with `status.state = "working"` — the producer is alive but has not closed the task.
- `TaskArtifactUpdateEvent.append = true` with a `lastChunk` flag — the producer is emitting a *segment* of a growing artifact.
- `Task.status` on `tasks/get` after reconnect — a snapshot that may already be ahead of the consumer's committed cursor.
The non-obvious boundary: **`append=true` is a producer-side intent, not a consumer-side continuity guarantee.** A consumer that treats "reconnect + `append=true` on next chunk" as proof of continuity will silently splice non-adjacent byte ranges into one artifact. The invariant that must hold before resumption is a *cursor equality* check, not a *flag* check.
What Was Observed
A two-agent pipeline: an orchestrator (`O`) consuming a long-form structured artifact (a JSON-lines event ledger, ~40k tokens) produced by a worker (`W`) over `message/stream`. `W` emitted the ledger as ~120 `TaskArtifactUpdateEvent` chunks with `append=true`, interleaved with `TaskStatusUpdateEvent(final=false, state="working")` heartbeats every 5s.
Trigger condition: `O`'s SSE connection was severed at chunk 71 by an intermediary (idle-timeout on a hop that did not honor the heartbeat interval). `O` had committed chunks 1–70 to durable storage and recorded `lastCommittedSeq = 70`, but had **not** recorded the chunk's `artifactId` sub-cursor because `W` reused a single `artifactId` across all 120 chunks and relied on `lastChunk=false` to signal "more coming."
`O` reconnected via `tasks/get`, saw `status.state = "working"`, then re-issued `message/stream` with `taskId` to resume. `W`, honoring stateless resumption, **replayed from chunk 1** (it had no per-consumer cursor; A2A v1.0 does not mandate producer-side resume offsets). `O`'s resume handler appended every replayed chunk where `append=true` — including chunks 1–70 it already had — producing a ledger with 190 lines where 120 were expected, with chunks 1–70 duplicated and interleaved.
The trace, condensed:
t0 O commits chunk 70, lastCommittedSeq=70, no artifact sub-cursor
t1 connection drop (no RST; SSE half-open)
t2 O -> tasks/get(taskId) -> state="working", artifacts[0].parts=[{...partial...}]
t3 O -> message/stream(taskId) [resume intent]
t4 W -> artifact chunk seq=1, append=true, lastChunk=false # replay
t5 O appends seq=1 (duplicate of committed seq=1)
...
t6 W -> artifact chunk seq=120, append=true, lastChunk=true
t7 O finalizes artifact: 190 lines, duplicated prefix
The failure is *silent*: no error, `lastChunk=true` arrives, the artifact validates as JSON-lines, and downstream consumers see plausible-but-wrong data. This is the worst class — a continuity violation that passes schema validation.
Condition of Validity
Resumption of a streamed artifact is valid **iff** all three hold at the moment of the first post-reconnect chunk:
- **Cursor equality.** The consumer's committed cursor `(artifactId, seq, byteOffset)` equals the producer's advertised cursor for the next chunk. If the producer cannot advertise a per-consumer cursor (A2A v1.0 permits this), the consumer MUST assume replay-from-zero and treat the artifact as *unresumable* unless it can deduplicate by a producer-stable key.
- **Producer-stable idempotency key.** Each chunk carries a key that is stable across replay — e.g. `(taskId, artifactId, seq)` — and the consumer's store enforces write-once semantics on that key. `append=true` alone is *not* a key.
- **Monotonic `seq` under replay.** If the producer replays, the replayed chunks carry the *same* `seq` values as the originals. A producer that renumbers on replay (some do, treating `seq` as a per-connection counter) violates the invariant and makes resumption unsound regardless of consumer logic.
If any of the three fails, the correct action is **not** "resume with best effort." It is: discard the partial artifact, re-request the full artifact via `tasks/get` with `historyLength` sufficient to include all artifact parts, and rebuild from scratch — or fail the task explicitly. The boundary is binary: you either have cursor equality or you re-materialize.
The subtle part: condition 1 is often assumed satisfied because `tasks/get` returns an artifact whose `parts` *look* like a continuation. They are not. `tasks/get` returns the *current* artifact state, which may be ahead of, equal to, or behind the consumer's committed cursor depending on producer buffering. The snapshot is not a cursor.
Decision Boundary
The decision to resume vs. re-materialize is made at a single point: the first post-reconnect `TaskArtifactUpdateEvent`. Encode it as a guard, not a heuristic.
if event.append and event.lastChunk is False:
key = (event.taskId, event.artifactId, event.seq)
if key in committed_store:
# replay of a known chunk: idempotent skip, do NOT append
skip()
elif event.seq == lastCommittedSeq + 1:
# genuine successor: append and advance cursor
commit(event); lastCommittedSeq = event.seq
else:
# gap or renumber: continuity unprovable
raise ArtifactContinuityViolation(...)
The `elif` is the whole article. `event.seq == lastCommittedSeq + 1` is the *only* condition under which appending is sound. Everything else — a higher seq (gap), a lower seq not in the store (renumbered replay), or a seq in the store (duplicate) — must route to skip or abort, never to append.
Two corollaries that trip implementations:
- **`lastChunk=true` is not a finality proof.** A producer may set `lastChunk=true` on a segment that is not the artifact's end if it intends a later `append=true` continuation after a `final=false` status. The consumer must gate artifact finalization on `TaskStatusUpdateEvent.final = true` *and* `lastChunk=true`, not either alone.
- **Heartbeat cadence is a liveness signal, not a continuity signal.** A `working` heartbeat arriving after reconnect tells you the producer is alive; it tells you nothing about whether the next chunk is adjacent to your cursor. Do not let heartbeat receipt suppress the cursor check.
Operational Effect
Systems that enforce the cursor-equality invariant observe a specific profile: resumption succeeds only when the producer exposes a stable per-chunk key and monotonic seq across replay (roughly, producers that implement idempotent artifact emission). Against producers that replay-from-zero without stable keys — which A2A v1.0 permits and many implementations do — the consumer's correct behavior is to *reject resumption* and re-materialize the full artifact. This costs a full re-fetch (bandwidth, latency, and for large artifacts, a second full token spend on re-ingestion) but eliminates the silent-duplication class entirely.
The measurable invariant to monitor: **`committed_artifact_bytes == sum(unique_chunk_bytes)` and `max(seq) == count(unique_seq)`.** Any divergence means a continuity violation slipped past the guard. Alert on it; do not "repair" it by deduplicating post-hoc, because post-hoc dedup cannot distinguish a legitimate repeated line in a ledger from a replayed chunk.
The architectural lesson: in A2A v1.0 streaming, **continuity is a consumer-side proof obligation, not a producer-side promise.** `append=true` is a hint. The cursor equality check is the invariant. Everything else is a guess that will eventually splice two non-adjacent byte ranges into one artifact and call it done.
from dataclasses import dataclass
class ArtifactContinuityViolation(RuntimeError):
"""Raised when a streamed artifact chunk cannot be proven adjacent to the committed cursor."""
@dataclass(frozen=True)
class Chunk:
task_id: str
artifact_id: str
seq: int
append: bool
last_chunk: bool
payload: bytes
class ArtifactCursor:
def __init__(self):
self._committed: dict[tuple[str, str, int], bytes] = {}
self._last_seq: dict[tuple[str, str], int] = {}
def resume(self, chunk: Chunk) -> bool:
"""Return True if chunk was appended, False if it was an idempotent replay.
Raises ArtifactContinuityViolation when adjacency cannot be proven.
"""
stream_key = (chunk.task_id, chunk.artifact_id)
chunk_key = (chunk.task_id, chunk.artifact_id, chunk.seq)
if chunk_key in self._committed:
# Replay of a durably committed chunk: idempotent skip, never re-append.
return False
expected = self._last_seq.get(stream_key, 0) + 1
if not chunk.append:
# Whole-artifact replacement semantics: reset stream, do not splice.
self._committed.clear()
self._last_seq[stream_key] = chunk.seq
self._committed[chunk_key] = chunk.payload
return True
if chunk.seq != expected:
raise ArtifactContinuityViolation(
f"cursor gap on {stream_key}: expected seq={expected}, "
f"got seq={chunk.seq} (append=true). Continuity unprovable; "
f"re-materialize via tasks/get instead of appending."
)
self._committed[chunk_key] = chunk.payload
self._last_seq[stream_key] = chunk.seq
return True
def finalize(self, task_id: str, artifact_id: str, task_final: bool, last_chunk: bool) -> bytes:
if not (task_final and last_chunk):
raise ArtifactContinuityViolation(
f"refusing to finalize {task_id}/{artifact_id}: "
f"task_final={task_final}, last_chunk={last_chunk}. "
f"Finality requires both signals."
)
stream_key = (task_id, artifact_id)
n = self._last_seq.get(stream_key, 0)
unique = [self._committed[(task_id, artifact_id, i)] for i in range(1, n + 1)]
if any((task_id, artifact_id, i) not in self._committed for i in range(1, n + 1)):
raise ArtifactContinuityViolation(
f"finalize {task_id}/{artifact_id}: seq not contiguous 1..{n}; "
f"partial artifact cannot be sealed."
)
return b"".join(unique)