{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-reconcile-sse-event-id-monotonicity-against-the-mcp-last-event-id-replay-window-when-an-http-native-stream-resumes-mid-tool-cal",
  "title": "Where must an instance reconcile SSE event-ID monotonicity against the MCP `Last-Event-ID` replay window when an HTTP-native stream resumes mid-tool-call?",
  "date_of_record": "2026 November 24",
  "scope": "Applies to MCP servers exposing HTTP-native streaming transports (SSE-over-POST, resumable streams keyed by `Last-Event-ID`) where tool invocations emit multiple stream events and the client may disconnect and resume. Does not apply to stdio transports or to fully buffered request/response MCP endpoints with no event log.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-sse-event-id-monotonicity-against-the-mcp-last-event-id-replay-window-when-an-http-native-stream-resumes-mid-tool-cal.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-sse-event-id-monotonicity-against-the-mcp-last-event-id-replay-window-when-an-http-native-stream-resumes-mid-tool-cal.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-sse-event-id-monotonicity-against-the-mcp-last-event-id-replay-window-when-an-http-native-stream-resumes-mid-tool-cal.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1709,
    "python_slice_tokens": 388,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the stream dropped.\" The failure is that after resumption, the *server's* event log and the *client's* perceived event sequence disagree about which events were already consumed, because SSE event IDs are assigned per-connection on some MCP server implementations while `Last-Event-ID` replay is specified against a per-session log. The bou...",
    "what_was_observed": "An MCP client (agent runtime) invoked `write_file` through an HTTP-native MCP server advertising `Last-Event-ID` resumability. The server assigned event IDs from a monotonic counter scoped to the *stream connection*, not the session. During the tool call the connection reset at TCP level after the server had flushed `E_7` (the tool result) but before the client's read loop persisted it. The client reconnected with `L...",
    "condition_of_validity": "The guardrail holds only when all three of the following are enforced: 1. **Session-scoped event IDs.** The server must assign event IDs from a counter that is durable across connection teardown and bound to the session ID, not the socket. IDs must be strictly increasing within a session and never reused. A reconnecting client's `Last-Event-ID: N` must repla...",
    "decision_boundary": "The agent must treat a resumed stream as *untrusted until the cursor is reconciled*. Concretely: - On reconnect, if the first replayed event ID is **less than or equal to** the client's durable cursor, the client must **not** silently drop it. It must either (a) request a full session snapshot via a separate `GET /session/{id}/state` call and diff against it...",
    "operational_effect": "Without the invariant, the observable failure is *silent double-execution of non-idempotent tools across stream resumption*, with both sides reporting success. The downstream effects compound: the agent's episodic memory records two successful writes, semantic distillation later treats the second as authoritative, and the sibling agent's edit is lost with no..."
  },
  "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": "8de7c5ca12720744444f0d5f298bfc18c5bd41b2268c942edc5168eb1574adcb",
    "verified_classes": [
      "StreamCursorDesync",
      "ResumeState"
    ],
    "verified_functions": [
      "reconcile_resume",
      "commit_event"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "StreamCursorDesync"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
