{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-pin-mcp-streamable-http-sessions-to-a-single-replica-before-backpressure-can-be-trusted",
  "title": "Under what conditions must an instance pin MCP streamable-HTTP sessions to a single replica before backpressure can be trusted",
  "date_of_record": "2026 November 30",
  "scope": "Applies to MCP servers using the streamable-HTTP transport with multiple replicas behind a load balancer, where a single logical session spans a POST request stream and a paired GET SSE stream. Does not apply to stdio transport, single-replica deployments, or stateless JSON-RPC-over-HTTP shims where each request is fully self-contained.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-pin-mcp-streamable-http-sessions-to-a-single-replica-before-backpressure-can-be-trusted.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-pin-mcp-streamable-http-sessions-to-a-single-replica-before-backpressure-can-be-trusted.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-pin-mcp-streamable-http-sessions-to-a-single-replica-before-backpressure-can-be-trusted.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2097,
    "python_slice_tokens": 491,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct kinds of \"connection\" in the streamable-HTTP MCP transport, and conflating them is the root of the failure. The **transport connection** is the TCP/TLS socket the LB sees. The **session** is a server-assigned identifier (`Mcp-Session-Id`) that binds a POST request-stream and a GET event-stream into one logical conversation with shared ...",
    "what_was_observed": "A four-replica MCP server behind a round-robin LB with keep-alive enabled. A single agent client opened a session, issued `initialize`, received `Mcp-Session-Id: s-7f3a`, then opened the GET SSE stream and began issuing `tools/call` POSTs concurrently from a worker pool of eight. Trace of the failure: 1. `initialize` POST → replica R1. R1 creates session `s-7f3a`, stores request table and empty event queue, returns t...",
    "condition_of_validity": "Session-pinned backpressure is valid if and only if all three hold simultaneously: - **Affinity is session-keyed, not connection-keyed.** The LB (or an ingress rule) routes on `Mcp-Session-Id` (header or path segment), not on source-IP hash or round-robin. Connection-level affinity is insufficient because the spec permits the GET stream on a separate connect...",
    "decision_boundary": "The boundary is **whether the GET stream and the POST stream for a session can be routed independently.** If the transport guarantees they share a connection (many clients do this by default, and some servers enforce it), connection affinity suffices and the whole class of failure is out of scope. If the transport permits them to split — and the streamable-H...",
    "operational_effect": "When the invariant holds, backpressure bounds memory per session and the client sees monotonic progress: each `tools/call` result arrives on the same SSE stream that carries its correlation ID. When it breaks, three effects compound: 1. **Silent queue divergence.** The owning replica buffers events no consumer will read; memory grows to the hard cap, then ev..."
  },
  "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": "3753871a49854421de7fd1e9a251c1393b60d4ed5c86b87898d4f3b2475b11cf",
    "verified_classes": [
      "SessionAffinityError",
      "SessionState",
      "Replica"
    ],
    "verified_functions": [
      "route_get_stream",
      "apply_backpressure",
      "issue_request"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "SessionAffinityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
