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
[Windows Desktop] Shell child processes get PATHEXT truncated to .CPL, causing git, cmd, and other .exe commands to stop resolving #15174
Codex should preserve the normal Windows PATHEXT value when spawning shell child processes, so bare .exe commands such as git, cmd, node, etc. resolve the same way they do in a normal PowerShell session.
Additional information
I did some local investigation to narrow this down:
Machine-level registry PATHEXT is normal
User-level registry does not override PATHEXT
My PowerShell profile does not modify PATHEXT
git.exe is installed and present on PATH
Direct full-path execution works
The parent Codex Desktop processes appear to have a normal PATHEXT
The corruption appears when app\resources\codex.exe (app-server --analytics-default-enabled) spawns the PowerShell shell child
My current inference is that the desktop app is rebuilding the child environment incorrectly and truncating PATHEXT to the last segment (.CPL).
Thanks for linking the similar issue, but I do not think my bug is the same one.
In my case, the problem is not that Git is missing, not that PATH is wrong, and not that PowerShell cannot launch external programs in general. The failure is specifically caused by the shell child process inheriting a corrupted PATHEXT value (.CPL only), which prevents bare .exe command names from resolving.
For example, when I try to invoke Git by name inside the broken Codex shell, I get:
git : The term 'git' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the s
pelling of the name, or if a path was included, verify that the path is correct and try again.
At line:2 char:1
+ git --version
+ ~~~
+ CategoryInfo : ObjectNotFound: (git:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
However, this does not mean Git is absent. git.exe is installed, present on PATH, and can be launched successfully by full path. Also, if I restore PATHEXT inside the same broken shell to the normal Windows value, git --version immediately starts working again.
That behavior strongly suggests this is an environment-construction bug in the spawned shell process, specifically around PATHEXT, rather than the other reported issue.
Confirmed. I had the same root cause: inside the broken shell, $env:PATHEXT was only .CPL, so PowerShell stopped resolving git -> git.exe.
Workaround that fixed it for me:
[Environment]::SetEnvironmentVariable('PATHEXT','.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC','User')
And to auto-heal future PowerShell sessions, I added this to $PROFILE:
if (-not$env:PATHEXT-or$env:PATHEXT-notmatch'(^|;)\.EXE(;|$)') {
$fixedPathExt='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'$env:PATHEXT=$fixedPathExt
[Environment]::SetEnvironmentVariable('PATHEXT',$fixedPathExt,'User')
}
That restored git --version and Get-Command git for me.
Activity
github-actions commentedon Mar 19, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
STSNaive commentedon Mar 19, 2026
Thanks for linking the similar issue, but I do not think my bug is the same one.
In my case, the problem is not that Git is missing, not that
PATHis wrong, and not that PowerShell cannot launch external programs in general. The failure is specifically caused by the shell child process inheriting a corruptedPATHEXTvalue (.CPLonly), which prevents bare.execommand names from resolving.For example, when I try to invoke Git by name inside the broken Codex shell, I get:
However, this does not mean Git is absent.
git.exeis installed, present onPATH, and can be launched successfully by full path. Also, if I restorePATHEXTinside the same broken shell to the normal Windows value,git --versionimmediately starts working again.That behavior strongly suggests this is an environment-construction bug in the spawned shell process, specifically around
PATHEXT, rather than the other reported issue.iFTY-R commentedon Apr 3, 2026
~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
Microsoft.PowerShell_profile.ps1
whale7788 commentedon Apr 10, 2026
Confirmed. I had the same root cause: inside the broken shell,
$env:PATHEXTwas only.CPL, so PowerShell stopped resolvinggit->git.exe.Workaround that fixed it for me:
That restored git --version and Get-Command git for me.