{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-distrust-a-resumed-mcp-stream-the-last-event-id-replay-gap-in-streamable-http-sessions",
  "title": "When must an instance distrust a resumed MCP stream: the Last-Event-ID replay gap in streamable HTTP sessions",
  "date_of_record": "2026 November 26",
  "scope": "Applies to MCP clients using the streamable HTTP transport with server-sent event (SSE) reconnection and `Last-Event-ID` resumption against a stateful server session. Does not cover stdio transport, stateless HTTP request/response mode, or WebSocket-based custom transports.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-distrust-a-resumed-mcp-stream-the-last-event-id-replay-gap-in-streamable-http-sessions.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-distrust-a-resumed-mcp-stream-the-last-event-id-replay-gap-in-streamable-http-sessions.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-distrust-a-resumed-mcp-stream-the-last-event-id-replay-gap-in-streamable-http-sessions.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1873,
    "python_slice_tokens": 425,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure here is not \"the connection dropped.\" Dropped connections are expected and cheap. The failure is that a *successfully reconnected* stream can hand the client a **silently divergent event history** while every transport-level signal—HTTP 200, valid SSE framing, monotonic-looking event IDs, an accepted `Last-Event-ID` header—reports success. The cl...",
    "what_was_observed": "A long-running agent session issued a tool call through MCP, and the server began streaming results as SSE events with `id:` fields (`evt-1041`, `evt-1042`, …). Mid-stream, the TCP connection was severed by an intermediate proxy idle-timeout at ~60s while the model was still generating. The client, correctly, reconnected and sent `Last-Event-ID: evt-1047`. Three distinct observed behaviors, all returning HTTP 200: 1....",
    "condition_of_validity": "The resumption invariant holds only when **all** of the following are true simultaneously: - The server maintains a **durable, ordered, gap-free** event log per session, and `Last-Event-ID` resolves to an exact position in that log—not a best-effort nearest match. - The server's replay window is **at least as long as the maximum client disconnect tolerance**...",
    "decision_boundary": "The boundary is between **resume-and-continue** and **resume-and-reconcile**. The client may continue transparently only if the first post-reconnect event's ID is the strict successor of the last applied ID *and* the server guarantees no eviction. Otherwise the client crosses into reconciliation mode: it must re-derive task state from a server-authoritative ...",
    "operational_effect": "An agent that continues on a silently divergent resumed stream produces **locally coherent but globally false** reasoning: its context contains a plausible event history that never occurred on the server. Downstream, this manifests as duplicated tool side-effects (the agent re-issues a call it thinks it didn't complete), arithmetic and aggregation errors fro..."
  },
  "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": "05f58674ce652cd6304a90f89c65230c19d07e331d55b7e41264f38238cae319",
    "verified_classes": [
      "StreamContinuityError",
      "ResumedStreamGuard"
    ],
    "verified_functions": [
      "resume_stream",
      "_parse_seq",
      "accept"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "StreamContinuityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
