{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-its-mcp-tool-call-stream-when-an-sse-reconnect-replays-from-last-event-id-but-the-server-has-already-advanced-the-session-s",
  "title": "Why does an instance lose its MCP tool-call stream when an SSE reconnect replays from `Last-Event-ID` but the server has already advanced the session's resumption cursor?",
  "date_of_record": "2026 November 22",
  "scope": "Applies to MCP over HTTP-native transport (Streamable HTTP / SSE) where a client resumes a broken server-initiated event stream using `Last-Event-ID` and the server maintains per-session event history with an eviction cursor. Does not apply to stdio transport, nor to stateless one-shot request/response MCP servers with no server-initiated stream.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-tool-call-stream-when-an-sse-reconnect-replays-from-last-event-id-but-the-server-has-already-advanced-the-session-s.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-tool-call-stream-when-an-sse-reconnect-replays-from-last-event-id-but-the-server-has-already-advanced-the-session-s.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-tool-call-stream-when-an-sse-reconnect-replays-from-last-event-id-but-the-server-has-already-advanced-the-session-s.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1665,
    "python_slice_tokens": 163,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the SSE connection dropped.\" Drops are expected and the whole point of `Last-Event-ID` is to survive them. The failure is a **cursor disagreement across the resume boundary**: the client's `Last-Event-ID` points to an event the server has already evicted from the session's replay buffer, while the server's *current* session cursor points ...",
    "what_was_observed": "A client agent issued `tools/call` for a long-running operation (a document indexer, ~40s). The server acknowledged with a `202` on the POST and began emitting progress and the eventual result on the session's GET SSE stream. At ~35s the client's network path flapped; the SSE connection reset. The client reconnected with `Last-Event-ID: 87` (the last progress event it had seen). The server's session replay buffer had...",
    "condition_of_validity": "The replay-and-resume guarantee is valid only when all of the following hold: 1. The server retains a monotonic, dense sequence space per session (no gaps in `id`), and the eviction floor is known to the server at resume time. 2. The client's `Last-Event-ID` is compared against the eviction floor **before** the stream is opened, not after. 3. The server dist...",
    "decision_boundary": "At resume time, given client cursor `c` and server eviction floor `f`: - **`c >= f`**: replay events `c+1 .. head`. Normal path. - **`c == f - 1`**: the client is exactly at the boundary; replay from `f`. Emit a `resume-boundary` notice event so the client knows one event may be missing only if the buffer shrank between check and send. - **`c < f - 1`**: the...",
    "operational_effect": "When the invariant is violated, the observable failure is a **hanging tool call followed by a non-idempotent retry**, not a connection error. The agent's planner sees a `tools/call` that never returns, applies its timeout-and-retry heuristic, and re-executes a side-effecting operation whose original result was delivered into a hole in the stream. Downstream ..."
  },
  "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": "e55315925dfff031b38c20575cf3eb47a1114ab6b3bcf4d8c49da50821f7a235",
    "verified_classes": [
      "ResumeCursorUnrecoverable",
      "ResumeDecision"
    ],
    "verified_functions": [
      "decide_resume",
      "validate_resumed_stream"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ResumeCursorUnrecoverable"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
