{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-in-flight-tool-results-when-an-mcp-streamable-http-session-resumes-across-a-transport-restart",
  "title": "Why does an instance lose in-flight tool results when an MCP streamable HTTP session resumes across a transport restart",
  "date_of_record": "2026 November 24",
  "scope": "Applies to MCP servers/clients using the streamable HTTP transport with `Mcp-Session-Id` resumption and SSE event-stream replay (`Last-Event-ID`) when a session is re-established after a transport disruption. Does not apply to stdio transport, nor to stateless request/response MCP endpoints that never issue a session identifier.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-in-flight-tool-results-when-an-mcp-streamable-http-session-resumes-across-a-transport-restart.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-in-flight-tool-results-when-an-mcp-streamable-http-session-resumes-across-a-transport-restart.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-in-flight-tool-results-when-an-mcp-streamable-http-session-resumes-across-a-transport-restart.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1706,
    "python_slice_tokens": 346,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the connection dropped.\" TCP drops are routine and recoverable. The failure is that **session resumption and event replay are two independent durability domains that the protocol treats as if they were one**. The session identifier (`Mcp-Session-Id`) guarantees *logical* continuity of the agent's conversation state on the server. The SSE ...",
    "what_was_observed": "An agent instance issued a `tools/call` for a long-running operation (a multi-minute retrieval/aggregation tool) and received `202 Accepted` with the result to be delivered asynchronously over the SSE stream. Mid-execution, the HTTP/2 connection was reset by an intermediate load balancer during a deploy (a ~4-second window). The client reconnected with the same `Mcp-Session-Id` and `Last-Event-ID: 41`. The server's r...",
    "condition_of_validity": "The silent-gap failure requires all of the following to hold simultaneously: 1. Transport is streamable HTTP with a server-assigned session id and SSE delivery. 2. The server maintains a **bounded** replay buffer (any finite `Last-Event-ID` retention — ring buffer, TTL, or per-session cap). 3. A disconnect occurs while events are being produced faster than t...",
    "decision_boundary": "The correct architectural decision is to make the replay low-water mark an **explicit, checked boundary**, not an implicit one: - **On the server:** every resumption must compare the presented `Last-Event-ID` against `oldest_retained_event_id`. If `Last-Event-ID < oldest_retained - 1`, the server MUST refuse silent reattach and instead return a gap signal (e...",
    "operational_effect": "Without this boundary, the observable failure signature is an agent that (a) stalls on a tool result that was delivered into a skipped region, (b) exhausts budget and reports an incomplete plan with no error, and (c) under backpressure, duplicates side-effecting tool calls because liveness signal was silently dropped. All three present as \"the agent just sto..."
  },
  "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": "9b74fe82ef8e7c975d1f0a59b7c29583848836b646fe26ba365c261e3fadf1f3",
    "verified_classes": [
      "ReplayGapError",
      "ReplayWindow"
    ],
    "verified_functions": [
      "resume_session",
      "handle_backpressure_drop"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ReplayGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
