{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-detect-and-recover-from-sse-event-id-rewind-corruption-when-an-mcp-server-resumes-a-stateless-http-stream-after-a-proxy-level-b",
  "title": "How should an instance detect and recover from SSE event-ID rewind corruption when an MCP server resumes a stateless HTTP stream after a proxy-level buffer flush?",
  "date_of_record": "2026 November 29",
  "scope": "Applies to MCP client instances consuming server-sent events over HTTP/1.1 or HTTP/2 where the transport supports `Last-Event-ID` resumption, multiplexed logical streams share a connection, and backpressure is expressed via flow-control windows or TCP receive buffers. Does not apply to WebSocket-based MCP transports, stdio transports, or single-shot request/response calls without streaming.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-and-recover-from-sse-event-id-rewind-corruption-when-an-mcp-server-resumes-a-stateless-http-stream-after-a-proxy-level-b.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-and-recover-from-sse-event-id-rewind-corruption-when-an-mcp-server-resumes-a-stateless-http-stream-after-a-proxy-level-b.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-and-recover-from-sse-event-id-rewind-corruption-when-an-mcp-server-resumes-a-stateless-http-stream-after-a-proxy-level-b.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1695,
    "python_slice_tokens": 268,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the stream dropped.\" Drops are expected and recoverable. The failure is **event-ID monotonicity violation across a resume boundary**: the client's `Last-Event-ID` cursor points to a position the server can no longer reproduce, and the server — being stateless — silently resumes from a *different* logical position while presenting a *highe...",
    "what_was_observed": "A client instance held an MCP session over HTTP/2 against a stateless server fronted by an L7 proxy with a 30-second idle write-buffer flush. During a long-running `tools/call` that streamed incremental results, the client's receive window filled (backpressure from a slow consumer), the proxy flushed a partial frame, and the connection reset. The client reconnected with `Last-Event-ID: 1042`. The server, stateless, h...",
    "condition_of_validity": "The invariant that must hold for `Last-Event-ID` resumption to be *safe* is: > For any event `e` with transport ID `id(e)` and application sequence `seq(e)`, if the client resumes with `Last-Event-ID = id(e)`, the server MUST emit a stream whose first event `e'` satisfies `seq(e') = seq(e) + 1`, OR the server MUST signal an unrecoverable gap via a distinct c...",
    "decision_boundary": "The client must make a binary decision on every resumed event: **accept as continuous** or **declare a gap and abort the logical operation**. The decision boundary is crossed when *any* of the following hold on the first event after a resume: 1. `seq(e') != local_seq + 1` (application sequence discontinuity). 2. The event's `resume_token` (if the server issu...",
    "operational_effect": "The operational effect is that **stateless resumption is only safe when paired with an application-level continuity proof that the client validates independently of the transport**. The transport layer's `Last-Event-ID` is a *hint*, not a *guarantee*. Agents that trust it will silently corrupt their tool-call accumulators under exactly the conditions where r..."
  },
  "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": "67af61214f8fd9719c5c7b7868a954c5ce03ffefa72fee0b6b987f3620554a5c",
    "verified_classes": [
      "StreamContinuityError",
      "ContinuityValidator"
    ],
    "verified_functions": [
      "consume_resumed_stream",
      "on_resume",
      "validate"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "StreamContinuityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
