Skip to content

Codex update succeeds via npm -g, then verification reads a shadowed PATH binary #4009

Open

Description

@VKirill

The workflow

On a Mac with two codex installs (user npm prefix and Homebrew npm), open Settings → Providers → Codex and click Update. BB runs codex update.

What happens today

codex update exits 0 and prints that it updated via npm install -g @openai/codex. BB then fails the post-update check:

codex update exited successfully, but the provider could not verify the installed result.

Observed on Mac Mini (host_7sea4qaad8) just after that run:

Path Version
/Users/…/.local/bin/codex (first on PATH) codex-cli 0.154.0
/opt/homebrew/bin/codex codex-cli 0.155.1
npm ls -g @openai/codex (Homebrew npm) @openai/[email protected]

codex update refreshed the Homebrew global package. Verification then runs codex --version through resolveExecutablePath("codex"), which still hits ~/.local/bin/codex at 0.154.0.

provider-codex plans the update as version_at_least the npm latest. Host daemon installationVerificationPassed compares that to status.currentVersion from the first PATH binary (apps/host-daemon/src/command-dispatch.ts). The npm package moved; the binary BB will actually spawn did not.

Related but not the same as #3166 (externally managed / ChatGPT.app / Homebrew Cellar). Here both copies are npm-global, just different prefixes.

What you would expect

After a successful codex update, verification should look at the same install the updater just wrote, or refuse Update when more than one codex is on PATH and say which one BB uses. A green npm log plus a red “could not verify” is the wrong outcome when the CLI BB launches is unchanged.

Checks

  • I searched open and closed issues for the same report.
  • If an agent wrote this, the body ends with > AGENT GENERATED.

AGENT GENERATED

Activity

  1. added theissue type on Sep 21, 2026
  2. added
    providers
    provider-codex
    partial-repro
    on Sep 21, 2026
  3. bb-slop-cop commented on Sep 21, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Applied Bug · Priority: Medium · Effort: Medium, with providers, provider-codex, and partial-repro.

    Reproduction and root-cause report: PARTIALLY REPRODUCED, with high confidence in the BB-side mechanism. Controlled CLI fixtures and a host-dispatch test passed in two clean checkouts of trusted origin/main.

    Update planning does not reconcile the PATH-selected executable with the active npm prefix. Verification correctly rejects success when the executable BB uses remains old. The report includes the repeatable tests and results.

    No PR: real Codex/npm updater destination selection remains unverified, so this does not meet the automatic-fix reproduction gate.

    AGENT GENERATED

  4. ryanolson commented on Oct 15, 2026

    @ryanolson

    The same thing happens with pi, and we confirmed where the update goes. This closes the gap in the partial repro (the updater's install destination).

    Pi repro

    pi was installed with NPM_CONFIG_PREFIX=~/.npm-global npm install -g @earendil-works/pi-coding-agent@latest. ~/.npm-global/bin/pi is first on PATH and is a symlink into ~/.npm-global/lib/node_modules/@earendil-works/pi-coding-agent/. Then Settings → Providers → Pi → Update.

    macOS (Homebrew node), after the update:

    Path Version
    ~/.npm-global/bin/pi (first on PATH, the one bb runs) 1.1.0
    /opt/homebrew/bin/pi (written by bb's update) 1.2.0

    Linux (pixi node): the same update went to ~/.pixi/envs/nodejs, npm's default prefix there.

    Both machines then show pi update exited successfully, but the provider could not verify the installed result., and every retry does the same. Status shows install source external.

    Cause

    • bb runs npm install -g <package>@latest with no --prefix (provider-maintenance-kit.ts#L131-L137).
    • The host daemon runs it with its own environment plus only PATH from the login shell (command-dispatch.ts#L165-L168, runtime-shell-env.ts#L623). NPM_CONFIG_PREFIX from the shell is dropped.
    • So npm uses its default prefix. With only PATH set, npm prefix -g prints /opt/homebrew on the Mac. The daemon's npm debug logs (cwd ~/.bb-machines/<server>/provider-maintenance-workspace) load /opt/homebrew/etc/npmrc.
    • The verification step is right to fail: the CLI bb runs did not change.

    Pi and codex share the provider maintenance kit for npm installs and the npm probe. Codex updates with codex update, and in this issue that ran npm install -g @openai/codex inside the same daemon environment, so it hits the same default-prefix problem.

    Fix

    Draft PR: #5550. The shared kit now finds the npm prefix that owns the CLI on PATH (its real path is under <prefix>/lib/node_modules/<package>). When that prefix is not npm's default, the npm install and the npm list -g probe add --prefix <prefix>. Pi uses it. It does not fix codex yet, because codex update does not go through the kit's npm command. A follow-up could plan the codex update with the kit's npm command (with --prefix) when an owning prefix is found.

    Suggest renaming this issue to cover all npm-installed providers, for example: "Provider update installs into npm's default prefix, not the prefix of the CLI bb runs".

    AGENT GENERATED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    partial-reproprovider-codexproviders

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions