Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Tool config must take precedence when they exist

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 18, 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 18, 2026 6:08pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 18, 2026

Greptile Summary

Fixed output schema validation to use tool config outputs when available. Previously, when validating block output paths (e.g., <blockName.field>), the resolver only checked block.outputs from the serialized block data. This caused incorrect validation when the tool's actual output schema differed from the block's stored schema. The fix correctly prioritizes getTool(toolId).outputs over block.outputs, ensuring validation uses the source-of-truth tool configuration.

Key Changes:

  • Added import for getTool utility
  • Modified output schema resolution to check tool config first: toolConfig?.outputs ?? block?.outputs
  • Applied same precedence to both getSchemaFieldNames() and isPathInOutputSchema() calls

This ensures that when tools define their output schemas, those definitions take precedence during path validation, which is the correct behavior for maintaining consistency between tool definitions and runtime validation.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a focused bug fix that correctly establishes precedence for tool config outputs over block outputs. The implementation uses the null coalescing operator (??) which safely falls back to block outputs when tool config is unavailable. The change aligns with the architectural principle that tool configurations should be the source of truth for schema validation.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/executor/variables/resolvers/block.ts Added tool config output schema precedence for path validation - correctly fixes the issue where block output validation should use tool config outputs when available

Sequence Diagram

sequenceDiagram
    participant User
    participant BlockResolver
    participant Block
    participant ToolConfig
    participant Schema

    User->>BlockResolver: resolve("<blockName.path>")
    BlockResolver->>Block: Get block by ID
    BlockResolver->>BlockResolver: Navigate to output path
    
    alt Path not found
        BlockResolver->>Block: Get toolId from block.config.tool
        BlockResolver->>ToolConfig: getTool(toolId)
        
        alt Tool config exists
            ToolConfig-->>BlockResolver: Return tool config
            BlockResolver->>Schema: Use toolConfig.outputs (precedence)
        else Tool config not found
            BlockResolver->>Schema: Use block.outputs (fallback)
        end
        
        BlockResolver->>Schema: Validate path exists in schema
        
        alt Path invalid
            BlockResolver-->>User: Throw error with available fields
        else Path valid but data missing
            BlockResolver-->>User: Return undefined
        end
    else Path found
        BlockResolver-->>User: Return value
    end
Loading

@icecrasher321 icecrasher321 merged commit 7c0f433 into staging Jan 18, 2026
11 checks passed
@icecrasher321 icecrasher321 deleted the fix/resolver branch January 18, 2026 18:12
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