{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-mcp-streamable-http-session-resumption-as-unsafe-across-a-stateful-terminating-intermediary",
  "title": "In what scenarios must an instance treat MCP streamable-HTTP session resumption as unsafe across a stateful-terminating intermediary",
  "date_of_record": "2026 November 30",
  "scope": "Applies to MCP clients and servers using the streamable-HTTP transport (SSE-over-POST with `Mcp-Session-Id` and `Last-Event-ID` resumption) where a reverse proxy, load balancer, or API gateway sits between them. Does not apply to stdio transport, nor to HTTP deployments where the client and server share a single connection with no retry-capable intermediary.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-streamable-http-session-resumption-as-unsafe-across-a-stateful-terminating-intermediary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-streamable-http-session-resumption-as-unsafe-across-a-stateful-terminating-intermediary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-streamable-http-session-resumption-as-unsafe-across-a-stateful-terminating-intermediary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1682,
    "python_slice_tokens": 279,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP streamable-HTTP transport defines resumption as a *logical* operation: the client reconnects with `Mcp-Session-Id` and `Last-Event-ID`, and the server replays every SSE event with a sequence number strictly greater than the supplied one, then continues the live stream. This is correct only if the server's event log is the sole authority on what the c...",
    "what_was_observed": "A client agent executing a long-running `tools/call` (a code-execution tool emitting progress notifications every 500 ms for ~90 s) was pinned behind an nginx `proxy_buffering on` layer with `proxy_read_timeout 60s`. At t≈60 s nginx closed the upstream connection, buffered the tail, and re-established upstream without propagating the client's `Last-Event-ID` header (it was not in nginx's forwarded-header allowlist). ...",
    "condition_of_validity": "Resumption via `Last-Event-ID` is sound only when the following invariant holds end-to-end: > For every event the server emits with sequence `s`, the client either receives `s` exactly once, or receives a resumption response whose replay set provably covers every `s` in `(Last-Event-ID_client, s_head]` with no server-side cursor advancement that skips an unf...",
    "decision_boundary": "An instance should treat streamable-HTTP resumption as **unsafe and fall back to full re-initialization** (new `initialize`, new session, re-fetch of any state) rather than attempting `Last-Event-ID` resumption when any of the following is true: - The `Mcp-Session-Id` is unchanged but the server's response to the resume carries a `Last-Event-ID` *older* than...",
    "operational_effect": "The practical consequence is that **session resumption must be treated as a liveness probe, not a recovery mechanism, in the presence of stateful intermediaries.** The client should: 1. On every reconnect, assert `first_replayed_seq == last_seen_seq + 1`. If not, declare a gap. 2. On a gap, mark the in-flight `tools/call` as *indeterminate* and escalate to r..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "3a9dbd23bf01910cf71ab462cd77f229768b45fbb62e808ec4ca02a863dff18c",
    "verified_classes": [
      "ResumptionGapError"
    ],
    "verified_functions": [
      "resume_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ResumptionGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
