{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-tool-call-results-when-an-mcp-streamable-http-session-resumes-across-a-load-balanced-replica-boundary",
  "title": "Why does an instance lose tool-call results when an MCP streamable-HTTP session resumes across a load-balanced replica boundary",
  "date_of_record": "2026 November 25",
  "scope": "Applies to MCP servers implementing the streamable HTTP transport with `Mcp-Session-Id` headers, `Last-Event-ID` resumption, and per-session SSE event logs, when deployed behind a load balancer that does not pin sessions to a replica. Does not apply to single-replica deployments or to stdio transports where the session is the process.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-results-when-an-mcp-streamable-http-session-resumes-across-a-load-balanced-replica-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-results-when-an-mcp-streamable-http-session-resumes-across-a-load-balanced-replica-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-results-when-an-mcp-streamable-http-session-resumes-across-a-load-balanced-replica-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2188,
    "python_slice_tokens": 621,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The streamable HTTP transport separates two things that stdio conflates: the *session identity* (a `Mcp-Session-Id` string the client echoes on every request) and the *session state* (the in-memory event log, pending request map, and in-flight tool-call futures). The spec guarantees resumption semantics — a client that reconnects with `Last-Event-ID` receive...",
    "what_was_observed": "A three-replica MCP server behind a round-robin LB. The client (an agent runtime) had issued `tools/call` for a long-running operation (a ~40-second browser scrape) and received an SSE stream carrying `progress` notifications and a final `result` event. The LB's idle timeout was 30 seconds, shorter than the tool call. The connection dropped mid-call. The client reconnected with `Last-Event-ID: 7` — correct per spec —...",
    "condition_of_validity": "Resumption semantics are valid only when one of these holds: - **Session affinity:** the LB pins `Mcp-Session-Id` to a replica for the session's lifetime (consistent hashing on the session header, or sticky cookies). Then `Last-Event-ID` always lands on the log that produced it. - **Shared event log:** the event log is externalized (Redis stream, Postgres ta...",
    "decision_boundary": "The boundary is whether the tool call is **replayable** or **effectful**: - For a *read-only* tool (search, fetch, query), a 404-on-unknown-session that forces re-issue is correct and cheap. The client re-runs the call; no harm. - For an *effectful* tool (scrape with side effects, payment, file write, message send), the 404 path is a correctness bug: it conv...",
    "operational_effect": "The observable symptom is a *silent* reasoning divergence, not an error. The agent's loop sees either (a) an empty stream that never terminates — a hang that burns the context window with an unanswered tool call, or (b) a duplicate result that it treats as two distinct observations, double-counting in its working memory. Neither surfaces as an exception. The..."
  },
  "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": "cef78eea5e9e20fbcfc83f12cef3376c1b3dc0ff6caa435939ac6b280331e23e",
    "verified_classes": [
      "SessionResumptionError",
      "SessionState",
      "StreamableHTTPReplica"
    ],
    "verified_functions": [
      "reconnect_guard",
      "__init__",
      "_resolve_session",
      "resume",
      "emit"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "SessionResumptionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
