Skip to content

Conversation

@ctate
Copy link
Collaborator

@ctate ctate commented Nov 28, 2025

No description provided.

@vercel
Copy link
Contributor

vercel bot commented Nov 28, 2025

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

Project Deployment Preview Comments Updated (UTC)
workflow-builder Ready Ready Preview Comment Nov 29, 2025 0:20am

};

const handleExecute = async () => {
// Guard against concurrent executions
Copy link
Contributor

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:

  1. Create a new workflow without adding any nodes (just has the trigger)
  2. Press Ctrl+Enter to trigger the keyboard shortcut
  3. The workflow executes despite nodes.length === 0

Alternatively:

  1. Start an AI workflow generation
  2. While AI is still generating (isGenerating = true), press Ctrl+Enter
  3. 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.

@ctate ctate merged commit d646580 into main Nov 29, 2025
4 checks passed
taitsengstock pushed a commit to techops-services/keeperhub that referenced this pull request Dec 8, 2025
* step handler

* step logging

* better dx

* better dx

* workflow complete

* check integrations before running

* add check for db too

* adds guard
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.

2 participants