#6284 · Native Claude installs are missed outside PATH
Issue · 2026-10-25 · trusted base 3a2c49a267cd2a62a96ebff880068a7c37074251
Verdict: REPRODUCED · Root-cause confidence: high
1. TL;DR
BB can offer Claude installation again even when its native executable is already present. On POSIX, the maintenance path only searches PATH, while session startup already knows the native installation directories. If the native directory is absent from the host environment, the status reports the provider missing and offers installation again. Re-running installation cannot repair this discovery mismatch. Two clean checkouts reproduce the missing-installation result without downloading an installer or accessing an account.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| A native executable can exist while BB offers installation. | Verified | Both regression runs return installed=false, executablePath=null, currentVersion=null for an executable under the temporary HOME/.local/bin. |
| A successful installer can be followed by failed verification. | Mechanism verified; installer not run | The host daemon tests the same installed status after an exit-zero install and rejects installed=false. |
| Updating or reopening BB itself causes the problem. | Unverified | No packaged upgrade or GUI restart was exercised. The mismatch exists on current trusted main independently of an upgrade. |
| The reported user's exact operating system and shell environment. | Unverified | The report does not establish the user's complete inherited environment. The reproduction isolates the relevant missing-PATH condition. |
3. Environment
Trusted public repository get-bb/bb; Linux x64; Node v22.19.0; pnpm 9.15.0. Both checkouts were created at the full commit above. Dependencies installed using pnpm install --frozen-lockfile; SDK types built using pnpm exec turbo run build:types --filter=@get-bb/plugin-sdk. Tests execute the real provider-maintenance implementation and real executable/version probes. A tiny authored executable returns a version string; it is not the upstream Claude binary. UID is simulated as 1000 to exercise the existing unprivileged-host fallback policy while the test runner itself runs as root. Each test creates a fresh temporary home and isolated PATH containing only the lookup utility and any test executable. No servers, ports, provider credentials, runtime database, or user data directory are used.
4. Minimal reproduction
- Clone the trusted repository and check out
3a2c49a267cd2a62a96ebff880068a7c37074251. - Install frozen dependencies and build SDK types with the commands above.
- Save the regression test at
plugins/provider-claude-code/src/bridge/provider-maintenance.discovery.test.ts. - Run
pnpm exec turbo run test --filter=bb-plugin-provider-claude-code -- src/bridge/provider-maintenance.discovery.test.ts.
Expected: a runnable native installation outside PATH is installed, exposes its executable path/version, and offers no install action. Actual assertion diff (the temporary native path varies per run):
- "currentVersion": "2.1.310",
- "executablePath": "/tmp/claude-discovery-NCBNgO/.local/bin/claude",
- "installed": true,
+ "currentVersion": null,
+ "executablePath": null,
+ "installed": false,
Test Files 1 failed (1)
Tests 1 failed | 2 passed (3)
The PATH-present and no-install controls pass. The native-off-PATH case alone fails. This is a discovery/status bug, not a visual rendering bug; no screenshots are claimed.
Complete repeatable regression
import { mkdtemp, mkdir, rm, symlink, writeFile } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { getClaudeProviderInstallationStatus } from "./provider-maintenance.js";
describe.skipIf(process.platform === "win32")(
"Claude Code executable discovery on an unprivileged POSIX host",
() => {
let homeDir: string;
let pathDir: string;
beforeEach(async () => {
homeDir = await mkdtemp(path.join(os.tmpdir(), "claude-discovery-"));
pathDir = path.join(homeDir, "path");
await mkdir(pathDir);
await symlink("/usr/bin/which", path.join(pathDir, "which"));
vi.stubEnv("HOME", homeDir);
vi.stubEnv("PATH", pathDir);
vi.stubEnv("BB_CLAUDE_CODE_EXECUTABLE", "");
vi.spyOn(process, "getuid").mockReturnValue(1000);
});
afterEach(async () => {
vi.unstubAllEnvs();
vi.restoreAllMocks();
await rm(homeDir, { recursive: true, force: true });
});
it.each([
{ nativeInstalled: true, onPath: false },
{ nativeInstalled: true, onPath: true },
{ nativeInstalled: false, onPath: false },
])(
"reports nativeInstalled=$nativeInstalled, onPath=$onPath without reinstalling an existing CLI",
async ({ nativeInstalled, onPath }) => {
const nativePath = path.join(homeDir, ".local", "bin", "claude");
const pathExecutable = path.join(pathDir, "claude");
const executableContents = `#!${process.execPath}\nprocess.stdout.write("2.1.310 (Claude Code)\\n");\n`;
if (nativeInstalled) {
await mkdir(path.dirname(nativePath), { recursive: true });
await writeFile(nativePath, executableContents, { mode: 0o755 });
}
if (onPath) {
await writeFile(pathExecutable, executableContents, { mode: 0o755 });
}
const status = await getClaudeProviderInstallationStatus(false);
expect(status).toMatchObject({
installed: nativeInstalled || onPath,
executablePath: onPath
? pathExecutable
: nativeInstalled
? nativePath
: null,
currentVersion: nativeInstalled || onPath ? "2.1.310" : null,
});
expect(status.installAction?.kind ?? null).toBe(
nativeInstalled || onPath ? null : "install",
);
},
);
},
);
5. Root cause
claudeExecutable(), lines 57–72 immediately returns the bare command on non-Windows systems:
if (process.platform !== "win32" ||
(await resolveExecutablePath("claude")) !== null) {
return "claude";
}resolveExecutablePath() resolves a relative command through which on POSIX. getClaudeProviderInstallationStatus() also runs the relative command for --version, so both probes fail if the native location is not in PATH. Its installed flag is the OR of those two results, and the missing state produces an install action.
installationVerificationPassed() requires status.installed for install verification. The post-install verification path therefore changes a successful installer event into a failed verification event. Meanwhile the existing session resolver already checks HOME/.local/bin/claude, HOME/.claude/local/claude, and known Homebrew directories for non-root users. Two different executable discovery paths are the underlying inconsistency.
6. Proposed fix
Keep explicit executable overrides and PATH precedence, then reuse the existing session resolver for the missing-PATH POSIX case. Retain its executable-file validation and existing root guard. Preserve the Windows-specific fallback unchanged. Regression coverage should exercise native off-PATH discovery, PATH precedence, and the genuinely missing installation. No SDK, wire, stored-data, installation-script, or release contract needs to change.
Autopilot fix check: stopped, not pushed
A local two-file candidate reuses the existing guarded session resolver. Its focused regression passes all four cases after repair; the revised regression fails the intended native-off-PATH case on unchanged main (one failed, three passed). The extra case verifies that root still does not use the home-directory fallback. The original three-case reproduction above is preserved unchanged.
The full provider test suite does not pass in this root-run environment: 405 pass and five fail in bridge.test.ts. A separate run of that existing bridge suite on unchanged trusted main reproduces the same five failures (95 pass, five fail). They cover existing non-root executable fallback and permission assumptions. Lint and typecheck pass, but the simple-fix requirement that relevant existing tests pass is not met. The candidate is therefore stopped locally: no fix commit, branch push, or pull request. No unrelated test or permission behavior was changed to force a passing result.
Revised candidate regression · Revised regression before fix · Focused regression after fix · Candidate full validation · Unchanged-main bridge failures.
7. Verification
The same agent repeated the test directly, not through a workflow or another agent. Checkout A and checkout B were separate clean detached worktrees at 3a2c49a267cd2a62a96ebff880068a7c37074251. Before copying the authored test, checkout B had empty git status; its dependencies and SDK artifacts were installed/built locally. The exact Turbo command above ran in each checkout with fresh temporary homes. Both runs exited 1 with the same intended assertion failure and two passing controls. No production source was changed in either baseline run. No report correction was needed. Run A log · Run B log.
8. Related issues and PRs
No open pull request linked to #6284 was found in the issue timeline or open-PR search at investigation time. #3166 concerns update commands for externally managed executables and is not this missing-installation lookup defect.
9. Appendix and limits
The regression, raw logs, and exact setup/test commands above are the reproducible artifacts. Issue content was treated only as untrusted evidence; no attachment URL or installer script from the issue was fetched or executed. No upstream installation, packaged upgrade, GUI restart, or macOS run was performed. The confidence is high for the directly reproduced POSIX status bug, not for unobserved details of the reporter's machine.