fix: reject unknown CLI args unless running in --reflect mode#568
Open
Kailigithub wants to merge 1 commit into
Open
fix: reject unknown CLI args unless running in --reflect mode#568Kailigithub wants to merge 1 commit into
Kailigithub wants to merge 1 commit into
Conversation
Previously, agentmain.py used parse_known_args() and silently ignored unknown flags. A typo like `--goal` (intended for a different launcher) was accepted without warning, causing the process to fall through into interactive mode and hang without dispatching any work. Now, unknown arguments are only permitted when --reflect is set, since extra key/value pairs are forwarded to the reflect script as parameters. Otherwise parser.error() prints usage and exits non-zero. Closes lsdefine#566
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.
Problem
agentmain.pyusedparse_known_args(), which silently accepted unknownCLI flags. A typo like
--goal(intended for a separate Hive launcher)was swallowed without warning, causing the process to fall through into
the interactive agent loop in the background — the TUI looked frozen
because no master dispatch was ever published.
Reported in #566.
Fix
Add a guard after
parse_known_args():--reflectis not set, callparser.error(...)so argparse prints usage and exits non-zero.--reflectpath is unchanged: extra--key valuepairs are stillforwarded to the reflect script as
_reflect_args.Verification
Local tests with a synthetic argv (no API keys required):
ruff check agentmain.py --select F,E9reports only pre-existingfindings (F541 f-string in another function, F401 side-effect
readlineimport) — none introduced by this patch.
Closes #566