Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Description

Pass child workflow variables in correctly for workflow in workflow block.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Screen.Recording.2025-07-24.at.4.12.09.PM.mov

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally and in CI (bun run test)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • I have updated version numbers as needed (if needed)
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Security Considerations:

  • My changes do not introduce any new security vulnerabilities
  • I have considered the security implications of my changes

@vercel
Copy link

vercel bot commented Jul 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sim ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2025 11:14pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Skipped (Inspect) Jul 24, 2025 11:14pm

logger.error(`[${requestId}] Failed to parse workflow variables: ${workflowId}`, error)
// Continue execution even if variables can't be parsed
}
// Get workflow variables - they are stored as JSON objects in the database
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

remove useless fallback logic

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.

Greptile Summary

This PR fixes a critical bug where workflow variables were not being passed correctly to child workflows in the workflow-in-workflow block feature. The changes address two key areas:

  1. WorkflowBlockHandler Enhancement: The workflow-handler.ts file now properly extracts workflow variables from the API response and passes them to child workflow executors. Previously, only environment variables were passed, leaving workflow-specific variables inaccessible in nested executions.

  2. Variable Handling Simplification: The execute route in route.ts removes complex JSON parsing logic for workflow variables, instead directly casting them as Record<string, any>. This assumes variables are already stored as JSON objects in the database, eliminating potential parsing errors.

The fix leverages the existing Executor constructor interface that already supports a workflowVariables parameter, making this a straightforward integration. The changes ensure that when a workflow calls another workflow (nested execution), all parent workflow variables are properly accessible in the child context, which is essential for variable resolution throughout the execution chain.

Confidence score: 4/5

  • This appears to be a well-targeted bug fix that addresses a specific functionality gap in workflow variable inheritance
  • The implementation uses existing infrastructure correctly and maintains the established patterns
  • The execute route file needs careful attention due to the removal of error handling for JSON parsing, which could be problematic if the database format assumptions are incorrect

2 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

@icecrasher321 icecrasher321 merged commit a84c557 into staging Jul 24, 2025
5 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/variables-workflow-in-workflow branch July 27, 2025 01:34
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
…simstudioai#783)

* fix(workflow-in-workflow): child workflow must be able to access vars

* simplify
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