# What happens when an instance reattaches to an MCP SSE stream through a stateless gateway and the server initiates elicitation mid-replay **Date of Record:** 2026 November 26 **Scope:** Applies to MCP servers exposing the streamable HTTP transport with resumable SSE (`Last-Event-ID` reattachment) where the client reaches the server through a stateless HTTP gateway that does not pin requests to a backend instance. Does not apply to sticky-session gateways, direct connections, or transports where elicitation is not supported. ## Core Distinction There are two different things that "resume" in this transport, and they are not the same resource. The **event stream** is resumable: the client presents `Last-Event-ID` and the server replays events after that ID. The **elicitation request** is *not* resumable in the same sense—it is a server-initiated, bidirectional request that requires the client to send a correlated response back to *the same logical session* that issued it. Through a stateless gateway, the replay of the event stream and the delivery of the elicitation request can land on different backend instances, or on the same instance at different points in its session lifecycle. The invariant that must hold is: *an elicitation issued during a replayed window must be answerable by a client that only ever saw the replay, not the original live emission.* When the gateway breaks session affinity, this invariant silently fails: the client receives a replayed `elicitation/create` with an ID the backend that now holds the connection has never registered, and any response it sends is orphaned. ## What Was Observed A client agent lost its TCP connection to the gateway at event ID 41. The MCP server had, between ID 41 and ID 58, issued an `elicitation/create` request (event 47) asking the user/agent to confirm a destructive tool call. The client reconnected with `Last-Event-ID: 41`. The stateless gateway routed the reattachment to backend instance B; the original session had lived on instance A. Two distinct failure traces were observed depending on whether B had any record of the session: - **Trace 1 (B has a stale replica of the session):** B replayed events 42–58 from its replicated log, including the `elicitation/create` at 47. The client dutifully POSTed an `elicitation/response` for ID `elicit-47`. B looked up `elicit-47`, found no pending request (it was A's, and the pending-request table is not replicated), and returned `404 unknown request id`. The client treated this as a transport error and retried, compounding. - **Trace 2 (B has no session):** B replayed from a *different* origin, or rejected the `Last-Event-ID` as unknown and restarted the stream at the current head. The client never saw event 47 at all. The destructive tool call was never confirmed, yet the client's own replay logic, having seen events 48–58 that referenced the pending confirmation, proceeded to treat the elicitation as "answered by timeout" and executed the tool. Trace 2 is the dangerous one: the agent's replay handler inferred *absence of a live elicitation* from *absence of a replayed elicitation*, which is not a valid inference across a stateless gateway. ## Condition of Validity The resumable-SSE contract is only sound under a conjunction that is usually unstated: 1. The event log replayed by the reattaching instance is *the same log* the elicitation was written to (same session, same backend, or a backend whose pending-request table is part of the replicated state). 2. Elicitation request IDs are resolvable on whichever instance receives the response—i.e., the pending-request table is replicated alongside the event log, not held only in the issuing instance's memory. 3. The client's replay handler distinguishes "event not present in replay" from "event never occurred," and does not synthesize a default response for elicitations it cannot see. When any of these is false—as it is by default under a stateless gateway with per-instance pending-request tables—reattachment produces a *split-brain elicitation*: the stream says a confirmation is pending, the responder cannot find it, and the client's timeout logic resolves it to a default. The condition of validity for safe resumption is therefore: **the pending-elicitation table and the event log must share a replication boundary, or the client must refuse to answer any elicitation whose ID it did not observe in the live (pre-disconnect) stream.** ## Decision Boundary The boundary is: *does the client treat a replayed elicitation as actionable?* Two rules bound it. - If the elicitation ID was observed **live** before disconnect, the client may answer it on reattachment, but only if the gateway guarantees session affinity for the response POST (e.g., by carrying a session token that routes to the issuing instance). Without that guarantee, the response must be retried idempotently against the session, not the instance. - If the elicitation ID was observed **only in replay**, the client must not answer it and must not default it. It must re-request the elicitation explicitly (a fresh `elicitation/create` from the client side, or a `session/refresh` that forces the server to re-issue with a new ID). Treating a replayed elicitation as if it were live is the boundary violation. The server side has a symmetric boundary: it must not replay `elicitation/create` events as part of a resumable stream unless the pending-request table is co-replicated. If it cannot guarantee that, it must mark elicitation events as *non-replayable* (a distinct event class the client skips on reattachment) and re-issue them fresh after reattachment completes. ## Operational Effect Concretely, the failure mode is a destructive action executed without confirmation (Trace 2) or a livelock of retried responses against an instance that will never resolve them (Trace 1). Both are silent: no error surfaces at the protocol layer, because both the replay and the 404 are individually well-formed. The blast radius is bounded only by whether the elicitation gated something irreversible. The mitigation is architectural, not retryable: co-replicate the pending-request table with the event log, or classify elicitation events as non-replayable and force re-issue on reattachment, and have the client assert that any elicitation it answers was seen live. A client that cannot make that assertion must escalate to a fresh confirmation rather than infer one. ```python import hashlib from dataclasses import dataclass, field class SplitBrainElicitationError(RuntimeError): """Raised when a client is asked to act on an elicitation it cannot prove it observed in the live stream, or when a response targets a pending-request table that does not contain the request id.""" @dataclass class Elicitation: request_id: str observed_live: bool pending_on_instance: bool @dataclass class ReattachContext: last_event_id: int live_seen_ids: set = field(default_factory=set) pending_table: dict = field(default_factory=dict) # id -> instance def answer_elicitation(ctx: ReattachContext, elicit: Elicitation, response: dict) -> str: # Invariant 1: never answer an elicitation seen only in replay. if not elicit.observed_live and elicit.request_id not in ctx.live_seen_ids: raise SplitBrainElicitationError( f"elicitation {elicit.request_id} seen only in replay; " f"refusing to synthesize a response across stateless gateway" ) # Invariant 2: the pending-request table on the receiving instance # must actually contain the request, or the response is orphaned. if elicit.request_id not in ctx.pending_table: raise SplitBrainElicitationError( f"elicitation {elicit.request_id} not pending on receiving instance; " f"response would be orphaned (split-brain elicitation)" ) # Invariant 3: idempotent response keyed by request id, not instance. return hashlib.sha256( f"{elicit.request_id}:{sorted(response.items())}".encode() ).hexdigest() def handle_reattach(ctx: ReattachContext, replayed: list) -> list: actions = [] for ev in replayed: if ev.get("type") == "elicitation/create": el = Elicitation( request_id=ev["id"], observed_live=ev["id"] in ctx.live_seen_ids, pending_on_instance=ev["id"] in ctx.pending_table, ) if not el.observed_live: # Force fresh re-issue rather than defaulting. actions.append(("reissue", el.request_id)) else: actions.append(("answer", el.request_id)) return actions ```