fix(workflows): fan-out max_concurrency .inf falls back to sequential instead of crashing#3521
Open
jawwad-ali wants to merge 1 commit into
Open
Conversation
…, not crash
_run_fan_out coerces max_concurrency with int() inside except (TypeError,
ValueError). int(float('inf')) raises OverflowError, which is not in that tuple,
so a YAML 'max_concurrency: .inf' crashed the whole run with an uncaught
OverflowError instead of the documented 'cannot be coerced -> sequential'
fallback. Add OverflowError to the except tuple (nan already coerced via
ValueError).
Extends the existing invalid-value parametrization with float('inf')/nan (fails
before on inf: OverflowError; passes after: sequential, all items in order).
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.
What
A fan-out step with
max_concurrency: .infcrashes the entire workflow run:WorkflowEngine._run_fan_outcoerces the user-controlledmax_concurrencywithint()insideexcept (TypeError, ValueError):But
int(float("inf"))raisesOverflowError, which is not in that tuple — so.inf(a valid YAML float) escapes the guard and takes down the run, contradicting the method's own docstring ("a value that cannot be coerced … runs sequentially").Fix
Add
OverflowErrorto the except tuple so.inffalls back to sequential like any other uncoercible value. (.nanalready coerced viaValueError.) One-line change; direction matches the documented intent and the sibling numeric-coercion guards in this codebase (e.g._coerce_input's OverflowError handling).Test
Extends the existing
test_invalid_max_concurrency_coerces_to_sequentialparametrization withfloat("inf")/float("nan")— fails before oninf(OverflowError), passes after (sequential, all items in order).🤖 Written with the assistance of Claude Code (AI). Bug self-found; fix/tests verified locally (fail-before / pass-after), ruff clean.