You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Codex spawning multiple node processes that block computer #1570
@MauScheff while I don't believe #1626 will fix your issue since your screenshots appear to be on macOS, can you tell me what those node commands were (i.e., the full argument list)? Or more importantly, were they long-running commands (like tsc --watch) or something else? Is the PPID 1 (the init process) because they were reparented after codex exited?
I do believe they were spawned by codex, but it could be something else, as that problem happened during a workflow when I was mostly using codex --full-auto on VSCode to work with TypeScript, but it could be something else like VSCode itself (or an extension), and I may have occasionally used Copilot Chat (and that caused the issue) but I used it sparingly (eg. 5% of the time) and I remember having to reset my computer and killing those processes, and this happening again a few times. I was working with a complex typescript codebase, and I always allow codex to go outside the sandbox, so it may have ran some commands. All I have is the screenshots I added from when that happened. It could have been that vscode was running tsc --watch but I'm not sure. I can see that all processes have the same number of threads, this may suggest whomever spawned them was the same actor. I just verified that if I open the same project on VSCode, there is no node process that just runs: eg. a background long running tsc --watch (and I wasn't doing that). The one thing I probably did inadvertently was having multiple running instances of codex (but only one operating at the time).
Ahh I see, interesting, I understand what happened now, makes sense. I don't know how you would get around it though. Seems like an OS level problem were parent processes can be killed and the children keep running as if they're disconnected.
From what I can tell, the remaining processes are child processes spawned by vitest itself. This does not happen when running npm run test directly in a regular terminal — only when run inside Codex.
This does not reproduce when running inside a sandboxed environment.
However, if sandbox execution is denied with EPERM, it may fall back to direct execution (instead of privilege escalation), and in that case the issue reproduces.
The remaining processes disappear automatically after some time (around 5 minutes).
Running npm run test (vitest) leaves orphaned node (vitest N) processes
Processes remain after Codex exits or times out
Each orphaned process consumes ~100% CPU
Temporary workaround until fixed (at least for my own vitest processes):
Add to your shell profile (.zshrc or .bashrc) alias codex-cleanup='pkill -f "node.*vitest"'
Looks like what needs to be implemented is some kind of process group management, similar to how shells handle job control with setpgid() and to kill the entire process group on exit.
I think the original issue reported here is no longer relevant because the CLI has been completely rewritten in Rust since then. Some of the other issues that were reported in this thread may still be an issue today, but it's hard to say. If you're seeing a similar issue, please open a new bug report and provide repro steps.
Activity
bolinfest commentedon Jul 16, 2025
Out of curiosity, did you install via
npmas opposed tobrew?bolinfest commentedon Jul 16, 2025
My hypothesis is that it has something to do with #1590. Will try to look into that today.
fix: update bin/codex.js so it listens for exit on the child process (#…
MauScheff commentedon Jul 17, 2025
I installed it with brew.
bolinfest commentedon Jul 17, 2025
@MauScheff hmm, OK, then #1590 is not likely the right fix. I do have one other hypothesis...
But to confirm: do you believe Codex was invoking
nodeas part of its work?bolinfest commentedon Jul 19, 2025
@MauScheff while I don't believe #1626 will fix your issue since your screenshots appear to be on macOS, can you tell me what those
nodecommands were (i.e., the full argument list)? Or more importantly, were they long-running commands (liketsc --watch) or something else? Is the PPID 1 (the init process) because they were reparented aftercodexexited?fix: use PR_SET_PDEATHSIG so to ensure child processes are killed in …
MauScheff commentedon Jul 23, 2025
I do believe they were spawned by codex, but it could be something else, as that problem happened during a workflow when I was mostly using codex --full-auto on VSCode to work with TypeScript, but it could be something else like VSCode itself (or an extension), and I may have occasionally used Copilot Chat (and that caused the issue) but I used it sparingly (eg. 5% of the time) and I remember having to reset my computer and killing those processes, and this happening again a few times. I was working with a complex typescript codebase, and I always allow codex to go outside the sandbox, so it may have ran some commands. All I have is the screenshots I added from when that happened. It could have been that vscode was running tsc --watch but I'm not sure. I can see that all processes have the same number of threads, this may suggest whomever spawned them was the same actor. I just verified that if I open the same project on VSCode, there is no node process that just runs: eg. a background long running tsc --watch (and I wasn't doing that). The one thing I probably did inadvertently was having multiple running instances of codex (but only one operating at the time).
bolinfest commentedon Jul 23, 2025
@MauScheff thanks for the incredibly detailed report!
I'm going to start paying more attention to this and have some ideas on how to create the equivalent to #1626 in a way that works on Mac.
MauScheff commentedon Jul 23, 2025
Ahh I see, interesting, I understand what happened now, makes sense. I don't know how you would get around it though. Seems like an OS level problem were parent processes can be killed and the children keep running as if they're disconnected.
ishikawa commentedon Aug 9, 2025
I think I’ve encountered a phenomenon similar to what’s described in this issue.
Steps to reproduce:
npm run testvia Codex CLI.In my case, this script runs
vitest run.ps aux | grep node.You can see multiple
node (vitest N)processes.ps aux | grep nodeagain — somevitestprocesses are still alive.Example output while Codex was running:
After Codex exit (still running):
From what I can tell, the remaining processes are child processes spawned by
vitestitself. This does not happen when runningnpm run testdirectly in a regular terminal — only when run inside Codex.ishikawa commentedon Aug 9, 2025
Additional information for #1570 (comment)
EPERM, it may fall back to direct execution (instead of privilege escalation), and in that case the issue reproduces.3 remaining items
mettamatt commentedon Aug 19, 2025
Temporary workaround until fixed (at least for my own vitest processes):
Add to your shell profile (.zshrc or .bashrc)
alias codex-cleanup='pkill -f "node.*vitest"'Looks like what needs to be implemented is some kind of process group management, similar to how shells handle job control with setpgid() and to kill the entire process group on exit.
fix: update bin/codex.js so it listens for exit on the child process (o…
fix: use PR_SET_PDEATHSIG so to ensure child processes are killed in …
ichabodcole commentedon Sep 6, 2025
@mettamatt I was able to instruct my agent to run
codex-cleanupafter every test run it initiates :Dfix: update bin/codex.js so it listens for exit on the child process (o…
fix: use PR_SET_PDEATHSIG so to ensure child processes are killed in …
GreatAuk commentedon Sep 15, 2025
+1
codex 0.34.0
after run vitest
etraut-openai commentedon Nov 2, 2025
I think the original issue reported here is no longer relevant because the CLI has been completely rewritten in Rust since then. Some of the other issues that were reported in this thread may still be an issue today, but it's hard to say. If you're seeing a similar issue, please open a new bug report and provide repro steps.
fix: update bin/codex.js so it listens for exit on the child process …
fix: use PR_SET_PDEATHSIG so to ensure child processes are killed in …
fix: update bin/codex.js so it listens for exit on the child process (o…
fix: use PR_SET_PDEATHSIG so to ensure child processes are killed in …
fix: update bin/codex.js so it listens for exit on the child process (o…
fix: use PR_SET_PDEATHSIG so to ensure child processes are killed in …