Repository navigation
Description
What version of the Codex App are you using (From “About Codex” dialog)?
Codex desktop app package version: 26.715.4045.0
What subscription do you have?
Pro
What platform is your computer?
Windows 11
What issue are you seeing?
Summary
On Windows, the Codex desktop app started an unbounded recursive PowerShell search across my complete user profile.
The command continued running after the conversation had moved on and spawned a Windows PowerShell 5.1 compatibility child process. Both processes remained active until I terminated them manually.
This resulted in locked temporary files and may cause sustained CPU, disk, and memory usage.
Environment
- Codex desktop app package version:
26.715.4045.0 - Operating system: Windows 11
- Shell: PowerShell 7.6.2
- Compatibility host: Windows PowerShell 5.1
- Authentication: ChatGPT login
- Workspace: projectless Codex workspace
- Session ID:
019f7da6-e113-7971-9ea9-dc0645c15d78
Observed command
Codex started a command with this general shape:
Get-ChildItem -Path 'C:\Users\<user>' -Filter '<external-handoff-file>.md' -Recurse -File -ErrorAction SilentlyContinue
This searched the complete Windows user profile, including AppData and other large directory trees.
The live process tree was:
ChatGPT.exe
└─ codex.exe
└─ pwsh.exe
└─ powershell.exe
The PowerShell 5.1 child was started with:
-Version 5.1 -s -NoLogo -NoProfile
The use of -NoProfile confirms that the user's PowerShell profile was not responsible.
What steps can reproduce the bug?
These are the observed steps. I have not yet reduced the issue to a completely deterministic minimal reproduction.
-
Start the Codex Windows desktop app.
-
Open a projectless workspace outside the normal repository root.
-
A bounded custom SessionStart hook reports an external handoff file using a relative path.
-
Codex cannot directly resolve that path from the current workspace.
-
Codex starts a recursive PowerShell search across
C:\Users\<user>. -
Continue the conversation or move on from the command.
-
Inspect the running processes with:
Get-CimInstance Win32_Process -Filter "Name='pwsh.exe' OR Name='powershell.exe'" | Select-Object ProcessId,ParentProcessId,Name,CommandLine -
Observe a
pwsh.exeprocess owned bycodex.exeand a Windows PowerShell 5.1 child process. -
The processes remain active until manually terminated.
-
Some temporary files remain locked while these processes are running.
The affected live process was created on 2026-07-20 at approximately 06:53 local time.
What is the expected behavior?
Codex should:
- Avoid recursively searching an entire Windows user profile for one known file.
- Prefer bounded search roots and tools such as
rg --files. - Apply a timeout to potentially expensive recursive searches.
- Cancel the complete process tree when a command times out, is interrupted, or the task moves on.
- Clean up PowerShell compatibility sessions and temporary proxy modules.
- Warn before recursively scanning
%USERPROFILE%. - Avoid repeating the same expensive search after reopening Codex.
Additional information
Restart clarification
At first, this looked like a process that had survived a Windows restart.
Further investigation showed that the previous process had been terminated by the restart, but Codex created a new instance of the search after the app was opened again.
The searched handoff filename was several days old, while the live process creation timestamp was from the current day. Historical temporary directories remained on disk across restarts, making the process appear older than it actually was.
Temporary directory impact
Many directories with names similar to the following accumulated under %TEMP%:
remoteIpMoProxy_DnsClient_1.0.0.0_localhost_<guid>
Some could not be removed because files inside them were held open by active PowerShell processes.
A typical error was:
The process cannot access the file because it is being used by another process.
Administrator privileges and -Force did not help because these were active file locks rather than permission errors.
Local configuration assessment
There is also a local configuration issue: the SessionStart hook supplied an external handoff using a relative path in a projectless workspace.
The hook itself is bounded, read-only, starts no child processes, and does not perform the recursive search. I will correct the local path handling separately.
However, the Codex runtime should still bound and terminate a shell command and its child processes when an agent proposes an overly broad search.
A total of 253,488 matching temporary directories were counted. A second measurement after 10 seconds returned the same count, confirming that directory generation had stopped and that this was a stable accumulated backlog.
Related reports
I searched the existing issues and did not find an exact duplicate.
Potentially related reports:
- Codex Windows App keeps spawning
git.exe status --porcelain=v1 -zand leaves orphangit.exe/conhost.exeprocesses #17229 - Windows: Codex spawns many Git for Windows processes causing sustained high CPU after recent update #22085
- BUG: Codex for Windows does not fully exit; old process tree remains alive after app close / Where can I report it? #14758
Those reports concern child-process cleanup or high resource usage on Windows. This report adds a concrete pwsh.exe to powershell.exe process chain, an unbounded recursive filesystem scan, locked PowerShell proxy directories, and evidence that the process was recreated after restarting and reopening Codex.
I can provide sanitized screenshots, process timestamps, sanitized command lines, relevant session logs, and the bounded SessionStart hook if requested.
Activity
github-actions commentedon Jul 20, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
willamboss commentedon Sep 9, 2026
Reproduced on Codex App 26.901.6511.0 with bundled CLI 0.153.4 on Windows 11 x64.
Four concurrent
rg.execommands recursively searched large historical JSONL files under.codex/sessions. After the tool calls timed out/yielded, the processes were not terminated, and additional searches were started.After approximately 40 minutes:
rg.exeprocesses consumed about 60% CPU combined.pwsh.exeparent processes also remained active, consuming about 862 MB of memory combined.Manually terminating the four
rg.exeand twopwsh.exeprocesses immediately restored system responsiveness.This occurrence shows that multiple expensive searches can accumulate after timed-out or abandoned tool cells. Codex should terminate the complete process tree, enforce per-session resource/concurrency limits, warn before scanning the full session archive, and provide a visible "stop all background commands" control.
GuanYuankai620 commentedon Nov 10, 2026
Another Windows Codex desktop observation with a lingering
rg.exeprocess.26.1103.7773.0, Windows x64.rg --files ... | rg 'Service.java$'as the path argument to a secondrg. The file list was empty. The observed second process had onlyrg.exe -n -i 'status|flow|approve'and searched the working directory.ChatGPT.exe → codex.exe app-server → codex.exe --__codex-windows-mxc → pwsh.exe → rg.exe. Thergprocess had been running for roughly 40 minutes and showed around 56% CPU and roughly 0.9 GB working set at inspection.rgprocess, three system CPU samples were approximately 33%, 39%, and 37%, down from approximately 96–97% in earlier Task Manager screenshots. Other tasks were running, so the samples are not a controlled benchmark.Please investigate tracking and terminating the complete process tree when a task or command is no longer active, including Windows sandbox execution.