Updater can leave `codex` on an older version when `~/.local/bin/codex` points at a stale user-local install
What version of Codex CLI is running?
Observed before fix on this machine:
codex-cli 0.118.0
Observed installed latest package at the same time:
@openai/codex@0.135.0
What subscription do you have?
This report comes from a Sprite Linux environment. Subscription tier is not relevant to reproduction.
Which model were you using?
Not relevant.
What platform is your computer?
Linux (Sprite VM / Ubuntu-family environment).
What terminal emulator and version are you using (if applicable)?
Shell environment in Sprite VM.
Codex doctor report
_Not captured before local repair._
What issue are you seeing?
Codex can appear to be "stuck" on an older CLI version even though a newer global npm install already exists.
The root cause was a stale user-local launcher symlink:
/home/sprite/.local/bin/codex -> ../lib/node_modules/@openai/codex/bin/codex.js
That symlink resolved to an older package tree:
/home/sprite/.local/lib/node_modules/@openai/codex/package.json = 0.118.0
At the same time, the active npm global prefix already contained a newer Codex install:
npm config get prefix
# /.sprite/languages/node/nvm/versions/node/v22.20.0
npm list -g --depth=0
# @openai/codex@0.135.0
So the machine had:
- current global package:
@openai/codex@0.135.0 - active shell command found first in
PATH:/home/sprite/.local/bin/codex - stale target behind that command:
~/.local/lib/node_modules/@openai/codexat0.118.0
Because /home/sprite/.local/bin came earlier in PATH, codex --version reported the old version even though the newer package was already installed and available elsewhere.
This is the same bug family as multiple-install / mismatched-update-target issues, but the specific failure mode here is a stale ~/.local/bin/codex symlink that silently keeps launching an older user-local package tree after a newer install lands under a different npm prefix.
What steps can reproduce the bug?
One way to reproduce this class of issue:
- Have an older user-local install under:
``text``
~/.local/lib/node_modules/@openai/codex
- Have
~/.local/bin/codexsymlink to that old install:
``text``
~/.local/bin/codex -> ../lib/node_modules/@openai/codex/bin/codex.js
- Later install a newer Codex globally under a different npm prefix, for example an nvm-managed prefix:
``text``
<other-prefix>/lib/node_modules/@openai/codex
- Keep
~/.local/binahead of the newer prefix'sbindirectory inPATH. - Run:
``bash``
which codex
codex --version
npm list -g --depth=0
npm config get prefix
- Observe that:
codex --versionreports the old CLI version from~/.local/bin/codexnpm list -gshows a newer@openai/codexalready installed under a different prefix
Concrete values from the affected machine:
which codex
# /home/sprite/.local/bin/codex
codex --version
# codex-cli 0.118.0
/home/sprite/.local/lib/node_modules/@openai/codex/package.json
# 0.118.0
npm list -g --depth=0
# @openai/codex@0.135.0
npm config get prefix
# /.sprite/languages/node/nvm/versions/node/v22.20.0
What is the expected behavior?
Codex should detect and surface this mismatch clearly.
At minimum, update/install diagnostics should warn when:
- the
codexexecutable first inPATHpoints at one package root npm install -g @openai/codexwould update a different package rootcodex --versionis therefore likely to stay old even after a successful install
Even better:
- the updater should refuse to claim success if the active
codexinPATHstill resolves to a different older install codex doctor/ update diagnostics should explicitly call out a stale launcher symlink such as~/.local/bin/codex- the installer/updater could recommend or offer to repoint the launcher to the active npm prefix's
bin/codex
Additional information
Local fix on the affected machine was simply to repoint the stale launcher:
ln -sfn /.sprite/languages/node/nvm/versions/node/v22.20.0/bin/codex /home/sprite/.local/bin/codex
After that:
which codex
# /home/sprite/.local/bin/codex
codex --version
# codex-cli 0.135.0
This looks closely related to:
- #21897 (multiple install targets / updater mismatch)
but this issue adds a concrete Linux/Sprite reproduction where the stale path is specifically ~/.local/bin/codex pointing into an old ~/.local/lib/node_modules tree while the newer install lives under a different npm prefix.
cc @Onlydole
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Likely duplicate / same bug family as #21897.
Why linking that earlier report is useful:
codexactually being executed.~/.local/bin/codexsymlink continues to point at an older~/.local/lib/node_modules/@openai/codex, while a newer version is already installed under a different npm prefix.codex --versionstays old despite a successful newer install.So I would treat this as either:
Either way, linking them should reduce fragmented investigation and make it easier to verify the eventual fix across both the broad and specific scenarios.
This occurs if you have multiple installs (e.g. a global and a per-user install) or have a corrupt installation. You'll need to manually clean that up and then reinstall.
Got it! Thank you for your help, @etraut-openai.