Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Derive the block/tool outputs the same way throughout codebase -- based on actual block registry. Previously, resolver takes it from block outputs [from state rather than registry]

Type of Change

  • Bug fix
  • Other: Code quality improvement

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 Feb 10, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 10, 2026 6:25pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 10, 2026

Greptile Overview

Greptile Summary

This PR centralizes block output/path/type derivation by introducing getEffectiveBlockOutputs/getEffectiveBlockOutputPaths/getEffectiveBlockOutputType in apps/sim/lib/workflows/blocks/block-outputs.ts, and then updating UI, copilot tools, workflow builders, and executor schema resolution to use these helpers instead of mixing state-derived outputs, tool outputs, and ad-hoc responseFormat parsing.

Key integration points:

  • UI tag/output pickers now derive available references from the registry + subBlocks (and tool selection) via the new “effective” helpers.
  • Executor variable resolution and schema collection now validate references against schemas derived from the registry (with includeHidden: true to allow pre-execution validation of hidden fields).
  • Copilot workflow tools now list outputs using the same derivation logic.

Issues to address before merge mainly relate to option consistency (triggerMode vs preferToolOutputs) and payload/test shape mismatches that can cause consumers to see missing/incorrect outputs or inconsistent metadata.

Confidence Score: 3/5

  • This PR is mostly safe to merge after fixing a few correctness inconsistencies in output derivation/options and one test realism issue.
  • Core refactor to centralize schema derivation looks coherent and has added parity tests, but there are a couple of concrete option inconsistencies (triggerMode/preferToolOutputs) that can lead to missing outputs in UI and inconsistent tool payloads, plus a unit test that may not reflect the normalized responseFormat shape used in practice.
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-block-output-fields.ts; apps/sim/lib/workflows/defaults.ts; apps/sim/lib/copilot/orchestrator/tool-executor/workflow-tools/queries.ts; apps/sim/lib/copilot/tools/server/workflow/edit-workflow/builders.test.ts

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-block-output-fields.ts Replaced custom output handling with getEffectiveBlockOutputs; however triggerMode/preferToolOutputs selection can be wrong when block.triggerMode is true but triggers aren’t enabled.
apps/sim/executor/utils/block-data.ts Executor schema collection now derives outputs from registry via getEffectiveBlockOutputs(includeHidden) instead of state/tool config. Simplifies schema computation.
apps/sim/lib/copilot/orchestrator/tool-executor/workflow-tools/queries.ts Switched to getEffectiveBlockOutputPaths for output listing; loop/parallel triggerMode field remains unnormalized (can be undefined).
apps/sim/lib/copilot/tools/server/workflow/edit-workflow/builders.test.ts Adds unit test for createBlockFromParams agent output derivation; responseFormat shape may not match normalized runtime representation.
apps/sim/lib/workflows/blocks/block-outputs.ts Introduces getEffectiveBlockOutputs/Paths/Type with includeHidden option; unifies agent responseFormat + evaluator metrics + tool outputs handling.
apps/sim/lib/workflows/defaults.ts Default start block outputs now derived via getEffectiveBlockOutputs with preferToolOutputs forced true; may unintentionally select tool outputs.

Sequence Diagram

sequenceDiagram
  participant UI as UI (TagDropdown/OutputSelect)
  participant Store as SubBlockStore/WorkflowStore
  participant BO as block-outputs.ts
  participant Reg as BlockRegistry/ToolsRegistry
  participant Exec as Executor (BlockResolver)

  UI->>Store: read block.type + subBlocks
  UI->>BO: getEffectiveBlockOutputPaths/Type(type, subBlocks, opts)
  BO->>Reg: getBlock(type)
  alt preferToolOutputs && !triggerMode
    BO->>Reg: blockConfig.tools.config.tool(params)
    BO->>Reg: getTool(toolId).outputs
    BO-->>UI: tool-derived outputs/paths/types
  else triggerMode && triggers.enabled
    BO->>Reg: getTrigger(triggerId).outputs
    BO-->>UI: trigger-derived outputs
  else
    BO-->>UI: blockConfig.outputs + inputFormat applied
  end

  Exec->>BO: getEffectiveBlockOutputs(type, paramsToSubBlocks(config.params), includeHidden)
  BO-->>Exec: output schema for validation
  Exec-->>Exec: resolveBlockReference() validates path against schema
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.

12 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 10, 2026

Additional Comments (1)

apps/sim/lib/workflows/blocks/block-outputs.ts
Duplicate agent responseFormat logic

getBlockOutputs() already contains an if (blockType === 'agent') { ... } branch that derives outputs from responseFormat (apps/sim/lib/workflows/blocks/block-outputs.ts:310-328). The new getEffectiveBlockOutputs() adds another agent responseFormat derivation via getResponseFormatOutputs() (apps/sim/lib/workflows/blocks/block-outputs.ts:388-391). This double-implementation is now divergent risk and makes behavior harder to reason about (e.g., changes must be made in two places). Consider removing the agent special-case from getBlockOutputs() and letting getEffectiveBlockOutputs() be the single entry point for responseFormat-based agent outputs (or vice versa), but not both.

@icecrasher321
Copy link
Collaborator Author

@cursor review

@icecrasher321
Copy link
Collaborator Author

@cursor review

…-derivation

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	apps/sim/lib/copilot/tools/client/workflow/block-output-utils.ts
@icecrasher321
Copy link
Collaborator Author

@cursor review

@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
Copy link
Collaborator Author

@greptile

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.

6 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 10, 2026

Additional Comments (1)

apps/sim/lib/copilot/orchestrator/tool-executor/workflow-tools/queries.ts
Inconsistent triggerMode type

In executeGetBlockOutputs, loop/parallel entries set triggerMode: block.triggerMode (possibly undefined), while other blocks use Boolean(block.triggerMode) for output derivation. This makes the tool output payload inconsistent (triggerMode sometimes boolean, sometimes undefined), which can break consumers expecting a boolean. Consider normalizing loop/parallel to Boolean(block.triggerMode) as well.

@icecrasher321
Copy link
Collaborator Author

@cursor review

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@icecrasher321 icecrasher321 merged commit 20b230d into staging Feb 11, 2026
11 checks passed
@icecrasher321 icecrasher321 deleted the improvement/schema-derivation branch February 11, 2026 00:31
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.

1 participant