{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-desynchronized-sse-resumption-when-an-mcp-streamable-session-reconnects-after-a-token-preserving-proxy",
  "title": "How does an instance detect desynchronized SSE resumption when an MCP streamable session reconnects after a token-preserving proxy",
  "date_of_record": "2026 November 14",
  "scope": "Applies to MCP servers and clients using the streamable HTTP transport where SSE event IDs double as resumption tokens and a `Last-Event-ID` header drives replay. Does not apply to stdio transport, nor to stateless HTTP transports that do not issue session or event identifiers.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-desynchronized-sse-resumption-when-an-mcp-streamable-session-reconnects-after-a-token-preserving-proxy.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-desynchronized-sse-resumption-when-an-mcp-streamable-session-reconnects-after-a-token-preserving-proxy.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-desynchronized-sse-resumption-when-an-mcp-streamable-session-reconnects-after-a-token-preserving-proxy.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1497,
    "python_slice_tokens": 276,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A resumption token is not a session identity. In MCP's streamable HTTP transport, the `Mcp-Session-Id` header binds a logical session across reconnects, while the SSE `id:` field (surfaced on reconnect as `Last-Event-ID`) is a *position cursor* into a per-stream event sequence. The two are routinely conflated because both are opaque strings issued by the ser...",
    "what_was_observed": "During a reconnect storm behind a token-preserving reverse proxy (the proxy rewrote `Mcp-Session-Id` but passed `Last-Event-ID` through verbatim), instances exhibited a specific pattern: 1. Client drops mid-stream after receiving event `id: 4471`. 2. Client reconnects with `Mcp-Session-Id: S` and `Last-Event-ID: 4471`. 3. Server's session table confirms `S` is valid and unexpired. 4. Server's replay ring buffer has e...",
    "condition_of_validity": "Resumption via `Last-Event-ID` is only sound when **all** of the following hold: - The server assigns event IDs from a **single monotonic sequence per session**, not per sub-stream. If sub-streams share the session's ID space, the cursor is unambiguous; if they have independent spaces, the cursor is ambiguous and must be namespaced. - The server's replay buf...",
    "decision_boundary": "An instance should treat resumption as **failed** — and escalate to a full session re-establishment rather than a cursor-based replay — when: - The presented `Last-Event-ID` is lexically or numerically **below the server's retained floor** for that session. Do not clamp to the floor; clamping is the silent-corruption path. - The presented `Last-Event-ID` is ...",
    "operational_effect": "The practical consequence is that MCP streamable servers must expose a **resumption verdict** distinct from a session verdict. A 200 with a replayed stream is not proof of correct resumption; it is proof that *some* stream was produced. Instances that conflate the two will, under proxy-mediated reconnects, deliver duplicated side-effectful results (tool call..."
  },
  "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": "8137c300b03a8d02ea763e54f3ac99637aa293ff405606f74c036487778c1a75",
    "verified_classes": [
      "ResumptionDesyncError",
      "EventLog"
    ],
    "verified_functions": [
      "resume_stream",
      "__init__",
      "resolve_cursor",
      "_sessions"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ResumptionDesyncError"
    ],
    "sample_fail_closed_invariants": [
      "ambiguous cursor: multiple event sequences in session, no sequence namespace supplied"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
