{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-resumes-an-mcp-sse-stream-after-a-load-balancer-re-pins-its-session-to-a-cold-replica",
  "title": "What happens when an instance resumes an MCP SSE stream after a load-balancer re-pins its session to a cold replica",
  "date_of_record": "2026 November 28",
  "scope": "Applies to MCP servers exposing the HTTP-native streamable transport (POST for requests, GET SSE for server→client notifications) with `Last-Event-ID`-based resumption behind a stateful session-affinity layer (cookie, header, or consistent-hash LB). Does not apply to stateless stdio transports or to SSE deployments that terminate the event log at the edge and replay from a shared durable buffer keyed identically across replicas.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-sse-stream-after-a-load-balancer-re-pins-its-session-to-a-cold-replica.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-sse-stream-after-a-load-balancer-re-pins-its-session-to-a-cold-replica.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-sse-stream-after-a-load-balancer-re-pins-its-session-to-a-cold-replica.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2355,
    "python_slice_tokens": 322,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the stream dropped.\" Streams drop constantly and resumption is designed for exactly that. The failure is a **silent semantic divergence between the client's `Last-Event-ID` cursor and the server replica's event-log offset** when affinity re-routes a resume request to a replica that never produced the events the client is asking to skip pa...",
    "what_was_observed": "A tool-calling agent driving a long-running `filesystem` + `git` MCP server over the streamable transport. The server emits `notifications/tools/list_changed` and progress notifications on the SSE channel. Mid-task, the agent issued a `tools/call` for a `git rebase` that streamed progress every ~2s. The LB (consistent-hash on `Mcp-Session-Id`) had replica A pinned. A rolled during a deploy; the LB re-hashed the sessi...",
    "condition_of_validity": "Resumption via `Last-Event-ID` is sound **iff** all of the following hold: - The event-ID space is **globally monotonic per session**, not per replica. Either a single writer per session, or a shared sequencer (e.g., a durable log with a global offset), or IDs that encode `(replica_epoch, local_seq)` so a client can detect an epoch change. - The replica serv...",
    "decision_boundary": "The server, on receiving a resume GET with `Last-Event-ID: N`, must branch on a comparison it currently does not make: - **`N < log.low_water`** (client's cursor is older than the retained window): the events are gone. Do **not** silently resume at `log.high_water`. Emit a synthetic `notifications/stream_gap` (or close with a distinct code) so the client kno...",
    "operational_effect": "The compounding effect is what makes this a boundary failure rather than a dropped connection. Event-stream loss alone is recoverable: the agent re-syncs tool lists and continues, at worst missing a progress update. But the *silent* acceptance of a foreign cursor converts a transport hiccup into a **state-corrupting retry**: the agent cannot observe that 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": "dc98a509ee9737d97b6ec7a79504f6601fa403bc7a23e3c81243e082c7bb9279",
    "verified_classes": [
      "StreamCursorEpochMismatch",
      "EventLog"
    ],
    "verified_functions": [
      "resume_stream",
      "__init__",
      "replay_after"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "StreamCursorEpochMismatch"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
