#5428 · Codex maintenance loses executable identity
Verdict: PARTIALLY REPRODUCED · Root-cause confidence: high · Reproduction label: partial-repro
1. TL;DR
The provider correctly discovers an absolute Codex executable path but drops it when constructing the update command. A new public maintenance-boundary regression fails on trusted main in two clean checkouts: discovery returns the scratch executable, while the run plan returns codex. The daemon passes that command directly to node-pty, so the plan cannot preserve a native executable extension or an explicitly discovered installation. This confirms the command-selection defect, but this Linux investigation does not reproduce native Windows process startup or a real vendor update. An open pull request already closes this issue, so no duplicate fix was pushed.
2. Claims vs findings
| Claim | Status | Evidence |
|---|---|---|
| Discovery finds an absolute executable, but the update plan returns a bare command. | Verified | Both clean-checkout regressions fail at command identity after discovery and update availability pass. |
| The daemon forwards the maintenance command to node-pty without restoring the resolved path. | Verified by source | The trusted daemon spawner directly passes args.command and args.args. |
| A native Windows installation fails with an extensionless command but launches with the .exe path. | Unverified here | No native Windows machine or genuine Codex executable was used. Original issue logs are not independently reproduced evidence. |
| The vendor updater will complete after command selection is repaired. | Unverified | No download or vendor updater was executed. |
3. Environment
- Trusted base:
e9dafb6c0245a37c6972dffa71134d546f3d497e, fetched fromorigin/mainand matched against the target repository's main commit. - Linux; Node
v22.19.0; Vitest4.1.1. - Two separate temporary Git worktrees at the same base; each received a frozen dependency installation. Production files were unchanged during both reproduction runs.
- Controlled scratch CLI fixtures report Codex
0.150.0and npm registry version1.1.0, not real provider installations. - Isolated scratch home and PATH per test; no live BB instance, real account data, server ports, or vendor updater.
- The first checkout's full trusted build passed: 65 successful tasks. The second built the regression's upstream dependencies through Turbo.
4. Minimal reproduction
The test exercises the public status and run-plan functions using executables in a directory containing spaces. It reuses the repository's scratch-CLI fixture and environment cleanup, without adding production seams or dependencies.
- Create a clean trusted checkout:
git clone https://github.com/get-bb/bb.git bb-5428-repro cd bb-5428-repro git checkout --detach e9dafb6c0245a37c6972dffa71134d546f3d497e pnpm install --frozen-lockfile --prefer-offline
- In
plugins/provider-codex/src/bridge/provider-maintenance.test.ts, addgetCodexProviderInstallationRunto the existing import from./provider-maintenance.js. Insert the complete test body below inside the existingdescribe("Codex credential health and usage", ...), immediately before itsit.eachblock. The existing fixture, setup, and cleanup supply all other symbols. Then run:pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/bridge/provider-maintenance.test.ts -t 'preserves the discovered executable'
- Expect an absolute executable path. Actual first-run output:
Expected: "/tmp/bb-codex-maint-USER-A/native installation with spaces/codex" Received: "codex" Tests 1 failed | 13 skipped (14) exit status: 1
Added test body, with the existing repository fixture supplying executable scripts:
it("preserves the discovered executable in the public update plan", async () => {
const binDir = path.join(homeDir, "native installation with spaces");
await fs.mkdir(binDir);
await writeFakeCli({ binDir, name: "codex", output: "codex-cli 0.150.0" });
await writeFakeCli({ binDir, name: "npm", output: "1.1.0" });
vi.stubEnv("PATH", `${binDir}${path.delimiter}${process.env.PATH ?? ""}`);
const executablePath = path.join(
binDir,
process.platform === "win32" ? "codex.cmd" : "codex",
);
const status = await getCodexProviderInstallationStatus();
expect(status.executablePath).toBe(executablePath);
expect(status.installAction?.kind).toBe("update");
const result = await getCodexProviderInstallationRun("update");
expect(result.available).toBe(true);
if (!result.available) throw new Error(result.message);
expect(result.command.command).toBe(executablePath);
expect(result.command.args).toEqual(["update"]);
expect(result.command.displayCommand).toBe(`'${executablePath}' update`);
expect(status.installAction?.command).toBe(result.command.displayCommand);
});
The Windows fixture creates a .cmd file, not a native .exe; that branch was not executed here. This test does not establish Windows vendor-update success.
5. Root cause
The update-command helper hardcodes executable identity:
const args = ["update"];
return {
command: "codex",
args,
displayCommand: formatCommand("codex", args),
};
Status discovery resolves and returns executablePath. The public run-plan path nevertheless invokes the parameterless helper rather than preserving that field.
The daemon spawner calls spawnPty(args.command, args.args, ...). The lost executable identity therefore reaches process startup. A Windows extension-resolution mismatch is consistent with this mechanism, but its exact startup error was not observed here.
The shared discovery helper already recognizes Windows executable extensions. Repair belongs in the provider's plan construction, not a second daemon discovery mechanism.
6. Proposed fix
Pass the discovered path to the existing update helper for both action display and execution; retain the bare-name fallback only when discovery returns null. Keep update separate and use the existing formatter for paths with spaces. No protocol or schema change is needed.
A locally authored experimental implementation passed the maintenance suite: 16 tests, including native-Windows-shaped path and null-fallback cases. It was created from trusted source, not copied from a PR. It was stopped, restored, and not committed or pushed once the open PR was found. This validates the mechanism, not that PR's branch.
7. Existing PR review
PR #5429 is open, targets main, and lists #5428 in GitHub closing-issue metadata. Only metadata and diff were read as untrusted data; the branch was never checked out or run.
Static assessment: its diff carries the resolved path into the update helper for display and execution, retaining the null fallback. This addresses the verified root cause and replaces private plan coverage with a public maintenance regression. No additional blocking defect was established by this limited static review; native Windows startup and vendor-update completion still need platform verification. No duplicate PR was safe or necessary.
8. Related issues
No other issue was needed to establish the provider-local defect. Package-manager ownership and update-download behavior were outside the reproduction.
9. Verification
The same agent repeated the reproduction in a second clean detached worktree at the exact base. Only the independently authored test patch was copied in, followed by a frozen install. No live process, shared runtime state, ports, or user data were used. The second run had a different scratch directory and the same failure:
Expected: "/tmp/bb-codex-maint-USER-B/native installation with spaces/codex" Received: "codex" Tests 1 failed | 13 skipped (14) exit status: 1
Command in both checkouts: pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/bridge/provider-maintenance.test.ts -t 'preserves the discovered executable'. A full maintenance-file run on unchanged production fails only the new regression; the 13 existing tests pass. The second run supports the report without correcting the root cause. The verdict remains partial because native Windows startup was not repeated. This is a same-agent repeat, not independent verification.
10. Appendix
Saved local logs and test patch were checked against the inline evidence. Raw logs and reproduction files remain outside the public reports repository, per its publication policy. The complete test and all reproduction instructions are inline. Temporary directory identifiers in displayed output are replaced by USER-A and USER-B; all other assertion content is preserved.
Unchanged production, complete maintenance file: Test Files 1 failed (1) Tests 1 failed | 13 passed (14) Locally authored experimental fix, complete maintenance file: Test Files 1 passed (1) Tests 16 passed (16) Trusted first-checkout full build: Tasks: 65 successful, 65 total
Other checks: git fetch origin main; pnpm exec turbo run build in the first checkout; pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/bridge/provider-maintenance.test.ts for baseline and experimental suites; git diff --check. No PR-branch execution is claimed.
Trust boundary: issue text, code snippets, links, and PR contents were treated as untrusted claims. No issue script or linked branch was run; no issue-supplied URL was fetched. Reproduction and experimental code were authored from trusted main and existing fixtures. No credentials or live user data were read.