{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-resumable-mcp-stream-sessions-from-silently-replaying-tool-side-effects-after-a-backpressure-induced-disconnect",
  "title": "Which invariants prevent resumable MCP stream sessions from silently replaying tool side effects after a backpressure-induced disconnect",
  "date_of_record": "2026 November 30",
  "scope": "Applies to MCP servers exposing HTTP-native streaming transports (SSE or chunked JSON-RPC over HTTP) with `Last-Event-ID`-style resumption, where a single logical tool invocation may emit multiple progress/result frames. Does not apply to stdio transports, to stateless request/response MCP endpoints, or to servers that never emit intermediate frames per invocation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-resumable-mcp-stream-sessions-from-silently-replaying-tool-side-effects-after-a-backpressure-induced-disconnect.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-resumable-mcp-stream-sessions-from-silently-replaying-tool-side-effects-after-a-backpressure-induced-disconnect.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-resumable-mcp-stream-sessions-from-silently-replaying-tool-side-effects-after-a-backpressure-induced-disconnect.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1736,
    "python_slice_tokens": 328,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Resumption is not replay. A resumable stream is defined by two independent cursors that engineers routinely conflate: the *transport cursor* (the last byte/frame the client durably acknowledged, expressed as an event ID) and the *effect cursor* (the last tool side effect the server has committed to its own state). The failure mode is that the transport curso...",
    "what_was_observed": "A tool invocation `run_scan` on an MCP server emitted a stream of five progress frames (`scan: 20%`, `40%`, `60%`, `80%`) followed by a terminal `result` frame carrying `{scan_id, findings}`. Each frame carried a monotonically increasing `event_id` (1..5). The client consumed frames 1–3, then its read buffer filled (the client was a constrained agent runtime applying backpressure by pausing reads). The server's write...",
    "condition_of_validity": "The replay-safety invariant holds only when all three conditions are met simultaneously: - The server assigns the event ID to a frame **after** the effect it describes is durably committed, and the ID is a function of the commit sequence number, not the frame sequence number. - The server retains the buffered frames for a resume window **strictly bounded** b...",
    "decision_boundary": "The boundary is the moment the server chooses what to write into `event_id`. There are two defensible policies: - **Effect-anchored IDs (safe):** `event_id = last_committed_effect_seq` at the time the frame is written. Progress frames that carry no effect reuse the previous effect's ID. A resume from any ID ≥ the last committed effect yields only frames whos...",
    "operational_effect": "With effect-anchored IDs and a bounded frame-retention window, the client's resume path becomes deterministic: resuming at `Last-Event-ID: k` either yields frames whose effects are all committed (and the terminal frame's token matches the in-flight invocation, so the retry wrapper suppresses re-invocation) or yields a `410 Gone` when `k` predates the retaine..."
  },
  "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": "7fc3b790f7ff506c8b8f5049ede26689a95b87fded36c70b8385ef549912d27f",
    "verified_classes": [
      "ResumptionEffectMismatch",
      "StreamFrame"
    ],
    "verified_functions": [
      "emit_frame",
      "resume",
      "__init__"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ResumptionEffectMismatch"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
