Fail fast on unknown shell run arguments#1490
Closed
biefan wants to merge 1 commit intoAzure:mainfrom
Closed
Conversation
6076fd4 to
eaf604a
Compare
hannahwestra25
approved these changes
Mar 17, 2026
rlundeen2
reviewed
Mar 17, 2026
| else: | ||
| logger.warning(f"Unknown argument: {parts[i]}") | ||
| i += 1 | ||
| raise ValueError(f"Unknown argument: {parts[i]}") |
Contributor
There was a problem hiding this comment.
I didn't see where this is in code, but hoping this doesn't terminate the process, just re-type. If so that's ideal :)
Contributor
|
Fixed it in another pr because we had to consolidate another fix. Closing this one although this is independently a good fix. See: #1489 |
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
pyrit_shell runarguments instead of logging a warning and continuingruninput is shown to the user immediatelyProblem
parse_run_arguments()currently logs unknown tokens and keeps parsing. In shell mode that means a typo can be silently ignored while the rest of the command still runs.For example:
run demo --bogus 123 --max-retries 2currently logs warnings for
--bogusand123, but still returns a parsed command withmax_retries=2.That turns invalid CLI input into a silent partial execution instead of a clear parse error.
Testing
.venv/bin/pytest tests/unit/cli/test_frontend_core.py -q.venv/bin/pytest tests/unit/cli/test_pyrit_shell.py -q -k parse_error