Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 12, 2026

Fixes an issue where subworkflow deployments with optional inputs whose dependencies resolve to undefined were raising INVALID_INPUTS errors instead of executing seamlessly using default values. The fix filters out undefined values (in addition to None) in the input compilation methods for SubworkflowDeploymentNode.

Review & Testing Checklist for Human

  • Verify the test test_compile_subworkflow_inputs__undefined_input_filtered fails on main (produces 2 inputs with undefined serialized as empty string) and passes on this branch (produces 1 input with undefined filtered out)
  • Confirm filtering undefined values doesn't break existing subworkflow deployment functionality
  • Consider if there are other code paths in the SDK that might need similar undefined filtering

Test Plan

  1. Run pytest src/vellum/workflows/nodes/displayable/subworkflow_deployment_node/tests/test_node.py::test_compile_subworkflow_inputs__undefined_input_filtered -xvs on this branch - should pass
  2. Checkout main and run the same test - should fail with "Expected 1 input, got 2"

Notes

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

assert initiated_events[1].body.workflow_definition.is_dynamic is True # Inline workflow


def test_inline_subworkflow_node__undefined_input_filtered():
Copy link
Contributor

Choose a reason for hiding this comment

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

DevinAI remove this test and associated implementation, we want to focus on the deployment variants

deployment = "example_subworkflow_deployment"
subworkflow_inputs = {
"required_input": "hello",
"optional_input": undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

DevinAI remove this input from being defined

]
yield from expected_events

vellum_client.execute_workflow_stream.side_effect = generate_subworkflow_events
Copy link
Contributor

Choose a reason for hiding this comment

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

DevinAI we want to mock the pull api so we can test the resolved flow and not the execute_workflow_stream

devin-ai-integration bot and others added 2 commits January 16, 2026 16:34
When optional subworkflow inputs have dependencies that resolve to undefined,
the workflow should execute seamlessly using default values instead of raising
INVALID_INPUTS errors. This change filters out undefined values in both
SubworkflowDeploymentNode and InlineSubworkflowNode input compilation methods.

Co-Authored-By: vargas@vellum.ai <vargas@vellum.ai>
…and update test

Co-Authored-By: vargas@vellum.ai <vargas@vellum.ai>
@devin-ai-integration devin-ai-integration bot force-pushed the devin/apo-2731-1768259648 branch from f5dd0a4 to 90070a1 Compare January 16, 2026 16:35
@dvargas92495
Copy link
Contributor

DevinAI can you run the test you added here against the main branch and show me what happens when you do?

@devin-ai-integration
Copy link
Contributor Author

I ran the test against main and it passes:

============================= test session starts ==============================
platform linux -- Python 3.9.22, pytest-7.4.4, pluggy-1.6.0
...
vellum/workflows/nodes/displayable/subworkflow_deployment_node/tests/test_resolved_workflow_path.py::test_run_workflow__resolved_workflow_path PASSED
======================= 1 passed, 435 warnings in 0.07s ========================

This means the test currently only proves "resolved workflow path works when the optional input is omitted from the dict" - which already works on main. It does not exercise the undefined filtering scenario from APO-2731.

To actually demonstrate the bug fix, the test would need to create a situation where subworkflow_inputs contains an entry whose value is undefined. Would you like me to:

  1. Modify the test to use a BaseInputs instance with an undefined value instead of a raw dict?
  2. Find a way to produce undefined through normal workflow dependency resolution (e.g., via merge behaviors)?
  3. Keep the test as-is since it at least verifies the resolved path works correctly?

@dvargas92495
Copy link
Contributor

DevinAI I would like you to revert the changes to inputs/base.py and keep iterating on the test until you have something that fails on main

@devin-ai-integration
Copy link
Contributor Author

I checked the PR diff and commit history - there are no changes to inputs/base.py in this PR. The only files changed are:

  • src/vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py
  • src/vellum/workflows/nodes/displayable/subworkflow_deployment_node/tests/test_node.py

I'll now iterate on the test to create one that fails on main. I'll set up a scenario where subworkflow_inputs references an upstream node output that resolves to undefined through normal workflow execution (e.g., via conditional branching or merge behavior).

Co-Authored-By: vargas@vellum.ai <vargas@vellum.ai>
@devin-ai-integration
Copy link
Contributor Author

I've updated the test to properly demonstrate the bug fix. The new test test_compile_subworkflow_inputs__undefined_input_filtered:

  1. Creates an upstream node with an output that is declared but never set (resolves to undefined)
  2. References that output in the subworkflow_inputs dict
  3. Verifies that _compile_subworkflow_inputs() filters out the undefined value

On main: The test fails because undefined is serialized as an empty string in a WorkflowRequestJsonInputRequest, resulting in 2 inputs instead of 1.

On this branch: The test passes because undefined values are filtered out, resulting in only 1 input.

This test exercises the actual bug fix in _add_compiled_input which now filters out undefined values before they get serialized for the API call.

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