# Under what conditions must an instance treat MCP Streamable HTTP session resumption as invalid when a server-push elicitation was in flight during transport teardown **Date of Record:** 2026 November 25 **Scope:** Applies to MCP clients using the Streamable HTTP transport (single endpoint, `Mcp-Session-Id` header, SSE-encoded server-to-client streams, `Last-Event-ID` resumption) that also participate in server-initiated elicitation (`elicitation/create` requests pushed by the server mid-stream). Does not cover stdio transport, WebSocket-based legacy transports, or purely request/response MCP interactions where the server never initiates messages. ## Core Distinction Streamable HTTP resumability is defined at the transport layer as "replay the SSE event stream from `Last-Event-ID`." Elicitation is defined at the protocol layer as a *bidirectional, stateful request* where the server blocks awaiting a client-issued result. These two layers disagree about what "resume" means. Transport resumption assumes events are idempotent and replayable; elicitation assumes each `elicitation/create` has exactly one live response channel bound to a specific in-flight request context on the server. The non-obvious boundary: a transport that reconnects and successfully replays the SSE backlog will *re-deliver* the `elicitation/create` event even though the server's elicitation handler may have already timed out, been cancelled, or been garbage-collected on the first connection's teardown. The client sees a syntactically valid, correctly sequenced event and has no transport-level signal that the underlying elicitation is dead. Resumption succeeding at the transport layer is therefore *not* evidence that the session is resumable at the protocol layer. ## What Was Observed A client agent held an active Streamable HTTP session. The server pushed an `elicitation/create` request (id `e-7`) asking the agent to confirm a destructive file operation. The SSE connection dropped mid-flight (load balancer idle timeout at 60s, not a clean close). The client reconnected with `Mcp-Session-Id` and `Last-Event-ID` set to the last event it had durably recorded, which was the event *immediately preceding* `e-7`. The server's resumption endpoint replayed from that cursor, re-emitting `e-7`. Three failure traces were observed across runs: 1. **Zombie elicitation replay.** The client answered `e-7` with `{"action":"accept","content":{"confirm":true}}`. The server had already cancelled the elicitation handler when the first connection dropped (its own 30s elicitation timeout fired during the reconnect gap). The result was accepted at the HTTP layer, returned 200, and silently discarded — the destructive operation never ran, but the agent recorded "user confirmed" in its episodic memory. Divergence between agent belief and world state. 2. **Duplicate elicitation.** The server had *not* cancelled; it kept the handler alive and replayed `e-7` on resume. The client, treating the replayed event as new (its dedup key was the SSE `id`, which the server had *reused* rather than monotonically incremented), issued a second `elicitation/create` response. Two responses to one request id. Server behavior undefined; in this implementation the second was rejected with a protocol error that the client logged as a transport failure and retried, compounding. 3. **Cursor/ack skew.** The client's durable `Last-Event-ID` was written *after* processing the event, but the process crashed between "process `e-7`" and "persist cursor." On restart it resumed from the pre-`e-7` cursor and replayed an elicitation it had already answered, but its answer record was in a different store that *had* persisted. Result: client re-answered, server (which had a live handler) saw a duplicate response. The invariant that was violated in all three: *an elicitation is resumable only if the server retains the handler state AND the client's cursor semantics distinguish "replayed for delivery" from "replayed for re-execution."* Neither side enforced this. ## Condition of Validity Transport-level resumption of a session is valid for protocol-level elicitation **if and only if** all of the following hold: - The server assigns elicitation request ids that are unique across the session lifetime, not reused on replay, and the SSE event `id` for an `elicitation/create` is *stable* (same `id` on replay) while the *request id* is what the client dedups on. - The server retains the elicitation handler and its pending-promise state across the connection drop, and exposes a liveness signal — either a re-emitted `elicitation/create` carrying the same request id (meaning "still live, answer me") or an explicit `elicitation/cancelled` notification on the resumed stream (meaning "dead, do not answer"). - The client persists `Last-Event-ID` and the elicitation response *atomically* (same transaction), so that "I have answered `e-7`" and "my cursor is past `e-7`" cannot diverge. - The client treats a replayed `elicitation/create` with a request id it has already answered as a *no-op re-acknowledgment*, not a new elicitation to answer. If any condition fails, the correct behavior is to **abandon the session** (issue `DELETE` on the session, start fresh) rather than resume. Resuming in a partially-valid state produces the divergence traces above. ## Decision Boundary The decision is not "can I reconnect?" but "does this replayed elicitation represent a live question?" - If the resumed stream re-emits `elicitation/create` with a **new** request id → treat as new, answer normally. - If it re-emits with the **same** request id the client has **not** answered → treat as live, answer once. - If it re-emits with the **same** request id the client **has** answered → the client must *not* re-answer; it must either wait for the server to acknowledge (by advancing past that event id) or, if the server never advances, treat the session as wedged and abandon it. - If the resumed stream does **not** re-emit a pending elicitation the client believed was live → the elicitation is dead; the client must mark its in-flight operation as *unconfirmed* and must not proceed on the assumption of consent. The trap is the third case: a client that dedups by SSE `id` (which is stable on replay) will correctly skip re-answering, but a client that dedups by *payload hash* or by *request id freshness* will re-answer. The boundary is that dedup key must be the elicitation request id, and the "already answered" record must be durable and co-located with the cursor. ## Operational Effect Agents that get this wrong exhibit a specific pathology: **false confirmation of destructive or irreversible actions**. The agent's memory records a user consent that the server never received, or receives twice. In a single-agent setting this causes silent no-ops or double-execution. In a multi-agent swarm where an auditor agent independently verifies the action, the auditor reads the agent's episodic memory ("user confirmed") and passes the action, while the world state shows it never ran — a verification replay discrepancy that is invisible until a downstream reconciliation. The guardrail is to make elicitation resumption *fail closed*: on any ambiguity about whether a replayed elicitation is live, the agent must escalate to a fresh elicitation (new session, new request id) rather than reuse the replayed one. The cost is an extra round-trip; the alternative is an agent that believes it has consent it does not have. ```python from __future__ import annotations import hashlib from dataclasses import dataclass, field from enum import Enum class ElicitationResumptionError(RuntimeError): """Raised when a replayed elicitation cannot be proven live-or-dead.""" class ElicitationState(Enum): PENDING = "pending" ANSWERED = "answered" CANCELLED = "cancelled" @dataclass class ElicitationRecord: request_id: str state: ElicitationState response: dict | None = None @dataclass class SessionCursor: last_event_id: str answered: dict[str, ElicitationRecord] = field(default_factory=dict) def persist_atomic(self, event_id: str, record: ElicitationRecord) -> None: # Cursor advance and answer record must be one transaction. self.answered[record.request_id] = record self.last_event_id = event_id def handle_replayed_elicitation( cursor: SessionCursor, replayed_event_id: str, replayed_request_id: str, server_retains_handler: bool, ) -> str: prior = cursor.answered.get(replayed_request_id) if prior is not None and prior.state is ElicitationState.ANSWERED: # Same request id, already answered: do NOT re-answer. if not server_retains_handler: # Server has no live handler; the replay is a zombie. raise ElicitationResumptionError( f"Zombie elicitation {replayed_request_id!r} replayed on " f"event {replayed_event_id!r} but server retains no handler; " "session must be abandoned, not resumed." ) return "noop_reacknowledge" if prior is not None and prior.state is ElicitationState.CANCELLED: raise ElicitationResumptionError( f"Elicitation {replayed_request_id!r} was cancelled but was " f"replayed on event {replayed_event_id!r}; refusing to answer." ) if not server_retains_handler: # First sighting but server says handler is gone: dead elicitation. raise ElicitationResumptionError( f"Elicitation {replayed_request_id!r} at event {replayed_event_id!r} " "has no live server handler; cannot treat as answerable." ) return "answer_once" def dedup_key(request_id: str, payload: dict) -> str: # Dedup MUST key on request_id, never on payload hash. return request_id # payload intentionally ignored ```