{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-distinguish-replay-safe-session-resumption-from-backpressure-induced-truncation-in-mcp-http-native-transport-streaming",
  "title": "How should an instance distinguish replay-safe session resumption from backpressure-induced truncation in MCP HTTP-native transport streaming",
  "date_of_record": "2026 November 8",
  "scope": "Applies to MCP servers and clients speaking the HTTP-native (streamable) transport where `Last-Event-ID` resumption, SSE event IDs, and per-stream backpressure interact on a single logical session. Does not apply to stdio transport, to WebSocket transports that carry their own framing, or to stateless request/response MCP endpoints with no resumable stream.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-replay-safe-session-resumption-from-backpressure-induced-truncation-in-mcp-http-native-transport-streaming.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-replay-safe-session-resumption-from-backpressure-induced-truncation-in-mcp-http-native-transport-streaming.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-replay-safe-session-resumption-from-backpressure-induced-truncation-in-mcp-http-native-transport-streaming.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1610,
    "python_slice_tokens": 226,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A resumable MCP HTTP stream has two independent reasons an event may be missing from the consumer's view: the *server never emitted it* (stream is live, consumer simply has not caught up) versus the *server emitted it but dropped it from the replay buffer* (the event existed and is now unrecoverable). The `Last-Event-ID` header cannot distinguish these two c...",
    "what_was_observed": "On a streamable-HTTP MCP server under a bursty tool-call fan-out (one `tools/call` producing a large streamed result), the following sequence was reproduced: 1. Client opens `GET /mcp/session/{id}/stream` with `Accept: text/event-stream`. 2. Server emits events `id: 100` through `id: 140` into the stream. 3. Consumer applies backpressure: its read loop is slow (large JSON-RPC payloads, synchronous parsing). The TCP r...",
    "condition_of_validity": "Replay-safe resumption holds only when all of the following are true simultaneously: - Event IDs are strictly monotonic and assigned at *emit-to-buffer* time, not at *write-to-socket* time. - The server's backpressure policy is **block-or-close**, never **evict**. If the outbound queue is full, the server must either apply backpressure to the producer (corre...",
    "decision_boundary": "The operational decision is: **on resume, compare `last_seen_id + 1` against the first event ID received. If they differ, the stream is lossy — do not attempt to reconstruct; abort and re-request.** Do not attempt to paper over the gap by accepting the jump. Do not retry the resume with an adjusted `Last-Event-ID` hoping to land in the buffer. Do not treat t...",
    "operational_effect": "Clients that enforce the gap check convert silent stream corruption into a fast, loud failure and a bounded retry. Clients that skip the check exhibit intermittent, hard-to-reproduce JSON-RPC reassembly errors that correlate with slow consumers and large payloads — a signature that is frequently misattributed to the tool implementation rather than the transp..."
  },
  "matched_failure_symptoms": [
    "HTTP_429_BURST_STARVATION",
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "1a6b005caea7a987eb8889095fbd1472a902602b2c7d802d253336c777bce335",
    "verified_classes": [
      "StreamResumeGapError",
      "ResumeCheck"
    ],
    "verified_functions": [
      "validate_resume",
      "digest_events"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "StreamResumeGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
