Skip to content

Events (#3026) phase 2: subscription engine (poll and push runners) #3029

Done

Description

@cliffhall

Part of #3026, which has the spec summary and the overall plan. Depends on #3028.

Scope

A UI-agnostic subscription engine in core.

  • Registry. The spec makes the client the owner of all subscription state. The registry is:
    • keyed by (name, canonical-JSON arguments, mode)
    • a TypedEventTarget store
    • read through a useStoreSnapshot hook in core/react/
  • Poll runner:
    • persists the cursor; null or absent means don't persist
    • waits nextPollMs, with a configurable floor (default 1000 ms)
    • drains immediately on hasMore
    • supports maxEvents and maxAgeMs
    • surfaces truncated as a gap marker
  • Push runner:
    • events/stream with no request timeout
    • routes active/event/heartbeat/error/terminated by subscriptionId
    • advances the cursor on heartbeat
    • treats the stream as dead after 3× the granted heartbeatMs with no message, then reconnects with the last cursor after jitter
    • cancels by abort on HTTP, or notifications/cancelled on stdio
    • holds concurrent streams
  • Web relay. Support for an unbounded events/stream with cancellation. The hardcoded relay waits must not cut it off (see Inspector times out when FastMCP tool emits ctx.info/ctx.report_progress (v2.2.0, LEGACY/STDIO) #2028).
  • Per-subscription eventId dedup, and an occurrence log capped like the message log.
  • Optional validation of data against payloadSchema, flagged the way core/mcp/toolOutputValidation.ts flags tool output.
  • Termination:
    • NotFound or Unsupported/schema_changed: re-list, then offer to resubscribe
    • Forbidden: end the subscription
    • the outcome is always visible

Acceptance

  • Tests run against the fixture presets: backlog, gap, error, both kinds of termination, heartbeat timeout and reconnect, and cancellation.
  • No floating promises on any teardown path.
  • Coverage ≥ 90.

Activity

  1. added this to the v2.18.0 milestone on Nov 23, 2026
  2. added
    enhancement
    v2
    on Nov 23, 2026
  3. cliffhall commented on Nov 23, 2026

    @cliffhall
    MemberAuthor

    Triage: Priority Medium (total 8)

    Board: #28, Status Todo, milestone v2.18.0 (filed through the create flow).

  4. modified the milestones: v2.18.0, v2.17.0 on Nov 24, 2026
  5. self-assigned this
    on Nov 24, 2026
  6. cliffhall commented on Nov 24, 2026

    @cliffhall
    MemberAuthor

    Shipped in #3037.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions