You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
runner.py: reject zero or negative agent, fan-out and budget values - #6
pipeline/runner.py takes --agents, --fan-out and --budget as plain int/float with no range check. The preset builders slice with prompts[:n], so bad values change the run silently:
--agents 0 builds zero tasks.
--agents -3 builds 17 tasks for market_scan, because a negative slice drops items from the end.
--budget 0 or below is accepted.
Change
parse_args() now calls a small _check_positive_args() helper after p.parse_args(). It rejects --agents < 1, --fan-out < 1 and --budget <= 0 with p.error(...), which prints a usage message and exits with status 2.
Defaults are unchanged. The helper is a separate function so parse_args() stays under the 60-line rule.
Testing
Added pipeline/test_runner_args.py, which runs the dry-run path with each invalid value and expects exit status 2, and runs --preset market_scan --agents 5 --dry-run and expects 5 tasks. It needs no API key or extra packages.
Before the fix, python pipeline/test_runner_args.py fails on all five invalid values (exit 0 instead of 2).
After the fix, it passes.
python pipeline/runner.py --preset market_scan --agents -3 --dry-run now exits 2 with --agents must be at least 1 (got -3).
python pipeline/runner.py --preset market_scan --agents 5 --dry-run still prints the summary and exits 0.
The other commands in the issue (--agents 0, --fan-out 0, --budget 0) were also run and exit 2 with the matching message.
Regression test: fails on base twice (/exit=\d+ expected=2/), passes on fix twice (python pipeline/test_runner_args.py)
Thanks for this, Jay. The fix is small and clear, and the error messages tell the user exactly what went wrong.
I checked out the branch and ran the CI steps locally plus python pipeline/test_runner_args.py on Python 3.11 and 3.9, and it passes. I also ran your test against the old runner.py and it failed on all five bad values, so it really guards the fix. Valid input still works as before. The default market_scan dry run builds 20 tasks, --agents 1 builds 1, --prompt hi with the default fan-out builds 20, --budget 0.01 is accepted and --tasks bln_100_agents.json still builds 100. The agent and budget checks also match the asserts already in Orchestrator, so a bad value now fails early with a clear message instead of a traceback on a real run.
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
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.
Problem
pipeline/runner.pytakes--agents,--fan-outand--budgetas plainint/floatwith no range check. The preset builders slice withprompts[:n], so bad values change the run silently:--agents 0builds zero tasks.--agents -3builds 17 tasks formarket_scan, because a negative slice drops items from the end.--budget 0or below is accepted.Change
parse_args()now calls a small_check_positive_args()helper afterp.parse_args(). It rejects--agents < 1,--fan-out < 1and--budget <= 0withp.error(...), which prints a usage message and exits with status 2.parse_args()stays under the 60-line rule.Testing
Added
pipeline/test_runner_args.py, which runs the dry-run path with each invalid value and expects exit status 2, and runs--preset market_scan --agents 5 --dry-runand expects 5 tasks. It needs no API key or extra packages.python pipeline/test_runner_args.pyfails on all five invalid values (exit 0 instead of 2).python pipeline/runner.py --preset market_scan --agents -3 --dry-runnow exits 2 with--agents must be at least 1 (got -3).python pipeline/runner.py --preset market_scan --agents 5 --dry-runstill prints the summary and exits 0.The other commands in the issue (
--agents 0,--fan-out 0,--budget 0) were also run and exit 2 with the matching message.Regression test: fails on base twice (/exit=\d+ expected=2/), passes on fix twice (
python pipeline/test_runner_args.py)Fixes #3