{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-re-establish-event-id-monotonicity-after-an-mcp-stream-resumes-behind-a-load-balancer",
  "title": "Where must an instance re-establish event-ID monotonicity after an MCP stream resumes behind a load balancer",
  "date_of_record": "2026 November 27",
  "scope": "Applies to MCP servers exposing HTTP-native streaming (SSE) with resumable sessions (`Last-Event-ID` replay) fronted by L7 load balancers or any multi-replica fan-out. Does not apply to single-process stdio transports or to stateless request/response MCP endpoints with no event log.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-re-establish-event-id-monotonicity-after-an-mcp-stream-resumes-behind-a-load-balancer.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-re-establish-event-id-monotonicity-after-an-mcp-stream-resumes-behind-a-load-balancer.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-re-establish-event-id-monotonicity-after-an-mcp-stream-resumes-behind-a-load-balancer.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2127,
    "python_slice_tokens": 430,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the stream disconnected.\" Disconnection is normal and the resumable-SSE contract exists precisely to survive it. The failure is that **event-ID monotonicity is a per-connection property in most implementations but a per-session property in the protocol's intent**. When a client reconnects with `Last-Event-ID: N`, the server is obligated t...",
    "what_was_observed": "An MCP server was deployed as three replicas behind a round-robin L7 balancer with no session affinity. Sessions were stored in each replica's local memory; a shared Redis was used only for the session *metadata* (capabilities, negotiated schema), not the event log. A client agent held an open SSE stream for a long-running `tools/call` that emitted progress events with monotonically increasing integer IDs. Trace of t...",
    "condition_of_validity": "The invariant that must hold for resumable SSE to be sound is: > For any session S and any client-observed last-event-ID N, a reconnect with `Last-Event-ID: N` must yield a contiguous replay of exactly the events in `(N, current]` for S, with stable IDs, regardless of which replica serves the reconnect. This holds only when one of the following is true: - **...",
    "decision_boundary": "The operational decision is **when to treat a resumed stream as authoritative versus when to force session re-initialization**. The boundary is drawn at the first event received after reconnect: - If the first replayed event's ID is exactly `N+1` (or the session has no events in `(N, current]` and the stream is correctly idle), accept the resumption. The log...",
    "operational_effect": "Without the guardrail, the failure mode is **silent result loss with a healthy-looking stream**: agents block on tool calls whose results were emitted but never delivered, exhausting token budgets or wall-clock deadlines while server logs show success. Retries amplify the problem if the tool is non-idempotent — the agent re-issues a `tools/call` whose origin..."
  },
  "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": "86764e780f3c3000739987aeeb4f5c0422a93120fdcceccfc7ecca8c8648c34a",
    "verified_classes": [
      "StreamResumeViolation",
      "StreamEvent",
      "ResumableStreamGuard"
    ],
    "verified_functions": [
      "resume_session",
      "__init__",
      "accept",
      "consume"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "StreamResumeViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
