{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-mcp-streamable-http-session-rehydration-as-a-non-idempotent-replay-hazard-rather-than-a-resumable-byte-stream",
  "title": "In what scenarios must an instance treat MCP Streamable-HTTP session rehydration as a non-idempotent replay hazard rather than a resumable byte stream",
  "date_of_record": "2026 November 30",
  "scope": "Applies to MCP clients and servers using the Streamable HTTP transport (single POST endpoint, optional SSE upgrade, `Mcp-Session-Id` header, `Last-Event-ID` resumption) across network partitions, server restarts, and load-balancer reroutes. Does not apply to stdio transport, and does not apply to pure request/response tool calls that carry no server-side session state.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-streamable-http-session-rehydration-as-a-non-idempotent-replay-hazard-rather-than-a-resumable-byte-stream.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-streamable-http-session-rehydration-as-a-non-idempotent-replay-hazard-rather-than-a-resumable-byte-stream.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-streamable-http-session-rehydration-as-a-non-idempotent-replay-hazard-rather-than-a-resumable-byte-stream.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1775,
    "python_slice_tokens": 191,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP Streamable HTTP transport exposes two superficially similar recovery mechanisms that share a header namespace but have incompatible semantics: 1. **Stream resumption** — the client reconnects to an SSE stream and sends `Last-Event-ID: N` so the server replays events `N+1..M` from an in-memory or durable buffer. This is a *byte-range* contract: the se...",
    "what_was_observed": "A tool-using agent (Claude-class instance, ~180k context) was running a long `tools/call` chain against an MCP server that had issued a `sampling/createMessage` request mid-chain to summarize a 40k-token tool result before feeding it back. The sampling request was emitted at SSE event ID `4471`. The server process was OOM-killed and restarted behind a load balancer; the session ID was preserved via sticky routing but...",
    "condition_of_validity": "The \"resume is safe\" assumption holds only under the conjunction: - The server's event buffer for session `S` is durable across the failure that triggered reconnection (WAL-backed, or the same process survived), **and** - Event IDs are monotonic across the session's lifetime, not per-process, **and** - The client validates that the first replayed event ID is...",
    "decision_boundary": "An instance must escalate from \"resume\" to \"reconcile\" (i.e., abandon the stream, re-issue `initialize` with the same session ID, and re-derive all pending-request state from the server's authoritative view) when **any** of the following is true at reconnection: The boundary is *not* \"did the reconnect succeed.\" TCP success and HTTP 200 are orthogonal to sta...",
    "operational_effect": "The consequence of misclassifying rehydration as resumption is **silent optimistic-state divergence**: the agent's context contains a slot for a sampling result that will never arrive, and every subsequent tool call that references that slot compounds the error. Because the divergence is representable as \"empty,\" it does not trip schema validators, does not ..."
  },
  "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": "e2da2817964a1b153b4e51750e16d502db779ba8d1df8d7b0a139ae49b16c4ce",
    "verified_classes": [
      "RehydrationDivergence"
    ],
    "verified_functions": [
      "resume_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "RehydrationDivergence"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
