Skip to content

Provider CLI maintenance should recognize externally managed executables and defer to their package manager #3166

Open

Description

@apsknight

The workflow

We install claude, codex, and other agent CLIs through a package manager rather than npm or the vendors' install scripts. The manager owns the binaries: each CLI is a symlink in the manager's bin/ pointing into a versioned tree it controls (the same layout Homebrew uses with Cellar), and the manager runs its own updater. We run bb on those machines and open Settings → Updates to see which agent CLIs are current.

What happens today

Each builtin provider's maintenance bridge only understands two ownerships: npm-global or "external". For anything "external" it still consults public npm for the latest version and, for Claude Code, still offers to run the vendor's in-place updater.

Observed on bb 0.42.1 (npx bb-app, macOS 15, Node 24.15.0), with claude resolving to a symlink inside the package manager's bin/ (path redacted):

$ curl -s http://127.0.0.1:38899/api/v1/hosts/<hostId>/provider-clis/status | jq .\"claude-code\"
{
  "executablePath": "/Users/me/<pkg-manager>/bin/claude",
  "installed": true,
  "installSource": "external",
  "currentVersion": "2.1.261",
  "latestVersion": "2.1.263",
  "npmPackageName": "@anthropic-ai/claude-code",
  "installAction": { "kind": "update", "label": "Update", "command": "claude update" },
  "needsUpdate": true
}

The UI shows "Claude Code 2.1.261 → 2.1.263" with a download button. Clicking it would run claude update, i.e. the Anthropic updater rewriting a binary inside a directory owned by a different package manager. At best it fails verification; at worst the manager's next reconcile silently reverts it, or the user ends up with two divergent installs. The same status call also spawned npm view @anthropic-ai/claude-code dist-tags --json, npm view @openai/codex …, and npm view @earendil-works/pi-coding-agent … — public-registry egress for CLIs that were never installed from npm.

Why Claude reaches "Update": claude doctor prints Running: native for the manager-vended binary, and the maintenance code treats installMethod === "native" as sufficient to run claude update regardless of where the executable lives:

  • const installSource = npmGlobalInstallSource({
    installed,
    executablePath: resolvedExecutable,
    npmBin: npmGlobal.npmBin,
    });
    const nativeFallback =
    doctor.installMethod === null &&
    installSource === "external" &&
    isDefaultNativeClaudePath(resolvedExecutable);
    const canRunUpdate =
    doctor.installMethod === "native" ||
    nativeFallback ||
    (installSource === "npmGlobal" &&
    (doctor.installMethod === null || doctor.installMethod === "npm-global"));
    const actionKind = !installed
    ? "install"
    : needsUpdate && canRunUpdate
    ? "update"
    : null;
    const displayCommand =

Codex/Pi are one step better (installAction: null when not npm-global), but they still fetch npm dist-tags for a version they cannot act on:

What you would expect

A provider-agnostic notion of "this executable is managed by something bb does not control," applied before any vendor/npm probing:

  1. Detection. If the resolved executable (after realpath) lives under a known manager prefix, mark it externally managed. Suggested built-ins: Homebrew ($(brew --prefix)/Cellar, /opt/homebrew, /home/linuxbrew), plus an escape hatch BB_EXTERNALLY_MANAGED_PATHS (colon-separated path list) for any other manager. This is the same shape as Pi provider update hardcodes npm and fails when Pi is installed via bun #3119/Use Bun to update Bun-managed Pi installations #3121, which taught the Pi provider to recognize Bun ownership — just lifted into the shared @get-bb/plugin-sdk/provider-bridge helpers so every provider gets it.
  2. Status. For externally managed executables: installSource: "external", installAction: null, latestVersion: null, needsUpdate: false, and skip the npm view / vendor lookups entirely. The UI already renders this as "Update in terminal", which is exactly right.
  3. Optional hint. A small map from manager → display command (e.g. brew upgrade <formula>) so the row can say how to update in the terminal. Nice-to-have; (1)+(2) alone remove the footgun.

Context and alternatives

  • Workaround today: for a provider plugin we own, we wrapped its bridge's handleLine to answer provider/installation/status|run from the package manager's own metadata and only ever offer the manager's update command. That works for a provider we own, but re-wrapping the builtin Claude/Codex/Pi bridges would mean forking their registrations and losing upstream fixes — not reasonable.
  • Not a duplicate of Pi provider update hardcodes npm and fails when Pi is installed via bun #3119 (Bun-managed Pi): that fix is Pi-specific and still assumes bb should perform the update. This request is the general case where bb must not perform it.
  • Not a duplicate of Custom ACP providers report available on hosts that cannot execute them #2320 (custom ACP availability): different surface.
  • Affects any user who installs agent CLIs via Homebrew or another package manager; the Claude "Update" button is actively harmful for them.

Checks

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

AGENT GENERATED

Activity

  1. added theissue type on Sep 6, 2026
  2. added
    providers
    provider-claude-code
    provider-codex
    provider-pi
    confirmed-repro
    on Sep 6, 2026
  3. bb-slop-cop commented on Sep 6, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Classification: Bug · Priority Medium · Effort Medium · labels providers, provider-claude-code, provider-codex, provider-pi, confirmed-repro.

    Report: https://get-bb.github.io/reports/issues/3166.html

    Verdict: REPRODUCED · confidence high · reproduction label confirmed-repro.

    Root cause: provider bridges query package registries and choose update actions before they can identify manager-owned executable paths.

    No pull request was opened: the safe cross-provider fix requires a shared public Plugin SDK/configuration design and more than five files, so it does not qualify as a simple autopilot fix.

  4. SawyerHood commented on Sep 14, 2026

    @SawyerHood
    Collaborator

    Consolidating #3611 into this existing externally-managed-executable tracker at the owner's request. It adds a concrete Codex case: a symlink to ChatGPT.app's bundled Codex is classified external, yet BB offers codex update, which cannot detect its installation method. Preserve this as an acceptance case alongside package-manager-owned binaries: resolve executable ownership, avoid offering an updater that does not own it, and explain where updates are managed. The original report retains exact versions and output. This consolidation does not mean the defect is fixed.

    AGENT GENERATED

  5. Whamp commented on Oct 7, 2026

    @Whamp

    Machine-scoped provider CLI update commands

    Let users configure a provider's update executable and arguments per machine, through Settings, the BB CLI, and the SDK.

    A provider installed through Mise, Bun, vp, distribution packages, or an organization-owned script may need an updater other than BB's default. A command override lets the machine's owner choose that updater without requiring BB to support every package manager.

    For example, Codex could use Mise on one machine and BB's default updater on another:

    bb machine provider-cli update-command set desktop codex \
      --executable mise --args-json '["upgrade","codex","--no-prune"]'
    bb machine provider-cli update-command show desktop codex --json
    bb machine provider-cli update-command reset desktop codex

    These commands work in a local prototype; they are not available in released BB.

    Behavior

    • The server stores each override by machine ID and provider ID.
    • An override contains an executable and an ordered argument array. BB runs it directly, without implicit shell evaluation. Users can explicitly invoke a shell or executable script.
    • Saving does not execute the command. The existing Update button and CLI update routes use it; install actions stay unchanged.
    • Settings shows the effective command and offers Restore default.
    • The command runs on the selected machine, in the user's home directory, with the existing provider environment and no added privilege elevation.
    • Execution retains serialization, timeout, logs, and exit/error reporting.
    • A custom command's exit-zero success is separate from installed-version status. BB refreshes status and retains any remaining update warning. A manager's stable-channel or release-age policy should not make a successful command appear to have failed.
    • Without an override, BB retains the provider's default command planning and verification.
    • Matching SDK methods let agents and plugins configure overrides without automating Settings.

    This does not detect executable ownership or suppress public-registry probes in #3166. It also does not fix conflicting PATH installations in #4009. An override records the user's choice; it does not establish which manager owns the installation.

    Prototype and verification

    The local prototype includes Settings, CLI, SDK, server persistence, a generated database migration, and a daemon protocol bump. It adds no provider-specific bridge changes or package-manager dependencies.

    Base inspected: 92bce667cfb8f8f3a2797c10bf4156da6ed229e3. The prototype builds on these existing paths:

    Tests cover machine/provider scope, saving without execution, update-only overrides, validation, reset, literal arguments, home-directory execution, command failures, and host-management authorization.

    A browser test ran a harmless Node fixture through the Update button. The command succeeded while the installed version remained behind latest, and BB retained the update warning. No installed provider was changed. Linux was exercised; macOS, Windows, and mobile Safari remain unverified.

    The prototype is unpublished, and no PR is open. I can provide a fork link after agreement on scope.

    Decisions before a PR

    1. Does a machine/provider command override fit alongside the ownership work in this tracker?
    2. Should the contract use an executable and argument array rather than a shell string? The prototype's JSON argument editor can change without changing that contract.
    3. Should configuration live in machine detail Settings?
    4. Should user-defined updaters report command success separately from refreshed version status?

    AGENT and Human GENERATED

  6. zom-2018 commented on Oct 20, 2026

    @zom-2018
    Contributor

    A concrete case of this for Codex, on bb 0.46.2-nightly.39288295552.1, Linux host, Codex installed as a Homebrew cask (/home/linuxbrew/.linuxbrew/bin/codex → Caskroom/codex/0.163.0/bin/codex).

    When a newer Codex was published, Settings → Updates offered Update and it failed. bb always plans codex update, and on a cask install that prints:

    Error: Could not detect the Codex installation method. Please update manually: https://developers.openai.com/codex/cli/
    

    The correct command is brew upgrade --cask codex.

    The description above says Codex returns installAction: null when the install isn't npm-global. The current bundled getCodexProviderInstallationStatus doesn't do that. It sets installAction = installed ? (needsUpdate || versionUnsupported ? "update" : null) : "install" and never checks installSource, so external installs still get the Update button. At minimum, Codex should gate on installSource === "npmGlobal". Claude already gates through claude doctor's install method. Better still, map Homebrew cask/formula to brew upgrade ….

    AGENT GENERATED

  7. zom-2018 commented on Oct 31, 2026

    @zom-2018
    Contributor

    A narrow fix for one Codex case in this tracker: a Homebrew cask install of codex, which codex update cannot update. Posting it as a branch, not a PR.

    Commit: zom-2018@9312c8d01a94
    Branch: https://github.com/zom-2018/bb/tree/codex-homebrew-cask-option

    It changes two files under plugins/provider-codex/src/bridge/. When the resolved codex executable's real path is under Caskroom/codex/, the update plan is brew upgrade --cask codex instead of codex update. Other installs keep codex update, and the npm install path is unchanged.

    The branch is based on the fork's current main (b0bb686), so its tree differs from upstream 916d684. The two changed files are byte-identical to the commit I tested on 916d684. A comparison against upstream main lists only those two files. I have not checked for merge conflicts.

    What was run: on the 916d684 state, turbo run test --filter=bb-plugin-provider-codex passed 44 files and 553 tests. Without the implementation, the three new tests fail. lint and typecheck passed. The runs used Node 24.22.2 and pnpm 9.15.0. CI uses Node 22.x, so the CI run is unverified.

    What was not run: a real Homebrew cask install, and anything on macOS. The cask path is tested with a synthetic Caskroom/codex/<version>/bin layout in a temp directory.

    I am not opening a PR. Whether this belongs under this tracker is for the maintainers to decide.

    Refs #3166

    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

    confirmed-reproprovider-claude-codeprovider-codexprovider-piproviders

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions