codex icon indicating copy to clipboard operation
codex copied to clipboard

Autoupdater incorrectly suggests 'npm install' for global Bun installs

Open miraclebakelaser opened this issue 1 month ago • 0 comments

What version of Codex is running?

codex-cli 0.72.0

What subscription do you have?

Pro

Which model were you using?

No response

What platform is your computer?

Darwin 25.1.0 arm64 arm

What issue are you seeing?

When Codex is installed globally via Bun (bun install -g @openai/codex), the autoupdater incorrectly detects the package manager as npm and suggests running npm install -g @openai/codex to update.

This happens because detectPackageManager() in codex.js relies on npm_config_user_agent or npm_execpath, which are set by Bun when running scripts or using bunx, but are not set when running a globally installed binary directly from the shell.

What steps can reproduce the bug?

  1. Install Codex globally using Bun and run codex: bun install -g @openai/[email protected] && codex
  2. Observe that the update message suggests npm install -g @openai/codex
╭─────────────────────────────────────────────────╮
│ ✨ Update available! 0.65.0 -> 0.72.0            │
│ Run npm install -g @openai/codex to update.     │
│                                                 │
│ See full release notes:                         │
│ https://github.com/openai/codex/releases/latest │
╰─────────────────────────────────────────────────╯

Running a script to simulate the detection logic on a machine with Bun installed:

  npm_config_user_agent: (empty)
  npm_execpath: (empty)
  BUN_INSTALL: /Users/me/.bun

  detectPackageManager() → null
  Setting env var: CODEX_MANAGED_BY_NPM

  Result: Autoupdater suggests 'npm install -g ...' (Expected: bun)

What is the expected behavior?

The CLI should detect it is running from a Bun global installation and suggest bun install -g @openai/codex.

Additional information

This appears to be a regression caused by commit c3e4f920b4e965085164d6ee0249a873ef96da77 ("chore: remove bun env var detect") in v0.65.0, which removed the BUN_INSTALL environment variable checks.

miraclebakelaser avatar Dec 14 '25 08:12 miraclebakelaser