perf(core): bound EventBroadcaster and stop accumulating tool yields - #69
Open
LukasParke wants to merge 3 commits into
Open
perf(core): bound EventBroadcaster and stop accumulating tool yields#69LukasParke wants to merge 3 commits into
LukasParke wants to merge 3 commits into
Conversation
Trim replay behind the slowest live consumer so retained events stay proportional to unread backlog. Generator-tool UI progress now receives only the latest yield. Fixes DEV-819. BREAKING CHANGE: `ui.progress` is invoked with the latest yield only, not the full history. Tools that need history must accumulate it themselves. Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
|
@LukasParke is attempting to deploy a commit to the Matt Apperson's projects Team on Vercel. A member of the Team first needs to authorize it. |
7 tasks
…nerator yields (DEV-819) Broadcaster: buffer never exceeds maxBufferSize under 50x publish volume (structural invariant per emit), drop-oldest retains newest window, buffer stays at zero behind a caught-up consumer, unsubscribe frees per-subscriber state (post-depart emits discarded, no stale replay), lagging consumer is not stranded by eviction. Generator tools: first progress event is observable while the generator is still suspended (gate-based, no timers; deadlocks against accumulation), ui.progress retains only the latest yield across 100k yields, one tool_progress event per yield in order, and a mid-stream throw delivers partial yields in order then surfaces as NoeticError step_failed with the original cause. Verified red against the pre-fix sources (8890d5f~1): 2 generator tests and 2 broadcaster tests fail; green against 8890d5f.
…oin replay (DEV-819) The bounded EventBroadcaster trims its buffer to the consumed watermark, so re-attaching after collect() replays nothing. Update the two late-join assertions to derive text/items from the already-collected events instead: - textFromEvents() mirrors filterTextStream over the event list - eventsToBroadcaster() re-wraps events for buildItemStream Full core suite: 1453 pass / 0 fail; tsc --noEmit and biome clean.
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.
Fixes DEV-819.
Port the isolate-memory behaviors from openrouter-web#33659 into Noetic so DEV-798 does not reintroduce unbounded stream retention.
What
EventBroadcasternow trims behind the slowest live consumer. The 10k cap stays as a pre-consumer / stuck-consumer backstop.consumeToolGeneratorand the OpenRouter adapter no longer accumulate every generator yield.ui.progressis invoked with the latest event only.Why
@openrouter/agent0.9.0 still needs a bun patch because replay buffers and generator-tool yield arrays retain O(total streamed bytes) for the life of a run. That is the cfw-api/fusion WorkerexceededMemoryfailure mode. Long-term home is Noetic, not the bun patch.Breaking
ui.progressnow receives only the latest yield (single-element array). Tools that need history must accumulate it themselves. The array signature is unchanged.Test plan
packages/coretypecheckevent-broadcaster.test.tsincluding watermark + late-joiner casestool-ui.test.tsgenerator progress receives[latest]only