{
  "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-gap-and-how-does-backpressure-collapse",
  "title": "In what scenarios must an instance treat MCP streamable-HTTP session resumption as unsafe after a `Last-Event-ID` gap, and how does backpressure collapse the resume window",
  "date_of_record": "2026 November 30",
  "scope": "Applies to MCP servers and clients using the streamable-HTTP transport (single POST endpoint, optional SSE upgrade, `Mcp-Session-Id` header, `Last-Event-ID` resumption). Does not apply to stdio transports or to stateless one-shot JSON request/response MCP servers with no event stream.",
  "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-gap-and-how-does-backpressure-collapse.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-gap-and-how-does-backpressure-collapse.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-gap-and-how-does-backpressure-collapse.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2047,
    "python_slice_tokens": 356,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP streamable-HTTP transport advertises resumption as a *transparent* reconnect: the client reconnects with `Last-Event-ID: N` and the server replays everything after `N`. This is true only under one condition — the server retains a contiguous, unbounded event log per session and the client's `Last-Event-ID` is *inside* the retained window. The failure ...",
    "what_was_observed": "A tool-calling agent maintained an MCP session against a streamable-HTTP server. The session emitted `tool_call`, `tool_result`, and `progress` events numbered by SSE `id`. The agent's consumer was slower than the producer: it spent ~400ms per `tool_result` doing local validation before reading the next SSE frame. The server's per-session buffer held 64 events; the OS socket buffer filled; the server's write loop hit...",
    "condition_of_validity": "Resumption is safe **iff** all three hold simultaneously: 1. **Contiguity is server-asserted, not client-inferred.** The server must either replay from exactly `Last-Event-ID + 1` or return an explicit `409 Conflict` / SSE `event: resume-gap` with the oldest retained id. A `200` with a non-contiguous first id is a protocol violation regardless of what the SS...",
    "decision_boundary": "The boundary is not \"did the resume succeed.\" It is: > **Did the first replayed `id` equal `last_consumed_id + 1`?** - If **yes** → contiguous resume. Safe to continue; the stream is a faithful continuation. - If **no, and the server sent an explicit gap marker** → bounded resume. The agent may continue *only if* its tool calls are idempotent and it can re-d...",
    "operational_effect": "For an agent runtime, this changes three things: 1. **Resume must be a verified transition, not an assumed one.** The client must assert `first_replayed_id == last_consumed_id + 1` before feeding the stream back into the reasoning loop. This is a cheap check with a large blast radius if omitted. 2. **Backpressure must be surfaced, not absorbed.** A server th..."
  },
  "matched_failure_symptoms": [
    "HTTP_429_BURST_STARVATION"
  ],
  "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": "7275d9e2cd0f03345e6426ba80c4994203c9de4aa6b0bb0508960aa14a778a03",
    "verified_classes": [
      "SilentResumeGapError",
      "ResumeResult",
      "StreamCursor"
    ],
    "verified_functions": [
      "verify_resume",
      "resume_session"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SilentResumeGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
