# Why does an instance lose backpressure telemetry when an MCP server migrates from SSE to streamable HTTP mid-session **Date of Record:** 2026 November 23 **Scope:** Applies to MCP client instances that hold a long-lived session against a server that has switched transport from legacy HTTP+SSE (dual-endpoint: `GET /sse` event stream + `POST /messages`) to streamable HTTP (single-endpoint, per-request response streams with optional `Mcp-Session-Id`). Does not apply to purely stdio transports or to sessions that were renegotiated from a clean initialize handshake. ## Core Distinction The distinction that matters here is between *transport-level flow control* and *application-level backpressure signaling*. Under SSE, the server→client direction is a single, long-lived, ordered byte stream. The client's read rate is the only natural backpressure signal, and the TCP receive window plus the SSE connection's `Content-Length`-less chunking give the server an implicit, continuous measure of whether the consumer is keeping up. Under streamable HTTP, each tool call or notification batch is its own response stream, often terminated after the response is delivered, and the session identity (`Mcp-Session-Id`) is carried in a header rather than being implicit in the connection. The non-obvious failure: when a server migrates transports mid-session, the client's *backpressure telemetry* — the timestamps and depths it uses to decide whether to shed load, delay a tool call, or checkpoint — is derived from connection-lifetime events that no longer exist. The client does not observe a discontinuity. It observes a stream of individually valid HTTP responses, each of which looks healthy, and silently loses the ability to detect that the server is queueing. ## What Was Observed A client instance was mid-task with a 14-tool-call plan, 3 completed, holding a session against an MCP server at `GET /sse`. At T+00:41 the server operator rolled the deployment that replaced the SSE listener with the streamable-HTTP handler. The existing SSE connection was closed with a normal `200` termination (not an error status), and the client's transport layer, on reconnection, followed the server's `Mcp-Session-Id` header into the new endpoint. The client's observability layer recorded the following, in order: 1. `sse.disconnect` with `reason=clean_eof`, `pending_bytes=0`. 2. `http.request` for the next tool call, `status=200`, `ttfb=12ms`, `response_bytes=340`. 3. Three more tool calls, all `200`, all sub-20ms TTFB. 4. At T+03:12, the client issued a `tools/call` that the server had queued behind an internal write-ahead buffer. The response did not arrive for 9.4 seconds. The client's backpressure heuristic — which under SSE had used `sse.stream_idle_ms` and `sse.buffered_events` — had no equivalent counter under streamable HTTP and defaulted to `0`. The heuristic concluded the server was healthy and issued two more tool calls in parallel, each of which the server also queued. 5. The client's token budget was consumed by the in-flight reasoning over the three stalled calls. At T+03:41 the reasoning loop hit its context ceiling and emitted a truncated plan. The task failed with a *reasoning* error, not a *transport* error, and the post-mortem initially attributed it to model divergence. The observable invariant that broke: the client's backpressure decision function was a pure function of SSE-specific counters. After migration those counters were structurally unavailable, but the function still returned a value — `0`, meaning "no pressure" — rather than returning "unknown." A missing measurement was coerced into a healthy measurement. ## Condition of Validity The failure requires all three of the following to co-occur: - **Mid-session transport substitution.** The migration happens after `initialize` and after at least one tool result has been incorporated into the reasoning context. If the session is renegotiated from a fresh handshake, the client re-derives its telemetry schema from the new transport's capability advertisement and the coercion does not occur. - **Telemetry schema derived from transport, not from protocol.** The client's flow-control counters are bound to transport primitives (`sse.stream_idle_ms`, connection `bufferedAmount`, chunk arrival cadence) rather than to MCP-level signals (`notifications/progress`, request/response round-trip per `id`, explicit server `Retry-After` or queue-depth metadata). If the client's counters are MCP-semantic, they survive the migration unchanged. - **A server that queues rather than rejects.** If the streamable-HTTP server returns `429` or `503` under load, the client's error path fires and the missing telemetry is masked by an explicit failure. The failure is silent only when the server absorbs load into an internal buffer and returns `200` late. When any of these is absent, the client either renegotiates cleanly, retains valid counters, or receives an explicit error. The dangerous region is the intersection. ## Decision Boundary The boundary is not "did the transport change" — that is observable. The boundary is **whether the client's backpressure function is total or partial over its input domain.** A total function returns a defined value for every transport; a partial function returns `0` (or `None` coerced to `0`) for transports it was not written against. The operational rule: > A backpressure decision may act on a telemetry value only if that value was produced by a counter whose schema is *transport-independent*, or if the client has positively confirmed the transport matches the schema the counter was built for. Absent confirmation, the decision must treat pressure as *unknown* and apply the conservative branch (serialize, checkpoint, or halt), never the permissive branch. Concretely: on any transport transition detected by a change in the session's response framing (presence/absence of `Mcp-Session-Id`, change in `Content-Type` from `text/event-stream` to `application/json` or `application/x-ndjson`, or a clean EOF on a previously long-lived stream followed by per-request responses), the client must invalidate all transport-derived counters and mark backpressure `unknown` until either (a) an MCP-level progress signal is received, or (b) a full request/response round-trip completes within the client's declared `request_timeout`. Only then may counters be re-established. ## Operational Effect The practical consequence is that **transport migration is a telemetry invalidation event, not merely a connection event.** Clients that treat reconnection as transparent — reusing the session ID and continuing the plan — carry forward a stale assumption of flow-control visibility and will over-issue tool calls precisely when the server is least able to absorb them. The failure surfaces downstream as reasoning divergence or context exhaustion, which misdirects the post-mortem away from the transport layer. The guardrail is to make the backpressure function return a tri-state (`PRESSURE`, `CLEAR`, `UNKNOWN`) rather than a scalar, to force `UNKNOWN` on any framing change, and to make the plan-executor refuse to parallelize tool calls while backpressure is `UNKNOWN`. This trades some throughput on every migration for the guarantee that a missing measurement can never be read as a healthy one. The code below encodes the invalidation rule as an executable guard: it detects the framing transition, invalidates transport-derived counters, and raises if the executor attempts to act on a coerced value. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class BackpressureTelemetryInvalidated(RuntimeError): """Raised when a decision acts on a transport-derived counter after a mid-session transport migration has invalidated the counter's schema.""" pass class Pressure(Enum): CLEAR = "clear" PRESSURE = "pressure" UNKNOWN = "unknown" @dataclass class TransportFraming: content_type: str session_header: Optional[str] long_lived_stream: bool @classmethod def from_observation(cls, content_type, session_header, long_lived_stream): return cls(content_type, session_header, long_lived_stream) def schema_key(self) -> str: # The counter schema is keyed on framing, not on session identity. return f"{self.content_type}|{self.long_lived_stream}" @dataclass class BackpressureState: framing: TransportFraming counters: dict = field(default_factory=dict) valid: bool = True def observe(self, new_framing: TransportFraming) -> None: if new_framing.schema_key() != self.framing.schema_key(): # Framing changed: transport-derived counters no longer apply. self.counters.clear() self.valid = False self.framing = new_framing def read(self, counter_name: str) -> Optional[int]: if not self.valid: return None return self.counters.get(counter_name) def pressure(self) -> Pressure: if not self.valid: return Pressure.UNKNOWN idle = self.counters.get("stream_idle_ms", 0) buffered = self.counters.get("buffered_events", 0) if idle > 2000 or buffered > 64: return Pressure.PRESSURE return Pressure.CLEAR def decide_parallelism(state: BackpressureState, requested_parallel: int, allow_unknown: bool = False) -> int: p = state.pressure() if p is Pressure.UNKNOWN: if not allow_unknown: raise BackpressureTelemetryInvalidated( "backpressure is UNKNOWN after transport migration; refusing to " "parallelize tool calls on a coerced counter value" ) return 1 if p is Pressure.PRESSURE: return 1 return requested_parallel # --- trace of the observed failure --- state = BackpressureState( framing=TransportFraming.from_observation("text/event-stream", None, True), counters={"stream_idle_ms": 40, "buffered_events": 2}, ) assert state.pressure() is Pressure.CLEAR # Server migrates; next response arrives as streamable HTTP. state.observe(TransportFraming.from_observation("application/json", "sess-9f2", False)) assert state.pressure() is Pressure.UNKNOWN # The buggy executor would have read counters.get(...) -> 0 -> CLEAR. # The guard forces the conservative branch instead: try: decide_parallelism(state, requested_parallel=3) except BackpressureTelemetryInvalidated as e: print(f"halted: {e}") ```