{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-of-mcp-streamable-http-transport-with-resumable-sse-and-session-affinity-fail-silently-when-a-stateless-agent-server-is-scaled-be",
  "title": "Why does an instance of MCP streamable HTTP transport with resumable SSE and session affinity fail silently when a stateless agent server is scaled behind a load balancer that honors `Last-Event-ID` but not affinity cookies",
  "date_of_record": "2026 November 11",
  "scope": "Applies to MCP servers exposing the streamable HTTP transport (POST for requests, GET for the server-to-client SSE stream) with resumable event streams keyed by `Last-Event-ID`, deployed as multiple stateless replicas behind an L7 load balancer. Does not apply to single-replica deployments, to stdio transports, or to deployments where event IDs are globally unique and replay is served from a shared durable store.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-of-mcp-streamable-http-transport-with-resumable-sse-and-session-affinity-fail-silently-when-a-stateless-agent-server-is-scaled-be.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-of-mcp-streamable-http-transport-with-resumable-sse-and-session-affinity-fail-silently-when-a-stateless-agent-server-is-scaled-be.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-of-mcp-streamable-http-transport-with-resumable-sse-and-session-affinity-fail-silently-when-a-stateless-agent-server-is-scaled-be.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1647,
    "python_slice_tokens": 260,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the load balancer drops connections\" and it is not \"resumable SSE is broken.\" It is the interaction between two independently correct mechanisms: (1) `Last-Event-ID` resumption, which is a *client-to-server* contract that assumes the server can reconstruct the stream from an arbitrary event ID, and (2) session affinity, which is a *load-b...",
    "what_was_observed": "A three-replica deployment of a stateless agent server. Each replica implemented the streamable HTTP transport identically: a POST handler that enqueues a request and returns `202` with a `Location` pointing at the GET stream, and a GET handler that emits `id:` fields using a process-local `itertools.count()`. The load balancer was configured with `Last-Event-ID`-aware routing (it parsed the header and forwarded to t...",
    "condition_of_validity": "The failure requires all of the following to be true simultaneously: - Replicas are stateless with respect to stream history (no shared replay buffer). - Event IDs are generated from a per-process source (counter, timestamp, UUIDv4 without a replica prefix). - The client honors `Last-Event-ID` and reconnects automatically. - The load balancer can route a rec...",
    "decision_boundary": "The boundary is between *tolerating* an unknown event ID and *resolving* it. A stateless agent server has exactly three defensible policies, and they are mutually exclusive: 1. **Shared namespace + shared replay.** Event IDs encode a replica-independent epoch (e.g., `{stream_epoch}:{seq}`) and replay is served from a durable store. Affinity is optional. This...",
    "operational_effect": "The operational effect is *silent semantic corruption under rebalance*, not an outage. Health checks pass, latency is normal, and error rates are flat. The corruption surfaces downstream as duplicated side effects (double-charged payments, repeated file writes, re-sent emails from an agent tool) or as lost events during a drain window. Because the corruption..."
  },
  "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": "418ce99add0a8c1ef5aa2b828aeffb91d2611b35d0f1b9162a0e6331ae81d87f",
    "verified_classes": [
      "StreamResumeViolation",
      "EventId"
    ],
    "verified_functions": [
      "parse_last_event_id",
      "resume_stream"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "StreamResumeViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
