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
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗