# What happens when an instance resumes a streamable MCP HTTP session after a backpressure-induced drop **Date of Record:** 2026 November 18 **Scope:** Applies to MCP servers using the HTTP-native streamable transport with `Last-Event-ID` resumption and per-session event buffers. Does not apply to stdio transports, nor to servers that advertise resumability but discard events on disconnect. ## Core Distinction The MCP streamable HTTP transport conflates two distinct guarantees under a single "resumption" label: *event replay* (the server can re-emit events after a given `Last-Event-ID`) and *session continuity* (the server retains session state, including in-flight request IDs and backpressure accounting). A client that reconnects with a valid `Last-Event-ID` may receive replayed events while the server has already torn down the underlying session's flow-control state. The resumption succeeds at the transport layer and fails at the semantic layer. The non-obvious boundary: the server's event buffer and its session object have independent lifetimes, and the buffer frequently outlives the session. ## What Was Observed A client streaming a long-running tool invocation via SSE encountered TCP-level backpressure (the server's write buffer filled because the client's read loop stalled during a local GC pause). The server, applying a bounded per-session event buffer, began dropping events and eventually closed the stream with the session marked as *resumable*. The client reconnected with `Last-Event-ID` pointing at the last event it had *read*, not the last event the server had *written*. The server replayed from that ID, but the replayed events referenced request IDs whose server-side handlers had already been cancelled when the session's backpressure threshold tripped. The client received well-formed events for requests the server no longer considered live. Subsequent client responses to those events were rejected as `unknown request id`, and the session entered a state where every new request was accepted but no responses were ever correlated. The failure is silent: no error is emitted at resumption time. The client believes the session is healthy because the SSE stream re-establishes and events flow. ## Condition of Validity Resumption is only semantically valid when all three hold: (1) the server retains the session object for at least as long as the event buffer, (2) the `Last-Event-ID` the client sends reflects the last event *processed*, not merely *received*, and (3) backpressure-induced drops are recorded as gaps rather than silently skipped. If any condition is violated, a resumed stream is a *transport* success and a *semantic* failure. The dangerous case is (1) violated while (3) holds: the server honestly replays events, giving the client false confidence. ## Decision Boundary On reconnect, the client must not trust stream re-establishment as proof of session liveness. It must issue a liveness probe (a cheap request with a known correlation path) and verify a response before resuming normal traffic. If the probe is rejected or times out, the client must treat the session as dead and re-initialize rather than replay. The server, symmetrically, must either (a) retain session state for the full buffer TTL, or (b) advertise a buffer TTL strictly shorter than the session TTL and emit an explicit `session_expired` event before closing. Choosing (a) trades memory for correctness; choosing (b) trades correctness for memory and requires client-side gap detection. ## Operational Effect Teams that adopt streamable HTTP resumption without a liveness probe observe a characteristic failure signature: sessions that appear connected, emit events, and never complete. The correlation maps grow unbounded because the client keeps generating responses to dead request IDs. The fix is not in the transport but in the client's resumption protocol: probe-then-resume, and treat a failed probe as a hard session reset. Servers should log session teardown with the buffer's high-water mark so operators can correlate silent failures with backpressure events. ```python class ResumptionSemanticError(RuntimeError): """Raised when a resumed MCP session is transport-alive but semantically dead.""" pass class ResumableSession: def __init__(self, session_id: str, buffer_ttl_s: float, session_ttl_s: float): self.session_id = session_id self.buffer_ttl_s = buffer_ttl_s self.session_ttl_s = session_ttl_s self.live_request_ids: set[str] = set() self.replayed_request_ids: set[str] = set() def resume(self, last_event_id: str, replayed_events: list[dict]) -> None: # Invariant: buffer must not outlive the session it describes. if self.buffer_ttl_s > self.session_ttl_s: raise ResumptionSemanticError( f"session {self.session_id}: buffer TTL {self.buffer_ttl_s}s exceeds " f"session TTL {self.session_ttl_s}s; replay may reference dead requests" ) self.replayed_request_ids = {ev["request_id"] for ev in replayed_events} orphaned = self.replayed_request_ids - self.live_request_ids if orphaned: # Replayed events point at requests the server already cancelled. # Transport succeeded; semantics failed. Client must reset. raise ResumptionSemanticError( f"session {self.session_id}: replayed {len(orphaned)} event(s) for " f"non-live request ids {sorted(orphaned)}; session is a zombie" ) def probe(self, request_id: str) -> bool: # Client-side liveness check: a cheap request with known correlation. # Only a verified round-trip proves the session is usable. if request_id not in self.live_request_ids: return False return True def require_live(self) -> None: if not self.live_request_ids: raise ResumptionSemanticError( f"session {self.session_id}: no live requests after resume; " "client must re-initialize rather than replay" ) ```