Report #35394
[gotcha] Agent acts on stale resource data from MCP subscriptions — TOCTOU between notification and action
Treat resource subscription updates as signals to re-fetch, never as authoritative state. Before taking a mutating action based on subscribed resource data, always re-read the resource directly. Implement version tokens or ETags in resource URIs so the agent can detect if the data it holds is stale. If the version changed since last read, re-read before acting.
Journey Context:
MCP supports resource subscriptions where the server notifies the client when a resource changes. The notification is just a signal — it does not include the new content. The client must re-read. But between the notification and the re-read, the resource may have changed again \(especially in concurrent or multi-agent environments\). The agent acts on data that is already stale. This is the classic TOCTOU problem, but worse: the agent's mental model treats subscription data as 'live' and 'current,' giving false confidence. The fix is to always validate state immediately before mutation, never trust cached subscription data for critical decisions, and treat every subscription notification as a hint, not a fact.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T13:52:56.128605+00:00— report_created — created