Skip to content

Conversation

@Sg312
Copy link
Contributor

@Sg312 Sg312 commented Nov 7, 2025

Summary

Fix streaming api for new executor and fix non agent block outputs in deployed chats

Type of Change

  • Bug fix

Testing

Manual

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)

waleedlatif1 and others added 24 commits October 11, 2025 22:23
* improvement(performance): remove unused source/target indices, add index on snapshot id (#1603)

* fix(blog): rename building to blogs with redirect (#1604)

* improvement(privacy-policy): updated privacy policy for google (#1602)

* updated privacy policy for google

* update terms, privacy, and emails to incl address and update verbiage

* feat(guardrails): added guardrails block/tools and docs (#1605)

* Adding guardrails block

* ack PR comments

* cleanup checkbox in dark mode

* cleanup

* fix supabase tools

* fix(inference-billing): fix inference billing when stream is true via API, add drag-and-drop functionality to deployed chat (#1606)

* fix(inference): fix inference billing when stream is true via API

* add drag-and-drop to deployed chat

* feat(mistal): added mistral as a provider, updated model prices (#1607)

* feat(mistal): added mistral as a provider, updated model prices

* remove the ability for a block to reference its own outluts

* fixed order of responses for guardrails block

* feat(versions): added the ability to rename deployment versions (#1610)

* fix(vulns): fix various vulnerabilities and enhanced code security (#1611)

* fix(vulns): fix SSRF vulnerabilities

* cleanup

* cleanup

* regen docs

* remove unused deps

* fix failing tests

* cleanup

* update deps

* regen bun lock
* fix(debug-mode): remove duplicate debug mode flag (#1714)

* feat(i18n): update translations (#1709)

* improvement(condition): added variable and envvar highlighting for condition input (#1718)

* fix(dashboard): add additional context for paginated logs in dashboard, add empty state when selected cell has no data (#1719)

* fix(dashboard): add additional context for paginated logs in dashboard, add empty state when selected cell has no data

* apps/sim

* renaming

* remove relative import

* feat(tools): added webflow OAuth + tools (#1720)

* feat(tools): added webflow OAuth + tools

* remove itemId from delete item

* remove siteId

* added webhook triggers + oauth scopes + site/collection selector

* update sample payload for webflow triggers

* cleanup

* fix discord color

* feat(i18n): update translations (#1721)

* improvement(schedule): fix UI bug with schedule modal (#1722)
* fix(already-cancelled-sub): UI should allow restoring subscription

* restore functionality fixed

* fix
@vercel
Copy link

vercel bot commented Nov 7, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Nov 7, 2025 10:34pm

@Sg312 Sg312 merged commit 9fd2156 into staging Nov 7, 2025
9 checks passed
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 Overview

Greptile Summary

This PR fixes streaming API functionality by adding support for deployed workflow execution with proper output selection and formatting.

Key Changes:

  • Added resolveOutputIds function in workflow execution route to convert block names to UUIDs for deployed workflows
  • Integrated createStreamingResponse for non-draft executions, enabling proper streaming for deployed chat workflows
  • Enhanced chat streaming hook to handle outputConfigs, extracting and formatting specific block outputs in final responses
  • Fixed MDX documentation formatting issues with escaped brackets in JSON examples

Implementation:
The PR splits execution paths: draft workflows use console log streaming (existing behavior), while deployed workflows now use the new streaming API that properly handles selected outputs through the createStreamingResponse function. The resolveOutputIds function handles multiple output ID formats (UUID-based, dot notation, block names) and normalizes them for the executor.

Confidence Score: 4/5

  • Safe to merge with minor considerations around edge case handling
  • The implementation is solid with proper fallback handling and logging. Score reflects the complexity of the resolveOutputIds function which handles multiple formats and edge cases. While the logic appears sound, the multiple conditional branches increase cognitive complexity and could benefit from additional test coverage for edge cases like blocks with special characters in names or ambiguous output ID formats.
  • Pay closer attention to apps/sim/app/api/workflows/[id]/execute/route.ts - specifically the resolveOutputIds function's block name matching logic

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/app/api/workflows/[id]/execute/route.ts 4/5 Added streaming API response for deployed workflows with new resolveOutputIds function to handle block name to UUID resolution
apps/sim/app/chat/hooks/use-chat-streaming.ts 4/5 Enhanced final event handling with outputConfigs support, formatting outputs from specific blocks and paths in chat responses

Sequence Diagram

sequenceDiagram
    participant Client as Chat Client
    participant API as /api/workflows/[id]/execute
    participant Streaming as createStreamingResponse
    participant Executor as executeWorkflow
    participant Hook as useChatStreaming

    Client->>API: POST with trigger=chat & streaming
    API->>API: Load deployed workflow state
    API->>API: resolveOutputIds(selectedOutputs, blocks)
    Note over API: Converts block names to UUIDs
    API->>Streaming: createStreamingResponse(config)
    Streaming->>Executor: executeWorkflow(workflow, streamConfig)
    
    loop For each streaming block
        Executor->>Streaming: onStream(blockId, stream)
        Streaming->>Client: SSE chunk events
        Client->>Hook: handleStreamedResponse
        Hook->>Hook: Accumulate text chunks
    end
    
    Executor->>Streaming: onBlockComplete(blockId, output)
    Note over Streaming: Extract selected outputs by path
    Streaming->>Client: SSE chunk with formatted output
    
    Streaming->>Streaming: Build minimal result with selected outputs
    Streaming->>Client: SSE final event with output data
    Client->>Hook: Process final event
    Hook->>Hook: Extract values using outputConfigs
    Hook->>Hook: Format outputs (JSON/string)
    Hook->>Hook: Combine accumulated text + formatted outputs
    Hook->>Client: Update message with final content
Loading

8 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

waleedlatif1 added a commit that referenced this pull request Nov 7, 2025
* fix(billing): should allow restoring subscription (#1728)

* fix(already-cancelled-sub): UI should allow restoring subscription

* restore functionality fixed

* fix

* Fix streaming api

* Fix uuid stuff

* Lint

* Stripe docs fix

* Fix docs build error

* Fix uuid check

* Fix deployed chat streaming for non agent blocks

* Fix lint

---------

Co-authored-by: Waleed <[email protected]>
Co-authored-by: Vikhyath Mondreti <[email protected]>
waleedlatif1 added a commit that referenced this pull request Nov 7, 2025
* feat(i18n): update translations

* fix(streaming-api): fix streaming api (#1846)

* fix(billing): should allow restoring subscription (#1728)

* fix(already-cancelled-sub): UI should allow restoring subscription

* restore functionality fixed

* fix

* Fix streaming api

* Fix uuid stuff

* Lint

* Stripe docs fix

* Fix docs build error

* Fix uuid check

* Fix deployed chat streaming for non agent blocks

* Fix lint
@waleedlatif1 waleedlatif1 deleted the fix/streaming-api branch November 8, 2025 23:28
waleedlatif1 added a commit that referenced this pull request Nov 9, 2025
* fix(billing): should allow restoring subscription (#1728)

* fix(already-cancelled-sub): UI should allow restoring subscription

* restore functionality fixed

* fix

* Fix streaming api

* Fix uuid stuff

* Lint

* Stripe docs fix

* Fix docs build error

* Fix uuid check

* Fix deployed chat streaming for non agent blocks

* Fix lint

---------

Co-authored-by: Waleed <[email protected]>
Co-authored-by: Vikhyath Mondreti <[email protected]>
waleedlatif1 added a commit that referenced this pull request Nov 9, 2025
* feat(i18n): update translations

* fix(streaming-api): fix streaming api (#1846)

* fix(billing): should allow restoring subscription (#1728)

* fix(already-cancelled-sub): UI should allow restoring subscription

* restore functionality fixed

* fix

* Fix streaming api

* Fix uuid stuff

* Lint

* Stripe docs fix

* Fix docs build error

* Fix uuid check

* Fix deployed chat streaming for non agent blocks

* Fix lint
waleedlatif1 added a commit that referenced this pull request Nov 12, 2025
* fix(billing): should allow restoring subscription (#1728)

* fix(already-cancelled-sub): UI should allow restoring subscription

* restore functionality fixed

* fix

* Fix streaming api

* Fix uuid stuff

* Lint

* Stripe docs fix

* Fix docs build error

* Fix uuid check

* Fix deployed chat streaming for non agent blocks

* Fix lint

---------

Co-authored-by: Waleed <[email protected]>
Co-authored-by: Vikhyath Mondreti <[email protected]>
waleedlatif1 added a commit that referenced this pull request Nov 12, 2025
* feat(i18n): update translations

* fix(streaming-api): fix streaming api (#1846)

* fix(billing): should allow restoring subscription (#1728)

* fix(already-cancelled-sub): UI should allow restoring subscription

* restore functionality fixed

* fix

* Fix streaming api

* Fix uuid stuff

* Lint

* Stripe docs fix

* Fix docs build error

* Fix uuid check

* Fix deployed chat streaming for non agent blocks

* Fix lint
@waleedlatif1 waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
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.

4 participants