Repository navigation
feat(events)!: one shared event feed per client (2.0.0) - #902
Merged
Merged
Conversation
This was referenced Nov 15, 2026
Merged
Merged
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One shared event feed per root client replaces the per-call reconnecting event streams. It follows upstream's first-party
shared-events.tsat the pin (v2.3.0):SubscribeAsyncenumeration is an independent subscription over one shared background source;This is the 2.0.0 change: it breaks behaviour, and the version moves to 2.0.0 on the same opencode 2.3.0 pin.
Closes #851. The one remaining provenance step is #901 (see "Deferred").
Public surface (the names the maintainer approved)
EventsClient.GetConnectionState()andEventsClient.WatchConnectionAsync(CancellationToken), both virtual.EventConnectionState(sealed), withStatus,AttemptandError, and a public constructor(EventConnectionStatus status, int attempt, Exception? error).EventConnectionStatus:Idle,Connecting,Connected,Reconnecting.OpenCodeEventSubscriberOverflowException(sealed, derives fromOpenCodeException), withCapacity.Capacityalways reports the SDK's single 4,096 bound.PublicApi.verified.txtchanges by exactly these entries.Design and canon
GLOSSARY records the approved names: Event feed, Event subscription, Subscriber overflow and Connection state.
ADR 0041 records one shared event feed per client. Its divergences from upstream each have a reason and a reversal trigger:
done;Erroris an exception, not a message;onActivity.client-runtime.mdgains the internalPipeline.RegisterOwnedhook. The Events door registers its feed there, so the feed is disposed before the transport when the root client is disposed.Pipelinestays free of Events types.ADR-0007 narrows its stream sentences to the other streams; the event bus follows ADR 0041.
Guides (streaming, errors and responses, getting started), README, GLOSSARY and the HQ playground README now describe the status quo.
CHANGELOG: the 2.0.0 entries are under 💥 Breaking, ✨ Added and 🔧 Changes.
Upstream parity details worth a look
server.connectedmarker is cached, and a late subscriber gets the latest one, asshared-events.ts:52does.The HQ playground
The board and the conversation recover from overflow: a new admission, a refresh at the marker, then the idempotent turn ends and the final-text replacement.
One limitation is stated in the code and in the streaming guide's recovery recipe. A text delta buffered across a refresh can repeat text until the part's
SessionTextEndedreplaces it, because the snapshot carries no delta cursor. Upstream's events give no identity that could decide the overlap (session-event.ts:419-439,publish-llm-event.ts:177-201).Clone baseline
tools/jscpd/tests.baseline.jsonloses six fingerprints that this change's own test rewrite made stale. No fingerprint was added. A shrinking baseline needs no reason.Deferred (#901)
The receipt route for adding
shared-events.tsto the source watch belongs to the generator's provenance tooling. It is tracked as #901, and these files are untouched here:spec/source-watch.json;spec/receipt.json;spec/SNAPSHOT.md.Reviews and their outcome
The change was implemented by one agent and reviewed by four independent readers:
Every finding was fixed, except these:
EndLockedalready drains the queue on a live cancellation (EventSubscription.cs:157), and a fault-ended subscription keeps its unread prefix until the next pull or its disposal, as upstream does. The live-cancellation row stays as a regression test.Tests
EventSelectionTests,EventSourceRunnerTests,EventSourceTests,EventStateWatcherTests,EventSubscriptionTests,SharedEventFeedTests,PipelineOwnedResourceTests, plus the scripted attempt source and the scenario support.Verification
c0080e3e(masterb587e7e3), on Linux, net10.0 and net11.0, SDK11.0.100, Bun 1.4.4 at the pin: every step passed.verify-clones0 new.--help, andgenerate --verify: current.OpenCode.Sdk.Tools.TestsexceptNativeAot: 2,823.OpenCode.Sdk.Tests: 4,366 on each target framework.ServiceElectionpass: 9 on each.9d405e14(master422c45ad), before the last rebase: GATE PASS.--helpandgenerate --verify.OpenCode.Sdk.Tests4,365 / 4,365 / 4,357 on net10.0 / net11.0 / net472;b587e7e3(fix(rpc): a plugin call waits until the plugin answers #899) was clean. It overlaps this change only inCHANGELOG.mdandclient-runtime.md, which is why the final head ran its own local check.