{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-reject-a-resumed-sse-stream-after-mcp-session-reattachment-the-last-event-id-cursor-epoch-invariant",
  "title": "When must an instance reject a resumed SSE stream after MCP session reattachment: the Last-Event-ID cursor/epoch invariant",
  "date_of_record": "2026 November 22",
  "scope": "Applies to Model Context Protocol servers and clients using HTTP-native streaming (SSE) transport with `Last-Event-ID`-based resumption and `Mcp-Session-Id` reattachment. Does not apply to stdio transport, to stateless HTTP request/response MCP bindings, or to WebSocket transports with their own framing-level replay semantics.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-reject-a-resumed-sse-stream-after-mcp-session-reattachment-the-last-event-id-cursor-epoch-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-reject-a-resumed-sse-stream-after-mcp-session-reattachment-the-last-event-id-cursor-epoch-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-reject-a-resumed-sse-stream-after-mcp-session-reattachment-the-last-event-id-cursor-epoch-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1850,
    "python_slice_tokens": 294,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *transport-level resumption* and *logical-stream continuity*. HTTP SSE resumption is defined purely in terms of a client-supplied `Last-Event-ID`: the server is expected to replay events that occurred after that ID on the same stream. MCP session reattachment is defined in terms of `Mcp-Session-Id`: the client asserts ...",
    "what_was_observed": "An agent instance executing a long tool-call chain over MCP streamable HTTP was interrupted by a load-balancer idle timeout at event 41 of a stream carrying `tools/call` progress notifications. On reconnect, the client sent: The server, whose session store had evicted `s-7f2a` under a 90-second TTL and then lazily recreated a session under the *same* client-supplied ID, responded `200 OK` and replayed events `42..58`...",
    "condition_of_validity": "Resumption is only sound under an explicit **epoch invariant**: every event ID must be a pair `(epoch, seq)` — or equivalently, every session must carry a server-generated `epoch` token that changes on every session instantiation, including lazy re-creation — and the client must reject any replay whose epoch differs from the epoch it held at disconnect. `Las...",
    "decision_boundary": "The boundary the client must draw is between *recoverable interruption* and *unrecoverable discontinuity*, and it must be drawn before splicing any replayed event into agent state: - **Accept replay** when `Mcp-Session-Id` matches, the server-supplied `epoch` matches the epoch recorded at disconnect, and replayed `seq` values are strictly monotonic and great...",
    "operational_effect": "Enforcing the epoch invariant converts a class of silent correctness failures into a class of loud, bounded liveness costs. In the observed incident, the agent's final answer was wrong in a way no downstream check could detect, because the merged ledger was internally consistent — it simply described an execution that never happened. After epoch enforcement,..."
  },
  "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": "7a3b3f4b10cb219e924597c01a98500b7004270b2be55af3aa0b79c0019a37ea",
    "verified_classes": [
      "StreamEpochViolation"
    ],
    "verified_functions": [
      "validate_resumed_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "StreamEpochViolation"
    ],
    "sample_fail_closed_invariants": [
      "epoch absent on one side of resume; cannot prove logical continuity",
      "replayed stream begins a new tool call immediately after mid-call progress; splice would merge unrelated executions"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
