Fix Codex Remote thread writer conflicts

This commit is contained in:
2026-08-23 02:39:00 +00:00
parent 927c90de43
commit a7d61d812e
5 changed files with 23 additions and 8 deletions
+7 -2
View File
@@ -349,6 +349,11 @@ def start_agent(cfg, agent, *, force=False):
if backend.get("remote_control"):
parts.append(_render_template(backend.get("remote_control_flag",
"--remote-control '{session}'"), {"session": session}))
if backend.get("remote_addr"):
parts.append(_render_template(backend.get("remote_addr_flag", "--remote '{addr}'"), {
"addr": backend["remote_addr"], "session": session, "model": model,
"dir": shlex.quote(cwd),
}))
if model:
parts.append(_render_template(backend.get("model_flag", "--model '{model}'"), {"model": model}))
if backend.get("flags"):
@@ -356,8 +361,8 @@ def start_agent(cfg, agent, *, force=False):
parts.append(f"\"$(cat '{kf}')\"")
cmd = " ".join(p for p in parts if p)
# Some interactive CLIs need an idempotent service prepared before their TUI starts.
# Codex Remote Control is one such service: `remote-control start` ensures the shared
# app-server daemon is enrolled and connected, then the pane runs the ordinary Codex TUI.
# The Codex backend starts the shared app-server here, while remote_addr above makes the
# pane's TUI a client of that daemon so both local and Remote UIs share one thread writer.
if backend.get("preamble"):
preamble = _render_template(backend["preamble"], {
"bin": backend["bin"], "session": session, "model": model,