Skip to content

Events: the event door follows upstream's shared feed, with a connection status and endless retry #851

Closed

Description

@Blind-Striker

What

The event door follows upstream's first-party client:

  • one shared, lazily opened event source per client;
  • a bounded queue per subscriber, which fails a subscriber that falls behind;
  • per-subscriber filtering and the connected-marker replay;
  • endless reconnection with a connection status that a consumer can watch.

It is built on System.Threading.Channels, and it replaces the current pull-per-subscription door. It is not a second, opt-in door.

Upstream at the pin (v2.3.0)

packages/client/src/shared-events.ts:17, make: one source feeds independently filtered subscribers through 4,096-event queues.

The SDK today

Each SubscribeAsync opens its own SSE connection and reads only when the consumer pulls. A stream gives up after one minute of failed attempts. docs/architecture/client-runtime.md records both as intended divergences. A host with several event consumers opens one connection each, or writes its own fan-out.

Done when

  • A reviewed design is approved, covering the contract delta and its version impact under ADR-0034.
  • The door, the canon, the streaming guide and the tests follow it.
  • The two recorded divergences are removed.

Activity

  1. added this to the 1.2.0 milestone on Nov 14, 2026
  2. added
    enhancement
    on Nov 14, 2026
  3. Blind-Striker commented on Nov 14, 2026

    @Blind-Striker
    CollaboratorAuthor

    Design approved (the maintainer, 2026-11-14).

    The SDK gets one shared event feed per client. It fans each server event out to every subscriber, and it owns reconnection and connection state, so a consumer composes nothing. These are the approved choices:

    • Retry: the feed reconnects forever, as upstream's connection layer does.
    • A late subscriber: it is admitted by a replay of the cached connection marker.
    • A slow subscriber: when its queue reaches 4,096 events, that subscriber fails with OpenCodeEventSubscriberOverflowException. The feed and the other subscribers continue.
    • Per-call Location: accepted, and nothing extra is sent.
    • onActivity: not admitted.
    • Connection state: exposed as virtual members on the events client, over an internal raw mode.
    • Version: the change ships in 2.0.0.
    • No subscribers: the state is Idle.
    • Event instances: subscribers share them, and the documentation says to treat them as read-only.
    • A fault in the feed: each subscriber receives its backlog before the fault.
    • Decoding: every frame is decoded.
    • Cancellation: it wins over a kept backlog. This is a recorded divergence from upstream.

    The public names in the design (EventConnectionState, EventConnectionStatus, GetConnectionState, WatchConnectionAsync, OpenCodeEventSubscriberOverflowException) are confirmed with the maintainer in the pull request.

    The first "Done when" item ("a reviewed design is approved") is met by this approval.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions