fix(deployed-chat): include workspace id in deployed chat request#1664
Merged
waleedlatif1 merged 1 commit intostagingfrom Oct 16, 2025
Merged
fix(deployed-chat): include workspace id in deployed chat request#1664waleedlatif1 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
Summary
Fixed deployed chat requests to include workspaceId when executing workflows, ensuring proper environment variable resolution and logging context.
Key changes:
- Added
workspaceIdto workflow query in chat route - Updated
StreamingResponseOptionsinterface to accept optionalworkspaceId - Passed
workspaceIdtocreateStreamingResponsefor workflow execution
Issues found:
- Line 135 still uses
deployment.userIdinstead ofworkflowResult[0].workspaceIdfor file upload context, creating inconsistency
Confidence Score: 3/5
- This PR is mostly safe but has one critical inconsistency that needs fixing
- The PR correctly adds
workspaceIdto workflow execution but misses updating it in the file upload context (line 135), which could lead to files being uploaded with incorrect workspace context - Pay close attention to
apps/sim/app/api/chat/[identifier]/route.ts- the file upload context needs the same fix
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/app/api/chat/[identifier]/route.ts | 3/5 | Added workspaceId to deployed chat workflow execution, but file upload context still uses incorrect deployment.userId |
| apps/sim/lib/workflows/streaming.ts | 5/5 | Added workspaceId property to workflow type definition as optional field |
Sequence Diagram
sequenceDiagram
participant Client
participant ChatAPI as Chat API Route
participant DB as Database
participant Streaming as Streaming Module
participant Execute as Execute Workflow
Client->>ChatAPI: POST /api/chat/[identifier]
ChatAPI->>DB: Query chat deployment
ChatAPI->>DB: Query workflow (get workspaceId)
Note over ChatAPI,DB: NEW: workspaceId added to query
ChatAPI->>ChatAPI: Process files (uses workspaceId)
ChatAPI->>Streaming: createStreamingResponse()
Note over ChatAPI,Streaming: NEW: workspaceId passed in workflow object
Streaming->>Execute: executeWorkflow(workflow)
Note over Execute: Uses workspaceId for:<br/>- Environment variables<br/>- Logging session<br/>- Execution context
Execute-->>Streaming: Execution result
Streaming-->>ChatAPI: Stream response
ChatAPI-->>Client: SSE stream
Additional Comments (1)
-
apps/sim/app/api/chat/[identifier]/route.ts, line 135 (link)logic: inconsistent
workspaceId- usingdeployment.userIdhere butworkflowResult[0].workspaceIdon line 153
2 files reviewed, 1 comment
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
include workspace id in deployed chat request
Type of Change
Testing
Tested manually
Checklist