Skip to content

fix(workflows): fan-out max_concurrency .inf falls back to sequential instead of crashing#3521

Open
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:fix/engine-maxconcurrency-inf-overflow
Open

fix(workflows): fan-out max_concurrency .inf falls back to sequential instead of crashing#3521
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:fix/engine-maxconcurrency-inf-overflow

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

What

A fan-out step with max_concurrency: .inf crashes the entire workflow run:

OverflowError: cannot convert float infinity to integer

WorkflowEngine._run_fan_out coerces the user-controlled max_concurrency with int() inside except (TypeError, ValueError):

try:
    workers = max(1, int(max_concurrency))
except (TypeError, ValueError):
    workers = 1

But int(float("inf")) raises OverflowError, 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 OverflowError to the except tuple so .inf falls back to sequential like any other uncoercible value. (.nan already coerced via ValueError.) 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_sequential parametrization with float("inf")/float("nan") — fails before on inf (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.

…, 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>
@jawwad-ali jawwad-ali requested a review from mnriem as a code owner July 14, 2026 17:13
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.

1 participant