-
Notifications
You must be signed in to change notification settings - Fork 29
fix: support Rust-based Codex CLI v0.98+ in tmux session spawning #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: support Rust-based Codex CLI v0.98+ in tmux session spawning #2
Conversation
The previous implementation launched `codex` in interactive TUI mode inside tmux and typed prompts via `tmux send-keys`. This fails with the Rust-based Codex CLI (v0.98+) because: 1. The interactive TUI requires a real TTY, which tmux's detached sessions don't provide — causing instant process exit 2. The `-a never` flag doesn't exist in `codex exec` mode 3. The `script` command used for output logging isn't available on all Linux distributions (e.g., Fedora minimal installs) Changes: - Switch from interactive `codex` to `codex exec` (non-interactive) - Pipe prompt via stdin (`cat prompt | codex exec -`) instead of fragile `tmux send-keys` typing - Replace `script` with `tee` for universal output logging - Use `--full-auto` / `--dangerously-bypass-approvals-and-sandbox` instead of `-a never` (correct flags for exec mode) - Add `--json` flag for structured JSONL output - Add `-o` flag to save last agent message to file - Remove all `sleep` + `send-keys` timing hacks (no longer needed) Tested with codex-cli 0.98.0 on Fedora Linux. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
I was having an issue, too. This fixed it. The Bug: In ~/.codex-orchestrator/src/tmux.ts line 79, the script command was using incorrect syntax: WRONG (missing -c flag)script -q "${logFile}" codex ${codexArgs} CORRECTscript -q -c "codex ${codexArgs}" "${logFile}" Without the -c flag, the script command failed to execute codex properly, causing tmux sessions to exit immediately before codex could start. The Fix Updated the tmux.ts file with the correct script command syntax. Tested with a simple agent that successfully ran and responded. |
|
|
|
Summary
createSession()insrc/tmux.tsto work with the Rust-based Codex CLI (v0.98+)codexin interactive TUI mode and typed prompts viatmux send-keys, which fails because the Rust CLI requires a real TTYcodex exec(non-interactive mode) with stdin prompt pipingProblem
With codex-cli v0.98.0 (Rust), every
codex-agent startcommand fails instantly (~2.5s, 0 tokens consumed):Root causes:
-a neverflag doesn't exist incodex execmodescriptcommand (used for output logging) isn't available on all Linux distros (e.g., Fedora)tmux send-keysprompt injection is fragile and timing-dependentChanges
codexinteractive TUI modecodex execnon-interactive modetmux send-keyscat prompt | codex exec -)script -qtee(universally available)-a never(invalid for exec)--full-auto/--dangerously-bypass-approvals-and-sandboxTest plan
codex-agent start "test prompt" -s read-onlycreates persistent tmux sessioncodex-agent jobs --jsonshowsstatus: "running"(notfailed)codex-agent capture <id>returns agent outputstatus: "completed"🤖 Generated with Claude Code