Merge Codex Remote Control support
This commit is contained in:
+57
-1
@@ -74,6 +74,23 @@ stall_idle = 900
|
||||
active_re = "esc interrupt|thinking|inferring|running tool|tool call|preparing patch|reading|searching"
|
||||
limit_re = "usage limit|limit reached"
|
||||
|
||||
[backend.codex]
|
||||
bin = "codex"
|
||||
preamble = "{bin} remote-control start --json >/dev/null"
|
||||
remote_addr = "unix://"
|
||||
flags = "--dangerously-bypass-approvals-and-sandbox --dangerously-bypass-hook-trust --no-alt-screen"
|
||||
supports_resume = false
|
||||
prompt_delivery = "arg"
|
||||
process_name = "codex"
|
||||
footer_ui = true
|
||||
log_grace = 180
|
||||
submit_key = "Enter"
|
||||
startup_prompt_re = "Trusting the directory|Do you trust"
|
||||
startup_prompt_response = "1"
|
||||
startup_prompt_delay = 0
|
||||
active_re = "working|thinking|running"
|
||||
limit_re = "usage limit|limit reached"
|
||||
|
||||
[backend.demo]
|
||||
bin = "echo up; exec sleep 100000"
|
||||
prompt_delivery = "exec"
|
||||
@@ -102,6 +119,13 @@ kind = "persistent"
|
||||
backend = "opencode"
|
||||
prompt = "hi"
|
||||
|
||||
[[agent]]
|
||||
name = "cx"
|
||||
kind = "persistent"
|
||||
backend = "codex"
|
||||
model = "gpt-test"
|
||||
prompt = "hi from codex"
|
||||
|
||||
[[agent]]
|
||||
name = "custom"
|
||||
kind = "persistent"
|
||||
@@ -233,10 +257,42 @@ class TestExampleConfig(unittest.TestCase):
|
||||
cfg = agents.load_config(ex)
|
||||
self.assertIn("builder", cfg["agents"])
|
||||
self.assertIn("adversary", cfg["agents"])
|
||||
for be in ("demo", "claude", "opencode"):
|
||||
for be in ("demo", "claude", "codex", "opencode"):
|
||||
self.assertIn(be, cfg["backends"], f"backend {be} missing from example")
|
||||
self.assertEqual(len(agents.phases(cfg)), 2)
|
||||
|
||||
def test_codex_launch_prepares_remote_control_then_connects_tui_to_daemon(self):
|
||||
tmp = tempfile.mkdtemp(prefix="aotest-ut-codex-")
|
||||
old_alive, old_new, old_log = agents.session_alive, agents.new_session, agents.log
|
||||
old_capture, old_run = agents.capture_pane, agents._run
|
||||
try:
|
||||
cfg = agents.load_config(_make_project(tmp))
|
||||
launched = []
|
||||
sent = []
|
||||
agents.session_alive = lambda _session: False
|
||||
agents.new_session = lambda session, cwd, cmd, log_path: launched.append(cmd)
|
||||
agents.log = lambda _msg: None
|
||||
agents.capture_pane = lambda *_args, **_kwargs: "Trusting the directory"
|
||||
agents._run = lambda command: sent.append(command)
|
||||
agents.start_agent(cfg, cfg["agents"]["cx"])
|
||||
self.assertEqual(len(launched), 1)
|
||||
cmd = launched[0]
|
||||
self.assertTrue(cmd.startswith(
|
||||
"codex remote-control start --json >/dev/null && "
|
||||
"codex --remote 'unix://' -C "))
|
||||
self.assertEqual(cmd.count("--remote 'unix://'"), 1)
|
||||
self.assertIn(f"-C {agents.shlex.quote(cfg['agents']['cx']['dir'])}", cmd)
|
||||
self.assertIn("--model 'gpt-test'", cmd)
|
||||
self.assertIn(
|
||||
"--dangerously-bypass-approvals-and-sandbox --dangerously-bypass-hook-trust --no-alt-screen",
|
||||
cmd)
|
||||
self.assertIn("kickoff-aotest-ut-cx.txt", cmd)
|
||||
self.assertTrue(any("1" in command for command in sent))
|
||||
finally:
|
||||
agents.session_alive, agents.new_session, agents.log = old_alive, old_new, old_log
|
||||
agents.capture_pane, agents._run = old_capture, old_run
|
||||
shutil.rmtree(tmp, ignore_errors=True)
|
||||
|
||||
|
||||
# ── kickoff-template assembly ──────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user