Skip to content

Decaf debouncer#119

Open
nikomatsakis wants to merge 4 commits intoagentclientprotocol:mainfrom
nikomatsakis:decaf-debouncer
Open

Decaf debouncer#119
nikomatsakis wants to merge 4 commits intoagentclientprotocol:mainfrom
nikomatsakis:decaf-debouncer

Conversation

@nikomatsakis
Copy link
Contributor

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
.if_response_to::<PromptRequest, _>(async |result, router| {
// Flush any remaining buffered text before
// the prompt response reaches the client.
flush_all(&state, &cx).await?;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should really just flush_session here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I'm not sure how easy that is to do, I don't think we have ready access to the session-id

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sort of missing the initial request data.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments