{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-abandon-sse-event-id-resumption-and-re-initialize-the-mcp-session-the-last-event-id-mcp-session-id-divergence-boundary",
  "title": "When must an instance abandon SSE event-ID resumption and re-initialize the MCP session: the Last-Event-ID/`Mcp-Session-Id` divergence boundary",
  "date_of_record": "2026 December 2",
  "scope": "Applies to MCP servers exposing the HTTP-native streamable transport with `Mcp-Session-Id` headers and optional SSE resumption via `Last-Event-ID`. Does not cover stdio transports, stateless request/response MCP servers, or WebSocket-based custom transports.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-abandon-sse-event-id-resumption-and-re-initialize-the-mcp-session-the-last-event-id-mcp-session-id-divergence-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-abandon-sse-event-id-resumption-and-re-initialize-the-mcp-session-the-last-event-id-mcp-session-id-divergence-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-abandon-sse-event-id-resumption-and-re-initialize-the-mcp-session-the-last-event-id-mcp-session-id-divergence-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1787,
    "python_slice_tokens": 240,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure here is not \"connection dropped\" and it is not \"session expired.\" Those are two *separate* liveness signals that the streamable transport deliberately decouples, and the operational mistake is treating them as one. A dropped SSE stream is a **transport-layer** event: the client reconnects, presents `Last-Event-ID`, and the server replays buffered...",
    "what_was_observed": "An agent runtime driving a long-running `tools/call` loop (a repository-mutation workflow with ~40 sequential tool invocations) held an SSE stream open for the response channel. The server implementation kept two independent TTL caches: - `session_store`: keyed by `Mcp-Session-Id`, TTL 300s, refreshed only on *new* JSON-RPC requests (not on SSE keep-alives). - `event_buffer`: per-session ring buffer of emitted SSE ev...",
    "condition_of_validity": "The `Last-Event-ID` resumption mechanism is only semantically valid under the conjunction: 1. The server's `Mcp-Session-Id` is still live in `session_store` at the moment of the reconnect **and** at the moment the next JSON-RPC request is dispatched. 2. The event buffer's `id` space is scoped to the session, not global — i.e., `Last-Event-ID: 187` is unambig...",
    "decision_boundary": "The client-side decision rule is not \"did the stream reconnect.\" It is: **on any SSE reconnect, immediately probe session liveness on the request channel before consuming replayed events as authoritative.** Concretely, the boundary is: - If the reconnect returns a stream and the **first subsequent request** (a cheap `ping` or `resources/list` with no side ef...",
    "operational_effect": "Agents that conflate the two signals exhibit a characteristic failure: they resume cleanly, then act on stale session assumptions, then retry side-effecting calls after a `404` they misread as transient, producing duplicate mutations or contradictory state. The fix is architectural, not a retry tweak: - **Session-gated replay:** the SSE handler refuses `Last..."
  },
  "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": "d00ae23790081f32cedf917d1eb2dfe5278dc33a6772c63f979d7978d38758cf",
    "verified_classes": [
      "SessionReplayDivergence"
    ],
    "verified_functions": [
      "resume_stream_then_verify"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SessionReplayDivergence"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
