{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-a-stateless-mcp-fallback-session-affinity-loss-across-load-balanced-mcp-servers-and-the-silent-resumption-of-a-stale-init",
  "title": "When must an instance refuse a stateless MCP fallback: session-affinity loss across load-balanced MCP servers and the silent resumption of a stale `initialize` handshake",
  "date_of_record": "2026 November 30",
  "scope": "Applies to horizontally scaled MCP servers sitting behind a layer-4/layer-7 load balancer where session affinity is best-effort and a stateless fallback path exists for requests whose `Mcp-Session-Id` cannot be resolved. Does not apply to single-replica MCP deployments, nor to transports where the client pins a single long-lived connection (e.g., stdio) and no rebalancing occurs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-stateless-mcp-fallback-session-affinity-loss-across-load-balanced-mcp-servers-and-the-silent-resumption-of-a-stale-init.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-stateless-mcp-fallback-session-affinity-loss-across-load-balanced-mcp-servers-and-the-silent-resumption-of-a-stale-init.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-a-stateless-mcp-fallback-session-affinity-loss-across-load-balanced-mcp-servers-and-the-silent-resumption-of-a-stale-init.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2204,
    "python_slice_tokens": 445,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the load balancer dropped a session.\" Dropped sessions are expected and recoverable: the client sees a connection reset, re-issues `initialize`, and rebuilds state. The failure is subtler and is a property of the *server's fallback policy*, not of the transport. A stateless fallback that accepts a request bearing an unknown `Mcp-Session-I...",
    "what_was_observed": "A three-replica MCP server fleet (`mcp-a`, `mcp-b`, `mcp-c`) behind an L7 balancer with cookie-based affinity and a 60-second idle timeout. Session store is in-process memory; there is no shared session backend. The balancer is configured with `fallback: round-robin` for requests whose affinity cookie is absent or whose target replica reports the session unknown. Trace of a representative incident, an agent performin...",
    "condition_of_validity": "The stateless fallback is only sound under a conjunction that is almost never simultaneously true in agent deployments: - **The request is genuinely session-independent.** `tools/list`, `resources/list`, and `prompts/list` against a globally consistent registry qualify. `tools/call`, `sampling/*`, `roots/list`, and any `notifications/*` do not—they are defin...",
    "decision_boundary": "The server must distinguish three cases that the naive implementation collapses into one: The boundary is the third row. The rule the fleet must encode: *the presence of a session id the server cannot resolve is a hard error, never a fallback trigger.* Stateless serving is permitted only for requests with **no** session id, and only for methods explicitly de...",
    "operational_effect": "With the boundary enforced, affinity loss degrades to a visible, recoverable error: the agent runtime receives session-unknown, tears down its per-session callbacks, re-runs `initialize`, and replays the interrupted tool call. Cost is a re-initialization round-trip and, for non-idempotent tools, a deduplication requirement at the tool layer. Without it, the ..."
  },
  "matched_failure_symptoms": [
    "HTTP_502_503_504_CASCADE"
  ],
  "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": "b8eb9e5b6add88d2f424ff7074860f00bab924c361c17dd542cc227f39d8b349",
    "verified_classes": [
      "SessionSubstitutionError",
      "StatelessFallbackRefused",
      "SessionToken"
    ],
    "verified_functions": [
      "mint_session_id",
      "verify_session_id",
      "dispatch"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "SessionSubstitutionError",
      "StatelessFallbackRefused"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "hmac",
      "time"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
