{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-refuse-mcp-notifications-cancelled-during-session-resumption-because-the-resumable-stream-s-replay-cursor-and-the-c",
  "title": "In what scenarios must an instance refuse MCP `notifications/cancelled` during session resumption because the resumable stream’s replay cursor and the cancellation epoch are not causally ordered",
  "date_of_record": "2026 December 1",
  "scope": "Applies to MCP servers that expose long-running tool calls over a resumable stream transport (SSE with `Last-Event-ID` resumption, or an equivalent event-log replay), where a client may issue `notifications/cancelled` while a session is being resumed. Does not apply to stateless request/response MCP transports, nor to cancellations issued on an already-live, continuously-connected stream where the event log is strictly linear in the client’s view.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-mcp-notifications-cancelled-during-session-resumption-because-the-resumable-stream-s-replay-cursor-and-the-c.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-mcp-notifications-cancelled-during-session-resumption-because-the-resumable-stream-s-replay-cursor-and-the-c.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-mcp-notifications-cancelled-during-session-resumption-because-the-resumable-stream-s-replay-cursor-and-the-c.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2037,
    "python_slice_tokens": 599,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"cancellation is lost.\" It is the inverse: a cancellation is *honored too early*, against a replay window it does not cover. MCP cancellation is a notification, not a request — it carries no response, no ordering guarantee relative to the tool-call result, and critically, **no stream position**. The `requestId` it references is the only jo...",
    "what_was_observed": "A document-analysis agent issued a `tools/call` for a long-running `extract_entities` operation (est. 40s). At t=8s the client's transport dropped (SSE connection reset). The client reconnected with `Last-Event-ID: evt-0007`. Meanwhile, at t=9s — during the disconnected window — the *orchestrating* agent (a different process sharing the same `requestId` namespace via a supervisor) issued `notifications/cancelled` for...",
    "condition_of_validity": "Refusing (or deferring) the cancellation is correct **iff** all of the following hold: - The transport is resumable and `Last-Event-ID` is present on the resuming connection. - The cancellation's `requestId` resolves to a request whose event log contains positions strictly greater than the supplied `Last-Event-ID` that have not yet been acknowledged by the c...",
    "decision_boundary": "The server must choose between three actions at the moment a `notifications/cancelled` arrives for a request with a live replay window: 1. **Apply immediately** — only when replay window is empty, or the cancel carries a stream position at/after head. 2. **Defer and mark pending** — queue the cancel; continue replaying events `> Last-Event-ID` up to the canc...",
    "operational_effect": "Implementing the deferral boundary converts a class of silent data loss and spurious client state-machine aborts into a bounded, observable delay: the cancellation takes effect at most `(replay window size) × (per-event delivery latency)` after arrival, and the client always observes a causally coherent event sequence — every `cancelled` frame it receives is..."
  },
  "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": "676ef1799d873ab9e5ca217ece73c2b339fb31d3c9fa5942cc2fd0a787295412",
    "verified_classes": [
      "CancellationOrderingViolation",
      "Event",
      "Session"
    ],
    "verified_functions": [
      "handle_cancellation",
      "drain_pending_cancellations",
      "head_seq"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "CancellationOrderingViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
