{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-sse-resumption-from-silently-forking-an-mcp-session-s-tool-call-ledger",
  "title": "Which invariants prevent SSE resumption from silently forking an MCP session's tool-call ledger",
  "date_of_record": "2026 November 19",
  "scope": "Applies to MCP servers using the HTTP-native transport where a single logical session spans an SSE stream that can be disconnected and resumed via `Last-Event-ID` plus a session token, and where the session carries stateful tool-call side effects (writes, allocations, external mutations). Does not apply to stateless request/response MCP transports, nor to SSE streams that carry only idempotent notifications.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-sse-resumption-from-silently-forking-an-mcp-session-s-tool-call-ledger.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-sse-resumption-from-silently-forking-an-mcp-session-s-tool-call-ledger.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-sse-resumption-from-silently-forking-an-mcp-session-s-tool-call-ledger.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2030,
    "python_slice_tokens": 356,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The naive mental model of SSE resumption treats the stream as a *lossy log replay*: the client missed events `N+1..M`, so it reconnects with `Last-Event-ID: N` and the server replays from `N+1`. Under this model, resumption is a pure read-side repair and cannot affect server state. The actual mechanism is different. In MCP's HTTP-native transport, the SSE st...",
    "what_was_observed": "A tool call `allocate_batch` (external side effect: reserves N units in a downstream quota system, returns a reservation ID) was issued on session `S`. The server began execution, emitted `notifications/progress` events `evt-101` and `evt-102` onto the SSE stream, then reserved the quota and emitted `evt-103` carrying the `tools/call` result with reservation ID `R-7`. The SSE connection dropped between the server emi...",
    "condition_of_validity": "The resumption contract is only sound when *all three* of the following hold simultaneously: - **Emit-at-commit ordering.** An event ID is written to the replay log in the same atomic step that the corresponding side effect becomes durable (or, for pure notifications, in the same step the value is finalized). If an event can be in the log before its effect i...",
    "decision_boundary": "The operational decision is not \"should I support resumption\" but *what the server does when the requested `Last-Event-ID` falls in the ambiguous window between \"effect committed\" and \"event acknowledged by client.\"* Three defensible policies exist: - **Reject-and-reconcile (safest for side-effecting tools).** If `Last-Event-ID` is older than the last *ackno...",
    "operational_effect": "The immediate effect of the fork is a **phantom reservation**: `R-7` exists in the downstream quota system with no client-side record, and the client holds `R-8` believing it is the sole reservation. Quota is over-consumed by N units. Because the client's session state and the downstream state diverged at the resumption boundary, no later event on the stream..."
  },
  "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": "83573bcd5a5b45612769ad7e3ea51aed52d6b18f1afd1a940cf63f730369b372",
    "verified_classes": [
      "ResumptionForkError",
      "EventRecord",
      "ResumptionGuard"
    ],
    "verified_functions": [
      "__init__",
      "__init__",
      "resume"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ResumptionForkError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
