Skip to content

Conversation

aadamgough
Copy link
Collaborator

@aadamgough aadamgough commented Aug 15, 2025

Summary

The chat streaming had a few bugs:

  1. The function result would append at the top of the entire streaming output despite it being the first block in execution order
  2. Even when I removed some of the chat outputs (e.g. I have two agent outputs and I remove one of them), the old output would still get streamed
  3. The router system prompt would get appended to the streaming

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

  • Bug fix

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

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Uploading Screen Recording 2025-08-14 at 7.38.20 PM.mov…

Copy link

vercel bot commented Aug 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Aug 18, 2025 11:47pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 18, 2025 11:47pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

Edit Code Review Bot Settings | Greptile

aadamgough pushed a commit that referenced this pull request Aug 15, 2025
@vercel vercel bot temporarily deployed to Preview – docs August 15, 2025 03:51 Inactive
aadamgough pushed a commit that referenced this pull request Aug 15, 2025
@vercel vercel bot temporarily deployed to Preview – docs August 15, 2025 19:08 Inactive
aadamgough pushed a commit that referenced this pull request Aug 15, 2025
@vercel vercel bot temporarily deployed to Preview – docs August 15, 2025 22:23 Inactive
aadamgough pushed a commit that referenced this pull request Aug 16, 2025
@vercel vercel bot temporarily deployed to Preview – docs August 16, 2025 01:57 Inactive
aadamgough pushed a commit that referenced this pull request Aug 16, 2025
aadamgough pushed a commit that referenced this pull request Aug 16, 2025
@vercel vercel bot temporarily deployed to Preview – docs August 16, 2025 01:59 Inactive
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