# When must an instance treat MCP streamable-HTTP backpressure as a resumable checkpoint rather than a lost call **Date of Record:** 2026 November 28 **Scope:** Applies to MCP clients driving long-running tool invocations over streamable HTTP where the server emits SSE frames with `event: message`/`id:` fields and advertises `Last-Event-ID` resumption. Does not apply to stateless one-shot request/response MCP transports or to stdio transports, where there is no server-side replay buffer to reconcile against. ## Core Distinction There are two superficially identical failure surfaces that an MCP client sees when a long-running tool stalls: a *transport stall* (TCP/HTTP backpressure, the server is still executing, the socket is alive but the SSE stream has gone quiet) and a *progress stall* (the server tool itself is blocked, the socket is healthy, frames simply are not being produced). The distinction that matters operationally is not "is the connection alive" but "does the server hold a replayable event log keyed by `id:` such that a reconnect with `Last-Event-ID` yields a superset of what I already consumed?" The non-obvious invariant: **a reconnection is only safe to treat as a checkpoint resume if the client can prove that the set of tool-side effects it observed before the disconnect is a prefix of the set it will observe after resume.** If that prefix relation cannot be established—because the server buffers by byte count and silently drops the oldest unacked frame, because the tool emits non-monotonic progress (e.g., retries that re-emit `step 3`), or because the client applied a side effect (wrote a file, sent an email, mutated a database) on a frame that the server will replay—then resumption is *at-least-once* delivery of side-effecting events, and the client must either deduplicate or refuse to resume. Most clients conflate these. They see `Last-Event-ID` in the spec, reconnect, and replay everything after the last id they *received*, not the last id they *committed*. That is the boundary failure this record documents. ## What Was Observed A tool `analyze_corpus` was invoked over streamable HTTP. The server emitted SSE frames at roughly 4 Hz, each carrying a partial result chunk and a monotonically increasing `id:`. The client consumed frames, appended each chunk to an in-memory buffer, and acknowledged by *receipt*—it advanced its `last_seen_id` the moment the frame was parsed, before the chunk was durably appended to the downstream sink. At T+38s the server's outbound buffer crossed its high-water mark (the client's read loop was blocked on a synchronous downstream write that took ~900ms per chunk). The server, configured with a bounded replay ring of 256 events and a drop-oldest policy, began evicting unacked frames. The socket did not close. No error frame was sent. The stream simply went quiet from the client's perspective while the server continued producing events into a ring that was now overwriting the frames the client had not yet read. At T+41s the client's read timeout fired. It reconnected with `Last-Event-ID: 1042`. The server's ring now held events `1088..1344`. Events `1043..1087`—45 frames, containing roughly 11% of the corpus analysis—were gone. The server, per its drop-oldest semantics, resumed from `1088` without signaling the gap. The client, per its receipt-based ack, had no record that `1043..1087` ever existed and treated the resumed stream as contiguous. The tool reported `status: complete`. The client assembled a result missing 11% of its chunks and marked the invocation successful. The gap was only discovered downstream when a checksum over the assembled artifact disagreed with the tool's own manifest hash—which the tool had emitted in frame `1101`, i.e., *after* the gap, so the client received the manifest but not the data it described. ## Condition of Validity The receipt-based ack is valid only under the conjunction: 1. The server's replay buffer is unbounded for the lifetime of the invocation, **or** the client's read loop cannot be blocked longer than `ring_size / emit_rate` (here 256/4 = 64s of slack, which the 900ms downstream write did not violate per-frame but did violate cumulatively under sustained load). 2. The server signals gaps explicitly—either by refusing the resume with a `4xx` when `Last-Event-ID` is older than the ring's floor, or by emitting a sentinel gap frame. Neither held. 3. The tool's event stream is monotonic in `id:` and each `id:` corresponds to exactly one side effect. The observed system satisfied none of the three. The general condition: **resumption is a checkpoint resume only if the client's ack watermark advances on *commit*, and the server's ring floor is exposed to the client so the client can detect when its watermark has fallen behind the floor.** Without the floor exposed, the client cannot distinguish "resumed cleanly" from "resumed across a silent gap." ## Decision Boundary The client must branch on a single predicate at reconnect time: - If `last_committed_id >= server_ring_floor` (floor obtained from a `HEAD`/capability probe or a `Retry-After`-style header on the resume response): resume, replaying `[last_committed_id+1, ...]`, and **deduplicate** any event whose `id:` is `<= last_committed_id` (defensive against server-side over-replay). - If `last_committed_id < server_ring_floor`: the resume is lossy. The client must **not** treat the invocation as resumable. It must either restart the tool from scratch (idempotency key required) or fail the invocation with a gap error and surface the missing range `[last_committed_id+1, server_ring_floor-1]` to the orchestrator. - If the floor is not exposed at all: the client must assume lossy and refuse to resume across any disconnect that occurred while it had uncommitted frames. This is the conservative default and the one most clients get wrong. The boundary is sharp because the two branches have opposite correctness properties: one is safe-to-resume, the other produces a silently truncated result that *looks* complete. There is no middle ground where "resume and hope" is sound. ## Operational Effect The practical consequence is that an MCP client driving long-running tools must maintain **two watermarks**, not one: `last_received_id` (advanced on parse) and `last_committed_id` (advanced only after the frame's side effect is durable). Reconnection uses `last_committed_id`. The gap between them is the client's in-flight window, and it must be bounded by the server's advertised ring capacity—if the client's in-flight window can exceed the ring, the client is structurally incapable of lossless resume and must fail closed. Second consequence: the server must expose its ring floor. A streamable-HTTP MCP server that advertises `Last-Event-ID` support without exposing the floor is making a promise it cannot keep under backpressure, because the client has no way to detect the silent gap. This is the invariant to enforce at the protocol layer: *`Last-Event-ID` resumption without a floor disclosure is not a checkpoint; it is a best-effort replay that can silently drop a contiguous range.* Third consequence: tool-side effect idempotency must be keyed on `id:`, not on arrival order. A replayed frame with an `id:` the client has already committed must be a no-op. This is cheap to implement and is the only thing standing between a backpressure event and a duplicated side effect when the server over-replays (which happens when the ring wraps and the server is configured to replay from the floor rather than from the requested id). The guardrail, expressed as code: ```python class McpResumeGapError(RuntimeError): """Raised when a streamable-HTTP MCP resume would cross a silent replay-buffer gap.""" def __init__(self, last_committed_id: int, ring_floor: int | None): self.last_committed_id = last_committed_id self.ring_floor = ring_floor super().__init__( f"resume unsafe: committed={last_committed_id} floor={ring_floor} " f"missing={None if ring_floor is None else ring_floor - last_committed_id - 1} frames" ) def resume_streamable_http( last_committed_id: int, ring_floor: int | None, *, allow_restart: bool, idempotency_key: str | None, ) -> str: # No floor disclosed: cannot prove prefix relation, must fail closed. if ring_floor is None: if not allow_restart or idempotency_key is None: raise McpResumeGapError(last_committed_id, None) return "restart" # Committed watermark is behind the oldest retained event: lossy resume. if last_committed_id < ring_floor: if not allow_restart or idempotency_key is None: raise McpResumeGapError(last_committed_id, ring_floor) return "restart" # Committed watermark is inside the retained window: safe to replay. return "resume" ```