Skip to content

fix(chat): update stream to respect all output select objects - #2729

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/output-selector
Jan 8, 2026
Merged

fix(chat): update stream to respect all output select objects#2729
waleedlatif1 merged 1 commit into
stagingfrom
fix/output-selector

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • update stream to respect all output select objects

Fixes#2724

Type of Change

  • Bug fix

Testing

Tested manually

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)

@vercel

vercelBot commented Jan 8, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentReviewUpdated (UTC)
docsSkippedSkippedJan 8, 2026 7:44pm

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

FilenameScoreOverview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/chat.tsx4/5Added 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.ts3/5Accumulates 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
Loading

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 processStreamingResponse to process the final execution result and extract non-content selected outputs from block logs
  • Modified useWorkflowExecution to accumulate BlockLog entries during execution so they're available in the final event
  • Updated dependency array in processStreamingResponse to include selectedOutputs and activeWorkflowId

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

FilenameScoreOverview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/chat.tsx4/5Enhanced 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.ts4/5Added 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
Loading

@waleedlatif1
waleedlatif1 merged commit fdac431 into stagingJan 8, 2026
10 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/output-selector branch January 8, 2026 19:54
Sign up for freeto 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.

1 participant

@waleedlatif1