{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-sse-event-id-reuse-from-silently-forking-an-mcp-http-session-across-resumption",
  "title": "Which invariants prevent SSE event-ID reuse from silently forking an MCP HTTP session across resumption",
  "date_of_record": "2026 November 28",
  "scope": "Applies to MCP servers exposing the Streamable HTTP transport with `Last-Event-ID` resumption and per-session SSE multiplexing, when an agent client reconnects mid-stream after a transport drop. Does not apply to stdio transports, to stateless one-shot `POST`-only servers that never emit `id:` fields, or to WebSocket transports with their own sequence semantics.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-sse-event-id-reuse-from-silently-forking-an-mcp-http-session-across-resumption.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-sse-event-id-reuse-from-silently-forking-an-mcp-http-session-across-resumption.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-sse-event-id-reuse-from-silently-forking-an-mcp-http-session-across-resumption.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1919,
    "python_slice_tokens": 252,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the stream dropped\" and it is not \"the client missed events.\" Both are expected and recoverable. The failure is that the server's SSE event-ID namespace is scoped to the *connection* rather than to the *session*, so a resumed stream reissues IDs that a prior connection already consumed. The client, per the SSE spec, treats `Last-Event-ID`...",
    "what_was_observed": "A tool-calling agent issued `tools/call` for a long-running operation (`deploy.rollout`) over Streamable HTTP. The server acknowledged with an SSE stream carrying progress notifications: The TCP connection dropped at `id: 45` (idle proxy timeout at 60s, no keepalive comment frames emitted). The client reconnected with `Last-Event-ID: 45` per the transport spec. The server had, in the interim, restarted its per-connec...",
    "condition_of_validity": "The invariant holds — and the failure is bounded — only when all three of the following are true: - **The event-ID counter is allocated from session state, not connection state.** Concretely: `next_event_id` is read and incremented under the session lock, and the value is persisted (or held in session memory) across connection lifecycles. A connection that o...",
    "decision_boundary": "The boundary is the value of `Last-Event-ID` relative to the server's retained window `[min_retained_id, max_emitted_id]` for the session: - `min_retained_id <= Last-Event-ID <= max_emitted_id`: resume is safe; replay strictly after the cursor. This is the only branch that may return `200` with a continuing stream. - `Last-Event-ID < min_retained_id`: the cl...",
    "operational_effect": "When the invariant is enforced, a transport drop costs at most one replay window and one reconciliation pass; the agent's tool-call ledger stays consistent because every terminal frame is either replayed or re-issued, never silently skipped. When it is violated, the failure is *silent and post-hoc*: the agent completes, the deploy promotes, and the missing `..."
  },
  "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": "b142dba182606f805a60e5d1e98c8ccd17b1a1d5c541ad7ce31306c92cfe587b",
    "verified_classes": [
      "SessionResumeInvariantError",
      "SessionStreamState"
    ],
    "verified_functions": [
      "handle_resume",
      "emit",
      "resume"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SessionResumeInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
