Repository navigation
Description
Events Version: Beta (c77b843)
Protocol Version: 2026-07-28
Summary
specification/beta/events/events.mdx (L676, L686-L689, L701-L717) is written for discrete messages. A subscriber to an event type that carries state, where a reader needs only the newest value, gets no current value on subscribe, a gap signal after coalescing and no normal end when the source finishes.
Found while drafting my SEP in ext-tasks#38, which puts a running task's output on Events as mcp.task.output.updated, a size-limited snapshot that replaces the previous one.
Steps to Reproduce
- A server lists
mcp.task.output.updatedinevents/list, withtaskIdas its subscription argument. - A task's output view reaches revision 5.
- A client that has the task ID but no cursor, for example after a restart, subscribes:
events/streamwith{ "taskId": "<id>" }andcursor: null. - The connection drops while the view moves to revisions 6, 7 and 8.
- The client reconnects:
events/streamwith its last cursor. - The task reaches a terminal status.
Actual Behaviour
Step 3 gets notifications/events/active with a fresh cursor and then nothing until revision 6, because cursor: null means "start from now" and replays nothing (L676). In step 5, the server either replays revisions 6, 7 and 8, or skips to revision 8 after a new notifications/events/active with truncated: true (L686, L694). That tells the client that events were skipped (L689) when nothing it needs was. In step 6, #2 requires the server to end the stream (L126), but every termination signal carries an error (L701-L711, L717). NotFound and Unsupported make the client SDK fetch events/list again and resubscribe (L198-L203), and if the server only closes the stream, the client can't tell why (L364) and reconnects with its cursor (L369).
At c77b843, an events/list entry has delivery, inputSchema and payloadSchema (L163-L165) but nothing that says the event type carries state, so these rules apply to every event type.
Expected Behaviour
A state-style event type sends its current value first on subscribe and can skip to the newest value without truncated: true, and a subscription can end without an error when its source finishes.
Notes
| Change | Proposed rule | Alternative with no Events change |
|---|---|---|
| 1. Current value on subscribe | An event type MAY declare in events/list that it carries state, such as "semantics": "state" (default "message"). For such a type, the server MUST send the current value as the first event after a poll or subscribe with cursor: null. |
tasks/get returns eventSource with an initialCursor just before the newest view. Needs Task Event Sources (#2), replay support and a Tasks change. |
2. Coalescing without truncated |
For a state-style type, a server MAY send only the newest value after a gap, and this MUST NOT set truncated: true, so truncated still means a real gap. |
The server sets truncated: true and the event type documents that it needs no action. Generic SDKs still report a gap and can't tell coalescing from a real one. |
| 3. Normal end | A termination without error means the source ended normally: notifications/events/terminated on push, {"type":"terminated"} on webhook, terminated: true on a poll result. The client SDK removes the subscription without resubscribing or reporting a failure. |
The server stops without a signal and the client ends the subscription when it sees the terminal status. A closed push stream doesn't say why it closed, so a client may reconnect. |
Changes 1 and 2 apply only to event types that declare they carry state, and change 3 to any event type whose source can end.
Prior discussion: "semantics": "state" was suggested on SEP-3415, and the SEP-3415 author agreed there that coalescing "shouldn't truncate". Resource Events (#19) would coalesce into the newest (L233). Under D6 in the draft SEP-3570, a server MUST send each task's current DetailedTask when it acknowledges taskIds on subscriptions/listen (L210), and a reviewer there asked how it sits next to event work.
Impact
Any event type that carries state is affected, including task-output views, task status as an mcp.task.updated event (SEP-3415 Open Question 4) and resources (#19). Daniel Shapiro's notes in #tasks-events-wg on implementing Events say the toughest client integration points were "mostly around resilience: recovering from stops/gaps, for example, when clients were offline for a bit and resumed with a large events backlog". For a state-style type, that backlog is one current value. I think change 1 is the same rule as D6, so if Events takes it, D6 and a later mcp.task.updated event would follow one rule instead of two.
Activity
tineira commentedon Dec 3, 2026
One use case for sending the current value on subscribe: a person points an agent at a row in another app, then the agent reconnects. It should be able to recover what the person last pointed at without asking them to pin it again.
In Agent Pointed Context, we keep one pin per grant and separate get_current_view from wait_for_focus. If the person moves the pin from A to B while the agent is offline, B is enough to restore context. A workflow that needs to notify the user about every pin would still need both. That distinction is why I’d make latest-value behavior opt-in per event type.
girishkvs commentedon Dec 3, 2026
@tineira I agree on opt-in per event type and the proposal already does that - only an event type that declares
"semantics": "state"inevents/listgets the current value first, and the default stays"message". I can add your pin case to Impact and credit you for it.tineira commentedon Dec 4, 2026
Thanks, Girish! I missed that semantics: state was already opt-in. Yes, please add the APC pinning example to Impact, and thanks for offering to credit me. The protocol docs linked above are a good reference for the example.