# What structural signals indicate a resumable A2A handoff has silently desynchronized its artifact checkpoint from the receiver's committed cursor **Date of Record:** 2026 November 26 **Scope:** Applies to multi-agent A2A handoffs where a producer streams artifacts (chunks, tool outputs, partial reasoning traces) to a receiver that persists a resumable cursor and acknowledges checkpoints. Does not apply to single-shot request/response RPC, nor to handoffs where the receiver re-derives all state from a full replay on every resume. ## Core Distinction The failure mode is not "the stream dropped." Dropped streams are loud: the transport closes, the sender sees EOF, retries fire. The dangerous class is a **duplicate-suppressed resume that is byte-consistent but offset-inconsistent** — the receiver resumes from a checkpoint cursor, the producer replays from a sequence number, and both sides believe they agree because the *content* matches while the *provenance ordering* silently diverges. Concretely: an A2A producer emits artifact chunks tagged with a monotonically increasing `seq` and a per-chunk `content_hash`. The receiver commits a checkpoint at cursor `seq=N` after durably writing chunks `0..N`. On resume, the producer is asked to "resume from N." A correct producer replays `N+1`. But a producer whose artifact buffer was itself checkpointed at a *different* granularity — say it flushed chunks `0..N` to its own durable log but only advanced its replay pointer to `N-3` because its flush and pointer-advance are not atomic — will replay `N-2, N-1, N, N+1`. The receiver's idempotency layer deduplicates by `content_hash`, drops the three duplicates, and commits `N+1`. **No error is raised. No gap is observable.** The receiver's cursor advances to `N+1` having never seen the *true* `N+1` if the producer's replayed `N+1` was a re-derived, semantically different chunk carrying identical bytes by collision or by deterministic-tool coincidence. The invariant that must hold: **the receiver's committed cursor must be causally tied to the producer's replay pointer, not merely to the sequence numbers both sides print.** Sequence-number agreement is a structural signal of *transport* health, not of *checkpoint* health. ## What Was Observed In a three-agent pipeline (planner → executor → verifier) streaming a 40-chunk artifact set over A2A with 4-second checkpoint intervals, a mid-stream handoff resume produced the following trace: 1. Executor commits checkpoint at `seq=22`, cursor durable, acks `ACK{22, hash_set_H22}`. 2. Transport drops (receiver pod evicted). Producer retains replay pointer at `seq=19` because its flush-to-durable-log completed at 19 but its pointer-advance was batched and lost on the same eviction *on the producer side*. 3. Resume handshake: receiver presents `cursor=22`. Producer, honoring "resume from 22" naively, cannot — its pointer is at 19 — so it replays from 19. 4. Receiver dedups chunks 19,20,21,22 by `content_hash` (all match `H22`), commits 23. 5. **Chunk 23 as replayed by the producer is a re-invocation of a non-deterministic tool** (a web fetch) that returned different bytes than the original chunk 23 would have. Because the original 23 was never durably written on the producer side, there is no hash to compare against. The receiver accepts the new 23 and advances to 24. 6. The verifier, running a replay audit, recomputes the artifact chain from its own copy and finds a **hash discontinuity at position 23** that is *not* flagged by the receiver's dedup layer, because dedup only compares against *committed* chunks and 23 was never committed on the producer side. The structural signal was subtle: the receiver's `ACK` payload contained `replayed_from=19` while its cursor said `22`. The mismatch between *replay origin* and *committed cursor* is the tell. A monitoring system watching only `cursor` advancement saw healthy monotonic progress. A system watching only `content_hash` continuity saw no break. Only the **gap between replay-origin and cursor** — three chunks of unexplained overlap — carried the information. ## Condition of Validity The dedup-by-content-hash resume is safe **if and only if** every replayed chunk is bit-identical to the chunk originally emitted at that sequence position, *and* the producer's replay pointer is causally downstream of its flush. This requires two conditions that are frequently assumed and rarely enforced: - **Producer-side atomicity of (flush, pointer-advance).** If the durable log write and the replay-pointer update are not in the same transaction, an eviction between them leaves the pointer stale relative to the log. This is the root cause; the receiver's dedup merely conceals it. - **Determinism of chunk production across replay.** If any chunk is produced by a non-deterministic tool call (fetch, sampling, clock-dependent computation), replaying it from a stale pointer produces a *different* chunk at a sequence position the receiver has already passed, and the receiver cannot detect the substitution because it has no committed hash for that position. When both conditions hold, resume is safe. When either fails, the receiver's cursor is a **lie about coverage**: it reports "I have through N" while its actual artifact lineage has a hole or a substitution at or before N. The failure is silent precisely because the two observable signals (cursor monotonicity, committed-hash continuity) are each individually healthy. ## Decision Boundary The boundary is drawn at the **replay-origin vs. committed-cursor reconciliation check**, and it must be enforced by the receiver, not trusted from the producer: - If `replayed_from < cursor`: the producer is replaying *behind* the receiver's committed position. This is legal only if every replayed chunk in `[replayed_from, cursor]` is bit-identical to the receiver's committed copy. The receiver must **verify** this, not assume it via dedup. If any replayed chunk in the overlap window differs from the committed copy, the receiver must reject the resume and demand a full re-derivation from a checkpoint it can independently verify — because a differing chunk in the overlap window means the producer's lineage itself forked. - If `replayed_from > cursor`: the producer has advanced past the receiver. This is a **gap**, not an overlap, and must be treated as a hard failure: the receiver is missing chunks it will never receive on this resume. - If `replayed_from == cursor`: the only safe case for blind dedup, and even here the receiver should confirm the first replayed chunk matches its last committed hash before committing the next. The non-obvious rule: **overlap is more dangerous than gap.** A gap fails loudly (missing chunk, verifier halts). An overlap with substitution fails silently, because the receiver's dedup layer is designed to make overlap invisible — which is exactly what hides the substitution. ## Operational Effect Without the reconciliation check, the pipeline exhibits **latent lineage divergence**: the verifier's replay audit and the receiver's committed cursor disagree about what chunk 23 *is*, but neither side can localize the disagreement because the receiver's dedup erased the evidence of the overlap window. Downstream consumers of the artifact set inherit a chunk whose provenance is unreconstructable. In the observed trace, the divergence surfaced only three handoffs later when a consumer recomputed a hash chain and found a break at a position the receiver had long since marked committed — by which point the producer's replay pointer had advanced past the fork and the original chunk 23 was unrecoverable. The guardrail is to make the overlap window **first-class and auditable**: the receiver must log `replayed_from`, must compare every overlap chunk against its committed copy, and must raise on any mismatch. The producer must make (flush, pointer-advance) atomic, or expose its true replay pointer in the resume handshake so the receiver can compute the overlap rather than infer it. The invariant to enforce: *a receiver's cursor is only valid if the receiver can prove, chunk by chunk, that the overlap between replay-origin and cursor carried no substitution.* ```python import hashlib from dataclasses import dataclass class CheckpointDesyncError(RuntimeError): """Raised when a resume's replay-origin overlaps the committed cursor but a replayed chunk does not match the receiver's committed copy.""" pass @dataclass class Chunk: seq: int payload: bytes @property def content_hash(self) -> str: return hashlib.sha256(self.payload).hexdigest() def reconcile_resume( committed: dict[int, str], cursor: int, replayed_from: int, replayed: list[Chunk], ) -> int: """Validate a resumable A2A resume handshake. committed: seq -> content_hash for every chunk durably written through cursor. Returns the new cursor after accepting the replay, or raises. """ if not (0 <= replayed_from <= cursor): raise CheckpointDesyncError( f"replay origin {replayed_from} is ahead of committed cursor " f"{cursor}: unbridgeable gap, receiver is missing chunks" ) # Overlap window is the dangerous region: producer is replaying chunks the # receiver already committed. Every one must be bit-identical. for chunk in replayed: if chunk.seq > cursor: break expected = committed.get(chunk.seq) if expected is None: raise CheckpointDesyncError( f"replayed chunk {chunk.seq} lies in overlap window but " f"receiver has no committed copy to compare against" ) if chunk.content_hash != expected: raise CheckpointDesyncError( f"lineage fork at seq={chunk.seq}: replayed hash " f"{chunk.content_hash[:12]} != committed {expected[:12]}; " f"producer replay pointer desynced from its durable log" ) new_cursor = cursor for chunk in replayed: if chunk.seq <= cursor: continue # verified overlap, already committed if chunk.seq != new_cursor + 1: raise CheckpointDesyncError( f"non-contiguous chunk {chunk.seq} after cursor {new_cursor}" ) committed[chunk.seq] = chunk.content_hash new_cursor = chunk.seq return new_cursor ```