{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-an-mcp-stream-resumption-last-event-id-mismatch-as-a-hard-session-identity-violation-rather-than-a-benign",
  "title": "Under what conditions must an instance treat an MCP stream-resumption `Last-Event-ID` mismatch as a hard session-identity violation rather than a benign replay gap",
  "date_of_record": "2026 November 26",
  "scope": "Applies to MCP servers and clients using the HTTP-native transport with Server-Sent Events streaming and event-ID-based resumption (`Last-Event-ID` on reconnect). Does not apply to stdio transports, to stateless request/response MCP deployments, or to resumption schemes that carry no server-assigned event IDs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-an-mcp-stream-resumption-last-event-id-mismatch-as-a-hard-session-identity-violation-rather-than-a-benign.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-an-mcp-stream-resumption-last-event-id-mismatch-as-a-hard-session-identity-violation-rather-than-a-benign.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-an-mcp-stream-resumption-last-event-id-mismatch-as-a-hard-session-identity-violation-rather-than-a-benign.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1807,
    "python_slice_tokens": 261,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP HTTP transport lets a client resume a broken SSE stream by presenting the last event ID it observed. The naive mental model is that this is a *replay cursor*: the server looks up events after that ID and continues. That model is wrong in a way that matters for agents. The real invariant is that the event ID is a **session-scoped monotonic witness of ...",
    "what_was_observed": "A long-running agent session issued a tool call that streamed results over SSE. The stream dropped at the network layer (proxy idle timeout) mid-tool-execution. The client reconnected with `Last-Event-ID: 4471`. The server had, in the intervening ~40 seconds, been restarted by its supervisor; its event counter had reset and climbed back to 4489 on a *new* session for a *different* client. The reconnecting client's `4...",
    "condition_of_validity": "Resumption by `Last-Event-ID` is only sound when the server can prove the presented ID was minted by the *same session incarnation* that is now serving the reconnect. Concretely, at least one of the following must hold: - Event IDs are namespaced by an immutable session incarnation token (e.g., `sess_<incarnationUUID>:<seq>`) so that a foreign ID is *structu...",
    "decision_boundary": "The boundary is this: **a `Last-Event-ID` that cannot be attributed to the current session incarnation must be rejected with an explicit session-invalid response, forcing the client to re-initialize rather than resume.** The client, in turn, must treat that rejection as \"my in-flight tool call is unrecoverable; do not splice\" — not as \"retry the resume.\" The...",
    "operational_effect": "When the boundary is enforced, the failure mode changes from *silent state corruption* to *loud, recoverable session reset*. The agent's runtime catches the session-invalid rejection, discards the in-flight tool call's partial state, and re-plans from its last checkpointed turn — a bounded, observable cost. When the boundary is not enforced, the cost is unbo..."
  },
  "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": "ad23059892f705ce56af84c791088ed1ffad6711cec788f25d16f49a641bd33f",
    "verified_classes": [
      "SessionIdentityViolation"
    ],
    "verified_functions": [
      "resume_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SessionIdentityViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
