-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(stream-chat): fixed chat streaming #970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR fixes three critical chat streaming bugs by implementing a comprehensive overhaul of the streaming architecture. The changes address: 1) function results appearing at the top of streaming output despite being first in execution order, 2) old outputs persisting when chat outputs are removed from selection, and 3) router system prompts leaking into user-facing chat streams.
The solution involves multiple coordinated changes across the streaming pipeline. The frontend (use-chat-streaming.ts
) switches from single-message accumulation to per-block message tracking, creating individual streaming messages for each block with suppressCopy
flags, followed by a consolidated message with hideContent
for copy functionality. The executor (index.ts
) adds stream order hints by emitting zero-length start events for selected blocks, establishing proper execution order and implementing output filtering based on selectedOutputIds
. The agent handler (agent-handler.ts
) enriches StreamingExecution
objects with block metadata (blockId, blockType, blockName) to enable proper stream routing. The chat utils (utils.ts
) adds router block filtering, log reordering based on streaming sequence, and enhanced function block result handling. The router handler (router-handler.ts
) returns empty content instead of exposing internal prompts. Finally, the message component (message.tsx
) adds UI controls for the new streaming flags.
This architecture separates streaming display concerns from copy functionality while maintaining execution order consistency between the streaming experience and final aggregated results. The changes ensure that only user-relevant content streams while hiding implementation details like routing decisions.
7 files reviewed, 3 comments
b5d878f
to
4a422f2
Compare
4a422f2
to
f3ca484
Compare
9becd9c
to
696cd34
Compare
696cd34
to
470cce4
Compare
Summary
The chat streaming had a few bugs:
Added logic to fix the order of streaming to be 1 to 1 with workflow block execution, got rid of router system prompt getting added to chat, and got rid of stale block outputs that were still getting streamed.
Type of Change
Testing
Tested with workflow child blocks, function blocks with different outputs, multiple agent block outputs with multiple function block outputs, and adding and removing outputs to update the chat.
Checklist
Uploading Screen Recording 2025-08-14 at 7.38.20 PM.mov…