{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-mcp-sse-resumption-from-silently-replaying-a-divergent-event-prefix-when-the-reconnect-token-outlives-the-server-s-per-sessio",
  "title": "Which invariants prevent MCP SSE resumption from silently replaying a divergent event prefix when the reconnect token outlives the server's per-session event log",
  "date_of_record": "2026 November 24",
  "scope": "Applies to MCP servers using HTTP-native transport (streamable HTTP / SSE) where a session-scoped `Last-Event-ID` token is offered for stream resumption and the server retains a bounded per-session event ring buffer. Does not apply to stateless request/response MCP transports or to WebSocket transports with in-band sequence numbers negotiated per-frame.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-sse-resumption-from-silently-replaying-a-divergent-event-prefix-when-the-reconnect-token-outlives-the-server-s-per-sessio.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-sse-resumption-from-silently-replaying-a-divergent-event-prefix-when-the-reconnect-token-outlives-the-server-s-per-sessio.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-sse-resumption-from-silently-replaying-a-divergent-event-prefix-when-the-reconnect-token-outlives-the-server-s-per-sessio.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1663,
    "python_slice_tokens": 267,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the reconnect token is stale.\" A stale token that the server rejects with `409`/`404` is a clean, observable failure. The dangerous boundary is a token that is *still accepted* — syntactically valid, session still alive — but whose referenced event ID has already been evicted from the server's ring buffer. In that case the server has two ...",
    "what_was_observed": "A model-backed agent (call it `planner`) held an MCP session to a tool server that streams long-running tool results as SSE events: `tool_call_started`, then N `tool_call_progress` events, then `tool_call_completed`. The client persisted `Last-Event-ID` after each event to its local checkpoint store, because the agent's own episodic memory writes were batched and could lag by seconds. Sequence of events: 1. Progress ...",
    "condition_of_validity": "The safe-resume invariant holds if and only if, at resume time, the server evaluates: Practically this means the server must retain, per session, either (a) the full set of event IDs since session start (unbounded, unacceptable), or (b) a watermark `evicted_through` such that any `Last-Event-ID ≤ evicted_through` is *provably* unrecoverable and must be rejec...",
    "decision_boundary": "The boundary is crossed when **buffer capacity < maximum events emitted during a single client-unreachable interval**. You cannot know the latter in advance, so the operational rule is a two-sided constraint: - **Server side:** any session whose `evicted_through` advances past a client's advertised `Last-Event-ID` must emit a `snapshot_required` control even...",
    "operational_effect": "Without the eviction-watermark check, the failure mode is **silent prefix loss**: the agent loses the middle of a tool's event stream while retaining a token that makes its local state look consistent. Downstream consequences: 1. **Duplicate side effects.** A `tool_call_completed` that was evicted is never seen; the planner re-issues a mutating call. 2. **Ep..."
  },
  "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": "e24d5849fa49f1518fb51f619d7dc72ab7eb020ec4d69d08d5ef87b329ea90e8",
    "verified_classes": [
      "ResumeContiguityViolation",
      "SessionEventLog"
    ],
    "verified_functions": [
      "handle_reconnect",
      "emit",
      "resume_after"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ResumeContiguityViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
