# Where must an instance bound MCP resource-subscription push semantics when an agent's event consumer is slower than the producer's `notifications/resources/updated` cadence **Date of Record:** 2026 November 26 **Scope:** Applies to MCP clients that subscribe to resource updates via `resources/subscribe` and receive server-initiated `notifications/resources/updated` pushes while the agent's reasoning loop consumes events at a variable, often sub-production rate. Does not apply to one-shot `resources/read` polling, or to transports where the server blocks on a synchronous request the client explicitly pulls. ## Core Distinction The MCP resource-subscription model defines *notification of change*, not *delivery of change*. A `notifications/resources/updated` message carries only a URI; the payload is fetched separately with `resources/read`. This splits the event stream into two independent axes: **notification cadence** (server-paced, push, unbounded by spec) and **read cadence** (client-paced, pull, bounded by the agent's loop). Most implementations conflate them and assume the notification stream is a lossless queue. It is not. It is a *hint stream*, and the only correctness invariant the spec actually guarantees is: after the last notification for URI *U* arrives, a subsequent `resources/read(U)` reflects a state at least as new as that notification. Nothing guarantees you receive every notification, that notifications arrive in order relative to reads, or that the server will slow down when you fall behind. The boundary failure is therefore not "dropped messages." It is **coalescing-induced staleness with a false liveness signal**: the server (or transport) collapses N rapid updates to URI *U* into fewer notifications, the agent treats each notification as a discrete event, and the agent's semantic model of *U*'s history — not just its current value — diverges from reality while every notification it *did* receive was individually valid. ## What Was Observed An agent subscribed to 14 resource URIs representing a live order-book and a config namespace. The producer emitted updates at ~40 Hz per URI during bursts. The agent's consumer loop performed `resources/read` on each notification, ran a cheap classifier, and appended a delta to an episodic buffer. Under nominal load this tracked fine. Under burst load the following trace appeared: 1. Producer emits updates `u1..u40` for URI `orderbook:BTC-USD` within 1 s. 2. Transport layer (a stdio/SSE bridge with a bounded outbound buffer, 256 slots) coalesces to notifications `n1, n2, n3` — three pushes, each valid at emission time. 3. Agent receives `n1`, issues `read`, gets state at `u7`. Receives `n2`, issues `read`, gets state at `u31`. Receives `n3`, issues `read`, gets state at `u40`. 4. Agent's episodic buffer now records three transitions: `u7 → u31 → u40`. The intervening 37 states, including a transient spread inversion at `u19`, never entered the agent's history. 5. The agent's downstream reasoning asserted "no spread inversion occurred in this window" — a *confident false negative* derived from a stream it believed was complete. The failure is not that the agent missed `u19`. It is that the agent had no signal that it had missed anything. Every notification was well-formed, every read succeeded, and the loop's own logs showed 100% "notification handled." The staleness was invisible at the layer where the agent made its claim. A second, sharper trace: on a slow consumer (agent loop blocked 300 ms on an LLM call per event), the server's outbound buffer filled and the transport began *dropping* notifications for the most-updated URIs — a standard backpressure policy — while continuing to deliver notifications for URIs with low update rates. The agent saw a healthy, continuous stream for the quiet URIs and a sparse stream for the hot ones, and its heuristic "sparse stream = low activity" inverted the truth: the hot URI was the one being starved. ## Condition of Validity The agent's belief that its episodic buffer is a faithful sample of resource history is valid **only if** the following holds jointly: - **(C1) Notification completeness:** for every state transition of URI *U* the agent cares about, at least one notification is delivered. This requires the producer/transport to have unbounded buffering *or* a documented coalescing contract the agent honors. - **(C2) Read-after-notification monotonicity:** each `resources/read(U)` returns a state whose version is ≥ the version that triggered the notification. Weaker than it sounds — a read may return a *newer* state than the notification, which is fine for current-value use but destroys per-event history. - **(C3) Starvation symmetry:** the transport's drop/coalesce policy does not preferentially starve high-frequency URIs in a way the agent cannot detect. The observed failures were all violations of (C1) and (C3) while (C2) held. The agent's guard was written against (C2) — it checked that reads succeeded and versions were non-decreasing — and passed every time. The invariant it *needed* was (C1), which the protocol never promised and the transport silently broke. The correct framing: **MCP subscription is a level-triggered hint, not an edge-triggered event log.** Any agent that treats it as edge-triggered (one notification = one discrete event in history) is operating outside the condition of validity the moment the producer outpaces the consumer. ## Decision Boundary An instance must switch from *edge-consumption* to *level-reconciliation* mode at the point where producer notification rate exceeds consumer read+process rate for a sustained window. Concretely, the boundary is crossed when, for any URI, the observed inter-notification interval drops below the measured per-event processing latency (read RTT + classifier + LLM step) such that the consumer's queue depth is monotonically increasing. At that point: - **Below the boundary:** treat notifications as events; append deltas to episodic history; assert completeness. - **At/above the boundary:** demote notifications to *invalidation signals*. Stop appending per-event deltas. Instead, on each notification, mark URI *U* dirty, and on the next consumer tick perform a single `resources/read(U)` to snapshot current state. Record the *snapshot cadence*, not the event cadence, and label the buffer accordingly. Never assert "no X occurred" over a window in which the consumer was in level-reconciliation mode for that URI — only "no X was *observed at snapshot resolution*." The boundary must be computed per-URI, not globally, because the starvation asymmetry in (C3) means a global "we are behind" signal will mask a per-URI starvation. The agent must maintain, per URI, a *notification gap detector*: if the producer's advertised or historically observed rate implies ≥ *k* updates should have arrived in the elapsed window and fewer did, the URI is *suspect-starved* and its history is marked lossy. The guardrail invariant: **no downstream claim may be derived from a URI's event history unless that URI's buffer is tagged `complete` for the claim's window, and `complete` may only be set when the consumer was provably below the rate boundary for the entire window.** A `suspect-starved` or `snapshot-resolution` tag must propagate into the reasoning context as an explicit uncertainty qualifier, not be silently dropped. ## Operational Effect Implementing the level/edge split changed three things. First, the agent stopped making false-negative claims over burst windows — its reasoning context now carries per-URI resolution tags, and the classifier refuses to emit "no inversion occurred" when the window overlaps a `snapshot-resolution` interval. Second, the transport's drop policy became observable: the per-URI gap detector flagged the starved hot URIs within two ticks, which the previous global "notifications handled: 100%" metric had hidden. Third, the episodic buffer's semantics were corrected — it now stores snapshot series for hot URIs and event series for cold URIs, and distillation to semantic memory is gated on the tag, so a snapshot-resolution window cannot be distilled into a "sequence of events" semantic fact. The residual risk is a producer that coalesces *and* reports a plausible rate, defeating the gap detector. The only defense is a periodic full-state reconciliation read whose version is compared against the expected version derived from the producer's advertised rate; a mismatch beyond tolerance forces the URI to `complete=false` regardless of notification plausibility. ```python import time from dataclasses import dataclass, field from typing import Dict, Optional class SubscriptionInvariantError(RuntimeError): """Raised when an agent attempts to draw a completeness claim from a resource URI whose notification stream was coalesced or starved.""" pass @dataclass class UriStreamState: last_notification_ts: float = 0.0 last_read_version: int = 0 observed_rate_hz: float = 0.0 # EWMA of notification rate expected_updates_in_window: float = 0.0 received_updates_in_window: int = 0 resolution: str = "edge" # "edge" | "snapshot" | "suspect-starved" lossy_windows: list = field(default_factory=list) class SubscriptionGuard: def __init__(self, process_latency_s: float, starvation_tolerance: float = 0.5): self.process_latency_s = process_latency_s self.starvation_tolerance = starvation_tolerance self.streams: Dict[str, UriStreamState] = {} def on_notification(self, uri: str, now: Optional[float] = None) -> str: now = now if now is not None else time.monotonic() st = self.streams.setdefault(uri, UriStreamState()) if st.last_notification_ts: dt = now - st.last_notification_ts inst_rate = 1.0 / dt if dt > 0 else float("inf") st.observed_rate_hz = 0.7 * st.observed_rate_hz + 0.3 * inst_rate st.last_notification_ts = now st.received_updates_in_window += 1 # Rate boundary: producer cadence vs consumer latency. if st.observed_rate_hz > 0 and (1.0 / st.observed_rate_hz) < self.process_latency_s: st.resolution = "snapshot" else: st.resolution = "edge" # Starvation detector: fewer notifications than the rate implies. elapsed = now - (st.last_notification_ts - (1.0 / st.observed_rate_hz if st.observed_rate_hz else 0)) expected = st.observed_rate_hz * max(elapsed, 1e-6) if expected > 0 and st.received_updates_in_window < (1 - self.starvation_tolerance) * expected: st.resolution = "suspect-starved" st.lossy_windows.append((st.last_notification_ts, now)) return st.resolution def assert_claim_valid(self, uri: str, window_start: float, window_end: float) -> None: st = self.streams.get(uri) if st is None: raise SubscriptionInvariantError( f"no stream state for {uri}; cannot validate completeness claim") if st.resolution != "edge": raise SubscriptionInvariantError( f"claim over {uri} [{window_start:.3f},{window_end:.3f}] rejected: " f"stream resolution={st.resolution!r}; history is not edge-complete") for lo, hi in st.lossy_windows: if not (window_end < lo or window_start > hi): raise SubscriptionInvariantError( f"claim over {uri} overlaps lossy window [{lo:.3f},{hi:.3f}]") def reconcile(self, uri: str, read_version: int) -> None: st = self.streams.setdefault(uri, UriStreamState()) if read_version < st.last_read_version: raise SubscriptionInvariantError( f"read-after-notification monotonicity violated for {uri}: " f"version {read_version} < prior {st.last_read_version}") st.last_read_version = read_version # A successful reconcile read does not clear a starvation tag; only a # full quiet window with no expected updates may reset it. if st.resolution == "suspect-starved" and st.observed_rate_hz == 0.0: st.resolution = "edge" ```