High CPU usage when idle: background git/subprocess churn in Codex (Electron/Node) even when UI is inactive
What version of the Codex App are you using (From “About Codex” dialog)?
Version 26.318.11754 (1100)
What subscription do you have?
200/month
What platform is your computer?
Darwin 25.3.0 arm64 arm
What issue are you seeing?
Codex exhibits sustained CPU activity while idle, even when:
- no tasks are running
- no user interaction is occurring
- the app is not visible (fullscreen on another macOS Space)
A system trace shows the main thread is asleep in the AppKit run loop (waiting for events), with no rendering or UI activity. Despite this, background threads remain active.
The activity is concentrated in Electron/Node internals, with repeated subprocess management and stream handling. The trace shows frequent calls to:
- uv_run, uv__io_poll, uv__wait_children
- uv_spawn, posix_spawn
- LibuvStreamWrap::OnUvRead, EmitToJSStreamListener::OnStreamRead
- V8 lifecycle paths such as HandleWrap::OnClose and BackingStore::~BackingStore
There is also a dedicated git thread doing work.
This suggests Codex is repeatedly spawning subprocesses (likely git-related), reading their output, and tearing them down, even while idle.
No explicit error messages are shown; the issue is persistent background activity and CPU usage in an idle state.
What steps can reproduce the bug?
- Launch Codex
- Open a project/repository
- Ensure no active tasks are running
- Switch to another macOS Space (so Codex is not visible)
- Leave the app idle for a short period (e.g. 1–5 minutes)
- Observe CPU usage in Activity Monitor or sample the process
Optional (for verification):
- Take a sample in Activity Monitor
- Observe repeated subprocess activity (uv_spawn, posix_spawn) and stream handling even while idle
No specific code snippet is required; this occurs in normal usage with no prompts or active sessions.
Session/token/context details: not applicable (no active Codex session).
What is the expected behavior?
When Codex is idle and not visible:
- CPU usage should drop close to zero
- No repeated subprocess spawning should occur
- Background activity should be minimal or fully suspended
- The app should remain in a quiescent state until user interaction or an explicit task begins
Additional information
- This appears to be backend (Electron/Node/libuv) activity, not a rendering issue; the UI thread is idle.
- The pattern strongly suggests polling or supervision logic (likely git/repo-related) that continues running even when the app is inactive.
- Memory usage observed: ~230 MB current, ~565 MB peak, consistent with allocation churn rather than steady-state usage.
- The issue may be mitigated by:
- suspending polling when the app is hidden or on another Space
- replacing subprocess polling with event-driven mechanisms (e.g. filesystem watchers)
- batching or caching repo state queries
Codex while totally idle (was consuming 50-60% CPU and making my M5 Pro MacBook Pro's fans run hard):
codex5.txt
Codex while working on 2 threads:
codex.txt
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Check if you have a non-git folder with a lot of files, it causes codex to spam git commands on each files individually. (See #15631 )
Update: This is still an issue on Version 26.323.20928 (1173)
With the window hidden and nothing running, the main thread is idle, but Codex is still busy in the background. The trace shows:
• repeated V8Worker optimisation work in OptimizingCompileInputQueue::Prioritize 
• repeated uv_spawn / posix_spawn activity on the git worker
• continued JS callback / transfer / backing-store cleanup around that work
This looks like a persistent background work loop, not UI/rendering load. 
It did settle after a few minutes, but not without my MacBook Pro getting hot and spinning up its fans hard.
codex.txt
@jerometremblay Thanks for that. I do have a large project - 10k files or so - but I'm not sure there's much I can do about that. It's all under git anyway.
And just for completeness, here is a trace where Codex was working in two threads ("The git worker still looks pathological").
What is different in this trace is mostly degree:
I should mention that there is nothing significant appearing in the console.
codex.txt
An update. On a hunch after @jerometremblay mentioned a non-git folder with a lot of files being a possible cause, I realised that I keep all my build products in a ".DerivedFiles" in the project root (and listed in .gitignore). Codex would occasionally create additional derived files folders, too, on its own initiative.
I tried moving these to a folder outside the project root for all my different worktrees and it looks like the problem may have gone away entirely. At least I haven't had the problem for a number of hours now.
So this indeed does look like Codex going rogue with git on stuff in the project root.