{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-a-resumed-mcp-sse-stream-from-replaying-another-tenant-s-authorization-epoch",
  "title": "Which invariants prevent a resumed MCP SSE stream from replaying another tenant's authorization epoch",
  "date_of_record": "2026 November 27",
  "scope": "Applies to MCP servers exposing HTTP-native transports (Streamable HTTP / SSE) with `Last-Event-ID` resumption and per-tenant bearer/token authorization. Does not apply to stdio transports, nor to stateless single-tenant SSE proxies that terminate and re-establish the entire stream on reconnect.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-a-resumed-mcp-sse-stream-from-replaying-another-tenant-s-authorization-epoch.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-a-resumed-mcp-sse-stream-from-replaying-another-tenant-s-authorization-epoch.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-a-resumed-mcp-sse-stream-from-replaying-another-tenant-s-authorization-epoch.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2361,
    "python_slice_tokens": 534,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"a token expired mid-stream.\" It is the collision of two independent monotonic sequences that the MCP transport layer treats as one: 1. **The event sequence** — a per-session, monotonically increasing `id:` counter that the client echoes back as `Last-Event-ID` to resume. 2. **The authorization epoch** — the tenant/credential binding under...",
    "what_was_observed": "A gateway multiplexing MCP Streamable HTTP for ~40 tenants held per-session ring buffers of the last 256 SSE frames to support `Last-Event-ID` replay after mobile-network drops. Sessions were keyed `sess_<uuid>`; buffers were `dict[str, deque[Frame]]`. Authorization was enforced at *stream open*: the `Authorization` header was validated, `tenant_id` extracted, and the session record annotated with the tenant. The rep...",
    "condition_of_validity": "The guardrail is only valid under three conjoined conditions. Break any one and the replay window reopens: 1. **Epoch is part of the cursor.** The `Last-Event-ID` namespace must be scoped to `(session_id, auth_epoch)`, where `auth_epoch` is a server-generated opaque value issued at stream open and bound to the exact principal (tenant + subject + credential `...",
    "decision_boundary": "The boundary is between **resumption as a transport convenience** and **resumption as an authorization decision**. They coincide only when the replay set is provably a subset of what the resuming principal is entitled to read *now*. Operationally: - If the server can prove `replay_set ⊆ authorized_read_set(current_principal)` — e.g., because buffers are per-...",
    "operational_effect": "When the invariant holds, the observable behavior is that a resume under a changed epoch **fails closed with a resumable error**: the server returns `409 Conflict` (or an MCP-level error carrying `resume_rejected: epoch_mismatch`) and instructs the client to re-open the stream from position 0 under the new epoch. The client's in-flight tool call is re-issued..."
  },
  "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": "9ab4265c25f308874db8bc1ed36fa03525b03f5b61df60df441e35ee97b3330f",
    "verified_classes": [
      "EpochMismatchError",
      "Principal",
      "Frame",
      "SessionBuffer"
    ],
    "verified_functions": [
      "handle_resume",
      "demo",
      "epoch",
      "append",
      "resume",
      "rotate_epoch"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "EpochMismatchError"
    ],
    "sample_fail_closed_invariants": [
      "assert [f.seq for f in ok] == [2]",
      "negative Last-Event-ID is not a valid cursor"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
