fix: pass harness prompts through stdin
This commit is contained in:
@@ -281,6 +281,30 @@ class ExecuteRunnerSafetyTests(unittest.TestCase):
|
||||
|
||||
self.assertEqual(cm.exception.code, 1)
|
||||
|
||||
def test_invoke_codex_passes_prompt_through_stdin(self):
|
||||
execute = load_execute()
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
write_phase(root)
|
||||
executor = make_executor(execute, root)
|
||||
step = {"step": 1, "name": "Docs"}
|
||||
long_preamble = "x" * 40000
|
||||
|
||||
def fake_run(cmd, **kwargs):
|
||||
return subprocess.CompletedProcess(cmd, 0, '{"event":"done"}\n', "")
|
||||
|
||||
with patch.object(execute.subprocess, "run", side_effect=fake_run) as run_mock:
|
||||
executor._invoke_codex(step, long_preamble)
|
||||
|
||||
cmd = run_mock.call_args.args[0]
|
||||
kwargs = run_mock.call_args.kwargs
|
||||
self.assertEqual(
|
||||
cmd,
|
||||
["codex", "exec", "--dangerously-bypass-approvals-and-sandbox", "--json", "-"],
|
||||
)
|
||||
self.assertEqual(kwargs["input"], long_preamble + "# Step 1\n")
|
||||
self.assertEqual(kwargs["cwd"], str(root))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user