-
Notifications
You must be signed in to change notification settings - Fork 141
check integrations before running #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| }; | ||
|
|
||
| const handleExecute = async () => { | ||
| // Guard against concurrent executions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The handleExecute function is missing validation checks for empty workflows and generation in progress, which could allow workflow execution to be triggered via keyboard shortcut even when these conditions should prevent it.
View Details
📝 Patch Details
diff --git a/components/workflow/workflow-toolbar.tsx b/components/workflow/workflow-toolbar.tsx
index c21c0be..a1ade04 100644
--- a/components/workflow/workflow-toolbar.tsx
+++ b/components/workflow/workflow-toolbar.tsx
@@ -291,6 +291,7 @@ type WorkflowHandlerParams = {
data: { status?: "idle" | "running" | "success" | "error" };
}) => void;
isExecuting: boolean;
+ isGenerating: boolean;
setIsExecuting: (value: boolean) => void;
setIsSaving: (value: boolean) => void;
setHasUnsavedChanges: (value: boolean) => void;
@@ -308,6 +309,7 @@ function useWorkflowHandlers({
edges,
updateNodeData,
isExecuting,
+ isGenerating,
setIsExecuting,
setIsSaving,
setHasUnsavedChanges,
@@ -380,8 +382,8 @@ function useWorkflowHandlers({
};
const handleExecute = async () => {
- // Guard against concurrent executions
- if (isExecuting) {
+ // Guard against concurrent executions and invalid states
+ if (isExecuting || nodes.length === 0 || isGenerating) {
return;
}
@@ -396,8 +398,8 @@ function useWorkflowHandlers({
};
const handleExecuteAnyway = async () => {
- // Guard against concurrent executions
- if (isExecuting) {
+ // Guard against concurrent executions and invalid states
+ if (isExecuting || nodes.length === 0 || isGenerating) {
return;
}
@@ -536,6 +538,7 @@ function useWorkflowActions(state: ReturnType<typeof useWorkflowState>) {
edges,
updateNodeData,
isExecuting,
+ isGenerating,
setIsExecuting,
setIsSaving,
setHasUnsavedChanges,
@@ -573,6 +576,7 @@ function useWorkflowActions(state: ReturnType<typeof useWorkflowState>) {
edges,
updateNodeData,
isExecuting,
+ isGenerating,
setIsExecuting,
setIsSaving,
setHasUnsavedChanges,
Analysis
Missing validation checks in handleExecute allows workflow execution with empty nodes or during AI generation
What fails: The handleExecute() function in components/workflow/workflow-toolbar.tsx (lines 384-397) does not validate nodes.length === 0 and isGenerating conditions before executing a workflow, allowing the keyboard shortcut (Ctrl+Enter) to bypass these checks that are present in the UI button's disabled state.
How to reproduce:
- Create a new workflow without adding any nodes (just has the trigger)
- Press Ctrl+Enter to trigger the keyboard shortcut
- The workflow executes despite
nodes.length === 0
Alternatively:
- Start an AI workflow generation
- While AI is still generating (isGenerating = true), press Ctrl+Enter
- The workflow executes with incomplete nodes instead of waiting for generation to complete
Result: The keyboard shortcut bypasses the validation checks that the UI button enforces. Looking at the original code in app/workflows/[workflowId]/page.tsx (before toolbar refactoring), the handleRun function had all validations:
if (isExecuting || nodes.length === 0 || isGenerating || !currentWorkflowId) {
return;
}The refactored handleExecute in the toolbar only checks isExecuting (added in commit bc87f49), missing the nodes.length === 0 and isGenerating checks that were present in the original implementation.
Expected: The validation checks should match the button's disabled state to ensure keyboard shortcuts have the same validation as UI clicks. The button correctly disables with:
disabled={state.isExecuting || state.nodes.length === 0 || state.isGenerating}Fix applied: Added isGenerating parameter to WorkflowHandlerParams type and both handleExecute() and handleExecuteAnyway() functions now validate all three conditions:
if (isExecuting || nodes.length === 0 || isGenerating) {
return;
}This ensures keyboard shortcuts have feature parity with the UI button's validation.
* step handler * step logging * better dx * better dx * workflow complete * check integrations before running * add check for db too * adds guard
No description provided.