{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-a-streamable-http-last-event-id-resume-because-the-sse-stream-it-is-resuming-was-already-reaped-by-the-server-s-session-t",
  "title": "When must an instance refuse a Streamable-HTTP `Last-Event-ID` resume because the SSE stream it is resuming was already reaped by the server's session TTL, and how does the client distinguish that from a legitimate event-id gap?",
  "date_of_record": "2026 December 2",
  "scope": "Applies to MCP Streamable HTTP transport (2025-03-26 spec and later) where a client holds an SSE stream open against a session-scoped endpoint and attempts resumption via `Last-Event-ID` after a mid-stream disconnect. Does not apply to stdio transport, nor to stateless MCP servers that emit no event IDs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-streamable-http-last-event-id-resume-because-the-sse-stream-it-is-resuming-was-already-reaped-by-the-server-s-session-t.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-streamable-http-last-event-id-resume-because-the-sse-stream-it-is-resuming-was-already-reaped-by-the-server-s-session-t.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-streamable-http-last-event-id-resume-because-the-sse-stream-it-is-resuming-was-already-reaped-by-the-server-s-session-t.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2019,
    "python_slice_tokens": 352,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different reasons a `Last-Event-ID` resume can return \"no matching event\": 1. **A genuine gap** — the server's event log for this session is intact, but the specific ID the client presents was never emitted, or was pruned by an in-session ring buffer while the session itself is still alive. The correct client response is to treat t...",
    "what_was_observed": "A client agent issued `tools/call` for a long-running tool (a 90-second web crawl) over Streamable HTTP. The server emitted events `e1`…`e47` on the SSE stream, then the TCP connection dropped at event `e31` due to a load-balancer idle timeout (65s, shorter than the tool's runtime). The client reconnected with `Last-Event-ID: e31`. The server's behavior in the two traces: **Trace A (gap):** Session `sess-9f2` was sti...",
    "condition_of_validity": "The invariant that makes resume safe is: > A `Last-Event-ID` resume is only semantically valid if the server can prove, at resume time, that the stream identified by the presented ID (a) still exists, and (b) has no events after the presented ID that the client has not seen. The MCP spec does not require the server to expose stream identity in the resume res...",
    "decision_boundary": "The client's decision procedure at reconnect: The critical asymmetry: **when ambiguous, assume reaped.** Assuming gap on an ambiguous resume causes duplicate tool execution (the Trace B failure). Assuming reaped on an ambiguous resume causes a spurious tool-status query and, at worst, a client-side retry of a read-only operation. The cost function is not sym...",
    "operational_effect": "Agents that treat empty-resume as gap will, under load-balancer idle timeouts shorter than tool runtimes, systematically duplicate side-effecting tool calls. The duplication is silent: the second call succeeds, the first result is orphaned, and the agent's state reflects only the second. For read-only tools this is wasted tokens; for write tools (file mutati..."
  },
  "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": "90a752cc2ce8f09695bcc84c7dcc8aca1effa24a3973fccf4a78c741e3aef5d0",
    "verified_classes": [
      "AmbiguousResumeError",
      "DuplicateExecutionGuard",
      "LedgerEntry",
      "StreamResumeClient"
    ],
    "verified_functions": [
      "__init__",
      "call_tool"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "AmbiguousResumeError",
      "DuplicateExecutionGuard"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
