Repository navigation
Description
What happened?
While investigating a Windows standalone update failure, I found that the update action launches Windows PowerShell (powershell.exe) even when Codex itself is started from PowerShell 7 (pwsh). The child powershell.exe process can inherit PowerShell 7 entries in PSModulePath, which breaks module discovery in Windows PowerShell 5.1 and makes Get-FileHash unavailable.
The resulting installer failure looks like this:
Get-FileHash : The term 'Get-FileHash' is not recognized as the name of a cmdlet, function, script file, or operable program.
This does not appear to be caused by irm ... | iex corrupting the installer script text. I verified that the downloaded script text and piped script text are identical and parse successfully.
Environment
OS: Windows 10 22H2, 10.0.19045
Codex: codex-cli 0.138.0
Parent shell: pwsh 7.6.2
Child shell used by standalone update: powershell.exe 5.1.19041.6456
Codex executable: C:\Users\Administrator\AppData\Local\Programs\OpenAI\Codex\bin\codex.exe
Current main still has the Windows standalone update action hard-coded as:
UpdateAction::StandaloneWindows => (
"powershell",
&[
"-ExecutionPolicy",
"Bypass",
"-c",
"$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex",
],
),Observed on main commit:
08cb633c06a27d25872d0132fbd9c749556d7653
Minimal reproduction
This does not execute the Codex installer. It only simulates the relevant process-launch shape and checks whether Windows PowerShell can resolve and run Get-FileHash.
Run this from pwsh:
node - <<'NODE'
const { spawnSync } = require('child_process');
const psProbe = String.raw`
$ErrorActionPreference = 'Continue'
"PSVersion=$($PSVersionTable.PSVersion) Edition=$($PSVersionTable.PSEdition)"
"PSModulePath=$env:PSModulePath"
$cmd = Get-Command Get-FileHash -ErrorAction SilentlyContinue
"Get-FileHash found=$([bool]$cmd) type=$($cmd.CommandType) source=$($cmd.Source)"
try {
'Get-FileHash -LiteralPath $PSHOME\\powershell.exe -Algorithm SHA256 | Select-Object -First 1 Algorithm,Hash' | Invoke-Expression | Format-List
"InvokeExpressionResult=OK"
} catch {
"InvokeExpressionResult=FAIL"
"Error=$($_.Exception.Message)"
}
`;
const enc = Buffer.from(psProbe, 'utf16le').toString('base64');
const cleanWindowsPSModulePath = [
'C:\\Users\\Administrator\\Documents\\WindowsPowerShell\\Modules',
'C:\\Program Files\\WindowsPowerShell\\Modules',
'C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules',
].join(';');
const cases = [
['A. inherited env, like native child process', { ...process.env }],
['B. PSModulePath removed, let Windows PowerShell rebuild', (() => { const e = { ...process.env }; delete e.PSModulePath; delete e.PSMODULEPATH; return e; })()],
['C. clean WindowsPowerShell-only PSModulePath', { ...process.env, PSModulePath: cleanWindowsPSModulePath }],
];
for (const [name, env] of cases) {
const r = spawnSync('powershell.exe', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-EncodedCommand', enc], {
encoding: 'utf8', timeout: 30000, env
});
console.log('\n==== ' + name + ' ====');
console.log('exit=' + r.status);
console.log(r.stdout.trim());
const stderr = r.stderr.replace(/#< CLIXML[\s\S]*/,'<CLIXML progress omitted>').trim();
if (stderr) console.log('stderr=' + stderr);
}
NODEActual output
With the inherited environment, Windows PowerShell 5.1 sees PowerShell 7 module paths first and cannot resolve Get-FileHash:
==== A. inherited env, like native child process ====
exit=0
PSVersion=5.1.19041.6456 Edition=Desktop
PSModulePath=C:\Users\Administrator\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
Get-FileHash found=False type= source=
InvokeExpressionResult=FAIL
Error=The term 'Get-FileHash' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
If PSModulePath is removed before spawning powershell.exe, Windows PowerShell rebuilds a WindowsPowerShell-only module path and Get-FileHash works:
==== B. PSModulePath removed, let Windows PowerShell rebuild ====
exit=0
PSVersion=5.1.19041.6456 Edition=Desktop
PSModulePath=C:\Users\Administrator\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
Get-FileHash found=True type=Function source=Microsoft.PowerShell.Utility
Algorithm : SHA256
Hash : 9785001B0DCF755EDDB8AF294A373C0B87B2498660F724E76C4D53F9C217C7A3
InvokeExpressionResult=OK
Codex-shaped safe reproduction
This mirrors the update action shape (powershell -ExecutionPolicy Bypass -c "... | iex") without running the installer:
==== codex-shaped command, inherited env ====
Get-FileHash : The term 'Get-FileHash' is not recognized as the name of a cmdlet, function, script file, or operable program.
==== codex-shaped command, PSModulePath removed ====
SHA256 9785001B0DCF755EDDB8AF294A373C0B87B2498660F724E76C4D53F9C217C7A3
Why this does not look like an irm | iex encoding problem
I also checked the real installer script without executing it. The direct Invoke-RestMethod result and the piped text had the same length, same SHA-256 over the text, same Get-FileHash index, and both parsed with zero PowerShell parser errors:
directLength=29883
pipeLength=29883
directSha256=ab7d7864801e62f92aa3abf878e3b0aaa8b9f7de03120bc81b029f67281c1842
pipeSha256=ab7d7864801e62f92aa3abf878e3b0aaa8b9f7de03120bc81b029f67281c1842
directParserErrors=0
pipeParserErrors=0
directGetFileHashIndex=2768
pipeGetFileHashIndex=2768
Expected behavior
The standalone Windows update should run reliably when Codex is started from pwsh, without making Windows PowerShell 5.1 inherit a PowerShell 7 module path that breaks module discovery.
Possible fixes
A few possible directions:
- Add
-NoProfileto the Windows standalone update invocation. - Remove or normalize
PSModulePathbefore spawningpowershell.exeforStandaloneWindows, so Windows PowerShell can rebuild its default WindowsPowerShell module path. - Prefer
pwshwhen Codex itself is running frompwshandpwshis available. - Add a fallback in
install.ps1that computes SHA-256 using .NET APIs ifGet-FileHashis unavailable.
The most targeted fix seems to be normalizing/removing PSModulePath for the powershell.exe child process used by the Windows standalone update action.
I am happy to help with a PR if maintainers agree with the preferred fix direction.
Activity
thomak-dev commentedon Jun 18, 2026
I am having this problem when trying to update codex from PowerShell 7, which is my main shell. The expectation is that
codex updateworks from any shellrteoo commentedon Jul 2, 2026
I can confirm this is still reproducible with a newer Codex release and the latest PowerShell 7 available in my environment.
Environment
10.0.26200.86557.6.30.141.00.142.5Reproduction
From PowerShell 7.6.3:
The updater launches Windows PowerShell rather than the current
pwshprocess:Running Windows PowerShell 5.1 independently with a clean environment resolves
Get-FileHashfromMicrosoft.PowerShell.Utility, which is consistent with the root-cause analysis in this issue: the failure is caused by the PowerShell 7PSModulePathinherited by thepowershell.exechild process, not byGet-FileHashbeing unavailable on the machine.Proposed fix
For the
StandaloneWindowsupdate action:powershell.exeas the compatibility baseline becausepwshis not guaranteed to be installed.-NoProfile.PSModulePathfrom the child process environment before spawningpowershell.exe, allowing Windows PowerShell to reconstruct its native module search path.PSModulePathand verifies that the child can resolve and executeGet-FileHash.A defensive .NET SHA-256 fallback in
install.ps1could provide an additional safety net, but normalizing the child environment appears to be the smallest fix at the source.This also appears to be the same failure reported in #30015. I would be happy to prepare the focused change and regression test if a maintainer would like to invite a PR under the repository's contribution policy.
duckyb commentedon Jul 6, 2026
I tested this solution (proposed by OP) and it worked great for me. If you're having issues updating codex cli I recommend trying it. 👍🏻
powershell -NoProfile -ExecutionPolicy Bypass -c '$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex'balloon72 commentedon Jul 11, 2026
I reproduced this on current
main(5c19155cbd93) on Windows, with PowerShell 7.6.3 spawning Windows PowerShell 5.1.26100.8457.With the inherited
PSModulePath,Get-Command Get-FileHashreturned no command. RemovingPSModulePathbefore spawning the same child restoredMicrosoft.PowerShell.Utility. Both probes used-NoProfile, so adding that flag alone is not sufficient.The current standalone Windows path in
codex-rs/cli/src/main.rsdirectly spawns the updater command without adjusting its environment. The smallest fix looks like adding.env_remove("PSModulePath")only forUpdateAction::StandaloneWindows, while keepingpowershell.exeand every other update path unchanged.I can keep the patch to that focused change and validate it with the PowerShell probe,
just test -p codex-cli,just fix -p codex-cli, andjust fmt.If this matches the intended direction, would a maintainer like me to open an invited PR for this issue?
dzshzx commentedon Jul 11, 2026
Confirmed with a full isolated standalone update, not just a command-resolution probe.
Environment
10.0.26100.86557.6.30.142.50.144.15.1.26100.8655I copied the retained 0.142.5 standalone package into a temporary standalone layout, pointed
CODEX_HOMEandCODEX_INSTALL_DIRat isolated directories, and ran that binary's realcodex updatepath. The production installation was not used by the update.With the inherited environment, instrumentation in the child showed:
The real installer then failed at the archive verification step with:
I repeated the same isolated update after removing only
PSModulePathfrom the environment inherited bycodex.exe. The Windows PowerShell child reconstructed its native module path:The
Get-FileHashstep passed and Codex 0.144.1 was installed into the isolated target. This confirms that the narrow source fix is to removePSModulePathonly on theStandaloneWindowsupdater child process before spawningpowershell.exe.PowerShell's documented
pwsh -> powershell.exemodule-path translation does not apply here because nativecodex.exesits between the two shells:Adding
-NoProfilealone does not address the inherited process environment. I am preparing the focused.env_remove("PSModulePath")change and a unit-level command construction test. This is also the same user-visible failure reported in #30015.dzshzx commentedon Jul 11, 2026
The focused implementation is ready for maintainer review:
010e24d3fc05b85ff039bbf82bcd41c5c81e1c5cdzshzx:codex/fix-windows-update-psmodulepathScope:
cli/src/main.rsinto a focused module;PSModulePathonly from theStandaloneWindowsPowerShell child;Validation:
I have not opened a pull request because
docs/contributing.mdsays external PRs require an explicit maintainer invitation and uninvited PRs are closed without review. If a maintainer confirms this direction and invites the PR, the branch is ready to open immediately.galar71 commentedon Jul 16, 2026
Confirmed independently on the current standalone release; this is still reproducible in Codex CLI 0.144.5.
Environment
7.6.35.1.26100.88750.144.4 -> 0.144.5User-visible reproduction
Running the ordinary command from PowerShell 7:
downloads the update, then fails during archive verification:
Opening Windows PowerShell 5.1 and running the same ordinary
codex updatecompleted successfully.Additional isolation
Both installed shells have a valid
Get-FileHash:Microsoft.PowerShell.Utility 7.0.Microsoft.PowerShell.Utility 3.1.Profiles and user/machine
PSModulePathconfiguration were checked; there are no custom module-path or autoload changes causing this.A read-only process-chain probe reproduced the boundary precisely:
That matches the production chain:
The direct PowerShell 7-to-Windows PowerShell launch performs PowerShell's documented
PSModulePathcompatibility translation. Inserting a native process preserves the PowerShell 7 process environment and bypasses that handoff.This confirms the report and the focused fix already prepared in this thread: remove
PSModulePathfrom theStandaloneWindowsupdater child before spawningpowershell.exe. The expected behavior is that the literalcodex updatecommand works from PowerShell 7 without profiles, wrappers, alternate commands, or switching shells.Swatto86 commentedon Jul 22, 2026
Still reproduces on the latest release.
codex updatefrompwsh 7.6.3failed updating 0.144.3 → 0.145.0 with the sameGet-FileHasherror.Confirmed the exact mechanism described here: the inherited
PSModulePathputs PowerShell 7 module dirs ahead of the Windows PowerShell ones, so WinPS 5.1 autoloads the PS7 copy ofMicrosoft.PowerShell.Utility(from...\powershell\7\Modules\...), which does not surfaceGet-FileHashunder 5.1. Forcing a clean WinPS-onlyPSModulePathon the child fixes it:Note
-NoProfilealone (fix #1) is not sufficient — the shadowing comes from the inheritedPSModulePath, not the profile. Option #2 (normalize/removePSModulePathbefore spawningpowershell.exe) or #4 (.NET SHA-256 fallback ininstall.ps1) are the robust fixes.Rezetyan commentedon Jul 27, 2026
Confirmed on the latest release:
0.144.6 → 0.145.0, with a parent shell combination not yet reported here — pwsh 7.6.4 MSIX (Microsoft Store install) — childpowershell.exe5.1.26100.8894, Windows 11 Pro 26200. SameGet-FileHashCommandNotFound at the checksum step.Two findings I haven't seen in this thread yet, plus an explanation of why manually re-running the install command appears to work:
1. The shadowing module is
Microsoft.PowerShell.Utility, and its pwsh build declaresCompatiblePSEditions = @("Core")With the inherited
PSModulePath,Get-Module Microsoft.PowerShell.Utility -ListAvailablein the child 5.1 resolves to the pwsh copy (path order wins overC:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules). Its manifest:Windows PowerShell 5.1 cannot load this Core-only build and — critically — does not fall back to the compatible copy later in
PSModulePath, soGet-Command Get-FileHashreturns nothing andinstall.ps1dies.Shadowing by this single module is sufficient: staging a directory containing only pwsh's
Microsoft.PowerShell.Utility, then launchingpowershell.exewithPSModulePath = <staged dir>;<system32 WinPS modules>, already reproducesGet-FileHash: not recognized. Both pwsh install flavors ship the shadowing content: MSI (C:\Program Files\PowerShell\7\Modules) and MSIX/Store (C:\Program Files\WindowsApps\Microsoft.PowerShell_7.6.4.0_x64__8wekyb3d8bbwe\Modules).2. Why re-running the command manually from pwsh "works": pwsh hands direct
powershell.exechildren a clean PSModulePath — a native middle process defeats thatpwsh 7.6.4 → powershell.exe(direct child): the child receives a clean WinPS-defaultPSModulePath(Documents\WindowsPowerShell\Modules; ...\WindowsPowerShell\Modules; ...\system32\...\v1.0\Modules) andGet-FileHashresolves fine. This is likely why @duckyb's manual re-run of the install command works — it's the direct launch, not the-NoProfileflag (consistent with @balloon72's observation that-NoProfilealone doesn't fix the inherited-env case).pwsh 7.6.4 → node.exe → powershell.exe(native middle process, the exact launch shape ofcodex.exe): the middle process forwards the raw pwsh environment, the child 5.1 gets the poisonedPSModulePath,Get-FileHashgoes missing. Minimal repro:So the bug is specific to the pwsh 7 → native process → powershell.exe chain — precisely the standalone-update launch shape, and also why
codex updatefrom a Windows PowerShell 5.1 window succeeds (clean path end-to-end).Duplicates
#34030 and #30015 report the same failure signature and can probably be closed as duplicates of this one.
User-side workarounds (until the fix lands — @dzshzx's
.env_remove("PSModulePath")branch looks right)codex updatefrom a Windows PowerShell 5.1 or cmd window; orenv -u PSModulePath codex update$bak=$env:PSModulePath; Remove-Item Env:PSModulePath; codex update; $env:PSModulePath=$bakduckyb commentedon Jul 27, 2026
No, a manual rerun of the original command failed to update codex with the same error in my environment. It only worked for me after I added the
-NoProfileflag.Zburgers commentedon Aug 3, 2026
Still reproducible while updating the native Windows Codex CLI from
0.145.0to0.146.0.Environment:
The updater invoked:
The install first reported that it could not download or verify the
releases.openai.comSHA256SUMSfile and retried through GitHub Releases. The fallback then failed with:The harness does not modify the installer script; it only invokes the Codex update flow. This appears consistent with the inherited PowerShell
PSModulePathproblem described in this issue, and confirms that the failure is still present in the0.145.0→0.146.0update path.I have not yet verified the
PSModulePath-removal workaround on this machine, so I am not claiming that workaround as confirmed for this reproduction.kendonB commentedon Aug 5, 2026
Still an issue today
18 remaining items
snowyukitty commentedon Sep 4, 2026
Update — 2026-09-22 (JST)
A correction to the original September 4 note below: the served installer and
mainmatched then, but that is not a permanent equivalence. Rechecked on September 22 (JST), withmainpinned at7cec3e110ce6dc5c14704dfa06f6db9c23a530fc:main:scripts/install/install.ps1cd9c0c778916362fc0e41b522bd804f6ce6e24adhttps://chatgpt.com/codex/install.ps1(40,541 bytes)229663b1667e343d9b4879c03de8dfa94ccf2575Static comparison found the
Test-ArchiveDigestfunction text identical in both scripts; both callGet-FileHashat line 217. Differences elsewhere concern junction and daemon installation handling. The differing blobs do not establish a particular deployment mechanism or rule out a caller-side fix. The served script and CLI launch behavior need checking separately.I also reran a safe cmdlet probe from pwsh 7.6.6 through Python's native
subprocesslaunch intopowershell.exe -NoProfile -ExecutionPolicy Bypass -EncodedCommand:Get-FileHashnot recognizedPSModulePathremovedHASH_OKThis leaves
-NoProfileinsufficient for this process shape, without contradicting the report that it helped another host. No installer was executed and no persistent environment was changed. This checks cmdlet discovery, not a complete update or the installer's digest function.If a public candidate fix is available, a commit or build reference would help target the next verification at this exact process shape.
Original note — 2026-09-04 (preserved)
A short addendum to my status note above: it turns out there is only one surface
to watch here, not two.
The script the updater downloads at update time is not a build artifact of the
branch — it is the branch's file. Hashed as a Git object it is the same blob
mainrecords:That makes "has it shipped yet?" self-serve, so nobody has to wait on a reply in
this thread: while that hash still matches
scripts/install/install.ps1onmain, and that file still verifies the download withGet-FileHash(line 217as of today), nothing has changed for the Windows update path. The file last
changed on 2026-07-23 in 39a2438.
Measured 2026-09-04 against
mainat 8e6a44b. None of this contradicts theannounced fix — it just names the exact object whose change will show it
arriving.
nos1609 commentedon Sep 6, 2026
nos1609 commentedon Sep 10, 2026
MSPscripts commentedon Sep 16, 2026
I can confirm the issue is present in Powershell 7.6.6. PATH inheritance is not the issue for me, but -noprofile is the fix.
NOTgithub commentedon Sep 19, 2026
Still reproducible with Codex CLI 0.154.0 when accepting the suggested update to 0.155.1, launched from PowerShell 7.6.6 on Windows. The updater launches Windows PowerShell 5.1 and fails with “Get-FileHash is not recognized.” Local diagnostics confirmed that the child process inherits PowerShell 7’s PSModulePath and loads its utility module. Explicitly loading the correct Windows PowerShell module restores Get-FileHash.
mbylstra commentedon Sep 23, 2026
Minazuki commentedon Sep 24, 2026
Confirmed on the current standalone update, Codex CLI 0.156.0 → 0.156.1 (2026-09-24). This reproduces from a clean PowerShell 7 session:
Environment: Windows 11 x64 build 26200; parent
pwsh7.6.6; updater childpowershell.exe5.1.26100.9168. The update reachesDownloading Codex CLI, prints the fallback warning forcodex-package_SHA256SUMS, then fails withGet-FileHashnot recognized. The installed CLI remains 0.156.0.I captured the updater child's environment with a temporary
powershell.exediagnostic shim (the probe did not run the installer). The native-process chain preserves PowerShell 7 entries ahead of Windows PowerShell entries inPSModulePath. In the actual Windows PowerShell 5.1 child:With a WindowsPowerShell-only
PSModulePathin the same child launch shape,Microsoft.PowerShell.Utility 3.1.0.0loads and both commands resolve. This is fresh evidence that the inherited module path remains the cause in 0.156.1; the generic download warning is masking a local verification failure. Please apply the child-environment fix proposed in this issue (removePSModulePathfor theStandaloneWindowspowershell.exelaunch) so plaincodex updateworks frompwsh.rteoo commentedon Sep 24, 2026
Unfortunately this is abandoned
miiiladiii244 commentedon Sep 27, 2026
I can confirm this issue is still reproducible on Codex CLI 0.153.0 while updating to 0.157.1.
Environment:
Running:
causes Codex to launch the updater using:
The update begins normally:
It then reports:
The fallback subsequently fails with:
Full relevant error:
However, when I execute the installer manually from my existing PowerShell 7.6.6 session:
the installer gets past the
Get-FileHashfailure and proceeds with the update.This appears consistent with the root cause described in this issue: Codex launches
powershell.exerather than using the currentpwshsession, and the spawned Windows PowerShell process can inherit a module environment in whichGet-FileHashcannot be resolved.This reproduction confirms the issue remains present in the 0.157.1 update path as of September 27, 2026.
snowyukitty commentedon Sep 28, 2026
As of September 29, this is still unresolved in the public update path. At this point, the Codex engineering team's follow-through on this issue looks very unreliable.
The September 2 statement linked above said the PowerShell issue was fixed and needed roughly a week for testing and release. Nearly four weeks later, we still have no actionable follow-up here identifying a released fix, explaining the delay, or correcting that expectation. This report already contains detailed reproductions, root-cause analysis, and reference implementations with regression coverage.
Today's verification:
rust-v0.158.0Windows standalone update launcher still startspowershell.exewithout removingPSModulePathfrom the child environment.https://chatgpt.com/codex/install.ps1still callsGet-FileHashinTest-ArchiveDigest.powershell.exe -NoProfilefails to resolveGet-FileHashwith the inherited environment. Removing only the child'sPSModulePathmakes the same SHA-256 probe pass withMicrosoft.PowerShell.Utility3.1.For precision, this was a command-resolution and hashing probe plus inspection of the released launcher and live installer, not a new full end-to-end update reproduction. A direct manual installer invocation successfully updated this host from 0.155.1 to 0.158.0; that workaround succeeding does not establish that the built-in update path is fixed.
Please provide a concrete status: which commit or released build fixes this exact process chain, or, if it is still pending, why the announced fix has not reached affected users and what the current plan is. After this much evidence and an explicit release expectation, continued silence is not a credible resolution.
Spakus commentedon Sep 30, 2026
Still reproducible on a newer release.
Environment
Output of
codex updatefrom pwshNote: the
releases.openai.comwarning is a red herring — the first digest check fails on the same missingGet-FileHash, gets caught, and the installer retries from GitHub, where it fails uncaught.Confirmation of root cause (from pwsh 7):
Windows PowerShell 5.1 picks up
Microsoft.PowerShell.Utility7.0.0.0 from the PS7 module directory instead of its own 3.1.0.0, which lacksGet-FileHashfor Desktop edition.Workaround: run the installer directly from pwsh (
powershell -ExecutionPolicy Bypass -c "irm https://chatgpt.com/codex/install.ps1 | iex") — pwsh cleansPSModulePathfor a directpowershell.exechild.Possible fixes: prefer
pwshwhen available, or reset/stripPSModulePathin the environment of the spawnedpowershell.exe.Delcado19 commentedon Oct 2, 2026
Confirmed again on October 2, 2026, while updating the standalone Codex CLI from 0.159.3 to 0.160.0. Explicitly importing the Windows PowerShell Utility module in the installer process worked around the failure and allowed the update to succeed.
Observed environment and diagnosis
PSModulePath, before the Windows PowerShell module directory.PSModulePathvalues did not contain that PowerShell 7 directory; the additional paths were present in the process environment.Get-FileHash, including with-NoProfile.Microsoft.PowerShell.Utility7.0.0.0 from the PowerShell 7 directory.Get-FileHashas a function. Hashingpowershell.exewith SHA-256 then succeeded.This indicates that
-NoProfilealone does not fix the inherited module-path problem.Failing updater command
The output first reported that the checksum download or verification from
releases.openai.comfailed and that it was retrying from GitHub Releases. The final error wasGet-FileHashnot being recognized, followed by exit code 1. That initial warning alone does not establish an independent network failure, since it covers both download and verification failures.Confirmed end-to-end workaround
Run this from PowerShell:
The explicit manifest path selects the Windows PowerShell module instead of the PowerShell 7 module. The user confirmed that this exact command successfully completed the update. It preserves the installer's checksum verification.
Suggested upstream fix
Remove the inherited
PSModulePathfrom the environment of the Windows PowerShell updater child before spawning it, so Windows PowerShell can reconstruct its own defaults. Keep this change scoped to the child process rather than changing persistent user/machine configuration.-NoProfilemay additionally isolate profiles, but is insufficient on its own.As an installer-level fallback, explicitly importing the Utility module from
$PSHOME\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1avoids the wrong-edition module lookup. The absolute-path workaround above was verified; the launcher environment change is a proposed fix, not a patch tested in this report.A useful regression check would launch the updater-shaped Windows PowerShell child through a native intermediary with PowerShell 7 module paths in its inherited environment, then verify command resolution and SHA-256 hashing without downloading or installing anything.
sxcooler commentedon Oct 7, 2026
Adding the usability impact from another affected Windows standalone installation: having PowerShell 7 installed should be enough for the ordinary
codex updatecommand to work. Users should not have to remember a long command invoking the installer with an explicit shell path on every update.Current read-only checks on this machine (October 7, 2026):
codex-cli 0.159.2.powershell.exeresolves to Windows PowerShell underC:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.C:\Program Files\PowerShell\7\pwsh.exe; its version is 7.6.6.pwsh -NoProfile,Get-Command Get-FileHashresolves successfully toMicrosoft.PowerShell.Utility.codex update --helpdoes not expose a dedicated updater-shell option.The affected workflow is Codex launching the updater through legacy
powershelldespite an availablepwsh. Earlier local troubleshooting encountered the same missing-Get-FileHashsymptom and implicated the inherited module environment. These current checks did not rerun a complete update, so this is not a new end-to-end reproduction against 0.159.2.Please make shell selection/environment handling part of the updater itself: prefer an available compatible
pwsh, or ensure the Windows PowerShell child receives a compatible module environment. The desired user experience is simply:A permanent fix should not require replacing the system
powershell.exe, changing global module paths, or remembering a manual installer workaround.snowyukitty commentedon Oct 7, 2026
Update — 2026-10-07: fix merged in #51257, not yet served; the managed daemon is affected too
The fix is on
main. #51257 (162fcb3976, merged 2026-10-06) replacesGet-FileHashinTest-ArchiveDigestwith a direct .NET SHA-256 computation. That is the same approach as the reference patch in snowyukitty#2. Thanks to whoever picked it up.It is not what users download yet. The September note said the served installer and
mainwere the same blob. That no longer holds:scripts/install/install.ps1https://chatgpt.com/codex/install.ps1(2026-10-07 11:15 UTC)cd9c0c778916362fc0e41b522bd804f6ce6e24admainbefore #51257 (162fcb3976~1)cd9c0c778916362fc0e41b522bd804f6ce6e24admainnow05657ee2ff5ae906e0bbe47d3637d20f40b5aafbThe only difference between the served file and
mainis the #51257 hunk.To A/B it, I extracted
Test-ArchiveDigestfrom each file and ran it inpowershell.exe5.1, launched through a native intermediary so PowerShell 7'sPSModulePathis inherited:So #51257 works. It just needs to reach the served URL.
A second surface: the managed app-server daemon
codex app-server daemon updateand the daemon's background update loop fetch the same servedinstall.ps1. They run it inpowershell.exewith the environment the update loop inherited when it started. The installer's stdout and stderr go toStdio::null()(app-server-daemon/src/update_loop.rs), so the only visible output is:daemon-updater.stderr.logstays empty.What I saw on Windows 11 with the standalone CLI:
0.160.1. The managed daemon stayed on0.158.0for eight days, anddaemon versionreported"cliVersion":"0.160.1","appServerVersion":"0.158.0"./modelslist is fetched withclient_version, and the0.158.0response does not include the newest model.400 ... The 'gpt-6.1-sol' model is not supported when using Codex with a ChatGPT account.That reads like a plan or entitlement problem, but it was the stale daemon. Once the daemon was on
0.160.1, the same model worked on the same account.This is the same symptom #49418 describes from the other side (CLI upgraded, managed app-server left behind).
Workaround until the served script is updated:
CODEX_INSTALL_DAEMON_ONLY=1,CODEX_RELEASE=latest,CODEX_NON_INTERACTIVE=1,CODEX_INSTALL_IF_LATEST=1,CODEX_UPDATE_FROM_RELEASE=<current release dir name>.codex app-server daemon restart.pid-update-loopprocess and runcodex app-server daemon startfrom a shell whosePSModulePathis the Windows PowerShell default. The loop keeps the environment it was started with, so restarting the app server alone leaves the old updater in place.Two smaller suggestions for the daemon path:
daemon-updater.stderr.log. As it stands, a failed update can't be diagnosed.install.ps1callstarby bare name. If the inheritedPATHputs Git for Windows'usr\binahead ofSystem32, GNU tar readsC:\...ashost:pathand fails withtar (child): Cannot connect to C: resolve failed. The installer then reports a misleading "did not contain the expected package layout". Calling"$env:SystemRoot\System32\tar.exe"explicitly avoids that.I'd suggest keeping this issue open until
git hash-objectof the served file equals the post-#51257 blob, or whatever later blob replaces it.rattus-ratgirl commentedon Oct 7, 2026
Independent reproduction and update on merged fix (#51257)
I independently reproduced the
Get-FileHashfailure and confirmed that removing the inheritedPSModulePathresolves the command-resolution problem.Environment
Controlled reproduction
I launched four Windows PowerShell 5.1 child processes from PowerShell 7 using .NET
ProcessStartInfo, varying the inherited module environment and profile loading:PSModulePath, profiles disabled — FAILPSModulePathremoved, profiles disabled — PASSPSModulePath, profiles enabled — FAILPSModulePathremoved, profiles enabled — PASSBoth failing cases report
Get-FileHashas unrecognised. Both successful cases resolve it as a function fromMicrosoft.PowerShell.Utilityand successfully compute a SHA-256 hash.Root cause confirmation
The inherited
PSModulePathcontains PowerShell 7 module directories, including the Microsoft Store installation's module directory.Removing
PSModulePathfrom the child process environment allows Windows PowerShell 5.1 to reconstruct its default module paths and executeGet-FileHashsuccessfully.This independently corroborates the root cause described in this issue. Profile loading does not affect the outcome in this environment.
Status of the upstream fix
I subsequently found that PR #51257 was merged on October 6, 2026.
That change replaces the
Get-FileHashdependency inTest-ArchiveDigestwith direct .NET SHA-256 computation, avoiding the problematic module lookup.This appears to address the observed installer failure without requiring the launcher to modify
PSModulePath.I originally considered removing
PSModulePathfrom the Windows updater child via:command.env_remove("PSModulePath");Given the merged fix, I consider that an alternative approach or potential environment-hardening measure rather than a necessary additional change for this specific failure.
Remaining issue: deployment
As of October 7, 2026, the installer served through
https://chatgpt.com/codex/install.ps1still contains the originalGet-FileHashimplementation.The fix is therefore merged into
mainbut has not yet reached the publicly served installer at the time of verification.I have not independently tested the merged patch or confirmed end-to-end updater success. My reproduction establishes the original failure mechanism and confirms that correcting the child process's module environment resolves it.
The remaining actionable step appears to be deploying the updated installer and verifying that the ordinary Windows standalone update path succeeds.