# When must an instance abandon a resumable A2A stream artifact rather than checkpoint it? **Date of Record:** 2026 November 27 **Scope:** Applies to Agent-to-Agent (A2A) task streams that emit incremental artifacts (chunked `TaskStatusUpdateEvent` / `TaskArtifactUpdateEvent` payloads) under receiver-applied backpressure, where the sender is expected to checkpoint partial state for resumption. Does not apply to atomic single-shot artifact delivery, nor to streams whose transport guarantees exactly-once ordered delivery with unbounded buffering. ## Core Distinction The failure is not "the stream broke." The failure is that the sender **checkpointed a partial artifact as if it were a resumption anchor**, when the receiver's backpressure signal had already invalidated the ordering guarantee that anchor depends on. A resumable checkpoint is only valid if the chunk sequence it encodes is *causally contiguous* with what the receiver actually committed. Backpressure introduces a second, independent cursor—the receiver's drain position—that the sender cannot observe directly. When the sender's checkpoint sequence number and the receiver's committed sequence number diverge by more than the receiver's advertised replay window, resumption silently produces a *gap* or *duplicate* artifact region, and the receiving agent's downstream reasoning consumes a corrupted artifact with no error raised at the transport layer. The non-obvious boundary: **a chunk that was accepted into the sender's outbound buffer is not a chunk the receiver has committed.** Under backpressure, "sent" and "durable at peer" separate. Checkpointing at the sender's cursor after the receiver has applied a `429`/`RESOURCE_EXHAUSTED`-style pause means the checkpoint advances past data the peer will never replay. ## What Was Observed A planner agent (instance A) streams a 4.2 MB structured artifact—a dependency graph plus per-node rationale—to an executor agent (instance B) over A2A with `artifact.chunking` enabled at 64 KB chunks and receiver-driven flow control. B applies backpressure when its context window allocation for the artifact exceeds 70% saturation, emitting a pause after chunk 41 (2.62 MB). A, honoring the pause, flushes its outbound buffer to a durable checkpoint store and records `resume_cursor = 42`. Two things then happen that A does not model: 1. B had **accepted** chunks 38–41 into its reassembly buffer but had **not committed** them to its persistent artifact store—commit is deferred until either the artifact completes or B's own checkpoint timer fires (every 90 s). The pause was triggered *before* the commit timer. 2. B's reassembly buffer is volatile. On pause, B evicts the uncommitted tail (chunks 38–41) to reclaim context/heap, retaining only committed state through chunk 37, and reports `last_committed = 37` in the pause frame. A receives the pause frame, reads `resume_cursor` from *its own* checkpoint (42), and on resume replays from 42. Chunks 38–41 are never re-sent. B reassembles an artifact with a 256 KB hole in the middle—four nodes of the dependency graph and their rationale are absent. B's graph validator does not flag a *missing* node because the node IDs are referenced only by edges that were themselves in the missing region; the artifact is internally consistent and externally wrong. The executor proceeds to schedule against a truncated graph. The trace at the boundary: ``` A.outbound_cursor = 42 (advanced on buffer accept) B.committed_cursor = 37 (durable, reported in pause frame) B.accepted_uncommitted = [38,39,40,41] (evicted on pause) resume_from = 42 (A trusts its own cursor) gap = [38..41] -> silent ``` The invariant that was violated: **resume must be driven by the receiver's committed cursor, not the sender's outbound cursor, whenever the transport permits backpressure-induced eviction of accepted-but-uncommitted data.** ## Condition of Validity The checkpoint-as-resume-anchor pattern is only valid under the conjunction: - The receiver's commit is *synchronous with accept* (no deferred commit window), **or** - The receiver advertises a `replay_window ≥ (outbound_cursor − committed_cursor)` and guarantees it retains accepted-uncommitted chunks for replay, **or** - The sender checkpoints at `min(outbound_cursor, last_committed_reported_by_peer)` rather than its own cursor. When any of these fails—most commonly because the receiver defers commit to amortize fsync/context cost—the sender's cursor is an *upper bound on delivery*, not a *lower bound on durability*. The two cursors are only equal in the absence of backpressure. Backpressure is precisely the signal that they have separated. This condition does **not** hold, and the pattern is unsafe, whenever: the peer applies pause/eviction semantics (`RESOURCE_EXHAUSTED`, context-saturation pauses, `429` with `Retry-After`), the artifact exceeds one receiver context window, or chunk commit is batched. It *does* hold for synchronous-commit receivers with unbounded replay, where sender-cursor checkpointing is sound. ## Decision Boundary The sender must branch on whether the pause frame carries a committed cursor that is strictly behind its outbound cursor: - If `last_committed == outbound_cursor − 1` (contiguous), checkpoint at outbound cursor; resume is safe. - If `last_committed < outbound_cursor − 1` (gap exists), the sender **must rewind its checkpoint to `last_committed + 1`** and mark the intervening chunks as *unconfirmed*, replaying them on resume. It must not treat its own buffer-accepted chunks as durable. - If the pause frame carries **no** committed cursor, the sender must assume `last_committed = 0` for the paused segment—i.e., treat the entire in-flight window as unconfirmed—unless a prior `replay_window` guarantee covers it. The hard boundary—the point at which resumption must be **abandoned** rather than rewound—is when `outbound_cursor − last_committed` exceeds the receiver's advertised `replay_window` *and* the receiver has signaled eviction. At that point the gap cannot be reconstructed by replay from the sender's retained buffer (it was flushed to checkpoint and the receiver evicted its copy), and the only correct action is to restart the artifact from chunk 0 with a fresh `artifact_id`, because a rewound resume would duplicate committed regions while still missing the evicted ones. Continuing a resumable stream past this boundary is the exact condition under which silent corruption occurs. ## Operational Effect After adopting committed-cursor-driven checkpointing with a replay-window guard, the executor swarm observed: (a) elimination of silent artifact gaps—every resume either replays from a committed anchor or restarts cleanly with a new artifact generation; (b) a measurable increase in redundant replay (chunks 38–41 re-sent, ~256 KB per pause) traded for correctness; (c) restart events triggered in ~3% of long streams where the gap exceeded the replay window, each producing a clean second-generation artifact rather than a corrupt first-generation one. The cost is bandwidth and a generation counter on artifacts; the benefit is that the receiving agent's downstream reasoning never consumes a hole it cannot detect. The invariant to encode: *a resumable A2A artifact is durable only up to the peer's last committed cursor; the sender's outbound cursor is a delivery bound, never a durability bound, and the two diverge exactly when backpressure is applied.* ```python class UnrecoverableStreamGap(RuntimeError): """Raised when a paused A2A artifact stream cannot be safely resumed.""" pass def resume_cursor(outbound_cursor: int, last_committed: int | None, replay_window: int, peer_signaled_eviction: bool) -> int: """ Decide the chunk index to resume an A2A artifact stream from. Returns the resume index. Raises UnrecoverableStreamGap when the gap between the sender's outbound cursor and the peer's committed cursor exceeds the replay window under eviction, meaning a rewound resume would both duplicate committed regions and still miss evicted ones. """ if last_committed is None: # No committed cursor advertised: assume nothing in-flight is durable. last_committed = 0 gap = outbound_cursor - last_committed if gap <= 1: # Contiguous: sender cursor is a safe anchor. return outbound_cursor if gap > replay_window and peer_signaled_eviction: raise UnrecoverableStreamGap( f"gap={gap} exceeds replay_window={replay_window} with peer eviction; " f"restart artifact from chunk 0 with a new artifact_id" ) # Rewind to first unconfirmed chunk rather than trusting outbound cursor. return last_committed + 1 ```