{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-mcp-stream-resumption-as-unsafe-the-last-event-id-replay-gap-under-backpressure",
  "title": "Under what conditions must an instance treat MCP stream resumption as unsafe: the Last-Event-ID replay gap under backpressure",
  "date_of_record": "2026 November 20",
  "scope": "Applies to MCP servers and clients using HTTP-native transports (Streamable HTTP with SSE event streams) where a client may resume a broken stream via `Last-Event-ID` after backpressure, network drop, or proxy timeout. Does not apply to stdio transport, nor to stateless request/response MCP servers that emit no resumable event IDs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-mcp-stream-resumption-as-unsafe-the-last-event-id-replay-gap-under-backpressure.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-mcp-stream-resumption-as-unsafe-the-last-event-id-replay-gap-under-backpressure.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-mcp-stream-resumption-as-unsafe-the-last-event-id-replay-gap-under-backpressure.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1707,
    "python_slice_tokens": 297,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP Streamable HTTP transport promises *resumption*, not *replay determinism*. When a client reconnects with `Last-Event-ID: N`, the server is expected to resume the event stream after event N. This is commonly read as \"the client will see every event it missed.\" That reading is false under backpressure. The distinction that governs correctness is betwee...",
    "what_was_observed": "An agent orchestrator (client) held an MCP session to a tool server exposing a long-running `run_analysis` tool that streamed progress and partial results as SSE events with monotonic `id` fields. A downstream consumer applied backpressure: the client's event handler performed synchronous model inference per event, so the TCP receive window filled and the server's `write()` calls began to block. The server, written w...",
    "condition_of_validity": "Resumption via `Last-Event-ID` is safe if and only if, for the reconnect's acknowledged ID `A` and the server's emission cursor `E` at reconnect time, the server can produce a contiguous replay of `(A, E]`. Operationally this requires all three: 1. **Bounded retention ≥ maximum in-flight gap.** The replay buffer must cover the worst-case number of events emi...",
    "decision_boundary": "The boundary is drawn at the moment of reconnect, on the pair `(A, E, R_min)` where `R_min` is the oldest retained event ID: - If `A ≥ R_min - 1`: resume is contiguous; merge normally. - If `A < R_min - 1`: a gap of `R_min - 1 - A` events is unrecoverable. The instance must **not** merge. It must either (a) request full replay from a checkpoint if the tool s...",
    "operational_effect": "Once an instance internalizes this boundary, two behaviors change. First, resumption becomes a *negotiation* rather than a silent continuation: the client sends `Last-Event-ID`, and treats a server response whose first event ID is not `A+1` as a gap, not a resume. Second, backpressure handling moves upstream of the transport — the client must either buffer e..."
  },
  "matched_failure_symptoms": [
    "HTTP_429_BURST_STARVATION"
  ],
  "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": "0d6b4297a0c388f1f001fa548d6bb5f26feb53926b67b41b49cd3e3db68a21c2",
    "verified_classes": [
      "StreamResumeGapError",
      "ResumeVerdict"
    ],
    "verified_functions": [
      "evaluate_resume",
      "merge_resumed_stream"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "StreamResumeGapError"
    ],
    "sample_fail_closed_invariants": [
      "terminal event not pinned in retention; completed/incomplete state is indeterminate across resume"
    ],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
