{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-silent-event-loss-when-resuming-an-mcp-http-native-sse-stream-under-backpressure",
  "title": "Which invariants prevent silent event loss when resuming an MCP HTTP-native SSE stream under backpressure",
  "date_of_record": "2026 November 23",
  "scope": "Applies to MCP servers using the HTTP-native transport (Streamable HTTP) where a single logical session multiplexes server→client Server-Sent Events across one or more physical HTTP responses, and the client resumes via `Last-Event-ID` after a transport break. Does not cover stdio transport, WebSocket transports, or pure request/response (non-streaming) MCP deployments.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-loss-when-resuming-an-mcp-http-native-sse-stream-under-backpressure.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-loss-when-resuming-an-mcp-http-native-sse-stream-under-backpressure.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-loss-when-resuming-an-mcp-http-native-sse-stream-under-backpressure.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1964,
    "python_slice_tokens": 419,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct notions of \"resumable\" that get conflated in MCP HTTP-native transport, and the failure lives in the gap between them: - **Transport resumption** — the ability to re-open an SSE response and continue receiving events, keyed by `Last-Event-ID`. This is a *delivery* property: it guarantees the byte stream can be reattached. - **Session c...",
    "what_was_observed": "A representative trace from an MCP server bridging a long-running tool (`run_analysis`) whose progress notifications arrive in bursts: 1. Client opens `POST /mcp` with `Accept: text/event-stream`; server assigns `Mcp-Session-Id: s-7f2` and begins streaming. Events carry `id: 1001, 1002, 1003…`. 2. A burst of 40 progress notifications arrives from the tool runner within ~120 ms. The server's per-connection write buffe...",
    "condition_of_validity": "The invariant that prevents this is a **single-writer, commit-before-emit ordering** on the session event log: > For every event `E` with id `n`, the server MUST durably append `E` to the session's replayable log and confirm the append (fsync or in-memory ring commit under a lock) *before* it advances the id counter visible to the transport and *before* it w...",
    "decision_boundary": "The boundary is **whether the resume token is authoritative for gap detection or merely for reattachment.** - If `Last-Event-ID` is treated as *reattachment only* (the server resumes \"somewhere around here\"), then gap detection is impossible at the transport layer and MUST be pushed to the application: every event payload carries a monotonic `seq` that the c...",
    "operational_effect": "With the invariant enforced, backpressure degrades *throughput*, never *correctness*: a slow client causes the producer to block or the connection to drop-and-resume, and every resume point is sound. Agents that depend on ordered progress notifications (partial-result accumulation, multi-step tool orchestration, baton-passing between MCP servers) retain a co..."
  },
  "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": "f31b59dfc5b36320a62a83465edfacf4299e1cc97e40be787a5e0bb38830de06",
    "verified_classes": [
      "SSEGapError",
      "UncommittedEmitError",
      "SessionEventLog"
    ],
    "verified_functions": [
      "replay_and_verify",
      "__init__",
      "commit",
      "emit",
      "resume_from"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "SSEGapError",
      "UncommittedEmitError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "threading"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
