Skip to content

Conversation

@Sg312
Copy link
Contributor

@Sg312 Sg312 commented Nov 12, 2025

Summary

Fixes duplicate error and cmd+enter to run workflow

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)

@vercel
Copy link

vercel bot commented Nov 12, 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 12, 2025 9:40am

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 12, 2025

Greptile Overview

Greptile Summary

Fixed duplicate error logging and Cmd+Enter keyboard shortcut behavior for workflow execution.

  • Error logging: Prevented duplicate error messages by ensuring BlockExecutor logs complete error details once, while higher-level handlers (route.ts) only log error messages. Frontend now distinguishes between pre-execution errors (validation/serialization) and block execution errors.
  • Cmd+Enter fix: Simplified keyboard shortcut handler to exactly mirror the Run button behavior by removing unnecessary disabled state check that was preventing execution.
  • Error metadata: Preserved block error metadata (blockId, blockName, blockType) by attaching executionResult to original error objects instead of creating new ones.
  • Unhandled promises: Added empty catch handler in trackExecution to prevent unhandled rejection warnings while errors are properly handled by Promise.all/Promise.race.

Confidence Score: 5/5

  • This PR is safe to merge with no risk - it only improves error handling and fixes a keyboard shortcut bug
  • The changes are well-reasoned bug fixes that improve error handling by reducing duplicate logging, preserving error metadata, and fixing the Cmd+Enter shortcut. All changes follow defensive programming patterns (checking for object types, using fallbacks). No new functionality or breaking changes introduced.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/app/api/workflows/[id]/execute/route.ts 5/5 Reduced duplicate error logging by only logging error messages instead of full error objects, since BlockExecutor already logs complete error details
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/panel-new.tsx 5/5 Simplified Cmd+Enter handler to match button behavior exactly, removing unnecessary disabled state check and error handling
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts 5/5 Added check to prevent duplicate console entries for block errors by only logging pre-execution errors (validation, serialization) when no blocks have executed
apps/sim/executor/execution/engine.ts 5/5 Preserved original error metadata by attaching executionResult to existing error instead of creating new one, plus added empty catch handler to prevent unhandled rejection warnings

Sequence Diagram

sequenceDiagram
    participant User
    participant Panel as Panel UI
    participant Hook as useWorkflowExecution
    participant API as Execute Route
    participant Engine as ExecutionEngine
    participant BlockExec as BlockExecutor

    User->>Panel: Press Cmd+Enter or Click Run
    Panel->>Hook: runWorkflow()
    Hook->>API: POST /api/workflows/[id]/execute
    
    alt Pre-execution Error (validation/serialization)
        API-->>Hook: Error (no blocks executed)
        Hook->>Hook: Check existingLogs.length === 0
        Hook->>Hook: addConsole (validation error)
    else Normal Execution
        API->>Engine: execute()
        Engine->>BlockExec: executeBlock()
        
        alt Block Error
            BlockExec->>BlockExec: logger.error (full details)
            BlockExec-->>Engine: throw error with metadata
            Engine->>Engine: Attach executionResult to error
            Engine-->>API: throw error
            API->>API: Log only error.message
            API-->>Hook: onBlockError callback
            Hook->>Hook: addConsole (block error)
        else Block Success
            BlockExec-->>Engine: success
            Engine-->>API: success
            API-->>Hook: onBlockComplete callback
        end
    end
Loading

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.

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@Sg312 Sg312 merged commit 56835b9 into staging Nov 12, 2025
9 checks passed
waleedlatif1 pushed a commit that referenced this pull request Nov 12, 2025
* Fix executor error

* Fix cmd+enter

* Lint
@waleedlatif1 waleedlatif1 deleted the fix/executor-again branch November 12, 2025 15:39
waleedlatif1 pushed a commit that referenced this pull request Nov 12, 2025
* Fix executor error

* Fix cmd+enter

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

2 participants