Bug: CLI wrapper exits 0/hangs after child terminates by signal
Resolved 💬 0 comments Opened Jan 26, 2026 by Kbediako Closed Feb 6, 2026
What Version Of Codex Is Running?
codex-cli 0.91.0
What Subscription Do You Have?
Pro Plan
Which Model Were You Using?
GPT 5.2-Codex
What Platform Is Your Computer?
Mac Mini M4 - Darwin 25.3.0 arm64 arm
What Terminal Emulator And Version Are You Using (If Applicable)?
Apple_Terminal 466 (TERM_PROGRAM=Apple_Terminal), shell: /bin/zsh, TERM=xterm-256color
What Issue Are You Seeing?
When the native codex binary exits due to a signal (e.g., SIGTERM), the Node wrapper re-emits the signal while its own signal handlers are still installed. The parent can exit 0 or hang instead of terminating with signal semantics (128+signal), which breaks scripts/CI that depend on correct exit codes.
What Steps Can Reproduce The Bug?
- Create a stub vendor binary that sleeps (example below).
- Run the CLI wrapper with CODEX_CLI_VENDOR_ROOT pointing at the stub vendor tree.
- Send SIGTERM to the wrapper process and observe the exit status.
Example generator:
tmpdir=$(mktemp -d)
triple="aarch64-apple-darwin" # adjust for platform
mkdir -p "$tmpdir/$triple/codex"
cat > "$tmpdir/$triple/codex/codex" <<'STUB'
#!/usr/bin/env node
setInterval(() => {}, 1000);
STUB
chmod +x "$tmpdir/$triple/codex/codex"
CODEX_CLI_VENDOR_ROOT="$tmpdir" node codex-cli/bin/codex.js & pid=$!
sleep 0.2
kill -TERM $pid
wait $pid; echo $?
rm -rf "$tmpdir"
What Is The Expected Behavior?
The wrapper should terminate with signal semantics (e.g., 143 for SIGTERM).
Additional Information
Observed exit status was 0 or a hang prior to the fix.