Skip to content

[Windows Desktop 26.1029.7803.0] One codex.exe app-server accumulates ~140 idle helpers (39 node_repl, 20 app-tools MCP, 20 computer-use node) over 42 hours #59757

Open

Description

@getrdone

Summary

On Windows, one long-running Codex app-server process inside the ChatGPT desktop app accumulated about 140 idle helper processes over roughly 42 hours: 39 node_repl.exe, 20 codex-app-tools MCP servers (each a cmd.exe plus node.exe pair), 20 more bundled node.exe helpers, and a conhost.exe for nearly every one. All were idle (0% CPU). The PC became sluggish; fully quitting ChatGPT removed the tree and the system was immediately responsive again.

This looks like the same lifecycle problem as #29079 (reported on 26.616), still present on the current build, with a more specific breakdown below.

Environment

  • App: ChatGPT desktop with Codex, package OpenAI.Codex 26.1029.7803.0
  • OS: Windows 11 Pro 10.0.26300, 64-bit, 64 GB RAM, 16 logical processors
  • Usage: long-running app session with many Codex threads over two days; bundled plugins present: browser, chrome, codex-app-tools, computer-use, unified-computer-use, visualize

Observed (snapshot 2026-11-05 ~13:55 local)

System total: 635 processes, 118 of them conhost.exe.

Seven codex.exe processes were running under ChatGPT.exe. Six had zero or one child. One, started 2026-11-03 20:15 (about 42 hours earlier), owned almost all helpers:

Child of that one codex.exe Count
node_repl.exe 39
cmd.exe → node.exe (cmd /d /s /c call ./scripts/launch_codex_app_tools_mcp.cmd ./server.mjs) 20
node.exe (%LOCALAPPDATA%\OpenAI\Codex\runtimes\cua_node\<hash>\bin\node.exe --import file:///%USERPROFILE%/.codex/plugins/cache/openai-bundled/unified-co…) 20
codex-code-mode-host.exe 1

Further down the same tree: 24 more node.exe processes were children of node_repl.exe (14 direct, 10 under node.exe), and conhost.exe was attached to each node_repl.exe (39), each cmd.exe (20) and each direct node.exe (20).

Resource use of the whole ChatGPT/Codex family at that moment: ChatGPT 27 processes / 4.2 GB private, node 69 / 3.9 GB, node_repl 59 / 0.24 GB, codex 7 / 1.2 GB. A 5-second CPU sample showed every node and node_repl at 0%.

The counts (20 app-tools servers, 20 computer-use helpers, ~40 REPLs) suggest that one per thread or tool session is started and never stopped when the thread goes idle or is closed, so they pile up for the lifetime of the app-server process.

Expected

Helper MCP servers and REPLs belonging to a thread should exit when the thread is closed or idle, or be shared, so the count stays bounded no matter how long the app runs.

Workaround

Fully quit ChatGPT from the system tray and reopen it. That ends the whole tree immediately.

Notes

Activity

  1. added
    bug
    app
    windows-os
    app-server
    mcp
    on Nov 5, 2026
  2. getrdone commented on Nov 9, 2026

    @getrdone
    Author

    Reviewed the suggested duplicates; neither covers this report fully.

    Keeping this open as the Windows report covering accumulation across helper types. Happy to capture a fresh process tree with per-child creation times if that helps confirm whether the codex-app-tools servers follow the same subagent-cleanup path.

  3. itmminfo commented on Nov 12, 2026

    @itmminfo

    Still happening on Codex Desktop 26.1106.6628.0 (app-server codex-cli 0.167.0-alpha.4.1) on Windows 11.

    After ~16h one app-server had 256 direct children: 96 node_repl.exe, 56 unified-computer-use node.exe, 85 node.exe for user-configured stdio MCP servers, 17 cmd.exe (launch_codex_app_tools_mcp.cmd). The app-server had 552 threads and ~4000 handles. Then: agent thread limit reached, MCP handshake timeouts (10s/30s/120s), response_orphaned for getAuthStatus, [Composer] submit failed ... Timed out waiting for MCP response to getAuthStatus. Restarting the app cleared it.

    Teardown itself works on Windows too (same direction as #56937 and the follow-up on #56335). With a headless app-server, a temp CODEX_HOME with one dummy stdio MCP server and no auth, a thread with no subscribers gets thread/closed about 60s after thread/unsubscribe and its dummy MCP process is killed. The dummy ignores stdin EOF, so it is the app-server that kills it. The script below shows this.

    One retention path I could reproduce, in a separate run against a local mock Responses endpoint (that script is not included): the parent's turn spawns a v1 subagent, both turns complete.

    step loaded threads dummy MCP processes
    after both turns parent + child 2
    thread/unsubscribe parent, after 60s child 1
    after 90s child 1
    thread/unsubscribe child, after 60s none 0

    The client never started the child and got no thread/started for it, but the app-server attached it anyway (try_attach_thread_listener in app-server/src/lib.rs). The finished child stays loaded with its own MCP process until the client unsubscribes from it, and unloading the parent does not touch it.

    This does not cover everything I saw in the desktop app. Matching process start times against the app-server log, the surviving sets looked like top-level threads the desktop opened or resumed and never unsubscribed, plus multi-agent v2 subagents that were not evicted. That part is an observation from my logs, not a controlled repro. For subagents, node_repl and cua_repl also come from #59213 (their MCP startup is lazy, but SubagentStop calls turn_ended with wait_for_server = true).

    Repro (Node + pwsh, Windows): node repro.mjs <path-to-codex.exe> 3, optional IDLE_MS (default 90000). It creates its own temp CODEX_HOME with the dummy server, passes a minimal env without API keys, only looks at its own child processes and removes the temp dir at the end.

    repro.mjs
    // Repro: thread unload and stdio MCP cleanup in codex app-server (Windows, needs pwsh).
    // Usage: node repro.mjs <path-to-codex.exe> [threads=3]
    // Env:   IDLE_MS (default 90000, max 600000)
    // Creates its own temp CODEX_HOME with one dummy MCP server, passes a minimal env
    // (no API keys), only inspects its own child processes, removes the temp dir at the end.
    import { spawn, execFileSync } from 'node:child_process';
    import readline from 'node:readline';
    import fs from 'node:fs';
    import os from 'node:os';
    import path from 'node:path';
    
    const DUMMY_SRC = `
    import readline from 'node:readline';
    const rl = readline.createInterface({ input: process.stdin });
    const send = (o) => process.stdout.write(JSON.stringify(o) + '\\n');
    rl.on('line', (line) => {
      let m; try { m = JSON.parse(line); } catch { return; }
      if (m.method === 'initialize') send({ jsonrpc: '2.0', id: m.id, result: { protocolVersion: m.params?.protocolVersion ?? '2025-06-18', capabilities: { tools: {} }, serverInfo: { name: 'dummy-unload-probe', version: '0.0.1' } } });
      else if (m.method === 'tools/list') send({ jsonrpc: '2.0', id: m.id, result: { tools: [] } });
      else if (m.id !== undefined && m.method) send({ jsonrpc: '2.0', id: m.id, error: { code: -32601, message: 'not implemented' } });
    });
    // keep running after stdin closes, so we can see who actually kills the process; hard stop after 15 min
    setTimeout(() => process.exit(124), 15 * 60_000);
    setInterval(() => {}, 1 << 30);
    `;
    
    const [codexExe, nArg] = process.argv.slice(2);
    if (!codexExe) { console.error('usage: node repro.mjs <path-to-codex.exe> [threads]'); process.exit(2); }
    const N = Number(nArg ?? 3);
    if (!Number.isInteger(N) || N < 1 || N > 10) { console.error('threads must be an integer from 1 to 10'); process.exit(2); }
    const idleMs = Number(process.env.IDLE_MS ?? 90000);
    if (!Number.isInteger(idleMs) || idleMs < 0 || idleMs > 600000) { console.error('IDLE_MS must be an integer from 0 to 600000'); process.exit(2); }
    
    const home = fs.mkdtempSync(path.join(os.tmpdir(), 'codex-unload-repro-'));
    const work = path.join(home, 'work');
    fs.mkdirSync(work);
    const dummyPath = path.join(home, 'dummy-mcp.mjs');
    fs.writeFileSync(dummyPath, DUMMY_SRC);
    fs.writeFileSync(path.join(home, 'config.toml'), `[mcp_servers.dummy]\ncommand = "node"\nargs = [${JSON.stringify(dummyPath.replaceAll('\\', '/'))}]\n`);
    
    const keep = ['SystemRoot', 'WINDIR', 'ComSpec', 'PATH', 'PATHEXT', 'TEMP', 'TMP', 'USERPROFILE', 'LOCALAPPDATA', 'APPDATA'];
    const env = Object.fromEntries(keep.filter((k) => process.env[k] !== undefined).map((k) => [k, process.env[k]]));
    env.CODEX_HOME = home;
    
    const srv = spawn(codexExe, ['app-server'], { cwd: work, env, stdio: ['pipe', 'pipe', 'pipe'] });
    srv.stderr.on('data', () => {});
    const rl = readline.createInterface({ input: srv.stdout });
    let nextId = 1; const pending = new Map();
    rl.on('line', (l) => {
      let m; try { m = JSON.parse(l); } catch { return; }
      if (m.id !== undefined && pending.has(m.id) && !m.method) { const p = pending.get(m.id); pending.delete(m.id); m.error ? p.rej(new Error(JSON.stringify(m.error))) : p.res(m.result); }
      else if (m.id !== undefined && m.method) { srv.stdin.write(JSON.stringify({ id: m.id, error: { code: -32601, message: 'not supported by repro' } }) + '\n'); }
    });
    const req = (method, params, timeoutMs = 60000) => new Promise((res, rej) => {
      const id = nextId++; pending.set(id, { res, rej });
      srv.stdin.write(JSON.stringify({ id, method, params }) + '\n');
      setTimeout(() => { if (pending.has(id)) { pending.delete(id); rej(new Error(`timeout ${method}`)); } }, timeoutMs);
    });
    const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
    const log = (...a) => console.log(new Date().toISOString().slice(11, 19), ...a);
    
    // Only walks the app-server's own process tree (filtered by ParentProcessId).
    const dummyPids = new Set();
    function children() {
      const ps = `function d([int]$p){ Get-CimInstance Win32_Process -Filter "ParentProcessId=$p" | % { $_; d $_.ProcessId } }; d ${srv.pid} | % { '' + $_.ProcessId + '|' + $_.Name + '|' + ($_.CommandLine -like '*dummy-mcp.mjs*') }`;
      const out = execFileSync('pwsh', ['-NoProfile', '-Command', ps], { encoding: 'utf8' }).trim().split(/\r?\n/).filter(Boolean);
      const dummies = out.filter((l) => l.endsWith('|True')).map((l) => Number(l.split('|')[0]));
      dummies.forEach((p) => dummyPids.add(p));
      return { children: out.length, dummyMcp: dummies.length };
    }
    const loaded = async () => (await req('thread/loaded/list', {})).data?.length;
    
    function killTree() {
      if (srv.exitCode === null) {
        try { execFileSync('taskkill', ['/PID', String(srv.pid), '/T', '/F'], { stdio: 'ignore' }); }
        catch (e) { console.error('taskkill failed, kill app-server PID', srv.pid, 'manually:', e.message); }
      }
    }
    process.on('SIGINT', () => { killTree(); process.exit(130); });
    
    let failed = false;
    try {
      await req('initialize', { clientInfo: { name: 'unload-probe', version: '0.0.1' } });
      srv.stdin.write(JSON.stringify({ method: 'initialized' }) + '\n');
      await sleep(2000);
      const ids = [];
      for (let i = 0; i < N; i++) {
        const r = await req('thread/start', { cwd: work });
        ids.push(r.thread?.id ?? r.threadId ?? r.id);
        await sleep(2500);
        log(`after thread/start #${i + 1}`, children(), 'loaded:', await loaded());
      }
      for (const id of ids) await req('thread/unsubscribe', { threadId: id });
      const t0 = Date.now();
      log('unsubscribed all threads');
      while (Date.now() - t0 < idleMs) {
        await sleep(Math.min(15000, Math.max(0, idleMs - (Date.now() - t0))));
        log(`+${Math.round((Date.now() - t0) / 1000)}s after unsubscribe`, children(), 'loaded:', await loaded());
      }
    } catch (e) {
      failed = true;
      log('ERROR', e.message);
    } finally {
      srv.stdin.end();
      await sleep(4000);
      killTree();
      try {
        const ids = [...dummyPids].join(',');
        const alive = ids ? execFileSync('pwsh', ['-NoProfile', '-Command', `@(Get-Process -Id ${ids} -ErrorAction SilentlyContinue).Count`], { encoding: 'utf8' }).trim() : '0';
        log('dummy MCP processes from this run still alive:', alive);
      } catch (e) { failed = true; log('final check failed', e.message); }
      try { fs.rmSync(home, { recursive: true, force: true }); }
      catch (e) { console.error('could not remove temp dir', home, e.message); }
      process.exitCode = failed ? 1 : 0;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appapp-serverbugmcpperformancewindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions