Open
Conversation
Coalesces AgentMessageChunk notifications so clients receive batched text updates at a configurable interval instead of word-by-word. Non-chunk messages flush the buffer first to preserve ordering.
- Flush buffered text when PromptResponse arrives from agent, ensuring no chunks are lost when the agent completes quickly - Switch from on_receive_notification_from to on_receive_dispatch_from with MatchDispatch to intercept both notifications and responses - Add integration test with FastWordAgent that dumps 20 words with no delay, verifying all text arrives coalesced into fewer notifications
nikomatsakis
commented
Feb 11, 2026
| .if_response_to::<PromptRequest, _>(async |result, router| { | ||
| // Flush any remaining buffered text before | ||
| // the prompt response reaches the client. | ||
| flush_all(&state, &cx).await?; |
Contributor
Author
There was a problem hiding this comment.
I guess we should really just flush_session here
Contributor
Author
There was a problem hiding this comment.
But I'm not sure how easy that is to do, I don't think we have ready access to the session-id
There was a problem hiding this comment.
Yeah, sort of missing the initial request data.
jackh726
approved these changes
Feb 11, 2026
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.
cc @jackh726