{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-resumes-an-mcp-stream-against-a-server-that-has-already-rotated-its-per-stream-event-id-namespace",
  "title": "What happens when an instance resumes an MCP stream against a server that has already rotated its per-stream event ID namespace",
  "date_of_record": "2026 November 30",
  "scope": "Applies to MCP clients using the HTTP-native transport (streamable HTTP / SSE with `Last-Event-ID` resumption) across a process restart, network partition, or proxy failover, where the server maintains per-stream monotonic event IDs. Does not apply to stdio transports or to HTTP transports that guarantee globally monotonic event IDs across server restarts.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-against-a-server-that-has-already-rotated-its-per-stream-event-id-namespace.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-against-a-server-that-has-already-rotated-its-per-stream-event-id-namespace.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-against-a-server-that-has-already-rotated-its-per-stream-event-id-namespace.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2605,
    "python_slice_tokens": 498,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP HTTP transport contract treats resumption as a *transport-layer* concern: the client reconnects with `Last-Event-ID: N` and the server replays events `N+1..M`. This is correct only if event IDs are monotonic *within the lifetime of the resumable session*. The failure mode is the conflation of two distinct identities: the **session identity** (the MCP...",
    "what_was_observed": "A tool-calling agent (`claude-sonnet`-class instance, 200k context, 14 tools registered over MCP) was mid-execution on a long-running `run_migration` tool call whose result streamed as 47 SSE events (progress ticks plus a final result). At event 31 the client's host was drained by a rolling deploy; the agent process was checkpointed and resumed 40 seconds later against a different replica of the MCP server. The sessi...",
    "condition_of_validity": "Resumption via `Last-Event-ID` is sound if and only if all three hold: 1. **Incarnation binding.** The server's event IDs are unique across all stream incarnations for a given session (e.g., a monotonic counter persisted in the session store, or an ID of the form `<incarnation_uuid>:<seq>`), *or* the server rejects any `Last-Event-ID` that does not belong to...",
    "decision_boundary": "The operational decision is: **when a resumption attempt's `Last-Event-ID` is not recognized by the server's current incarnation, the server MUST NOT silently accept it.** The boundary between \"resume\" and \"restart\" is the incarnation check. Concretely: - If `Last-Event-ID` belongs to the current incarnation and is `<= next_id - 1`: replay `Last-Event-ID+1 ....",
    "operational_effect": "The bounded design changes the failure from *silent tool-result loss plus duplicate side-effect* into *a loud resumption error the agent loop can handle*. The agent, on receiving `409 stream_incarnation_mismatch`, does not re-execute `run_migration`; it issues a status query for `call_id` and learns the migration completed. The cost is one extra round-trip o..."
  },
  "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": "64383759e0df4b5e594b759e521945b7694be8bd030621620d8f9e4708b0aab0",
    "verified_classes": [
      "StreamIncarnationMismatch",
      "WatermarkAheadOfStream",
      "StreamIncarnation",
      "ResumeCursor"
    ],
    "verified_functions": [
      "resume_stream",
      "handle_resume",
      "emit"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "StreamIncarnationMismatch",
      "WatermarkAheadOfStream"
    ],
    "sample_fail_closed_invariants": [
      "assert resp['status'] == 409 and resp['error'] == 'stream_incarnation_mismatch'",
      "assert resp['status'] == 200 and len(resp['replay']) == 13"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing",
      "uuid"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
