fix: pass --model and its value as two argv elements

pi 1.5.2 rejects --model=<id> as an unknown option (live run 3838). The
probe already refuses ids starting with "-", so the id cannot be read as
an option. A test now asserts no option in pi's argv uses the = form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-12 16:57:09 -05:00
1 parent 7095db060e
commit f75f3dddf2
3 files changed
+10 -5

No files matched your search

+4 -2
View File
@@ -179,8 +179,10 @@ def models_config(base_url: str, model: str) -> dict:
def pi_argv(binary: str, model: str, task_file: Path, def pi_argv(binary: str, model: str, task_file: Path,
system_prompt_file: Path | None) -> list[str]: system_prompt_file: Path | None) -> list[str]:
"""The pi command line. The task goes in as an @file, so a long prompt never lands """The pi command line. The task goes in as an @file, so a long prompt never lands
in argv; the key is never in it.""" in argv; the key is never in it. Each option and its value are separate elements:
argv = [binary, "-p", "--mode", "json", "--provider", PROVIDER, f"--model={model}", pi 1.5.2 rejects `--model=<id>` as an unknown option. probe() refuses a model id
starting with `-`, so the id cannot be read as an option."""
argv = [binary, "-p", "--mode", "json", "--provider", PROVIDER, "--model", model,
"--thinking", THINKING, "--tools", TOOLS, *ISOLATION_FLAGS] "--thinking", THINKING, "--tools", TOOLS, *ISOLATION_FLAGS]
if system_prompt_file is not None: if system_prompt_file is not None:
argv += ["--append-system-prompt", str(system_prompt_file)] argv += ["--append-system-prompt", str(system_prompt_file)]
+1 -1
View File
@@ -52,7 +52,7 @@ class LocalPrTests(LocalSetup, test_cli.CliCase):
self.assertIn("Edited by the local drafter.", self.assertIn("Edited by the local drafter.",
git(self.remote, "show", f"{BRANCH}:docs/README.md")) git(self.remote, "show", f"{BRANCH}:docs/README.md"))
argv = json.loads(self.argv_file.read_text()) argv = json.loads(self.argv_file.read_text())
self.assertIn("--model=org/model-a", argv) self.assertEqual(argv[argv.index("--model") + 1], "org/model-a")
self.assertNotIn(KEY, " ".join(argv)) self.assertNotIn(KEY, " ".join(argv))
self.assertIn("Drafted by pi with org/model-a: 2 turns.", self.assertIn("Drafted by pi with org/model-a: 2 turns.",
self.fake.prs[0]["body"].splitlines()[-1]) self.fake.prs[0]["body"].splitlines()[-1])
+5 -2
View File
@@ -258,8 +258,11 @@ class RunLocalTest(unittest.TestCase):
self.assertEqual(argv[1:3], ["-p", "--mode"]) self.assertEqual(argv[1:3], ["-p", "--mode"])
self.assertEqual(argv[argv.index("--mode") + 1], "json") self.assertEqual(argv[argv.index("--mode") + 1], "json")
self.assertEqual(argv[argv.index("--provider") + 1], local.PROVIDER) self.assertEqual(argv[argv.index("--provider") + 1], local.PROVIDER)
self.assertIn("--model=org/model-a", argv) # pi 1.5.2 rejects the --flag=value form ("Unknown option: --model"), so every
self.assertNotIn("--model", argv) # option and its value are separate elements.
self.assertEqual(argv[argv.index("--model") + 1], "org/model-a")
self.assertEqual([a for a in argv[:argv.index("--")] if a.startswith("--") and "=" in a],
[])
self.assertEqual(argv[argv.index("--thinking") + 1], "medium") self.assertEqual(argv[argv.index("--thinking") + 1], "medium")
self.assertEqual(argv[argv.index("--tools") + 1], "read,ls,edit,write") self.assertEqual(argv[argv.index("--tools") + 1], "read,ls,edit,write")
for flag in ("--no-approve", "--no-extensions", "--no-skills", "--no-context-files", for flag in ("--no-approve", "--no-extensions", "--no-skills", "--no-context-files",