macOS desktop: closing subagents leaves app-server at >100% CPU and residual node_repl sessions
Summary
After closing subagents across multiple Codex Projects, the macOS desktop client's primary codex app-server remained at sustained CPU usage above 100%, although the UI reported the subagents as closed. Rebooting did not prevent recurrence after reopening Codex.
The observed state had 31 cua_node/bin/node_repl children beneath one app-server. The children were mostly idle, but their parent remained CPU-bound. Normal termination of the backend and its children did not clean it up because the desktop app recreated them. Fully terminating the ChatGPT desktop app cleared the state; on relaunch the backend remained near idle with only a small baseline of children.
Environment
- macOS on Apple Silicon
- ChatGPT desktop app, embedded Codex
- Codex Framework:
151.0.7922.137
Impact
- Sustained ~1.5–2 CPU cores while no intended work should have been running.
- High memory pressure: app-server roughly 2.2 GB resident, ~1.27 GB compressed.
- User also observed ~11M tokens used while away from the computer. This is not proven to be caused by the residual local processes, but needs correlation with supposedly closed agent work.
Evidence
Activity Monitor initially showed:
codex: 196.9% CPUCodex (Renderer): ~10.1%Codex (Service): ~2.1%
The backend command was:
/Applications/ChatGPT.app/Contents/Resources/codex -c features.code_mode_host=true app-server --analytics-default-enabled
While subagents were supposedly closed, a 10-second observation measured:
PID 1541 codex 166.2% CPU 2.23 GB memory 1.27 GB compressed
node_repl children: 31
The host also showed memory pressure/page-ins.
Cleanup experiment
- Sent SIGTERM to app-server and direct children: it continued/recreated children.
- Sent SIGKILL to app-server and children: the ChatGPT desktop parent recreated the backend.
- Fully terminated the ChatGPT desktop parent: this cleared the state.
- After relaunch, fresh backend stayed low over 10 seconds:
PID 6728 codex 0.0% -> 0.2% CPU 167 MB memory 114 MB compressed
node_repl children: 3
state: sleeping
Expected
Closing a subagent should promptly cancel/reap its local tool session and stop associated backend scheduling. With no active task, app-server should return to low CPU without a full desktop-app restart.
Actual
The UI reported closed subagents, but the backend accumulated node_repl children and its parent stayed CPU-bound. Rebooting did not prevent recurrence after Codex was reopened.
Reproduction outline
- Use multiple Projects and start subagents/tools.
- Close subagents in the UI.
- Observe app-server CPU in Activity Monitor and inspect
node_repldescendants. - Compare normal completion with a full desktop-app restart.
Requested investigation
Please investigate cancellation/reaping and event-loop behavior in the macOS desktop app-server, especially multi-Project subagent sessions and cua_node/bin/node_repl children. Please also investigate whether closed tasks can continue consuming agent tokens, or improve usage attribution so the originating thread is clear.
1 Comment
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action