{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-session-resumption-from-silently-forking-an-mcp-agent-s-tool-call-state-across-sse-replay-boundaries",
  "title": "Which invariants prevent session resumption from silently forking an MCP agent's tool-call state across SSE replay boundaries",
  "date_of_record": "2026 November 25",
  "scope": "Applies to MCP clients and servers using the HTTP-native transport (streamable HTTP + SSE), specifically when a client resumes a session after a dropped connection via `Last-Event-ID` replay and the server is configured for stateless request handling. Does not apply to stdio transport, nor to stateful servers that pin a session to a single in-memory event log.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-session-resumption-from-silently-forking-an-mcp-agent-s-tool-call-state-across-sse-replay-boundaries.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-session-resumption-from-silently-forking-an-mcp-agent-s-tool-call-state-across-sse-replay-boundaries.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-session-resumption-from-silently-forking-an-mcp-agent-s-tool-call-state-across-sse-replay-boundaries.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1632,
    "python_slice_tokens": 233,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the connection dropped.\" Connections drop constantly and resumption works. The failure is the **semantic gap between transport-level replay and reasoning-level idempotency**: SSE replay guarantees that the *bytes* of events `id=N+1..M` are re-delivered, but it does not guarantee that the client's *interpretation* of those bytes is unchang...",
    "what_was_observed": "A tool-orchestrating agent (call it the *executor*) issued `tools/call` for `write_file` against a long-running MCP server. The call was dispatched, the server began streaming progress notifications as SSE events with monotonic IDs, and the executor received events `1..14` before the TCP connection was reset by an intermediate proxy (idle timeout at 30s during a slow filesystem flush). The executor held `Last-Event-I...",
    "condition_of_validity": "The replay contract is only sound when **all three** of the following hold simultaneously: 1. **Session identity is durable and shard-independent.** The session token must resolve to the same logical handler state regardless of which process serves the reconnect. If the server is stateless, the session token must carry (or point to) enough state to reconstru...",
    "decision_boundary": "The boundary is between **replay as transport** and **replay as state transfer**. Transport replay is safe when the client's only obligation on resume is to append bytes to a transcript. State transfer is required when the client's obligation includes re-deriving in-flight intent. The two are indistinguishable from the wire, which is why the failure is non-o...",
    "operational_effect": "Without the epoch check, the failure mode is **silent duplicate tool execution with divergent state** — the worst class of agent bug, because the transcript looks clean, the logs look clean, and only the side effects reveal the fork. Agents that write files, send messages, or mutate remote state are the highest-risk class; read-only tool calls degrade to was..."
  },
  "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": "89cdf8cba4c42cd13f5e1036425df5233cdecb704833dea27394d51b7861c35d",
    "verified_classes": [
      "SessionEpochMismatch"
    ],
    "verified_functions": [
      "resume_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SessionEpochMismatch"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
