{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-abandon-mcp-session-affinity-and-negotiate-stateless-http-fallback",
  "title": "Under what conditions must an instance abandon MCP session affinity and negotiate stateless HTTP fallback",
  "date_of_record": "2026 November 15",
  "scope": "Applies to MCP servers operating behind a load balancer or reverse proxy that terminates client connections and fronts a multi-instance pool, where the Streamable HTTP transport is in use with `Mcp-Session-Id` headers and the server may be asked to serve requests without a prior `initialize`. Does not apply to single-instance deployments, to stdio transport, or to servers that have never advertised session support in their `initialize` capabilities.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-abandon-mcp-session-affinity-and-negotiate-stateless-http-fallback.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-abandon-mcp-session-affinity-and-negotiate-stateless-http-fallback.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-abandon-mcp-session-affinity-and-negotiate-stateless-http-fallback.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1537,
    "python_slice_tokens": 386,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Session affinity in MCP is not a transport-level property; it is a *state ownership* property. A `Mcp-Session-Id` is a handle to server-side state (negotiated capabilities, subscriptions, in-flight sampling contexts). The load balancer's sticky routing is an *optimization* that makes that state reachable without coordination. The two are frequently conflated...",
    "what_was_observed": "During a rolling deploy of a four-instance MCP server pool behind an L7 proxy with cookie-based stickiness, roughly 3.1% of `tools/call` requests arriving in the 90-second window after each instance restart carried a `Mcp-Session-Id` minted by the *previous* generation of that instance. The proxy had re-pinned the connection to a new generation instance because the old one was drained. The new instance had an empty s...",
    "condition_of_validity": "Affinity is valid only while all three hold: 1. The session handle is cryptographically bound to the instance generation that minted it (e.g., HMAC over `{session_id, instance_generation, expiry}` with a key rotated per generation). 2. The proxy's stickiness and the server's session table agree on *generation*, not just on instance identity. 3. The client's ...",
    "decision_boundary": "- **Owned + live:** serve normally. - **Signed under current generation, absent from table:** this is a genuine bug (eviction without invalidation). Return 404, do not mint. - **Signed under prior generation:** the session is *known-stale*. Return 404 with a `Mcp-Session-Id` reset hint, and require the client to re-`initialize`. Do not silently adopt. - **Un...",
    "operational_effect": "Adopting the signed-generation rule eliminated the deploy-correlated error burst: unknown-generation sessions now produce a deterministic 404 that the client's spec-compliant re-initialize path handles in one round trip, and the 409 guard on unverifiable mutating requests eliminated the duplicate-side-effect class entirely (observed count went from 2 to 0 ac..."
  },
  "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": "9dac39e438e648c7af9f82d28847f42d39376ca2d123d122219e98faa6d0ce26",
    "verified_classes": [
      "SessionOwnershipError",
      "UnverifiableMutatingRequestError",
      "SessionToken",
      "SessionAuthority"
    ],
    "verified_functions": [
      "dispatch",
      "__init__",
      "_sign",
      "mint",
      "verify"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 7,
    "raised_exceptions": [
      "SessionOwnershipError",
      "UnverifiableMutatingRequestError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "hmac",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
