fix: allow harness codex command override

This commit is contained in:
김경종
2026-06-12 17:43:50 +09:00
parent 6cc5ee6e25
commit 7179cfc243
2 changed files with 11 additions and 1 deletions
+3
View File
@@ -405,6 +405,9 @@ class StepExecutor:
@staticmethod @staticmethod
def _codex_command() -> str: def _codex_command() -> str:
override = os.environ.get("HARNESS_CODEX_COMMAND", "").strip()
if override:
return override
return ( return (
shutil.which("codex.cmd") shutil.which("codex.cmd")
or shutil.which("codex.exe") or shutil.which("codex.exe")
+7
View File
@@ -296,6 +296,7 @@ class ExecuteRunnerSafetyTests(unittest.TestCase):
with patch.object(execute.subprocess, "run", side_effect=fake_run) as run_mock: with patch.object(execute.subprocess, "run", side_effect=fake_run) as run_mock:
with patch.object(executor, "_codex_command", return_value="codex.cmd"): with patch.object(executor, "_codex_command", return_value="codex.cmd"):
with patch.dict(os.environ, {"HARNESS_CODEX_MODEL": ""}):
executor._invoke_codex(step, long_preamble) executor._invoke_codex(step, long_preamble)
cmd = run_mock.call_args.args[0] cmd = run_mock.call_args.args[0]
@@ -322,6 +323,12 @@ class ExecuteRunnerSafetyTests(unittest.TestCase):
with patch.object(execute.shutil, "which", side_effect=fake_which): with patch.object(execute.shutil, "which", side_effect=fake_which):
self.assertEqual(execute.StepExecutor._codex_command(), "C:/tools/codex.cmd") 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): def test_codex_exec_command_uses_model_env_override(self):
execute = load_execute() execute = load_execute()
with tempfile.TemporaryDirectory() as tmp: with tempfile.TemporaryDirectory() as tmp: