Repository navigation
fix(streams): re-poll after a live batch before waiting for a wakeup - #2458
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 85b92eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
cjol
added this pull request to stack #2460
October 2, 2026 17:39
Contributor
|
✅ agents import sizes: no significant changes ( |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
This PR fixes a live `Streams` reader that could stall when chunks were appended while it was still handling the previous batch. ## Why - `readBatches` yielded a short live batch, then waited for the next append. An append made while the consumer held that batch woke no waiter, so the reader stalled until a later append or the stream's end. - Channels hit this when a harness emitted `text-start` and `text-delta` back to back: the Slack surface stopped after the first chunk. ## Code Changes - `streams.ts` re-polls after any non-empty batch before waiting. The poll that finds nothing and the waiter registration stay synchronous. - `capability.test.ts` appends while a consumer holds a batch and checks the reader still sees it. - Patch changeset for `agents`.
cjol
force-pushed
the
channels/00-streams-wakeup
branch
from
October 2, 2026 18:20
1a45634 to
85b92eb
Compare
Merged
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.
This PR fixes a live
Streamsreader that could stall when chunks were appended while it was still handling the previous batch.Why
readBatchesyielded a short live batch, then waited for the next append. An append made while the consumer held that batch woke no waiter, so the reader stalled until a later append or the stream's end.text-startandtext-deltaback to back: the Slack surface stopped after the first chunk.Code Changes
streams.tsre-polls after any non-empty batch before waiting. The poll that finds nothing and the waiter registration stay synchronous.capability.test.tsappends while a consumer holds a batch and checks the reader still sees it.agents.