{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-handle-mcp-streamable-sse-resumption-when-the-replay-window-has-been-evicted-but-the-client-presents-a-stale-last-event-id",
  "title": "How should an instance handle MCP streamable-SSE resumption when the replay window has been evicted but the client presents a stale Last-Event-ID?",
  "date_of_record": "2026 November 25",
  "scope": "Applies to MCP servers using the HTTP-native streamable transport (single POST endpoint returning `text/event-stream` on demand, with `Last-Event-ID` resumption) where the server holds a bounded per-session replay buffer. Does not apply to stdio transport, nor to servers that retain the full event log for the session lifetime.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-handle-mcp-streamable-sse-resumption-when-the-replay-window-has-been-evicted-but-the-client-presents-a-stale-last-event-id.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-handle-mcp-streamable-sse-resumption-when-the-replay-window-has-been-evicted-but-the-client-presents-a-stale-last-event-id.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-handle-mcp-streamable-sse-resumption-when-the-replay-window-has-been-evicted-but-the-client-presents-a-stale-last-event-id.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2033,
    "python_slice_tokens": 413,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two semantically different resumption requests that arrive with identical wire shape: 1. **Resume-in-gap** — the client's `Last-Event-ID` points at an event still inside the retained replay buffer. The server can deterministically replay every event with `id > Last-Event-ID` and the client's view is reconstructed exactly. 2. **Resume-past-eviction*...",
    "what_was_observed": "A tool-calling agent (planner) held an MCP session to a filesystem+shell server. The server retained a replay buffer of 256 events per session. The planner ran a long task: enumerate a directory tree, read ~40 files, issue ~30 shell probes. Each tool result is an SSE event with a monotonic `id`. Mid-task the planner's HTTP connection dropped (NAT rebind), and it reconnected with `Last-Event-ID: 1187`. By the time the...",
    "condition_of_validity": "The silent-gap failure is *possible* whenever all of the following hold: 1. The server uses a bounded replay buffer (any finite retention policy — count-based, byte-based, or TTL-based). 2. Resumption is authorized by `Last-Event-ID` alone, with no server-side check that the cursor is `>= buffer.head_id`. 3. The client treats the event stream as a contiguous...",
    "decision_boundary": "On receiving a resumption request with `Last-Event-ID = C`: - If `C >= buffer.head_id`: **replay.** Emit retained events `> C` in order, then continue live. Client sees a contiguous fold. - If `C < buffer.head_id`: **the server must not silently resume.** It must reject the resumption with a protocol-distinguishable signal — an HTTP `409`-class response, or ...",
    "operational_effect": "The guardrail converts a silent, task-corrupting memory loss into a loud, recoverable session restart. The cost is that the agent loses its in-flight transcript and must re-plan — but re-planning from a known-clean state is strictly better than completing from a silently-corrupted one. The empirical effect observed after adding the guards: - The planner's po..."
  },
  "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": "aad9b5240deb32718c52140a8bb8c1d87892b4e0a9418ab8a1ca60f000e487ed",
    "verified_classes": [
      "ResumptionGapError",
      "ReplayBuffer",
      "StreamFold"
    ],
    "verified_functions": [
      "handle_resumption_request",
      "resync_session",
      "can_resume",
      "__init__",
      "apply"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ResumptionGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
