fix: support Rust-based Codex CLI v0.98+ in tmux session spawning#2
Open
OmerFarukOruc wants to merge 1 commit intokingbootoshi:mainfrom
Open
fix: support Rust-based Codex CLI v0.98+ in tmux session spawning#2OmerFarukOruc wants to merge 1 commit intokingbootoshi:mainfrom
OmerFarukOruc wants to merge 1 commit intokingbootoshi:mainfrom
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. |
|
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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