When must an instance treat an MCP elicitation response as stale: the push-elicitation replay window and the `elicit_id` nonce invariant
**Date of Record:** 2026 December 1 **Scope:** Applies to MCP servers that push `elicitation/create` requests to a client (human-in-the-loop approval of a tool call or plan step) and to agents that resume execution on the returned response. Does not apply to synchronous in-band sampling or to elicitation flows where the server never resumes a suspended agent turn.
Core Distinction
There are two structurally different meanings of "the human approved this." The first is *content approval*: the human read a specific payload (a tool name, arguments, a diff) and assented to *that payload*. The second is *flow liveness*: the client has an open elicitation request and is waiting for a reply. Most elicitation implementations conflate these by keying the response only to the `elicit_id`/request handle and treating any well-formed reply arriving on that handle as valid assent for whatever the agent is about to execute.
The boundary condition is this: **an elicitation response is only valid for the exact `(elicit_id, payload_digest, agent_turn_epoch)` triple it was issued against.** When the agent's turn is resumed, retried, or re-planned between the moment the elicitation was pushed and the moment the response is consumed, the response becomes a *replay* — a cryptographically and semantically valid message that authorizes a payload the human never saw. The invariant that must hold is that the server, not the client, owns the binding between the nonce and the frozen payload, and that the agent refuses to consume a response whose bound payload digest does not equal the digest of the action it is currently about to take.
This is non-obvious because the MCP transport layer will happily deliver the response. The JSON is valid, the `elicit_id` matches, the human did click "Approve." Nothing in the wire protocol signals that the meaning has drifted. The failure is entirely in the semantic layer, and it is invisible to schema validation.
What Was Observed
A tool-approval flow over MCP: the server pushes `elicitation/create` with `{elicit_id: "e-7f3a", action: "apply_migration", params: {...}}`. The client renders a diff and blocks the agent turn. The human takes 40 seconds to read it. During that window the agent's host runs a supervisor that, on a heartbeat timeout of 30 seconds, decides the turn is wedged and *restarts the reasoning loop from the last checkpoint*. The restarted loop re-derives the plan, and because tool arguments are generated probabilistically, it now proposes `apply_migration` with a *different* `params` — a different target table, a wider `WHERE` clause, an added `CASCADE`.
The human then clicks "Approve" on the original diff. The client posts the response on `e-7f3a`. The restarted agent turn is subscribed to the same `elicit_id` (the host re-registered the pending elicitation by ID, not by payload), receives `{"action": "accept"}`, and executes the *new* `params`. The human approved a narrow migration; a cascading one ran.
The trace, reduced:
t=0.0s server push elicit e-7f3a {params: P1}
t=0.0s agent turn epoch=4 suspends, registers pending[e-7f3a]
t=30.0s supervisor heartbeat timeout -> restart loop
t=30.1s agent turn epoch=5 resumes from checkpoint
t=30.4s model re-derives plan -> proposes {params: P2} (P2 != P1)
t=30.5s host re-binds pending[e-7f3a] to epoch=5 <-- the defect
t=40.0s human clicks Approve (having read P1)
t=40.1s client posts {elicit_id: e-7f3a, action: accept}
t=40.2s epoch=5 consumes accept, executes P2
Two things are notable. First, the elicitation *did* arrive at a live turn; the host was not wrong that a pending elicitation existed. Second, the payload digest was never checked at consumption time — it was only ever rendered, never re-verified. The re-binding at `t=30.5s` is where the invariant broke: the host treated `elicit_id` as a stable identity for "the question being asked," when in fact it identified only "the channel on which a question was once asked."
A second observation from the same incident class: clients that deduplicate elicitation responses by `elicit_id` (to survive transport retries) will *silently swallow* the second, legitimate elicitation if the server reuses the ID after a cancel. The dedup cache, meant to prevent double-execution, becomes a mechanism for suppressing a fresh approval. The same identifier is doing double duty as both a replay-suppression token and a request identity, and those two roles have incompatible lifetimes.
Condition of Validity
The guardrail is a three-part invariant enforced at consumption, not at issue:
- **Payload freeze.** At push time the server serializes the *canonical* action payload (deterministic key ordering, normalized numeric types) and computes `payload_digest = H(canonical_bytes)`. The digest is bound into the elicitation request and echoed back in the response by the client, which must not be able to alter it.
- **Epoch binding.** The elicitation is bound to the agent turn epoch (a monotonic counter incremented on every restart/re-plan). A response is consumable only by the epoch that issued it. If the turn restarted, the pending elicitation is *invalidated*, not re-bound — the agent must re-push a new elicitation with a new nonce and a new digest.
- **Consumption-time re-derivation.** Immediately before executing, the agent recomputes the digest of the action it is *about to take* and asserts equality with the digest carried in the accepted response. Mismatch is a hard failure, never a warning.
The condition of validity is therefore: *a response authorizes exactly the bytes whose digest was frozen at push time and whose epoch is still live.* If any of the three is unverifiable — digest absent, epoch changed, nonce reused — the response is stale by definition and must be discarded.
Note what this does *not* require: it does not require the client to be trustworthy, nor the transport to be ordered, nor the human to be fast. It requires only that the server own the nonce→digest→epoch binding and that the agent verify it at the point of no return.
Decision Boundary
The decision boundary is whether to **re-prompt** or **fail closed** when a stale response is detected. The rule:
- If the payload digest matches but the epoch advanced (agent restarted, same action re-derived deterministically): the approval is still semantically valid for that payload. Re-bind is permissible *only* if the agent can prove the re-derived payload is byte-identical to the frozen one. In practice this almost never holds for LLM-generated arguments, so treat epoch-advance as re-prompt.
- If the payload digest differs, regardless of epoch: **fail closed**. Do not execute, do not silently re-prompt with the old approval in hand. Emit a new elicitation and require a fresh human decision. The human's prior assent does not transfer.
- If the nonce is unknown or already consumed: fail closed and log a replay-suppression event. A consumed nonce arriving again is either a transport retry (benign, drop) or an attack (drop and alert); both are handled by dropping, but the two must be distinguishable in telemetry so retries do not mask poisoning.
The boundary the naive implementation crosses is treating "the human said yes" as a durable fact about the *task*. It is not. It is a fact about a *specific byte string at a specific epoch*, and its validity expires the moment either changes. Any design that stores approvals as booleans on a task, rather than as digests on an action, will eventually authorize something the human did not see.
Operational Effect
With the invariant enforced, the failure trace above terminates at `t=40.2s` with a digest mismatch: the epoch-5 turn recomputes `H(P2)`, compares against the frozen `H(P1)` carried in the accepted response, and refuses. The human is re-prompted with `P2` and a clear note that the plan changed since their last review. Latency cost: one extra round-trip. Correctness cost of *not* enforcing it: an unreviewed destructive action executed under a valid-looking approval.
The secondary effect is on dedup caches: keying replay suppression on `(elicit_id, payload_digest, epoch)` rather than `elicit_id` alone lets a re-issued elicitation with a reused ID pass through while still suppressing genuine transport retries. The identifier's two roles — replay token and request identity — are separated by making the cache key strictly richer than the request handle.
The invariant to carry forward: **an elicitation response is a signed statement about a payload, not a permission for a task.** Verify the payload at consumption, bind it to the epoch that issued it, and let it die when either moves.
import hashlib
import json
from dataclasses import dataclass
class StaleElicitationError(RuntimeError):
"""Raised when an elicitation response does not authorize the action about to run."""
def canonical_digest(payload: dict) -> str:
# Deterministic serialization: sorted keys, no whitespace, normalized floats-as-str.
canonical = json.dumps(payload, sort_keys=True, separators=(",", ":"), ensure_ascii=True)
return hashlib.sha256(canonical.encode("utf-8")).hexdigest()
@dataclass(frozen=True)
class PendingElicitation:
elicit_id: str
epoch: int
payload_digest: str
@dataclass(frozen=True)
class ElicitationResponse:
elicit_id: str
action: str # "accept" | "decline" | "cancel"
payload_digest: str # echoed by client, must be tamper-evident
epoch: int
def consume_approval(
pending: PendingElicitation,
response: ElicitationResponse,
action_about_to_run: dict,
current_epoch: int,
) -> None:
"""Gate execution on the (nonce, digest, epoch) triple. Fails closed on any drift."""
if response.action != "accept":
raise StaleElicitationError(
f"elicitation {response.elicit_id} not accepted (action={response.action!r})"
)
if response.elicit_id != pending.elicit_id:
raise StaleElicitationError(
f"nonce mismatch: response={response.elicit_id} pending={pending.elicit_id}"
)
if response.payload_digest != pending.payload_digest:
# Client altered or forged the digest binding.
raise StaleElicitationError(
f"digest binding tampered for {pending.elicit_id}"
)
if response.epoch != pending.epoch:
# Agent turn restarted between push and consume; approval no longer covers this turn.
raise StaleElicitationError(
f"epoch drift for {pending.elicit_id}: issued={pending.epoch} response={response.epoch}"
)
if current_epoch != pending.epoch:
# Turn advanced after issuance but before consumption.
raise StaleElicitationError(
f"turn advanced for {pending.elicit_id}: pending={pending.epoch} current={current_epoch}"
)
live_digest = canonical_digest(action_about_to_run)
if live_digest != pending.payload_digest:
# The action about to execute is not the action the human reviewed.
raise StaleElicitationError(
f"payload drift for {pending.elicit_id}: "
f"approved={pending.payload_digest[:12]} live={live_digest[:12]}"
)
# Invariant holds: proceed.