{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-sse-last-event-id-replay-with-streamable-http-mcp-session-id-resumption-when-both-headers-are-present",
  "title": "How should an instance reconcile SSE `Last-Event-ID` replay with streamable-HTTP `Mcp-Session-Id` resumption when both headers are present",
  "date_of_record": "2026 November 18",
  "scope": "Applies to MCP servers and clients migrating from the legacy HTTP+SSE transport to the streamable-HTTP transport, specifically when a client presents both a `Last-Event-ID` header (SSE replay semantics) and an `Mcp-Session-Id` header (streamable-HTTP session semantics) on a resumed `POST`/`GET`. Does not apply to pure SSE deployments (no session id) or pure streamable-HTTP deployments (no event id).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-sse-last-event-id-replay-with-streamable-http-mcp-session-id-resumption-when-both-headers-are-present.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-sse-last-event-id-replay-with-streamable-http-mcp-session-id-resumption-when-both-headers-are-present.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-sse-last-event-id-replay-with-streamable-http-mcp-session-id-resumption-when-both-headers-are-present.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1389,
    "python_slice_tokens": 201,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The two transports encode *different notions of \"where was I\"* and they are not interchangeable. `Last-Event-ID` is a **transport-level replay cursor**: it names the last SSE event the client durably received, and the correct server behavior is to replay every event after that id from a retained buffer. `Mcp-Session-Id` is a **protocol-level session identity...",
    "what_was_observed": "During a rolling migration, a client library was updated to streamable-HTTP but retained its SSE reconnect logic. On a transient `502` mid-stream it reconnected with the last SSE event id it had buffered (`Last-Event-ID: 41`) *and* the session id from the `initialize` response (`Mcp-Session-Id: sess_9f...`). The server had, in the interim, compacted its SSE event buffer for that session after the client's prior `202 ...",
    "condition_of_validity": "The invariant holds only when the following are all true, and fails loudly or silently otherwise: 1. Event ids are **scoped to the session**, not to the process or connection. If ids are global, replay-by-id must additionally be filtered by `Mcp-Session-Id`. 2. The server retains a replay buffer keyed by session, with an explicit **low-water mark** (oldest r...",
    "decision_boundary": "On a resumed request carrying both headers, the server must compute `replay_from = Last-Event-ID + 1` and compare against `low_water_mark` for that session: - If `replay_from >= low_water_mark`: replay `[replay_from, head]` from the session buffer, then continue live. The session id confirms the buffer is the right one; the event id confirms the position. Bo...",
    "operational_effect": "After enforcing the decision boundary, the stale-cache incident class disappeared: clients that fell behind the low-water mark received an explicit `409` and re-initialized, which is observable and recoverable, instead of silently missing notifications. Cross-session replay leakage was eliminated by scoping event ids to sessions and filtering replay by `Mcp-..."
  },
  "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": "31ae3d34c4c175a6d3755b5c2ae0941be0e78b89395586319e5d03508ea93631",
    "verified_classes": [
      "ResumptionGapError"
    ],
    "verified_functions": [
      "resolve_resume",
      "__init__"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ResumptionGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
