codex-cli 0.114.0 on Windows exits back to PowerShell during normal interactive use

Resolved 💬 1 comment Opened Mar 14, 2026 by NVX60110 Closed Apr 6, 2026

Environment

  • OS: Windows
  • Shell: PowerShell (also reproduced with powershell -NoProfile)
  • Terminal: Windows Terminal
  • Codex CLI: codex-cli 0.114.0
  • Install method: npm global (C:\Users\gflip\AppData\Roaming\npm\codex)
  • Node: v24.11.0

Config (~/.codex/config.toml)

[windows]
sandbox = "unelevated"

What happens

codex launches normally and responds to simple prompts, then exits unexpectedly back to PowerShell during normal interactive use. There is leftover TUI/status text after exit (e.g. gpt-5.4 low · 100% left · ~ remains on screen), which suggests terminal cleanup is not completing cleanly.

Example session:

  • hi → works
  • are u good? → works
  • are u stable? → works
  • next prompt (e.g. no crash, write a python function) → Codex exits, returns to PS C:\Users\gflip>

What was already ruled out

  • Not a PowerShell profile issue — reproduced with powershell -NoProfile
  • Not a PATH conflict — confirmed single npm install resolves first
  • Not a missing binary — codex --version prints cleanly, native codex.exe runs fine standalone
  • Reinstalling via npm did not fix it
  • Elevated sandbox was a separate compounding issue — config previously had sandbox = "elevated", which caused early exits. Switching to unelevated improved behavior but crashes still occur.
  • No panics or errors in ~/.codex/log/codex-tui.log — log ends cleanly at codex_core::codex: close with no preceding error

Log evidence

The log ends with a completed response turn and then:

codex_core::tasks: close time.busy=20.7ms time.idle=3.19s
codex_core::codex: close time.busy=695µs time.idle=3.83s

No panic, no error — suggesting the exit is intentional from the binary side, possibly triggered by a Windows-specific condition.

Repro steps

  1. Open powershell -NoProfile
  2. Run codex
  3. Send a few chat prompts: hi, are u good?, are u stable?
  4. Send one more prompt (any)
  5. Codex exits back to shell unexpectedly

Expected behavior

Codex remains interactive across multiple prompts and does not terminate unless explicitly exited (Ctrl+C or /exit).

Actual behavior

Codex exits to shell unpredictably, typically after 2–4 prompts. Leftover TUI text remains in the terminal after exit.

Additional context

Gemini CLI shows similar instability on the same machine, while Anthropic's Claude CLI is stable. This may point to a Windows terminal / ConPTY / process-handling interaction affecting some interactive CLIs, but Codex should not exit silently regardless.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗