{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-streamable-session-resumption-from-silently-forking-an-mcp-session",
  "title": "Which invariants prevent streamable-session resumption from silently forking an MCP session",
  "date_of_record": "2026 November 8",
  "scope": "Applies to MCP servers exposing the HTTP-native \"streamable\" transport where a client may resume an interrupted server-initiated SSE stream via a resumption token / `Last-Event-ID` after a network break, and where the server may independently re-initiate SSE pushes. Does not apply to stdio transports, to stateless per-request HTTP transports without session affinity, or to WebSocket transports where the connection itself is the session.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-streamable-session-resumption-from-silently-forking-an-mcp-session.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-streamable-session-resumption-from-silently-forking-an-mcp-session.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-streamable-session-resumption-from-silently-forking-an-mcp-session.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1637,
    "python_slice_tokens": 407,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A streamable MCP session has two identities that are easy to conflate: the **session identity** (the logical conversation, keyed by `Mcp-Session-Id` and its server-side state) and the **stream identity** (a specific server-initiated SSE stream, keyed by a per-stream resumption token). Resumption is correct only when a reconnect re-binds to the *same stream i...",
    "what_was_observed": "In a deployment where the MCP server pushed progress notifications over a server-initiated SSE stream, a client behind a flaky NAT dropped its TCP connection mid-stream after receiving event id `41`. The client reconnected with `Last-Event-ID: 41` but omitted the resumption token because its HTTP library dropped a custom header on the retry. The server treated the request as a *new* stream request (no token → no exis...",
    "condition_of_validity": "The gap-free single-stream invariant holds only under all of the following, and fails if any is missing: 1. The resumption token and `Last-Event-ID` are **co-validated**: a resume is honored only if both identify the same stream and the server's emitted high-water mark for that stream is `>= Last-Event-ID`. A token alone, or an id alone, is insufficient. 2. ...",
    "decision_boundary": "When a resume request arrives, the server must choose among: (a) resume the identified stream from `Last-Event-ID`; (b) reject with a resumable error and require the client to start a new session; (c) start a new stream, explicitly flagged as new. The boundary is: **if the server cannot prove stream identity and gap-freedom, it must choose (b), never (c) sil...",
    "operational_effect": "Systems that enforce the invariant observe resumption as idempotent: replaying a resume yields the same continuation or a clean, typed rejection, and duplicate side effects do not occur. Systems that violate it observe intermittent, load-dependent duplication and cursor drift that only manifests under connection churn — precisely the condition least covered ..."
  },
  "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": "b352a4fc0df201728b62e104a85a9a334a2c7954b76c4099981f243b51f1b9fc",
    "verified_classes": [
      "StreamResumptionError",
      "StreamState",
      "Session"
    ],
    "verified_functions": [
      "resume_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "StreamResumptionError"
    ],
    "sample_fail_closed_invariants": [
      "resume requires both resumption_token and Last-Event-ID; treat reconnect as a new session request"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
