Desktop app-server respawns entire MCP fleet on reconnect; one launcher tries to open .ts files via shell-execute, popping native OS dialogs
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
- Process leak: the app-server spawns a fresh instance of each configured MCP server (observed:
google-analytics-mcpviauvx --from analytics-mcp google-analytics-mcp, GitKraken'sgk-alpha.exe,screenpipe-mcpviabun.exe, adata-analyticsMCP server, genericmcp/server.mjs/server.bundle.mjsNode processes, and the unified-computer-use browser bridge) without killing the previous instance. Confirmed 17 orphanedgoogle-analytics-mcp+uv/uvxlauncher processes accumulated over ~3.5 hours of normal use (~500MB wasted). - Spurious native OS dialogs: one of the respawned (TypeScript-based) MCP launchers attempts to open a
.tsfile 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-serverprocess 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 execCLI calls against the same machine/session context during that window — plausibly triggering repeated reconnect events. - Detection one-liner used to catch it live:
A real occurrence shows a dozen+Get-CimInstance Win32_Process | Where-Object { $_.CreationDate -gt (Get-Date).AddMinutes(-2) } | Select-Object ProcessId, ParentProcessId, Namenode.exe/node_repl.exe/uvx.exe/gk-alpha.exechildren all appearing under onecodex.exePID 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.
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
- #59757
Powered by Codex Action
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.