Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • added success check on condition block processor
  • fixed terminal preventDefault copy bug

Type of Change

  • Bug fix

Testing

Tested manually

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 Jan 6, 2026

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 6, 2026 8:48pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 6, 2026

Greptile Summary

This PR fixes two distinct bugs:

Function Execution Error Handling: The transformResponse in apps/sim/tools/function/execute.ts was always returning success: true regardless of the actual API response. The API endpoint (/api/function/execute) returns { success: false, error: ..., output: {...} } when code execution fails (see lines 795-802, 859-866, 949-967 in route.ts), but the tool wasn't checking this field. This caused the condition block processor (ConditionBlockHandler.evaluateConditionExpression) to incorrectly treat failed evaluations as successful, leading to incorrect workflow execution paths.

Copy Keyboard Shortcut Fix: The global Ctrl/Cmd+C handler in workflow.tsx was preventing normal text copying from input fields and textareas. The fix checks if there's an active text selection before intercepting the copy event, allowing native browser copy behavior when text is selected.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Both fixes are straightforward bug corrections with clear logic: the first properly handles API error responses that were being ignored, and the second respects native text selection behavior. The changes are minimal, well-scoped, and align with expected behavior.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/tools/function/execute.ts Added proper error handling by checking API response success status before returning
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx Fixed copy shortcut to respect text selection in inputs/textareas

Sequence Diagram

sequenceDiagram
    participant CH as ConditionHandler
    participant ET as executeTool
    participant TR as transformResponse
    participant API as /api/function/execute
    
    CH->>ET: evaluateConditionExpression(ctx, expression)
    ET->>TR: Call with function_execute config
    TR->>API: POST /api/function/execute
    
    alt Execution Success
        API-->>TR: { success: true, output: {...} }
        TR-->>ET: { success: true, output: {...} }
        ET-->>CH: Boolean(result.output.result)
    else Execution Failure (BEFORE fix)
        API-->>TR: { success: false, error: "...", output: {...} }
        Note over TR: BUG: Always returned success: true
        TR-->>ET: { success: true, output: {...} }
        ET-->>CH: Boolean(result.output.result)
        Note over CH: Wrong path taken!
    else Execution Failure (AFTER fix)
        API-->>TR: { success: false, error: "...", output: {...} }
        Note over TR: Now checks result.success
        TR-->>ET: { success: false, error: "...", output: {...} }
        ET-->>CH: Throws error
        Note over CH: Correct error handling
    end
Loading

@waleedlatif1 waleedlatif1 merged commit 22f949a into staging Jan 6, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/cond branch January 6, 2026 20:52
waleedlatif1 added a commit that referenced this pull request Jan 8, 2026
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