Skip to content

fix(variables): fix variable resolution error and start block outputs - #1847

Merged
Sg312 merged 4 commits into
stagingfrom
fix/var-resolution-not-upstream
Nov 7, 2025
Merged

fix(variables): fix variable resolution error and start block outputs#1847
Sg312 merged 4 commits into
stagingfrom
fix/var-resolution-not-upstream

Conversation

@Sg312

@Sg312Sg312 commented Nov 7, 2025

Copy link
Copy Markdown
Collaborator

Summary

Fix variable resolution error surfacing and start block outputs

Type of Change

  • Bug fix

Testing

Manual

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

vercelBot commented Nov 7, 2025

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentPreviewCommentsUpdated (UTC)
docsSkippedSkippedNov 7, 2025 11:00pm

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Greptile Overview

Greptile Summary

This PR improves error handling in the block executor and fixes variable resolution behavior when blocks haven't executed yet.

Key changes:

  • Error handling refactoring: Extracted duplicate error handling logic into a dedicated handleBlockError method that properly catches and surfaces input resolution errors, ensuring errors during variable resolution are now properly logged and handled
  • Variable resolution fix: Changed BlockResolver to return undefined instead of throwing an error when a block output isn't found, allowing graceful handling of missing upstream block outputs
  • Start block output filtering: Modified start block output generation to exclude empty conversationId fields (setting to undefined instead of empty string) to prevent unnecessary fields in block outputs

Confidence Score: 4/5

  • This PR is safe to merge with minor testing considerations
  • The refactoring is well-structured and improves error handling. The behavior change for conversationId (empty string to undefined) may require test updates. The variable resolution change is sensible but should be verified with integration tests to ensure no regressions in workflows that depend on this behavior.
  • apps/sim/executor/utils/start-block.ts - verify test compatibility with conversationId behavior change

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/executor/execution/block-executor.ts5/5Refactored error handling to properly catch and surface input resolution errors by extracting error handling logic into a dedicated handleBlockError method
apps/sim/executor/utils/start-block.ts4/5Changed conversationId handling to be undefined instead of empty string when not set, may need test updates
apps/sim/executor/variables/resolvers/block.ts5/5Changed block output resolution to return undefined instead of throwing error when block state is not found

Sequence Diagram

sequenceDiagram
participant Executor as BlockExecutor
participant Resolver as VariableResolver
participant BlockRes as BlockResolver
participant State as ExecutionState
Note over Executor: Block Execution Start
Executor->>Resolver: resolveInputs(ctx, nodeId, params, block)
Resolver->>BlockRes: resolve(reference, context)
BlockRes->>State: getBlockOutput(blockId, currentNodeId)
alt Block output exists
State-->>BlockRes: return output
BlockRes-->>Resolver: return resolved value
Resolver-->>Executor: return resolvedInputs
Note over Executor: Continue execution
else Block output not found (NEW)
State-->>BlockRes: return undefined
BlockRes-->>Resolver: return undefined (no error thrown)
Resolver-->>Executor: return resolvedInputs
Note over Executor: Handle gracefully
else Resolution error (NEW)
BlockRes-->>Resolver: throw error
Resolver-->>Executor: throw error
Executor->>Executor: handleBlockError(phase: 'input_resolution')
Note over Executor: Log error & set error output
end
alt Has error port
Executor-->>Executor: Return error output
else No error port
Executor-->>Executor: Throw BlockExecutionError
end
Loading

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment threadapps/sim/executor/utils/start-block.ts
@Sg312
Sg312 merged commit b6c2c74 into stagingNov 7, 2025
9 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/var-resolution-not-upstream branch November 8, 2025 23:28
waleedlatif1 pushed a commit that referenced this pull request Nov 9, 2025
…#1847)
* Fix var resolution if block is not upstream
* Filter convo id from start block outputs if not set
* Lint
* Start block outputs
waleedlatif1 pushed a commit that referenced this pull request Nov 12, 2025
…#1847)
* Fix var resolution if block is not upstream
* Filter convo id from start block outputs if not set
* Lint
* Start block outputs
@waleedlatif1waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
Sign up for freeto 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

@Sg312