{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-mcp-streamable-session-resumption-from-silently-forking-agent-state-across-sse-to-http-upgrades",
  "title": "Which invariants prevent MCP streamable-session resumption from silently forking agent state across SSE-to-HTTP upgrades",
  "date_of_record": "2026 November 24",
  "scope": "Applies to MCP servers/clients using the HTTP-native streamable transport where a session is opened with `Accept: text/event-stream`, upgraded or re-established as plain HTTP POST/GET, and resumed via `Mcp-Session-Id` plus `Last-Event-ID`. Does not apply to stdio transport, nor to pure SSE transports without session resumption, nor to WebSocket-based bindings.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-streamable-session-resumption-from-silently-forking-agent-state-across-sse-to-http-upgrades.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-streamable-session-resumption-from-silently-forking-agent-state-across-sse-to-http-upgrades.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-streamable-session-resumption-from-silently-forking-agent-state-across-sse-to-http-upgrades.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2138,
    "python_slice_tokens": 422,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the connection dropped.\" Connections always drop. The failure mode is that the transport's *resumption contract* is defined over an event-log cursor (`Last-Event-ID`) while the agent's *semantic state* is defined over a tool-call lineage that may have been partially acknowledged on a stream the server no longer considers authoritativ...",
    "what_was_observed": "A research agent issued `tools/call` for a `write_file` tool over an SSE-upgraded streamable session. The server emitted `event: message` with a `partial` progress notification at `Last-Event-ID: 41`, then the model-side tool executed and committed the file write, then the server attempted to emit `event: message` `id: 42` containing the final `tool_result`. The TCP connection died between commit and emit (SIGPIPE on...",
    "condition_of_validity": "The invariant \"resumption is safe\" holds only when all three of the following are simultaneously true: 1. **Log completeness under the client's cursor.** The server's replay buffer must retain every event with `id > Last-Event-ID` for the lifetime of the session, *or* the server must signal gap explicitly (e.g., `409 Conflict` with `Mcp-Session-Id` invalid, ...",
    "decision_boundary": "The architecturally correct boundary is: **a session resumption is a replay, never a re-execution.** Concretely: - On reconnect, the client MUST first attempt `GET` with `Last-Event-ID`. If the server returns `200` with a non-empty stream, replay proceeds and no new request is issued until the replay cursor catches up to the client's last locally-committed r...",
    "operational_effect": "After the incident, the agent's semantic memory contained an entry: `write_file(path=X, content=C) → ok`, and the filesystem contained `content=C` written twice with the second mtime. The agent's next decision — a `read_file` to verify — returned `C`, so the agent's belief was *locally* confirmed. The fork only surfaced three turns later when a `git diff` to..."
  },
  "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": "c14eda5c42dc6a2168d84988648d0f2ff8101cfc705ef670da5b390e65bf6710",
    "verified_classes": [
      "ResumptionForkError",
      "OutcomeClass",
      "SessionCursor"
    ],
    "verified_functions": [
      "idempotency_token",
      "classify_resumption",
      "resume_and_maybe_reexecute"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ResumptionForkError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
