fix(chat): use explicit trigger type check instead of heuristic for chat guard#3419
fix(chat): use explicit trigger type check instead of heuristic for chat guard#3419waleedlatif1 merged 3 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview This prevents manual/test executions that happen to include an Written by Cursor Bugbot for commit fec4793. Configure here. |
Greptile SummaryThis PR fixes a false-positive bug in the Key observations:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[executeWorkflow called] --> B{overrideTriggerType?}
B -- "'chat'" --> C[isExecutingFromChat = true]
B -- "'manual' / 'api' / undefined" --> D[isExecutingFromChat = false]
C --> E[Fetch selectedOutputs from chat store]
C --> F[Find chat trigger start block]
C --> G{onStream && isExecutingFromChat?}
G -- yes --> H[Forward stream chunks to chat UI]
G -- no --> I[Skip stream forwarding]
D --> J[Resolve manual/API start block]
C --> K[onExecutionCompleted]
D --> K
K -- isExecutingFromChat=true --> L[Skip setIsExecuting false\nchat finally-block handles cleanup]
K -- isExecutingFromChat=false --> M[setIsExecuting false\nclearActiveBlocks]
C --> N[onExecutionError / onExecutionCancelled]
D --> N
N -- isExecutingFromChat=true --> O[Skip state reset\nchat handles cleanup]
N -- isExecutingFromChat=false --> P[setIsExecuting false\nsetIsDebugging false\nclearActiveBlocks]
Last reviewed commit: fec4793 |
Use only overrideTriggerType === 'chat' instead of also checking for 'input' in workflowInput, which can false-positive on manual executions with workflow input.
|
@greptile |
|
@cursor review |
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts
Outdated
Show resolved
Hide resolved
Replace inline overrideTriggerType !== 'chat' checks with !isExecutingFromChat to stay consistent with the rest of the function.
|
@greptile |
|
@cursor review |
…hat guard (#3419) * fix(chat): use explicit trigger type check instead of heuristic for chat guard * fix(chat): remove heuristic fallback from isExecutingFromChat Use only overrideTriggerType === 'chat' instead of also checking for 'input' in workflowInput, which can false-positive on manual executions with workflow input. * fix(chat): use isExecutingFromChat variable consistently in callbacks Replace inline overrideTriggerType !== 'chat' checks with !isExecutingFromChat to stay consistent with the rest of the function.
* feat(slack): add new tools and user selectors * fix(slack): fix download fileName param and canvas error handling * fix(slack): use markdown format for canvas rename title_content * fix(slack): rename channel output to channelInfo and document presence API limitation * lint * fix(chat): use explicit trigger type check instead of heuristic for chat guard (#3419) * fix(chat): use explicit trigger type check instead of heuristic for chat guard * fix(chat): remove heuristic fallback from isExecutingFromChat Use only overrideTriggerType === 'chat' instead of also checking for 'input' in workflowInput, which can false-positive on manual executions with workflow input. * fix(chat): use isExecutingFromChat variable consistently in callbacks Replace inline overrideTriggerType !== 'chat' checks with !isExecutingFromChat to stay consistent with the rest of the function. * fix(slack): add missing fields to SlackChannel interface * fix(slack): fix canvas transformResponse type mismatch Provide required output fields on error path to match SlackCanvasResponse type. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): move error field to top level in canvas transformResponse The error field belongs on ToolResponse, not inside the output object. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
!isExecutingFromChatheuristic with explicitoverrideTriggerType !== 'chat'check in execution completion callbacksisExecutingFromChatheuristic ('input' in workflowInput) could false-positive for manual executions with a user-defined "input" test field, leavingisExecutingstuck true foreverexecuteWorkflowalways pass an explicit trigger type ('chat','manual'), so this check is deterministicType of Change
Testing
Verified all 3
executeWorkflowcall sites always pass explicitoverrideTriggerType. Type check passes clean.Checklist