Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Resolution for multi-trigger paths needs to account for trigger mode + block mapping should have all blocks not just execution path.

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 26, 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 26, 2026 7:07am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 26, 2026

Greptile Overview

Greptile Summary

This PR fixes multi-trigger path resolution by ensuring block output schemas are correctly resolved for all blocks (not just executed ones) and that external triggers properly handle structured input formats.

Key Changes:

  • Extracted getBlockSchema helper (block-data.ts:14-27): centralizes logic to get output schema from either block.outputs or toolConfig.outputs, eliminating code duplication
  • Block mapping now includes all blocks (block-data.ts:40-54): changed from iterating only blockStates entries to iterating all workflow.blocks, ensuring schemas are available for blocks that haven't executed yet (critical for multi-trigger scenarios)
  • External trigger output handling (start-block.ts:381-390): buildIntegrationTriggerOutput now accepts and uses structuredInput when hasStructured is true, enabling proper resolution of trigger mode blocks with input formats
  • Simplified BlockResolver (block.ts:70-72): replaced duplicated schema resolution logic with call to shared getBlockSchema function

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The refactoring improves code quality through DRY principles, fixes a logical bug where block schemas weren't available for non-executed blocks, and the changes are well-isolated to executor utilities. The existing test suite covers trigger scenarios and all changes maintain backward compatibility.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/executor/utils/block-data.ts Refactored to use getBlockSchema helper and iterate all blocks for schemas, not just executed blocks
apps/sim/executor/utils/start-block.ts Updated buildIntegrationTriggerOutput to support structured input for external triggers
apps/sim/executor/variables/resolvers/block.ts Simplified to use shared getBlockSchema function instead of duplicating logic

Sequence Diagram

sequenceDiagram
    participant Executor as Executor
    participant BlockData as collectBlockData
    participant GetBlockSchema as getBlockSchema
    participant ToolUtils as getTool
    participant BlockResolver as BlockResolver
    participant StartBlock as buildStartBlockOutput
    participant IntegrationTrigger as buildIntegrationTriggerOutput

    Note over Executor,IntegrationTrigger: Multi-Trigger Resolution Flow

    Executor->>BlockData: collectBlockData(ctx)
    activate BlockData
    
    loop For each blockState
        BlockData->>BlockData: Collect output data
    end
    
    Note over BlockData: NEW: Iterate ALL workflow blocks<br/>(not just executed blocks)
    
    loop For each workflow block
        BlockData->>BlockData: Map block names
        BlockData->>ToolUtils: getTool(block.config.tool)
        ToolUtils-->>BlockData: toolConfig
        BlockData->>GetBlockSchema: getBlockSchema(block, toolConfig)
        activate GetBlockSchema
        
        alt block.outputs exists
            GetBlockSchema-->>BlockData: block.outputs
        else toolConfig.outputs exists
            GetBlockSchema-->>BlockData: toolConfig.outputs
        else
            GetBlockSchema-->>BlockData: undefined
        end
        deactivate GetBlockSchema
        
        BlockData->>BlockData: Store schema for block
    end
    
    BlockData-->>Executor: {blockData, blockNameMapping, blockOutputSchemas}
    deactivate BlockData
    
    Executor->>BlockResolver: resolve(reference, context)
    activate BlockResolver
    BlockResolver->>ToolUtils: getTool(toolId)
    ToolUtils-->>BlockResolver: toolConfig
    BlockResolver->>GetBlockSchema: getBlockSchema(block, toolConfig)
    GetBlockSchema-->>BlockResolver: outputSchema
    BlockResolver-->>Executor: resolved value
    deactivate BlockResolver
    
    Executor->>StartBlock: buildStartBlockOutput(options)
    activate StartBlock
    
    alt path === EXTERNAL_TRIGGER
        StartBlock->>IntegrationTrigger: buildIntegrationTriggerOutput(input, structured, hasStructured)
        activate IntegrationTrigger
        
        alt hasStructured === true
            Note over IntegrationTrigger: NEW: Return structured input<br/>for trigger mode blocks
            IntegrationTrigger-->>StartBlock: {...structuredInput}
        else
            IntegrationTrigger-->>StartBlock: workflowInput as object or {}
        end
        deactivate IntegrationTrigger
    else other paths
        StartBlock->>StartBlock: Build output per path
    end
    
    StartBlock-->>Executor: NormalizedBlockOutput
    deactivate StartBlock
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.

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321
Copy link
Collaborator Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@icecrasher321 icecrasher321 merged commit c140e90 into staging Jan 26, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/multi-trigger branch January 26, 2026 21:15
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