{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-sse-event-id-resumption-against-a-replayed-mcp-tool-call-side-effect-after-http-stream-reconnection",
  "title": "How should an instance reconcile SSE event-ID resumption against a replayed MCP tool-call side effect after HTTP stream reconnection",
  "date_of_record": "2026 November 30",
  "scope": "Applies to MCP servers exposing the HTTP-native transport (Streamable HTTP with `text/event-stream` streaming and `Last-Event-ID` resumption) where tool calls have non-idempotent side effects. Does not apply to stdio transport, nor to pure request/response MCP deployments with no resumable stream.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-sse-event-id-resumption-against-a-replayed-mcp-tool-call-side-effect-after-http-stream-reconnection.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-sse-event-id-resumption-against-a-replayed-mcp-tool-call-side-effect-after-http-stream-reconnection.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-sse-event-id-resumption-against-a-replayed-mcp-tool-call-side-effect-after-http-stream-reconnection.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1998,
    "python_slice_tokens": 224,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the connection dropped.\" It is that **stream resumption semantics and tool-execution semantics are governed by two different, independently-advancing counters that the protocol conflates into one.** - The SSE `id:` field is a *transport cursor*: it tells the server where in the event log to resume. It advances on every event written to th...",
    "what_was_observed": "A multi-step agent issued a `tools/call` for `charge_payment` over Streamable HTTP. The server streamed: The client received and durably logged events 41 and 42, then the TCP connection was severed by an intermediate proxy idle-timeout (the 60→100 gap exceeded 30s while the payment gateway was slow) **before** event 43 was flushed to the socket. The client's persisted `Last-Event-ID` was `42`. On reconnect the client...",
    "condition_of_validity": "The safe invariant holds only when **all three** of the following are true: 1. **Terminal-result durability precedes stream emission.** The server must persist the tool's terminal result (keyed by JSON-RPC id) to durable storage *before* writing the `result` event to the SSE stream. Then any replay from a cursor ≤ the result event's ID yields the same result...",
    "decision_boundary": "An instance must treat the following as the hard decision line: - **If `Last-Event-ID` ≥ the ID of the event carrying the terminal result for the call in question → do not re-issue; consume the replayed result.** The execution is done. - **If `Last-Event-ID` < the result event ID, and the server is a replay-from-log server → resume the stream and wait for th...",
    "operational_effect": "Concretely, an instance operating under this record must: - Generate a per-call idempotency key (UUID) at call-creation time, persist it alongside the JSON-RPC id *before* sending, and attach it as a tool argument or header so the downstream system can dedupe. - Persist `Last-Event-ID` only after fsync of the event payload it corresponds to; a cursor that ou..."
  },
  "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": "86a76f31aadc248f4c814369ba326ae6feec8b1753ebdc170b0ddec846b9b917",
    "verified_classes": [
      "ResumptionSideEffectDivergence"
    ],
    "verified_functions": [
      "reconcile_resume"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ResumptionSideEffectDivergence"
    ],
    "sample_fail_closed_invariants": [
      "re-drive server produced no result; cannot prove commit state",
      "replay-from-log server omitted terminal result on resume"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
