openai / openai/codex

[Linux Desktop] Ambient suggestions/prewarm leak MCP and node_repl stacks every ~5 minutes

Open
#44,525 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app app-server bug Linux mcp performance
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Summary

On the official ChatGPT/Codex Linux desktop package, leaving the app running for several days causes unbounded memory growth because periodic desktop-owned thread/start / startup_prewarm sessions create new node_repl and bundled MCP helper process stacks that are not reaped.

In this incident, the single long-lived Codex app-server accumulated 1,082 helper processes and approximately 12.65 GiB PSS plus 5.19 GiB swap. The system reached 18/22 GiB RAM and 8/8 GiB swap. Fully terminating the Codex scopes immediately returned the machine to about 6–7 GiB used RAM.

This looks like a Linux reproduction/variant of #12491, #25015, #30408, and the ephemeral-session lifecycle described in #39783. The apparent trigger here is periodic ambient suggestions/startup prewarming rather than user-created subagents.

Environment

  • ChatGPT/Codex Desktop RPM: chatgpt-26.901.41123-1.aarch64
  • Bundled Codex CLI: codex-cli 0.153.3
  • OS: Oracle Linux Server 10.2, aarch64
  • Kernel: Linux 6.12.0-205.92.4.2.el10uek.aarch64 aarch64
  • Physical memory: approximately 22 GiB
  • Swap: 8 GiB
  • Desktop: GNOME Wayland headless session
  • Subscription: not included; this appears independent of plan/account tier

Relevant configuration before mitigation:

[desktop]
ambient-suggestions-enabled = true

[features]
js_repl = false

[mcp_servers.node_repl]
command = "/usr/lib/chatgpt/resources/cua_node/bin/node_repl"
startup_timeout_sec = 120

The bundled Browser, Chrome, codex-app-tools, and unified-computer-use plugins were enabled.

What issue are you seeing?

The desktop app's long-lived app-server repeatedly starts fresh local MCP/helper stacks and retains the old ones indefinitely.

At capture time:

  • 537 processes with comm MainThread
  • 538 processes with comm node_repl
  • 1,082 processes in the ChatGPT/Codex app-server tree
  • app-server tree PSS: 12,652.8 MiB
  • app-server tree private memory: 12,508.4 MiB
  • app-server tree swap: 5,190.7 MiB
  • systemd scope memory.current: 13,147,430,912 bytes
  • systemd scope memory.swap.current: 5,010,042,880 bytes
  • systemd scope task count: 8,643

The app-server itself had grown to approximately 3,289.6 MiB PSS and 547.3 MiB swap.

The retained helper groups had this shape:

ChatGPT
└─ codex ... app-server
   ├─ node ./server.mjs
   ├─ node .../unified-computer-use/.../scripts/launch.mjs
   │  └─ node_repl
   └─ node_repl

Most helpers were direct children of the same app-server. New groups appeared at roughly five-minute intervals. During sustained reproduction, each hour added approximately 22–24 MainThread processes and 22–24 node_repl processes.

The local logs_2.sqlite correlated each creation cluster with a new desktop request and a new ephemeral thread ID:

app-server request: thread/start
thread_start.create_thread
thread_spawn
session_init
startup_prewarm
mcp.runtime.refresh:new{server_name=cua_repl}
mcp.runtime.refresh:new{server_name=node_repl}
mcp.runtime.refresh:new{server_name=codex_app}
mcp.runtime.refresh:new{server_name=codex_apps}

No user turn or MCP tool call was required for the periodic prewarm sessions.

A normal SIGTERM to the main ChatGPT PID closed the main UI process, but the codex app-server and hundreds of helpers remained alive after being reparented to the user systemd process. Terminating the two Codex-owned systemd scopes was required to remove all retained processes.

This was not GNOME or filesystem cache pressure: the user GNOME Shell was approximately 237 MiB PSS at diagnosis, while terminating Codex reduced used RAM from about 18 GiB to 5.9 GiB immediately.

Steps to reproduce

  1. Install and launch the Linux ChatGPT/Codex desktop package.
  2. Enable the bundled Browser/Computer Use plugins and leave ambient suggestions enabled.
  3. Keep the app and an existing project open for an extended period. User activity does not appear necessary once the periodic behavior starts.
  4. Monitor helper counts:
watch -n 30 'pgrep -xc MainThread; pgrep -xc node_repl; free -h'
  1. Inspect ~/.codex/logs_2.sqlite and correlate process birth times with thread/start, startup_prewarm, and mcp.runtime.refresh records.
  2. Observe a new helper stack approximately every five minutes and no return to baseline.
  3. Leave the application running for one or more days; RAM and swap eventually become exhausted.
  4. Fully terminate the ChatGPT/Codex app-server scope; memory returns immediately.

Mitigation and A/B result

The following was changed:

[desktop]
ambient-suggestions-enabled = false

After fully terminating all old Codex scopes and relaunching the desktop app, I monitored it for six minutes, covering the previous five-minute creation interval:

codex=1  MainThread=0  node_repl=0
used RAM remained approximately 6.96–7.02 GiB
available RAM remained approximately 15.39–15.45 GiB

No new helper stack appeared during that interval. This strongly associates the periodic trigger with ambient suggestions/prewarming, while the unbounded impact is caused by missing teardown of the inherited MCP runtime.

Expected behavior

  • Desktop-owned ambient-suggestion/prewarm threads that do not need tools should start with MCP servers disabled.
  • Completion or abandonment of an ephemeral/prewarm thread should shut down its session-owned MCP runtime and child process group.
  • Periodic background work must return process count and memory to a bounded baseline.
  • Fully quitting ChatGPT Desktop should terminate the app-server and all helper descendants.
  • A long-running idle desktop session should not require periodic manual restarts to avoid system-wide memory and swap exhaustion.

Additional information

Raw SQLite/session files are not attached because they contain prompts, local paths, and private project metadata. Sanitized counts, timestamps, process relationships, and log signatures are included above. I can provide a more targeted diagnostic if maintainers specify the required fields.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ~/.codex/logs_2.sqlite and the app-server paths handling thread/start, startup_prewarm, and mcp.runtime.refresh to trace how ambient prewarm sessions create MCP helpers. Reproduce with the supplied pgrep and memory checks, then verify that ephemeral sessions clean up their child process groups, periodic counts stay bounded, and quitting the desktop leaves no helper descendants.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, node.js, rust, sqlite
Domain
backend, desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.