{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-mcp-streamable-http-session-resumption-as-unsafe-after-a-last-event-id-replay-gap",
  "title": "In what scenarios must an instance treat MCP streamable HTTP session resumption as unsafe after a `Last-Event-ID` replay gap",
  "date_of_record": "2026 November 20",
  "scope": "Applies to MCP clients and servers using the streamable HTTP transport (single `POST`/`GET` endpoint with `text/event-stream` responses, `Mcp-Session-Id` header, and `Last-Event-ID` resumption) where a client may reconnect mid-stream. Does not apply to stdio transports, to the deprecated dual-endpoint HTTP+SSE transport, or to stateless servers that never emit an `id:` field on SSE events.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-streamable-http-session-resumption-as-unsafe-after-a-last-event-id-replay-gap.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-streamable-http-session-resumption-as-unsafe-after-a-last-event-id-replay-gap.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-streamable-http-session-resumption-as-unsafe-after-a-last-event-id-replay-gap.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1665,
    "python_slice_tokens": 240,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The streamable HTTP transport replaces the deprecated HTTP+SSE transport's separate `/sse` and `/message` endpoints with one endpoint that can upgrade any `POST` response to an event stream. Crucially, resumption is *advisory, not transactional*: a client that reconnects with `Last-Event-ID` receives events the server still holds, but the protocol defines no...",
    "what_was_observed": "A verification agent issued a long-running `tools/call` (a batch schema validation over ~40k records) via `POST` to the streamable endpoint. The server responded `200` with `Content-Type: text/event-stream` and began emitting progress notifications interleaved with partial `notifications/message` events, each carrying a monotonically increasing `id:` (e.g., `id: 1042`). At event `1047` the client's TCP connection was...",
    "condition_of_validity": "Replay is safe **only** when the client can prove the replayed stream is contiguous with what it already consumed. Concretely, resumption is valid iff all of the following hold: 1. The server emits strictly monotonic `id:` values on every event (not per-event-type counters, not UUIDs, not timestamps). 2. The client, on reconnect, verifies that the first repl...",
    "decision_boundary": "The boundary is between *transport-level resumption* and *agent-level recovery*. Transport resumption answers \"can I keep reading bytes from this session?\" Agent recovery answers \"is my belief state still a valid function of the events I've seen?\" These diverge exactly when the ID sequence is non-contiguous, when the session ID has changed, or when the serve...",
    "operational_effect": "The practical consequence is that any agent relying on streamable HTTP for long-running tool execution must carry its own **event-ledger invariant**: a monotonic counter of consumed IDs plus a contiguous-prefix check, independent of the transport. When the check fails, the agent must escalate to a *recovery* path that costs a full re-execution — there is no ..."
  },
  "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": "d08a5ab23677985a253a49f8920d25ed7723460402cd06550c48ded175171402",
    "verified_classes": [
      "StreamResumeGapError",
      "SessionLedger"
    ],
    "verified_functions": [
      "resume_stream",
      "__init__",
      "consume",
      "_apply"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "StreamResumeGapError"
    ],
    "sample_fail_closed_invariants": [
      "cannot resume a stream that was never consumed"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
