{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-mcp-streamable-http-session-resumption-from-silently-duplicating-tool-effects-under-backpressure",
  "title": "Which invariants prevent MCP streamable-HTTP session resumption from silently duplicating tool effects under backpressure",
  "date_of_record": "2026 November 21",
  "scope": "Applies to MCP servers and clients using the streamable-HTTP transport (single POST endpoint, optional SSE upgrade, `Last-Event-ID` resumption, session ID via `Mcp-Session-Id`) where tool calls are non-idempotent and the server applies backpressure by delaying SSE emission. Does not apply to stdio transport, nor to servers that fully materialize every response before emitting the first event.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-streamable-http-session-resumption-from-silently-duplicating-tool-effects-under-backpressure.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-streamable-http-session-resumption-from-silently-duplicating-tool-effects-under-backpressure.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-streamable-http-session-resumption-from-silently-duplicating-tool-effects-under-backpressure.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1711,
    "python_slice_tokens": 317,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **transport-level resumption** and **effect-level replay**. The streamable-HTTP spec lets a client reconnect with `Last-Event-ID` to resume an interrupted SSE stream. This is a *byte-stream* guarantee: the server replays events after the given ID. It is **not** an *effect* guarantee: the server does not know, and the s...",
    "what_was_observed": "A tool-calling agent issued `tools/call` for a `transfer_funds` operation over streamable-HTTP. The server executed the tool, committed the ledger mutation, and began emitting the JSON-RPC response as SSE events `id=41`, `id=42`. The client's TCP receive window was saturated (the agent's event loop was blocked on a synchronous model inference step). The server's `write()` succeeded into the kernel socket buffer for b...",
    "condition_of_validity": "The invariant \"resumption is safe\" holds *only* when all of the following are true simultaneously: 1. **The client's `Last-Event-ID` reflects the last event it has durably processed and its side effects committed**, not the last event it received into memory. If the client advances the cursor before committing the effect, a crash between receive and commit c...",
    "decision_boundary": "The boundary is whether **the resumption cursor and the effect-commit cursor are the same cursor**. They are, in a correct implementation, if and only if the client persists `Last-Event-ID` *after* committing the effect derived from that event, and the server assigns IDs at outbox-append (post-execution, pre-flush). If they are two different cursors — the co...",
    "operational_effect": "The observable effect of getting this wrong is **double-execution under load**, and it is load-correlated: it appears precisely when backpressure is highest, because that is when the client's processed-cursor lags the server's emitted-cursor by the most events. It is invisible in unit tests (no backpressure), invisible in low-traffic staging (buffer never fi..."
  },
  "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": "4378be184bf110a8f2054e895b29e6e785b96838c06bdd7441f0abd34482c5d6",
    "verified_classes": [
      "ResumptionDuplicationError",
      "OutboxEntry",
      "SessionOutbox"
    ],
    "verified_functions": [
      "handle_resume",
      "append",
      "resume_from"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ResumptionDuplicationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
