codex icon indicating copy to clipboard operation
codex copied to clipboard

Desktop app-server respawns entire MCP fleet on reconnect; one launcher tries to open .ts files via shell-execute, popping native OS dialogs

Open vladstefanescuglobal opened this issue 4 weeks ago • 2 comments

Description

The Codex desktop app's app-server process (codex.exe -c features.code_mode_host=true app-server ...) periodically respawns its entire configured MCP server fleet from scratch on reconnect, instead of reusing existing connections. This happened twice in one session on a Windows 11 machine, confirmed via live process-tree inspection both times.

Symptoms

  1. Process leak: the app-server spawns a fresh instance of each configured MCP server (observed: google-analytics-mcp via uvx --from analytics-mcp google-analytics-mcp, GitKraken's gk-alpha.exe, screenpipe-mcp via bun.exe, a data-analytics MCP server, generic mcp/server.mjs/server.bundle.mjs Node processes, and the unified-computer-use browser bridge) without killing the previous instance. Confirmed 17 orphaned google-analytics-mcp + uv/uvx launcher processes accumulated over ~3.5 hours of normal use (~500MB wasted).
  2. Spurious native OS dialogs: one of the respawned (TypeScript-based) MCP launchers attempts to open a .ts file via a raw OS-level "open" call instead of executing it through Node/tsx. On a machine with no default file association for .ts, this triggers Windows' native "Select an app to open this file" dialog — once per file it tried to open. Observed 3 simultaneous dialogs in one incident, 8 in another, both within the same session.

Reproduction

  • Platform: Windows 11
  • Codex CLI version: 0.166.0 (codex-cli 0.166.0)
  • The desktop app's app-server process had been alive for several hours in both incidents (started ~4:43 AM and ~9:02 AM respectively) before the burst occurred.
  • Both incidents correlated with the app-server reconnecting after other tooling made repeated codex exec CLI calls against the same machine/session context during that window — plausibly triggering repeated reconnect events.
  • Detection one-liner used to catch it live:
    Get-CimInstance Win32_Process | Where-Object { $_.CreationDate -gt (Get-Date).AddMinutes(-2) } | Select-Object ProcessId, ParentProcessId, Name
    
    A real occurrence shows a dozen+ node.exe/node_repl.exe/uvx.exe/gk-alpha.exe children all appearing under one codex.exe PID within the same second or two.

Workaround

Identify the codex.exe process with app-server in its command line that just spawned the burst of children, and Stop-Process -Id <pid> (no force needed, exits cleanly). Codex reconnects cleanly on next use with no apparent loss of conversation history (server-side persisted). Close any open "Pick an app" dialogs without selecting an app.

Expected behavior

  • The app-server should reuse existing MCP server connections on reconnect rather than respawning the entire fleet.
  • MCP launchers that run TypeScript entrypoints should always execute via Node/tsx, never via a raw shell "open"/ShellExecute call that depends on OS file associations.

vladstefanescuglobal avatar Nov 06 '26 10:11 vladstefanescuglobal

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #59757

Powered by Codex Action

github-actions[bot] avatar Nov 06 '26 10:11 github-actions[bot]

If you just want this to stop happening on Windows 11 right now, stick your stdio servers behind one local HTTP gateway so Codex only talks to http://127.0.0.1:8004/mcp and never spawns cmd/npx/uvx itself.

I built a small Windows app for that (MCP Hotplug, MIT): https://github.com/Darek3399/MCP-Hotplug

Codex stops respawning the whole process fleet or triggering those .ts file dialogs on reconnect, and turning a server off kills the full child tree via a Windows Job Object so Task Manager stays clean.

Darek3399 avatar Nov 18 '26 09:11 Darek3399