From 7179cfc2437a2cc72fee0a3b2bccebebb7bd0b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EA=B2=BD=EC=A2=85?= Date: Fri, 12 Jun 2026 17:43:50 +0900 Subject: [PATCH] fix: allow harness codex command override --- scripts/execute.py | 3 +++ scripts/test_execute.py | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/execute.py b/scripts/execute.py index 95b9e01..682ab90 100644 --- a/scripts/execute.py +++ b/scripts/execute.py @@ -405,6 +405,9 @@ class StepExecutor: @staticmethod def _codex_command() -> str: + override = os.environ.get("HARNESS_CODEX_COMMAND", "").strip() + if override: + return override return ( shutil.which("codex.cmd") or shutil.which("codex.exe") diff --git a/scripts/test_execute.py b/scripts/test_execute.py index 46f8186..8d7dacc 100644 --- a/scripts/test_execute.py +++ b/scripts/test_execute.py @@ -296,7 +296,8 @@ class ExecuteRunnerSafetyTests(unittest.TestCase): with patch.object(execute.subprocess, "run", side_effect=fake_run) as run_mock: with patch.object(executor, "_codex_command", return_value="codex.cmd"): - executor._invoke_codex(step, long_preamble) + with patch.dict(os.environ, {"HARNESS_CODEX_MODEL": ""}): + executor._invoke_codex(step, long_preamble) cmd = run_mock.call_args.args[0] kwargs = run_mock.call_args.kwargs @@ -322,6 +323,12 @@ class ExecuteRunnerSafetyTests(unittest.TestCase): with patch.object(execute.shutil, "which", side_effect=fake_which): self.assertEqual(execute.StepExecutor._codex_command(), "C:/tools/codex.cmd") + def test_codex_command_uses_env_override_first(self): + execute = load_execute() + + with patch.dict(os.environ, {"HARNESS_CODEX_COMMAND": "C:/app/codex.exe"}): + self.assertEqual(execute.StepExecutor._codex_command(), "C:/app/codex.exe") + def test_codex_exec_command_uses_model_env_override(self): execute = load_execute() with tempfile.TemporaryDirectory() as tmp: