Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • remove dead code from condition handler
  • defer resolution to function execute tool like the function block, previously used variable resolver which has different rules than the function execute tool

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)

…tion to function execute tool like the function block
@vercel
Copy link

vercel bot commented Dec 20, 2025

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Dec 20, 2025 3:56am

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 20, 2025

Greptile Summary

  • Refactors condition handler to use function_execute tool for variable resolution instead of custom variable resolver, aligning with function block behavior
  • Removes deprecated constructor parameters (pathTracker, resolver) and manual resolution logic from ConditionBlockHandler class
  • Updates test suite to remove mock resolver dependencies and add validation for new function_execute tool integration

Important Files Changed

Filename Overview
apps/sim/executor/handlers/condition/condition-handler.ts Refactored to delegate variable resolution to function_execute tool; removed manual resolution logic
apps/sim/executor/handlers/condition/condition-handler.test.ts Updated test suite to remove old resolver mocks and validate new function_execute integration

Confidence score: 4/5

  • This PR is safe to merge with low risk of breaking changes
  • Score reflects clean refactoring that standardizes resolution logic across block types, though some edge cases in condition evaluation may require monitoring
  • Pay close attention to how the function_execute tool handles different variable types compared to the old resolver system

Sequence Diagram

sequenceDiagram
    participant User
    participant ConditionBlockHandler
    participant ExecuteTool as "function_execute Tool"
    participant Context as "ExecutionContext"
    
    User->>ConditionBlockHandler: "execute(context, block, inputs)"
    ConditionBlockHandler->>ConditionBlockHandler: "parseConditions(inputs.conditions)"
    ConditionBlockHandler->>Context: "get source block output"
    ConditionBlockHandler->>ConditionBlockHandler: "buildEvaluationContext()"
    
    loop For each condition
        ConditionBlockHandler->>ExecuteTool: "executeTool('function_execute', code)"
        ExecuteTool-->>ConditionBlockHandler: "evaluation result"
        alt Condition is true
            ConditionBlockHandler->>ConditionBlockHandler: "findConnectionForCondition()"
            ConditionBlockHandler->>Context: "set decision in context"
            ConditionBlockHandler-->>User: "return result with selected path"
        end
    end
    
    alt No conditions matched
        ConditionBlockHandler->>ConditionBlockHandler: "check for else condition"
        ConditionBlockHandler->>Context: "set else decision in context"
        ConditionBlockHandler-->>User: "return result with else path"
    end
Loading

@waleedlatif1 waleedlatif1 merged commit a1a189f into staging Dec 20, 2025
11 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/cond branch December 20, 2025 04:18
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