From f75f3dddf20be058516909b40081fa4ea3354729 Mon Sep 17 00:00:00 2001 From: Jared Knowles Date: Thu, 12 Nov 2026 16:57:09 -0500 Subject: [PATCH] fix: pass --model and its value as two argv elements pi 1.5.2 rejects --model= 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 --- docs_review/local.py | 6 ++++-- tests/test_cli_local.py | 2 +- tests/test_local.py | 7 +++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs_review/local.py b/docs_review/local.py index 06a4395..18b9ca8 100644 --- a/docs_review/local.py +++ b/docs_review/local.py @@ -179,8 +179,10 @@ def models_config(base_url: str, model: str) -> dict: def pi_argv(binary: str, model: str, task_file: Path, system_prompt_file: Path | None) -> list[str]: """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.""" - argv = [binary, "-p", "--mode", "json", "--provider", PROVIDER, f"--model={model}", + in argv; the key is never in it. Each option and its value are separate elements: + pi 1.5.2 rejects `--model=` 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] if system_prompt_file is not None: argv += ["--append-system-prompt", str(system_prompt_file)] diff --git a/tests/test_cli_local.py b/tests/test_cli_local.py index cabc144..69cef59 100644 --- a/tests/test_cli_local.py +++ b/tests/test_cli_local.py @@ -52,7 +52,7 @@ class LocalPrTests(LocalSetup, test_cli.CliCase): self.assertIn("Edited by the local drafter.", git(self.remote, "show", f"{BRANCH}:docs/README.md")) 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.assertIn("Drafted by pi with org/model-a: 2 turns.", self.fake.prs[0]["body"].splitlines()[-1]) diff --git a/tests/test_local.py b/tests/test_local.py index 8b0bb5f..3e17d79 100644 --- a/tests/test_local.py +++ b/tests/test_local.py @@ -258,8 +258,11 @@ class RunLocalTest(unittest.TestCase): self.assertEqual(argv[1:3], ["-p", "--mode"]) self.assertEqual(argv[argv.index("--mode") + 1], "json") self.assertEqual(argv[argv.index("--provider") + 1], local.PROVIDER) - self.assertIn("--model=org/model-a", argv) - self.assertNotIn("--model", argv) + # pi 1.5.2 rejects the --flag=value form ("Unknown option: --model"), so every + # 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("--tools") + 1], "read,ls,edit,write") for flag in ("--no-approve", "--no-extensions", "--no-skills", "--no-context-files",