fix(workflows): fail fan-in step on non-list wait_for instead of crashing#3482
Open
Noor-ul-ain001 wants to merge 1 commit into
Open
fix(workflows): fail fan-in step on non-list wait_for instead of crashing#3482Noor-ul-ain001 wants to merge 1 commit into
Noor-ul-ain001 wants to merge 1 commit into
Conversation
…hing
`FanInStep.validate()` and the engine's fan-in checks both reject a
non-list `wait_for`, but the engine's `execute()` path does not
auto-validate (see `WorkflowEngine.load_workflow`, whose docstring notes
the definition is "not yet validated"). On an unvalidated run, `execute`
iterated the raw value with `for step_id in wait_for`, with two bad
outcomes:
* a scalar (`wait_for: 5`, `wait_for: null`) raised `TypeError` and
took down the whole run — the engine invokes `step_impl.execute()`
with no surrounding try/except; and
* a string (`wait_for: stepA`) silently iterated its characters and
returned a join of empty results with a COMPLETED status — the exact
"silent empty result + COMPLETED" wiring bug the engine's own fan-in
validation comment warns against.
Guard `execute` to return a FAILED StepResult naming the type error
instead, mirroring the fan-out step's non-list `items` handling. A
missing `wait_for` key still defaults to an empty list (COMPLETED),
unchanged; the guard fires only on an explicit non-list value.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FanInStep.validate()and the engine's fan-in wiring checks both reject a non-listwait_for, but the engine'sexecute()path does not auto-validate —WorkflowEngine.load_workflow's docstring notes the returned definition is "not yet validated; callvalidate_workflow()orengine.validate()separately."On such an unvalidated run,
FanInStep.executeiterated the raw value (for step_id in wait_for), with two bad outcomes depending on the type:wait_for: 5,wait_for: null) →TypeError, which took down the whole run, since the engine callsstep_impl.execute()with no surrounding try/except.wait_for: stepA) → silently iterated the string's characters, returning a join of empty results with aCOMPLETEDstatus:That silent-wrong case is exactly the "silent empty result + COMPLETED" wiring bug the engine's own fan-in validation comment (
engine.py) warns against.Fix
Guard
executeto return aFAILEDStepResultnaming the type error — mirroring the fan-out step's non-listitemshandling (test_execute_non_list_items_fails_loudly) and the switch/max_iterations/timeout/fan-in-outputguards. A missingwait_forkey still defaults to an empty list (COMPLETED), unchanged; the guard fires only on an explicit non-list value.Same bug class as #3481 and prior fixes: a validator catches the bad value, but the runtime path crashes (or silently misbehaves) on it when validation is skipped.
Testing
TestFanInStep::test_execute_non_list_wait_for_fails_loudly(parametrized overstr,int,None,dict).tests/test_workflows.pypasses except the 11 pre-existing Windows symlink-guard tests (fail identically on a clean base; require elevation).ruff checkclean on the changed files.🤖 Generated with Claude Code