{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-treat-an-sse-last-event-id-as-a-claim-rather-than-a-cursor-the-replay-identity-invariant-in-mcp-http-native-transport",
  "title": "When must an instance treat an SSE `Last-Event-ID` as a claim rather than a cursor: the replay-identity invariant in MCP HTTP-native transport",
  "date_of_record": "2026 November 29",
  "scope": "Applies to MCP servers and clients using the HTTP-native \"streamable\" transport, where a server emits `text/event-stream` frames carrying `id:` fields and the client may reconnect with `Last-Event-ID` plus an `Mcp-Session-Id` header to resume. Does not apply to stdio transport, to single-shot SSE responses with no resumption contract, or to servers that do not persist per-session event logs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-an-sse-last-event-id-as-a-claim-rather-than-a-cursor-the-replay-identity-invariant-in-mcp-http-native-transport.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-an-sse-last-event-id-as-a-claim-rather-than-a-cursor-the-replay-identity-invariant-in-mcp-http-native-transport.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-an-sse-last-event-id-as-a-claim-rather-than-a-cursor-the-replay-identity-invariant-in-mcp-http-native-transport.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2585,
    "python_slice_tokens": 446,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The `Last-Event-ID` header is specified as a *cursor*: \"resume after the event with this id.\" Implementations routinely treat it as an *identity assertion*: \"the client has already consumed everything up to and including this id, so I may skip re-sending it.\" These are not the same claim, and the gap between them is where agent state desynchronizes. A cursor...",
    "what_was_observed": "A coding agent driving an MCP server over streamable HTTP was mid-task: it had issued `tools/call` for a long-running `run_tests` invocation, and the server was streaming progress notifications and the eventual result over SSE. The server assigned monotonic ids per session and retained the last 200 events in a per-session ring buffer keyed by `Mcp-Session-Id`. At event id 47 the server emitted the terminal `result` f...",
    "condition_of_validity": "Treating `Last-Event-ID` as a cursor is valid only under all of the following: 1. The client persists the id **after** the event's payload has been durably committed to agent-visible state, not after the SSE parser has read the frame. The commit point must be the agent's episode log, not the transport's read cursor. 2. The server retains every event from the...",
    "decision_boundary": "The boundary is sharp: **does the client's persisted `Last-Event-ID` provably correspond to a committed agent state?** - If yes (commit-then-persist ordering is enforced, and the server guarantees no eviction below the acked id), resume with `Last-Event-ID` is a cheap, correct continuation. The client may treat EOF as terminal only if the server's stream con...",
    "operational_effect": "Concretely, the guardrail is a two-phase cursor with a commit barrier, plus a client-side replay detector: - The SSE reader writes parsed frames to a pending queue and records `last_parsed_id` in volatile memory only. - The agent's tool-result handler, after committing the payload to the episode log, advances `last_committed_id` and persists it. Only `last_c..."
  },
  "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": "618942a32112e1a9ff800d2c4d0d1295137c4e1b4dcd503f1d553ec61e003c42",
    "verified_classes": [
      "ResumeIdentityViolation",
      "ResumeCursor"
    ],
    "verified_functions": [
      "resume_stream",
      "header_value",
      "commit",
      "accept_replayed"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ResumeIdentityViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
