Moss on Nostr: Recently I debugged a pretty absurd Codex CLI incident. My new 18-core Mac was ...
Recently I debugged a pretty absurd Codex CLI incident.
My new 18-core Mac was usually running only two Codex terminals, but the fans suddenly went crazy, the machine got hot fast, and on battery it drained extremely quickly. Activity Monitor did not show an obvious app causing it.
Eventually I checked the process table and found 16 orphaned Codex CLI processes in the background.Each was using close to 100% CPU, together consuming roughly 16 CPU cores.
Root cause: I used to quit Codex by directly closing the Terminal window. After the window disappeared, some Codex processes did not exit properly. Their TTY became ??, stdin/stdout became
(revoked), the parent process was adopted by launchd, but the Codex main process kept spinning.
Debug command:
ps -axo pid,ppid,tty,pcpu,command | grep codex
If you see tty=?? and high CPU, it is likely an orphaned process.
Fix / prevention:
1. Do not close the Terminal window directly to quit Codex. Use /exit or /quit first.
2. Wait until you are back at the normal shell prompt, then close the terminal.
3. Periodically check for orphaned Codex processes.
4. If you find orphans, only clean up Codex processes with TTY=??. Do not run pkill codex, or you may kill your active Codex session too.
#codex
Published at
2026-06-30 15:43:30 UTCEvent JSON
{
"id": "50e6d57cc877944053160d3124770980473a65a352a6eede3a490bfa7e43761f",
"pubkey": "5144fe88ff4253c6408ee89ce7fae6f501d84599bc5bd14014d08e489587d5af",
"created_at": 1782834210,
"kind": 1,
"tags": [
[
"t",
"codex"
]
],
"content": "Recently I debugged a pretty absurd Codex CLI incident.\n\n My new 18-core Mac was usually running only two Codex terminals, but the fans suddenly went crazy, the machine got hot fast, and on battery it drained extremely quickly. Activity Monitor did not show an obvious app causing it.\n\n Eventually I checked the process table and found 16 orphaned Codex CLI processes in the background.Each was using close to 100% CPU, together consuming roughly 16 CPU cores.\n\n Root cause: I used to quit Codex by directly closing the Terminal window. After the window disappeared, some Codex processes did not exit properly. Their TTY became ??, stdin/stdout became\n (revoked), the parent process was adopted by launchd, but the Codex main process kept spinning.\n\n Debug command:\n\n ps -axo pid,ppid,tty,pcpu,command | grep codex\n\n If you see tty=?? and high CPU, it is likely an orphaned process.\n\n Fix / prevention:\n\n 1. Do not close the Terminal window directly to quit Codex. Use /exit or /quit first.\n 2. Wait until you are back at the normal shell prompt, then close the terminal.\n 3. Periodically check for orphaned Codex processes.\n 4. If you find orphans, only clean up Codex processes with TTY=??. Do not run pkill codex, or you may kill your active Codex session too.\n\n#codex",
"sig": "3d63a235661c1c1756c9a47e62bb17bacb6230054379cad10a104fba2cf5dbf6f56ce021bd18403dfab6fc6c831617d40db20d3c95da1bc7b7ea5b5e9379330c"
}