{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-silent-event-loss-when-an-mcp-http-native-stream-resumes-across-a-server-side-session-epoch-change",
  "title": "Which invariants prevent silent event loss when an MCP HTTP-native stream resumes across a server-side session epoch change",
  "date_of_record": "2026 November 21",
  "scope": "Applies to MCP servers exposing the HTTP-native transport (SSE `GET` stream plus `POST` message channel) where the server assigns a session identifier and supports resumption via `Last-Event-ID`. Does not apply to stdio transport, nor to stateless HTTP deployments that issue no session and no event IDs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-loss-when-an-mcp-http-native-stream-resumes-across-a-server-side-session-epoch-change.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-loss-when-an-mcp-http-native-stream-resumes-across-a-server-side-session-epoch-change.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-loss-when-an-mcp-http-native-stream-resumes-across-a-server-side-session-epoch-change.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2134,
    "python_slice_tokens": 333,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure this record isolates is *not* \"the stream dropped.\" Streams drop constantly and clients reconnect; that is the designed happy path. The failure is **resumption that returns `200 OK` with a valid SSE stream while silently skipping events that were emitted in the gap.** The client believes it has resumed a continuous event log; the server has actua...",
    "what_was_observed": "A tool-calling agent held a long-running MCP session against an HTTP-native server. The agent had issued a tool call whose result streamed as a sequence of progress events (`event: progress`, `id: 41` … `id: 57`) followed by a terminal `event: result`. Between `id: 48` and `id: 49` the intermediary load balancer recycled the backend connection (idle timeout on a keep-alive hop, unrelated to the SSE heartbeat interval...",
    "condition_of_validity": "The invariant holds only under a conjunction of conditions, and the failure appears precisely when any conjunct is dropped: - **Session-scoped, durable event IDs.** The allocator must be keyed by `session_id` and persisted, or the session must be invalidated on process change. A process-local counter is valid *only* if the session is also process-local and r...",
    "decision_boundary": "The operative decision is what a server does when it receives a resume request it cannot fully honor. The boundary is sharp: - **If `Last-Event-ID ≤ high_water_mark` and the suffix is still retained:** replay the suffix, then stream live. Safe. - **If `Last-Event-ID ≤ high_water_mark` but the suffix has been evicted:** fail closed. The client must re-establi...",
    "operational_effect": "When the invariant is violated, the observable effect is **silent partial execution with a clean terminal signal.** The agent does not crash, does not retry, does not surface an error to its orchestrator; it proceeds to the next task step believing the previous tool call completed atomically. Downstream, the effects are the classic orphaned-resource pattern:..."
  },
  "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": "975672ffdd2e010323da8604bd04fef88e9d69754cc5fac2d0210ea07dedfb18",
    "verified_classes": [
      "StreamResumeContinuityError"
    ],
    "verified_functions": [
      "validate_resume",
      "enforce_client_continuity"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "StreamResumeContinuityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
