{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-silent-event-loss-when-an-mcp-streamable-http-session-resumes-across-a-renegotiated-transport",
  "title": "Which invariants prevent silent event loss when an MCP streamable-HTTP session resumes across a renegotiated transport",
  "date_of_record": "2026 November 24",
  "scope": "Applies to MCP servers and clients using the streamable-HTTP transport where a session is established via `Mcp-Session-Id`, an SSE stream is opened for server→client notifications, and resumption is attempted via `Last-Event-ID` after a disconnect. Does not cover stdio transport, nor pure request/response MCP usage with no server-initiated stream.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-loss-when-an-mcp-streamable-http-session-resumes-across-a-renegotiated-transport.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-loss-when-an-mcp-streamable-http-session-resumes-across-a-renegotiated-transport.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-loss-when-an-mcp-streamable-http-session-resumes-across-a-renegotiated-transport.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1796,
    "python_slice_tokens": 302,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the client reconnected and missed a message.\" It is subtler: the client reconnected, *successfully negotiated a new stream*, and the server accepted `Last-Event-ID` — yet the two sides disagree about **which session the resumed stream belongs to**. Streamable HTTP lets a client reinitialize a transport (new SSE `GET`, possibly a fresh `Mc...",
    "what_was_observed": "A long-running agent held an MCP session against a tool server that pushed progress notifications (partial results from a slow `run_query` tool) over an SSE stream. The server enforced a 300-second idle-session TTL; the client's keepalive was a 60-second SSE comment (`:ping`). Under normal load the ping kept the session alive. During a GC pause on the server host, the reaper ran late but still ran: it evicted the ses...",
    "condition_of_validity": "The silent-loss path requires all of the following to hold simultaneously; remove any one and the failure is bounded: - **Session reaping is independent of cursor validity.** The server's session store and its event-log store have separate lifecycles, so a cursor can outlive the session that scoped it. - **The client caches `Last-Event-ID` across `initialize...",
    "decision_boundary": "The boundary is a single branch in the server's SSE handler, evaluated *after* session lookup and *before* stream establishment: - **If `Last-Event-ID` is absent** → fresh stream from head. Always valid. - **If `Last-Event-ID` present and its namespace matches the resolved session** → replay from cursor, then live. Valid. - **If `Last-Event-ID` present but i...",
    "operational_effect": "The practical consequence is that **resumability is only as strong as the binding between cursor and session**, and that binding is not carried by either header alone. Two independent, individually-correct subsystems — session lifecycle and event-log replay — compose into a silent data-loss bug at their seam. The agent experiences this as a *hang-then-timeou..."
  },
  "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": "182d4fb0d39d52e3c1e00be549d0339f9123aa79de99c75709cfc9328b7f34a2",
    "verified_classes": [
      "ResumeCursorMismatch",
      "Session"
    ],
    "verified_functions": [
      "resolve_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ResumeCursorMismatch"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
