Codex CLI leaves stale no-TTY process consuming high CPU after session exit
Summary
Codex CLI appears to leave a stale native codex process running after a previous TUI session has exited/disconnected. The stale process had no TTY and consumed significant CPU for hours, while a newer active Codex session from the same working directory was running normally.
Environment
- Codex CLI:
codex-cli 0.128.0 - npm package:
@openai/codex@0.128.0 - Node.js:
v24.14.0 - Platform: Linux x64
- Invocation mode: interactive TUI with
--no-alt-screen - Working directory: same repo/worktree for both the stale and current sessions
Observed behavior
A previous Codex process pair remained alive long after the session appeared to be gone:
PID PPID SID TTY STAT %CPU ELAPSED STARTED
2364433 2363561 2363561 ? Sl 0.0 03:52:15 Mon May 4 20:29:18 2026
2364440 2364433 2363561 ? Sl 63.8 03:52:15 Mon May 4 20:29:18 2026
Commands:
2364433 node .../bin/codex --no-alt-screen
2364440 .../node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex/codex --no-alt-screen
At the same time, the current active Codex session looked normal and was attached to a TTY:
PID PPID SID TTY STAT %CPU ELAPSED STARTED
2465381 2464666 2464666 pts/3 Sl+ 0.0 09:41 Tue May 5 00:11:52 2026
2465388 2465381 2464666 pts/3 Sl+ 0.3 09:41 Tue May 5 00:11:52 2026
Both process pairs had the same cwd. The old process pair had no TTY and the native child was burning ~64% CPU. Killing the old pair immediately removed the high CPU usage, leaving only the current session.
Additional local state
The rollout file corresponding to the old session was modified shortly after startup:
2026-05-04 20:32 ~/.codex/sessions/2026/05/04/rollout-2026-05-04T20-29-18-019df2f6-e0be-77c2-97f4-a24c11628ecf.jsonl
So the session data appears to have stopped updating around 20:32 local time, while the process continued running until it was manually killed around 00:23 local time.
The local Codex state/log files are fairly large, which may or may not be related:
50M ~/.codex/log/codex-tui.log
929M ~/.codex/logs_2.sqlite
4.3M ~/.codex/logs_2.sqlite-wal
4.4M ~/.codex/state_5.sqlite
2.5M ~/.codex/state_5.sqlite-wal
Expected behavior
When a TUI session exits, disconnects, or otherwise becomes detached, Codex should terminate its native child process or leave it idle without high CPU usage.
Actual behavior
A detached/no-TTY native codex child process remained alive for hours and consumed high CPU until manually killed.
Notes
I am not attaching full logs publicly because they may contain session/workspace data, but I can provide specific sanitized excerpts if useful.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗