Codex Desktop on Windows flashes visible PowerShell/console windows during background process polling
Bug report: Codex Desktop on Windows flashes visible PowerShell/console windows during background process polling
Summary
Codex Desktop on Windows repeatedly launches short-lived powershell.exe processes for background process inspection. These processes are created with a visible console window, causing black terminal windows to flash on screen during normal use, even when the user is not explicitly running a command.
This is disruptive and alarming because it looks like an unknown terminal or malware process briefly opening and closing.
Environment
- OS: Windows
- Codex Desktop version:
OpenAI.Codex_26.602.3474.0_x64__2p2nqsd0c76g0 - Codex CLI helper path observed:
C:\Users\Administrator\AppData\Local\OpenAI\Codex\bin\fb2111b91430cb17\codex.exe
- Shell observed:
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
- User's default daily terminal: Warp
- Windows Terminal delegation was removed from:
HKCU\Console\%%Startup
but visible black console flashes still occurred.
Evidence
Multiple Windows Event Log entries show Codex-spawned PowerShell processes with commands like:
powershell.exe -NoProfile -NonInteractive -Command "$ErrorActionPreference = 'Stop'; Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId | ConvertTo-Json -Depth 2"
and:
powershell.exe -NoProfile -NonInteractive -Command "$ErrorActionPreference = 'Stop'; $cpuByPid = @{}; Get-CimInstance Win32_PerfFormattedData_PerfProc_Process | ForEach-Object { $cpuByPid[[int]$_.IDProcess] = [double]$_.PercentProcessorTime }; Get-CimInstance Win32_Process -Filter ... | Select-Object ProcessId,ParentProcessId,CommandLine,WorkingSetSize,... | ConvertTo-Json -Depth 2"
Observed parent process:
ParentProcessId: 14100
Parent: Codex.exe
Observed event timing:
2026-06-05 21:33:28 PowerShell console started
2026-06-05 21:33:30 OpenConsole.exe prefetch updated
2026-06-05 21:41:22 OpenConsole.exe prefetch updated
2026-06-05 21:41:29 PowerShell.exe prefetch updated
After Windows Terminal delegation was removed, the issue persisted as a normal visible console flash, so this is not only a Windows Terminal default-terminal issue.
Expected behavior
Codex Desktop should launch all internal/background command probes without showing any user-visible console window.
On Windows, background process inspection should use one of:
CREATE_NO_WINDOW- hidden
STARTUPINFO.wShowWindow - a non-console helper process
- direct native process enumeration APIs instead of spawning
powershell.exe
Actual behavior
Codex Desktop launches short-lived PowerShell commands that visibly flash a black console window. The user sees this even when they did not ask Codex to run a command.
User impact
- Looks like malware or an unknown terminal pop-up.
- Breaks user trust in Codex Desktop.
- Distracts during normal work.
- Makes it hard to tell whether a window came from Codex, Claude Code, MSI Center, Windows Terminal, or another background process.
Severity
Medium. This is not data loss, but it is highly visible, frightening, and makes the application feel unsafe on Windows.
Suggested fix
The Codex Desktop Windows process runner/process monitor should never spawn visible consoles for internal background probes. Please audit the Windows child-process creation path used for process polling and ensure hidden/no-window semantics are applied consistently.
Specifically, the code path that runs powershell.exe -NoProfile -NonInteractive -Command Get-CimInstance Win32_Process ... should create the child process with no visible console.
Extra note
This is not an MSI Center issue. MSI Center has its own console-host behavior at startup, but this separate repro was captured with Codex-spawned PowerShell process polling. The parent process evidence points to Codex.
10 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
This is related to #25453, but it is not fully resolved for the visible-window symptom.
The user is on Codex Desktop
OpenAI.Codex_26.602.3474.0_x64__2p2nqsd0c76g0, which is newer than the26.527.31326version reported in #25453, and the issue still reproduces.The likely shared root cause is the same PowerShell/CIM process polling path, but this report is specifically about child
powershell.exeprobes being created with a visible console window. Even if the polling interval/CPU behavior from #25453 has been improved, the Windows child-process creation path still needs hidden/no-window semantics for internal background probes.So this can be treated as either:
Update (2026-07-14): the related Git-window workaround is now a portable, maintained Windows project:
https://github.com/rwang23/codex-windows-console-guard
It now combines process-local Git/PowerShell/CMD wrappers with a narrowly scoped native console-window guard for MSIX activation paths that bypass the local
PATH. The guard matches only Git console windows beneath either currentChatGPT.exeor legacyCodex.exe; it does not replace Git, modify persistentPATH, change the registry, or suppress unrelated terminals.Scope remains important: this project mitigates the Git console-flash variant. It does not fix the PowerShell/CIM polling window in this issue, nor does it reduce the underlying polling CPU/process cost. Those still require a Codex Desktop no-window or persistent-native-helper fix upstream.
The README includes portable install, external restart, diagnostics, rollback, and agent instructions. I will keep compatibility updated when Windows desktop package/process behavior changes.
I have a small additional measurement from native Windows that may help separate the PowerShell polling symptom from the Git-specific churn.
Environment:
63f009e9dad2e70454b7ed6434d8aa28dfb52b51Process-start measurement:
Codex.exeorcodex.exe.Observed in a 15s run:
git.exe: 24 starts, 96/minconhost.exe: 29 starts, 116/minpowershell.exe: 14 starts, 56/minObserved in a 30s run:
git.exe: 30 starts, 60/minconhost.exe: 51 starts, 102/minpowershell.exe: 28 starts, 56/minThe sampled
powershell.execommand lines includedGet-CimInstance Win32_ProcessandWin32_PerfFormattedData_PerfProc_Process, which looks like process-tree or process-resource polling.I searched the public Rust tree at the commit above for these strings:
Get-CimInstance Win32_ProcessWin32_PerfFormattedData_PerfProc_ProcessProcessId,ParentProcessIdCpuPercentAgeSecondsI did not find production matches under
codex-rs. The only nearby PowerShell code I found wascodex-rs/shell-command/src/command_safety/powershell_parser.ps1, which appears to be the long-lived AST parser path and does not match the sampled CIM/perf commands.So my current read is:
I am not opening any PR unless explicitly invited by a maintainer, per
docs/contributing.md; this is just measurement data and a source-boundary note.+1, reproduced on Windows 11 Pro (build 26200).
Affected versions on my machine:
OpenAI.Codex_26.623.4041.0_x64(MSIX)openai.chatgpt-26.616.41845Repro: With the Codex desktop app running (even while idle), it continuously
spawns visible
powershell.execonsole windows. Each spawn allocates aconhostconsole, so a black window flashes on the desktop roughly once a second.
Measured spawn rate: I sampled the process table and counted ~10 powershell
processes spawned in 12 seconds (≈1 every 1.2s), all parented to
Codex.exe.Exact command line being launched: powershell.exe -NoProfile -NonInteractive -Command "$ErrorActionPreference = 'Stop'; $cpuByPid = @{}; Get-CimInstance Win32_Process | Select ..."
(also a variant without
$cpuByPid, justGet-CimInstance Win32_Process | Select ...)So this is the desktop app's background process/CPU polling loop launching PowerShell
without
CREATE_NO_WINDOW. To end users it looks exactly like malware activity.No user-side workaround works. Removing the Windows Terminal console delegation
(
HKCU\Console) does not help — the flashes persist. The only way to stop it is tofully quit the Codex desktop app.
Please either pass
CREATE_NO_WINDOW/ setSTARTUPINFO.wShowWindow = SW_HIDEwhenspawning these helpers, or replace the per-second PowerShell polling with native
process-enumeration APIs (e.g.
CreateToolhelp32Snapshot/NtQuerySystemInformation)so it doesn't shell out to PowerShell at all.
I can reproduce this on a newer Codex Desktop build:
OpenAI.Codex_26.623.8305.0_x64__2p2nqsd0c76g0powershell.exelaunched underCodex.exe/codex.exe, runningGet-CimInstance Win32_ProcessandGet-CimInstance Win32_PerfFormattedData_PerfProc_Process.app/resources/app.asar!/.vite/build/child-process-snapshot-worker.jsRelevant packed snippet shows the worker uses
execFile("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", ...], { windowsHide: true }).So this does not look like a missing
windowsHideoption at the call site. It looks like hidden/no-window semantics are not consistently taking effect in this Windows Desktop runtime path.Additional observed log symptom:
GetCimInstanceCommandsometimes fails withHRESULT 0x80041010/Invalid class, while the visible console flash still occurs.Impact: this is visually alarming because it looks like an unknown terminal or malware process briefly opening and closing, even when the user did not explicitly run a command.
Additional confirmation on a newer Windows Desktop build.
Environment:
OpenAI.Codex_26.623.13972.0_x64__2p2nqsd0c76g010.0.26100x64 (Microsoft Windows 11 IoT Enterprise Subscription LTSC)Observed behavior:
While Codex Desktop was open, Task Manager repeatedly showed short-lived
Windows PowerShellprocesses appearing and disappearing. The user-facing symptom was alarming because it looked like a hidden process continuously starting and closing.A 15 second live process sample captured several transient
powershell.exechildren with parentCodex.exe; each appeared for a single sample and then exited. Representative captured command prefix:Another short-lived Codex-spawned probe observed immediately afterward:
There was also a long-lived PowerShell child under the app-server process:
That one appears to be the command-safety/AST parser and is separate from the repeatedly appearing short-lived
Codex.exeprocess-polling probes.Impact:
powershell.exeprocess creation is visible/noisy in Task Manager.This still reproduces on
26.623.13972.0, so the visible PowerShell/background process polling issue appears to remain present in current Windows Desktop builds.Same issue here on Windows 11 with Codex Desktop.
I see visible black console flashes during normal use, often near integer-minute boundaries around
:07/:08.Windows PowerShell logs show short-lived
powershell.exeConsoleHost sessions running commands shaped like:powershell.exe -NoProfile -NonInteractive -Command ... Get-CimInstance Win32_Process ... Get-CimInstance Win32_PerfFormattedData_PerfProc_Process ... ConvertTo-JsonLocal examples:
2026-07-06 17:30:00-17:30:022026-07-06 22:20:04-22:20:12A live process sample showed
powershell.exeparented byCodex.exe.Impact: distracting black window flashes and intermittent mouse/keyboard stutter. This appears to match #25453 and this issue. Please prioritize hidden/no-window process creation or replacing this polling path with a persistent/native helper.
Follow-up from a Windows Desktop reproduction: the command-safety PowerShell parser has a ready CREATE_NO_WINDOW fix linked in #18984 (commit acc2ab3: https://github.com/ryanquadrel/codex/commit/acc2ab3b6c58b5c3d07ccd096d42dfb181d00283). This addresses the long-lived parser child. Separately, the packaged Desktop Electron local-process runner still needs windowsHide: true for every non-interactive spawn/exec/execFile path, including wsl.exe and local ssh.exe. That host source is not present in the public repository, so the desktop team must land that portion internally. The two fixes are complementary; neither alone covers all observed console flashes.
Follow-up to the earlier local-workaround note: the maintained Windows mitigation has been updated for the merged ChatGPT/Codex desktop package and is available at:
https://github.com/rwang23/codex-windows-console-guard
The guard now covers Codex-owned
PseudoConsoleWindow/traditional console surfaces, the packagedChatGPT.exe -> codex.exebackend/helper path, and the Chrome native-hostcmd.exebridge. This helps with the visible symptom when AppX activation bypasses the process-local wrapperPATH.The scope is intentionally limited. It does not fix the short-lived
Get-CimInstance/process-sampling PowerShell polling, its CPU cost, or the underlying Electron/Desktop no-window inconsistency. Those still need the upstream persistent/native-helper or reliable Windows no-window launch fix described in this issue.