Codex Desktop on Windows periodically spawns visible PowerShell/conhost probe that steals focus
What version of the Codex App are you using?
Codex Desktop for Windows, installed package observed as OpenAI.Codex_26.519.2081.0_x64__2p2nqsd0c76g0 with Electron crashpad annotation version 26.519.21041.
What operating system are you using?
Windows with Codex configured to run in WSL (runCodexInWindowsSubsystemForLinux = true).
What steps can reproduce the bug?
- Start Codex Desktop on Windows.
- Work in another desktop application or another terminal tab/window.
- Leave Codex Desktop running for a short while.
- Observe intermittent flashes of a terminal/console window or tab opening and immediately closing.
I confirmed this by watching Windows process creation. Codex Desktop periodically launches a short-lived PowerShell process similar to:
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 | Select-Object ProcessId,ParentProcessId,CommandLine,WorkingSetSize,@{Name='CpuPercent';Expression={$cpuByPid[[int]$_.ProcessId]}},@{Name='AgeSeconds';Expression={[int]((Get-Date) - $_.CreationDate).TotalSeconds}} | ConvertTo-Json -Depth 2"
The parent process is Codex.exe. Each probe also creates a transient conhost.exe, which appears to be the visible flash/focus-stealing window.
What is the expected behavior?
Background process/resource probes should run without surfacing a console window and without stealing focus from other applications or terminal tabs. On Windows this likely means launching the child process hidden / with no console window, or using a non-console process collection path.
What happens instead?
A console window flashes briefly and steals focus. This interrupts typing in other desktop applications and other terminal tabs, making the Desktop app difficult to leave running while working.
Additional context
This does not appear to be caused by user tmux hooks, cron jobs, or devkit shell launchers. In the observed process tree, the repeating powershell.exe probe is a direct child of Codex.exe.
A CLI-only Codex session does not appear to trigger the same visible Windows console flash in my testing, so this seems specific to Codex Desktop on Windows.
6 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I can reproduce a related Windows trigger with command hooks enabled, separately from the periodic background probe in the original report.
Observed process chain during a visible flash:
Codex.exe -> codex.exe -> pwsh.exe -NoProfile -Command "context-mode hook codex userpromptsubmit"Codex.exe -> codex.exe -> pwsh.exe -NoProfile -Command "context-mode hook codex stop"This suggests changing a hook's
command/commandWindowsvalue cannot fully fix the flash: the outer shell process is already created by Codex before the hook command runs.Source check on current
main:codex-rs/core/src/session/mod.rs:build_hooks_for_config()derives hook execution viauser_shell.derive_exec_args("", false).codex-rs/core/src/shell.rs: on Windows, PowerShell commands becomepwsh.exe -NoProfile -Command ....codex-rs/hooks/src/engine/command_runner.rs: the hookCommandis spawned after stdio piping, without an apparent Windows no-console creation flag.Potential minimal fix: on Windows, set
CREATE_NO_WINDOW(0x08000000) on the hook process beforecommand.spawn(), since hooks already communicate through piped stdio and are non-interactive. This should preserve hook functionality while preventing transient PowerShell/conhost windows.I did not include local logs or user paths here, but can provide sanitized process-capture details if useful.
same on my pc
I found a separate, adjacent presentation path that may help distinguish Windows reports.
When the Windows default-terminal setting is Automatic, some otherwise-unbound Codex console UI can be brokered through WindowsTerminal.exe / OpenConsole.exe. Those CASCADIA_HOSTING_WINDOW_CLASS windows can be service-owned rather than descendants of the Codex process, so an ancestry-only guard cannot safely target them without risking a user's own terminal.
On one Windows test system, explicitly selecting Windows Console Host for the current user's default-terminal delegation stopped that brokered Terminal-flash class. I documented a reversible local mitigation, including its limits, here:
https://github.com/rwang23/codex-windows-console-guard
This does not explain or fix the direct Codex.exe -> powershell.exe -> conhost.exe probe reported here; an upstream no-window/native-helper change remains necessary for that direct process path.
I can reproduce this on a newer Codex Desktop build, and I captured an additional process path that may help narrow down the Windows-specific cause.
Environment
OpenAI.Codex_26.727.6591.0_x64__2p2nqsd0c76g0Visible-window evidence
A lightweight monitor recorded a real top-level
WindowsTerminal.exewindow with classCASCADIA_HOSTING_WINDOW_CLASSbecoming visible and, in several cases, becoming the foreground window before focus returned toChatGPT.exe.Observed visible durations were approximately 60–205 ms. During one 14-second interval, the monitor captured at least four flashes (74 ms, 108 ms, 60 ms, and 124 ms). The user visibly observed more rapid consecutive flashes than the poller captured, so this is a lower bound.
The Terminal window title was sometimes:
C:\Windows\System32\tzutil.exeThe focus transition was recorded as:
ChatGPT -> Windows Terminal / CASCADIA_HOSTING_WINDOW_CLASS -> ChatGPTThis interrupts typing.
Correlated process activity
The additional process chains observed around the flashes include:
ChatGPT.exe -> gh.exe -> [nested gh.exe] -> tzutil.exe -> conhost.exeChatGPT.exe -> gh.exe -> git.exe -> git.exeChatGPT.exe -> taskkill.exe -> conhost.exeChatGPT.exe -> powershell.exe -> conhost.exeIn one three-minute capture window, the monitor recorded:
ChatGPT.exe -> gh.exegh.exe -> git.exegh.exe -> tzutil.exeChatGPT.exe -> taskkill.exeChatGPT.exe -> powershell.exeThe Windows Terminal host can be brokered/service-owned, so it is not always a direct descendant of the short-lived command process. The correlation above is based on matching timestamps, the Terminal window title, window class, and foreground transitions.
All observed executables resolved to the expected Microsoft, GitHub CLI, or Git for Windows locations/signatures. This looks like a Codex background-process/console-window handling bug rather than an unknown executable.
I can provide sanitized JSONL capture details if useful.
Independent confirmation on a current Windows Codex Desktop build.
Environment
OpenAI.Codex_26.727.6591.0_x64__2p2nqsd0c76g0DelegationConsoleandDelegationTerminalboth all-zero GUIDs)User-visible behavior
Short-lived black command windows flash repeatedly. The user also observed the flashes while Codex remained open with zero active chats/tasks, independently confirming the idle/background condition reported in #34266.
During an interactive diagnostic, user-reported flashes aligned with new Codex-owned process families. Two same-second examples captured:
The PowerShell commands collected process ID, parent PID, command line, working set, CPU percentage, and process age, then serialized the result as JSON.
A separate 10 ms native process-table sampler subsequently captured these additional Codex-owned chains:
The Git command observed was repository-discovery/status work. This supports the multiple adjacent console-allocation paths described in this issue and #34266, rather than a third-party startup utility.
Installed-code check
Read-only inspection of the packaged
app.asarfound the exact WMI snapshot commands. The Electron/NodeexecFilecalls already specifywindowsHide: true, yet transientconhost.exechildren are still created and the flashes remain user-visible. This suggests the current regression may involve more than simply adding-NoProfile -NonInteractive; brokered/default-terminal behavior or another child-process path may also be involved.A hidden native watcher remains active to distinguish a direct
conhost.exesurface from a brokeredWindowsTerminal.exe/CASCADIA_HOSTING_WINDOW_CLASSsurface on the next observed flash.This evidence is sanitized: no account identifiers, task/thread contents, machine name, repository names, or user paths are included.