You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Codex App for Windows shows different environment variables between the integrated terminal and the agent shell_command runner. #19546
Impact:
MSBuild fails before compilation with:
MSB6001: Invalid command line switch for "CL.exe".
System.ArgumentException: Item has already been added. Key in dictionary: 'Path' Key being added: 'PATH'
What steps can reproduce the bug?
Codex App for Windows shows different environment variables between the integrated terminal and the agent shell_command runner.
Impact:
MSBuild fails before compilation with:
MSB6001: Invalid command line switch for "CL.exe".
System.ArgumentException: Item has already been added. Key in dictionary: 'Path' Key being added: 'PATH'
@Tomer96 maybe it's unrelated, but I just opened a ticket that may solve your problem: #19550
If you're using Powershell (and the agent as well) and Powershell was installed through Winget or Microsoft Store, the agent struggles with certain tool calls and seems to be unable to run certain commands for pnpm or node among others. I noticed that when I uninstalled Powershell 7 and then reinstalled it using a MSI installer, both the install location and path were set correctly and the tool calls stopped failing.
It might be worth checking to see if you have Powershell installed in C:\Program Files\WindowsApps\Microsoft.PowerShell_7.6.1.0_x64__{some_version} or if you have it installed in C:\Program Files\PowerShell\7
If you have the WindowsApps version, just uninstall it and download the MSI package from Microsoft and install that.
It's important to note that this issue is observed only with the Codex app for Windows. The Codex extension for VS Code or the Codex CLI does NOT have such issues with double path injection; they use a normalized Path.
It's important to note that this issue is observed only with the Codex app for Windows. The Codex extension for VS Code or the Codex CLI does NOT have such issues with double path injection; they use a normalized Path.
Ah, sorry, I did not notice this distinction. I never used Codex app itself. Are there any benefits over using the IDE extension?
I've been using Codex CLI, Codex IDE extension, and now the Codex App extensively over the past year, and I think the correct answer for the current state of the Codex app is absolutely no. The app is not yet as stable and robust as I would like it to be.
Relevant detail: Codex launches shell commands with powershell.exe -NoProfile -Command ..., so a PowerShell profile workaround cannot reliably fix this for agent shell commands.
Suggested fix: when constructing child environments on Windows, normalize keys case-insensitively and emit exactly one canonical Path entry instead of passing both PATH and Path.
Activity
github-actions commentedon Apr 25, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Tomer96 commentedon Apr 25, 2026
This is not a duplicate!!!!!!
SlippyDong commentedon Apr 25, 2026
@Tomer96 maybe it's unrelated, but I just opened a ticket that may solve your problem: #19550
If you're using Powershell (and the agent as well) and Powershell was installed through Winget or Microsoft Store, the agent struggles with certain tool calls and seems to be unable to run certain commands for pnpm or node among others. I noticed that when I uninstalled Powershell 7 and then reinstalled it using a MSI installer, both the install location and path were set correctly and the tool calls stopped failing.
It might be worth checking to see if you have Powershell installed in C:\Program Files\WindowsApps\Microsoft.PowerShell_7.6.1.0_x64__{some_version} or if you have it installed in C:\Program Files\PowerShell\7
If you have the WindowsApps version, just uninstall it and download the MSI package from Microsoft and install that.
Tomer96 commentedon Apr 25, 2026
@SlippyDong Hello.
I do not have the MS version of PWSH. I have the latest pwsh released install from the official repo: https://github.com/PowerShell/PowerShell/releases/tag/v7.6.1 (specific PowerShell-7.6.1-win-x64.msi)
This is a fuckup in the Codex app for Windows for sure 100%.
Tomer96 commentedon Apr 25, 2026
It's important to note that this issue is observed only with the Codex app for Windows. The Codex extension for VS Code or the Codex CLI does NOT have such issues with double path injection; they use a normalized Path.
Tomer96 commentedon Apr 25, 2026
needed to add a dedicated rule under AGENTS.md so the model can start listening.
with-clean-path.ps1
SlippyDong commentedon Apr 25, 2026
Ah, sorry, I did not notice this distinction. I never used Codex app itself. Are there any benefits over using the IDE extension?
Tomer96 commentedon Apr 25, 2026
I've been using Codex CLI, Codex IDE extension, and now the Codex App extensively over the past year, and I think the correct answer for the current state of the Codex app is absolutely no. The app is not yet as stable and robust as I would like it to be.
hakunan116 commentedon Jun 5, 2026
I can reproduce this on a newer Codex Desktop build as well.
Environment observed:
OpenAI.Codex_26.602.3474.0_x64__2p2nqsd0c76g0codex.exe app-server --analytics-default-enabled%USERPROFILE%\.codex\.sandbox-bin\codex-command-runner-0.137.0-alpha.4.exeObserved in the agent shell command environment:
cmd /c set pathprints both entries in the same process environment:
The values are effectively identical. This causes PowerShell environment enumeration to fail:
Get-ChildItem Env:with:
I also checked the persisted Windows environment sources:
reg query HKCU\Environment reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"Both only show
Path, not a separate uppercasePATH, so the duplicate appears to be introduced while Codex constructs the child process environment.Parent process chain observed for the shell command:
Relevant detail: Codex launches shell commands with
powershell.exe -NoProfile -Command ..., so a PowerShell profile workaround cannot reliably fix this for agent shell commands.Suggested fix: when constructing child environments on Windows, normalize keys case-insensitively and emit exactly one canonical
Pathentry instead of passing bothPATHandPath.real-worlds commentedon Jul 15, 2026
try
path=i.e lowercase path