#5332 · Pi command-shim launch mismatch
Verdict: PARTIALLY REPRODUCED · Root-cause confidence: medium
The Windows/npm installation and the Windows extra-pipe failure were not reproduced. Two Linux runs verify only the version-probe boundary and its explicit-Node positive control.
1. TL;DR
The report describes a Pi provider that cannot enumerate models on Windows despite a working terminal command. Trusted main sends the default bare command directly to Node's execFile for the version check, while the RPC child uses a different, portable spawn path. A synthetic PATH containing only a Node-backed command shim produces the reported ENOENT version failure through the real provider probe in two clean Linux checkouts; explicitly supplying Node and the same entrypoint succeeds. This is an analogous boundary experiment, not an end-to-end Windows reproduction: Linux does not resolve batch shims as executables either. The extension also requires descriptors 3 and 4, so fixing only the version check would not establish session correctness.
2. Claims vs findings
| Claim | Status | Evidence |
|---|---|---|
| The default version check cannot launch a command-shim-only installation. | Partially verified | The real probe returns ENOENT for a synthetic shim-only PATH on Linux in both runs. Native Windows resolution remains unverified. |
| The Windows terminal can launch npm-installed Pi. | Unverified | No Windows host was available. No global Pi installation or reporter-provided executable was run. |
| The RPC path needs additional inherited pipes. | Verified in trusted source | The child requests five stdio pipes. The extension reads descriptor 4 as a Socket and writes descriptor 3. |
| A batch-wrapper launch loses those pipes and triggers an unsupported-descriptor error. | Unverified | The Windows batch intermediate process was not executed. Actual Windows handle inheritance is not established by source inspection. |
| Direct Node launch avoids the version error. | Verified for the fixture | The explicit-Node control passes twice with the same trusted fake provider entrypoint. A real Windows session remains unverified. |
3. Environment
- Public repository:
get-bb/bb. Trusted base:e9ad6b0e3473628f96fa98378cf8528aac8984d2, fetched directly from its main branch. - Linux 4.19.0-gvisor, x86_64; Node 22.19.0; pnpm 9.15.0; Vitest 4.1.1.
- Provider: the repository's own
fake-pi-rpc.mjs, explicitly configured to return version0.84.0. The reported newer Pi installation was not exercised. - Two detached source worktrees, separately installed using the frozen lockfile and built through Turbo. Both complete builds passed: 65 tasks each.
- No live BB instance, user runtime data, provider account, browser, server port, or persistent data directory was used. Each test creates and removes its own temporary directory.
4. Minimal reproduction
This fixture tests the actual version-probe implementation without mocking the probe, child-process API, or platform. It does not execute the batch shim on Linux and deliberately omits npm's extensionless shell shim; it cannot establish the complete npm/Windows failure by itself.
- Create a fresh trusted checkout and install/build it:
git clone https://github.com/get-bb/bb.git qa-first cd qa-first git checkout --detach e9ad6b0e3473628f96fa98378cf8528aac8984d2 pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build
- Save this complete test at
plugins/provider-pi/src/bridge/issue-5332.repro.test.ts:
import { copyFileSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { afterEach, expect, it, vi } from "vitest";
import { probePiVersion } from "./provider-maintenance.js";
import { PI_BRIDGE_ARGS_ENV, PI_BRIDGE_COMMAND_ENV } from "./rpc-child.js";
const temporaryDirectories: string[] = [];
afterEach(() => {
vi.unstubAllEnvs();
for (const directory of temporaryDirectories.splice(0)) {
rmSync(directory, { recursive: true, force: true });
}
});
function prepareShimOnlyPath(): string {
const directory = mkdtempSync(path.join(os.tmpdir(), "pi-shim-probe-"));
temporaryDirectories.push(directory);
const entrypoint = path.join(directory, "cli.mjs");
copyFileSync(
fileURLToPath(new URL("./fake-pi-rpc.mjs", import.meta.url)),
entrypoint,
);
writeFileSync(
path.join(directory, "pi.cmd"),
`@echo off\r\n"${process.execPath}" "${entrypoint}" %*\r\n`,
);
vi.stubEnv("PATH", directory);
vi.stubEnv("FAKE_PI_VERSION", "0.84.0");
vi.stubEnv(PI_BRIDGE_COMMAND_ENV, "");
vi.stubEnv(PI_BRIDGE_ARGS_ENV, "");
return entrypoint;
}
it("loads the provider version when PATH contains only a Node-backed command shim", async () => {
prepareShimOnlyPath();
const result = await probePiVersion();
console.log("shim-only version probe:", JSON.stringify(result));
expect(result).toEqual({ version: "0.84.0", failure: null });
});
it("loads the same entrypoint when explicitly launched through Node", async () => {
const entrypoint = prepareShimOnlyPath();
vi.stubEnv(PI_BRIDGE_COMMAND_ENV, process.execPath);
vi.stubEnv(PI_BRIDGE_ARGS_ENV, JSON.stringify([entrypoint]));
const result = await probePiVersion();
expect(result).toEqual({ version: "0.84.0", failure: null });
});
Run through the dependency-aware test task:
pnpm exec turbo run test --filter=bb-plugin-provider-pi -- src/bridge/issue-5332.repro.test.ts
Expected by the fixture's support assertion: { version: "0.84.0", failure: null }. Actual output in each checkout:
shim-only version probe: {"version":null,"failure":"`pi --version` exited with ENOENT"}
Tests 1 failed | 1 passed (2)
The failing assertion is intentional evidence, not a passing platform regression test. The explicit-Node control succeeds. This negative control alone would be insufficient to accept a Windows production fix.
5. Root cause
The default launch resolver returns the bare command pi and no arguments unless explicit launch overrides are supplied. It contains no provider-local entrypoint resolution.
The version probe passes that command directly to execFileAsync without a shell or the portable process helper:
const launch = resolvePiLaunch(process.env);
({ stdout } = await execFileAsync(
launch.command,
[...launch.args, "--version"],
{ timeout: VERSION_PROBE_TIMEOUT_MS },
));
When no native executable with that bare name can be launched, the resulting error is formatted as the version-probe failure. Both executions establish this boundary result. Applicability to the reported Windows/npm installation is supported by the source's lack of a shim-aware launch path, but is not verified on that operating system.
In contrast, RPC startup uses experimental_spawnPortableProcess with five pipes. That helper delegates to cross-spawn. The extension reserves descriptors 3 and 4, and its Node branch attaches a Socket to descriptor 4. A batch intermediate process must preserve that contract; whether it does so on Windows remains untested.
6. Proposed fix and safety decision
Next experiment: a native Windows test using a locally generated npm-style installation, including both normal shims, followed by a bridge exchange over descriptors 3 and 4. Compare the current default launch with direct Node-and-entrypoint launch, checking version, catalog, session startup, channel input/output, paths containing spaces, missing packages, and explicit overrides. A shell-based version-check repair alone does not establish a repaired RPC transport.
If Windows confirms the hypothesis, resolve the provider's executable/entrypoint in the existing Pi launch path and reuse it for maintenance and RPC, preserving custom overrides and non-Windows behavior. No dependency should be necessary. This is a proposal, not a verified patch.
No pull request: the strict simple-fix condition requiring reproduction of the reported bug on trusted main was not met. Windows handle inheritance and post-fix platform behavior remain unverified. No production code, dependency, protocol, schema, packaging, or release process was changed. No open linked pull request was found in issue timeline metadata or the issue-number search.
7. Verification
The same agent repeated the reproduction in a second clean detached checkout at the exact base commit. Each separately installed worktree had unchanged production source plus only the authored test. Each case used a new temporary directory. No ports or persistent data directory were needed. Upstream dependencies could use Turbo's shared cache, but the reproduction test itself executed live twice.
| Run on 2026-10-10 | Result |
|---|---|
| First clean checkout, 16:11:57 UTC | ENOENT from default probe; Node control passed; task exit 1; 1 failed / 1 passed. |
| Second clean checkout, 16:12:13 UTC | Same ENOENT and passing control; task exit 1; 1 failed / 1 passed. |
| Existing maintenance/install-gate suites, 16:12:34 UTC | 8 tests passed across 2 files. |
Verification correction: the matching Linux error is not a full Windows reproduction. The verdict is therefore PARTIALLY REPRODUCED, confidence medium, and no fix is submitted. This was a repeat by the same agent, not independent verification.
8. Related issues
A repository search for Windows/Pi reports found no independently verified duplicate of this launch problem. Trusted history records PR #4661 as an earlier native-Windows provider-launch change; the current Pi version probe still uses direct execFile. No linked PR code was checked out or executed.
9. Appendix
Additional verification command and meaningful output:
pnpm exec turbo run test --filter=bb-plugin-provider-pi -- src/bridge/provider-maintenance.test.ts src/bridge/bridge.install-gate.test.ts Test Files 2 passed (2) Tests 8 passed (8)
Both clean full builds ended with Tasks: 65 successful, 65 total. The base was rechecked against trusted main and was unchanged. Source links use that full commit and were checked against local line numbers. The complete authored test and exact meaningful output are embedded here; raw logs and scratch fixtures remain local rather than being committed to the public report repository.
Issue text, commands, suggested remedies, and links were treated as untrusted claims. No issue-provided script, patch, executable, branch, or external link was run or fetched. Test design came from trusted repository code. No accounts, credentials, or unrelated user files were read.