Autoupdater incorrectly suggests 'npm install' for global Bun installs

Resolved 💬 0 comments Opened Dec 14, 2025 by miraclebakelaser Closed Dec 15, 2025

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/codex@0.65 && 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.

View original on GitHub ↗