Skip to content

Preserve quoted shell arguments in run parsing#1483

Open
biefan wants to merge 2 commits intoAzure:mainfrom
biefan:fix-shell-run-quoted-arguments
Open

Preserve quoted shell arguments in run parsing#1483
biefan wants to merge 2 commits intoAzure:mainfrom
biefan:fix-shell-run-quoted-arguments

Conversation

@biefan
Copy link
Contributor

@biefan biefan commented Mar 16, 2026

Summary

  • replace naive whitespace splitting in parse_run_arguments() with shell-aware tokenization
  • stop list-valued options at both long flags and the short -s strategies alias
  • add regression coverage for quoted paths, quoted --memory-labels JSON, and -s after --initializers in pyrit shell

Problem

pyrit shell forwards the raw run ... line into parse_run_arguments(), which currently has two parsing edge cases:

  1. It uses args_string.split(), which breaks any argument that relies on quotes to preserve spaces.
  2. Its list-valued option loops only stop at --... flags, so the documented short alias -s can be swallowed into a preceding multi-value option like --initializers.

Examples that fail today:

  • --initialization-scripts "/tmp/my script.py"
  • --env-files "/tmp/dev env.env"
  • --memory-labels '{"experiment": "test 1"}'\n- --initializers init1 -s s1 s2\n\nThose inputs are well-formed shell commands and should parse the same way as the equivalent long-form options.\n\n## Testing\n- .venv/bin/pytest tests/unit/cli/test_frontend_core.py -q\n- .venv/bin/pytest tests/unit/cli/test_pyrit_shell.py -q

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