fix(chat): update stream to respect all output select objects#2729
Merged
waleedlatif1 merged 1 commit intostagingfrom Jan 8, 2026
Merged
fix(chat): update stream to respect all output select objects#2729waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Fixes streaming chat to display all selected workflow outputs, not just content. The hook now accumulates block logs during execution and passes them in the final event, allowing the chat component to extract and display non-content outputs like model, tokens, and toolCalls. This ensures all user-selected outputs appear in the chat response.
Confidence Score: 3/5
- Generally safe to merge with minor optimization concerns
- The fix correctly addresses the issue by accumulating block logs and extracting selected outputs from the final event. The logic is sound and properly handles edge cases (skipping content path, checking for undefined values). However, the accumulation of block logs without size limits in long-running workflows could lead to memory issues. The dependency array update is correct, preventing stale closure issues.
- apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts for potential memory optimization
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/chat.tsx | 4/5 | Added logic to extract and display non-content selected outputs from streaming execution final event; properly updates dependency array |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts | 3/5 | Accumulates block logs during execution for final result; minor concern about potential memory usage with many blocks |
Sequence Diagram
sequenceDiagram
participant User
participant Chat
participant WorkflowExec as useWorkflowExecution
participant Server
participant StreamProcessor
User->>Chat: Send message with selected outputs
Chat->>WorkflowExec: handleRunWorkflow(input)
WorkflowExec->>Server: Execute workflow (with selectedOutputs)
Server-->>WorkflowExec: Stream starts
WorkflowExec->>StreamProcessor: onBlockCompleted callbacks
Note over WorkflowExec: Accumulate block logs
StreamProcessor->>Chat: Stream chunks (content)
Chat->>Chat: Display streaming content
Server-->>WorkflowExec: Final event with logs
WorkflowExec->>Chat: processStreamingResponse (final event)
Chat->>Chat: Extract non-content outputs from logs
Note over Chat: Filter path !== 'content'
Chat->>Chat: Append additional outputs (model, tokens, etc.)
Chat->>User: Display complete response
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts
Show resolved
Hide resolved
Collaborator
Author
|
@greptile |
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Enhanced chat streaming to extract and display all selected output fields (like model, tokens, toolCalls) from execution logs, not just the content field.
Key Changes:
- Added logic in
processStreamingResponseto process the final execution result and extract non-contentselected outputs from block logs - Modified
useWorkflowExecutionto accumulateBlockLogentries during execution so they're available in the final event - Updated dependency array in
processStreamingResponseto includeselectedOutputsandactiveWorkflowId
Confidence Score: 4/5
- This PR is safe to merge with minimal risk - focused bug fix with proper error handling
- The changes are well-contained and address a specific bug where non-content output selections weren't being displayed in chat. The implementation follows existing patterns, includes proper guards, and correctly filters out the content path to avoid duplication. Dependencies are properly declared in useCallback.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/chat.tsx | 4/5 | Enhanced streaming response handler to extract non-content selected outputs from execution logs and append them to chat messages |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts | 4/5 | Added block log accumulation in server-side execution callbacks to populate execution result logs for both success and error cases |
Sequence Diagram
sequenceDiagram
participant User
participant Chat
participant useWorkflowExecution
participant ExecutionStream
participant processStreamingResponse
User->>Chat: Send message with output selections
Chat->>useWorkflowExecution: handleRunWorkflow(input)
useWorkflowExecution->>ExecutionStream: execute workflow
alt Streaming Block (Agent/Router)
ExecutionStream-->>processStreamingResponse: Stream chunks
processStreamingResponse->>Chat: Append content chunks
end
alt Non-Streaming Block (Function)
ExecutionStream->>useWorkflowExecution: onBlockComplete(blockId, output)
useWorkflowExecution->>processStreamingResponse: Send via SSE
processStreamingResponse->>Chat: Append formatted output
end
ExecutionStream->>useWorkflowExecution: onExecutionCompleted(logs)
useWorkflowExecution->>processStreamingResponse: Send final event with logs
processStreamingResponse->>processStreamingResponse: Extract selected outputs from logs
processStreamingResponse->>processStreamingResponse: Filter out 'content' path
processStreamingResponse->>processStreamingResponse: Format additional outputs (model, tokens, etc)
processStreamingResponse->>Chat: Append additional outputs to message
processStreamingResponse->>Chat: Finalize stream
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.
Summary
Fixes #2724
Type of Change
Testing
Tested manually
Checklist