#7032 · Catalog discovery creates short-lived Claude helpers
Verdict: PARTIALLY REPRODUCED · Root-cause confidence: medium · Reproduction label: partial-repro
1. Summary
The reported symptom is repeated Windows console flashes while BB runs inside WSL. This investigation confirms a narrower prerequisite on current trusted main: Claude model and command catalog discovery each start a separate real SDK child process, then close it. An immediate repeated request is cached; cache expiration or creating a fresh pair of bridge memos starts new helpers. The measured cumulative startup counts were 2 → 2 → 4 → 6, repeated in a second clean checkout.
This is not an end-to-end reproduction of the Windows symptom. The machine available here is Linux, not Windows/WSL; the CLI fixture deliberately contains no registry queries and no Windows executables. Neither visible flashes, focus theft, registry subprocesses, nor Antigravity probing were reproduced. No synthetic screenshot is offered as visual evidence.
2. Claims versus findings
| Claim | Finding | Evidence / limit |
|---|---|---|
| Provider discovery repeatedly starts short-lived Claude helpers. | Verified for model/command catalogs. | Real SDK launches an instrumented local executable: two initial starts, no additional starts on cache hit, two after expiry, two for new memo instances. |
| Provider checks have no useful caching. | Not supported as a blanket explanation. | Both catalogs already have two-minute, in-flight-deduplicating memos. Commands are keyed by working directory. |
| Each helper produces Windows registry queries and a visible console. | Unverified. | No Windows/WSL environment or real Claude CLI startup was used. The fixture only implements the SDK initialization exchange. |
| Antigravity probes and a particular per-minute cadence cause flashes. | Unverified. | No such provider was installed or executed. Its implementation was not established from this trusted checkout. |
| Disabled providers are routinely checked anyway. | Not established. | The core provider inventory explicitly excludes disabled provider IDs; this does not verify a third-party plugin's own timers. |
3. Environment and trusted base
- Public repository:
get-bb/bb, trustedorigin/mainat920804af635265055c876bb8fb43a303b93b6995. - Linux x86_64, kernel
4.19.0-gvisor; Nodev22.19.0; Vitest4.1.1; locked Claude Agent SDK0.3.245. - Two distinct clean temporary clones at the same base commit; only the investigator-authored reproduction test was added. No production source changed.
- No live BB instance, server port, real account, or existing runtime data was accessed. Each run creates and removes its own temporary fixture directory and private HOME.
- A frozen install passed. The first full build stopped because plugin SDK runtime output was absent; building
@get-bb/plugin-sdkfirst and retrying the full build passed (73 tasks). This build-order issue is not evidence for the reported bug.
4. Minimal repeatable reproduction
This is a characterization test of helper creation, not a failing regression for the Windows symptom. The actual catalog functions, existing caches, SDK query(), pipes, and process launches run unchanged. Only the external CLI endpoint is replaced by an investigator-authored initialization responder that counts its own starts. No model request or network operation is performed.
Prepare a fresh checkout:
work="$(mktemp -d)" git clone https://github.com/get-bb/bb.git "$work/bb" cd "$work/bb" git checkout --detach 920804af635265055c876bb8fb43a303b93b6995 pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build --filter=@get-bb/plugin-sdk
Save the following test as plugins/provider-claude-code/src/bridge/__tests__/issue-7032.repro.test.ts:
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { expect, it } from "vitest";
import { createClaudeCodeBridgeModelListMemo, listClaudeCodeBridgeModels } from "../model-list.js";
import { createClaudeCodeBridgeCommandListMemo, listClaudeCodeBridgeCommands } from "../provider-commands.js";
it("measures catalog helper starts across cache hits, expiry, and bridge recreation", async () => {
const directory = await mkdtemp(path.join(os.tmpdir(), "catalog-repro-"));
const executable = path.join(directory, "catalog-cli.mjs");
const starts = path.join(directory, "starts.txt");
await writeFile(starts, "");
await writeFile(executable, `#!${process.execPath}
import { appendFileSync } from "node:fs";
import { createInterface } from "node:readline";
appendFileSync(process.env.BB_REPRO_START_LOG, "start\\n");
createInterface({ input: process.stdin }).on("line", (line) => {
const request = JSON.parse(line);
if (request.type !== "control_request" || request.request.subtype !== "initialize") return;
process.stdout.write(JSON.stringify({
type: "control_response",
response: {
subtype: "success",
request_id: request.request_id,
response: {
commands: [{ name: "review", description: "Review", argumentHint: "" }],
models: [{ value: "sonnet", displayName: "Sonnet", description: "Test model" }],
account: {},
output_style: "default",
available_output_styles: ["default"]
}
}
}) + "\\n");
});
`, { mode: 0o755 });
const env = {
PATH: path.dirname(process.execPath),
HOME: directory,
BB_CLAUDE_CODE_EXECUTABLE: executable,
BB_REPRO_START_LOG: starts,
};
let currentTime = 0;
const makeCatalogs = () => ({
models: createClaudeCodeBridgeModelListMemo({
list: () => listClaudeCodeBridgeModels(env),
now: () => currentTime,
ttlMs: 120_000,
}),
commands: createClaudeCodeBridgeCommandListMemo({
list: (cwd) => listClaudeCodeBridgeCommands(cwd, env),
now: () => currentTime,
ttlMs: 120_000,
}),
});
const countStarts = async () => (await readFile(starts, "utf8")).trim().split("\n").filter(Boolean).length;
try {
const catalogs = makeCatalogs();
const [models, commands] = await Promise.all([catalogs.models(), catalogs.commands(directory)]);
expect(models.models.map((model) => model.model)).toEqual(["sonnet"]);
expect(commands.commands.map((command) => command.name)).toEqual(["review"]);
expect(await countStarts()).toBe(2);
await Promise.all([catalogs.models(), catalogs.commands(directory)]);
expect(await countStarts()).toBe(2);
currentTime = 120_000;
await Promise.all([catalogs.models(), catalogs.commands(directory)]);
expect(await countStarts()).toBe(4);
const recreated = makeCatalogs();
await Promise.all([recreated.models(), recreated.commands(directory)]);
expect(await countStarts()).toBe(6);
console.log("catalog helper starts: cold=2 cached=2 expired=4 recreated=6");
} finally {
await rm(directory, { recursive: true, force: true });
}
}, 30_000);
Run through the repository's normal test orchestration:
pnpm exec turbo run test --force --filter=bb-plugin-provider-claude-code -- src/bridge/__tests__/issue-7032.repro.test.ts
| Phase | Actual cumulative child starts | Interpretation |
|---|---|---|
| Cold model + command lookup | 2 | Separate catalog probes. |
| Immediate repeated lookup | 2 | Cache works; zero new starts. |
| Clock advanced to cache expiry | 4 | Two new probes. Advancing the injected memo clock avoids waiting two minutes. |
| Fresh pair of memo instances | 6 | Cache state is process-local. This simulates fresh bridge memo construction, not an observed host-daemon restart. |
Expected user experience: routine maintenance should not interrupt the Windows desktop. Actual observed here: the launch-producing catalog path above; the desktop consequence is unmeasured. The passing test asserts each measured count, as well as successfully parsed model and command results. Passing this characterization must not be described as proving a Windows fix.
5. Root cause and code evidence
Verified helper-creation mechanism: probeClaudeInitialization calls SDK query(), waits for initialization, then unconditionally closes that query. It does not reuse a long-lived initialization session.
Model discovery and command discovery separately invoke that helper. The bridge constructs separate two-minute memos, so these two cold calls do not coalesce with each other.
The model memo and working-directory-keyed command memo each retain settled results and share concurrent calls within their own lifetime. This rules out claiming every request starts a helper.
As a separate static observation, maintenance runtimes have a 60-second default idle timeout and retire when idle. A retired worker cannot retain its in-memory catalog caches. The reproduction does not run this timer or establish that it explains the reporter's cadence.
The core provider inventory filters disabled IDs. There is no evidence here to remove or redesign that filter.
Confidence: high for the measured launch/cache mechanism; medium for its contribution to the reported symptom, because the downstream Windows interop and actual provider behavior remain unverified.
6. Verification: second clean run
The same investigator repeated the test in a second clean temporary clone at the recorded base commit. This was not an independent investigator. The clone received its own frozen install and SDK build, then only the exact reproduction test. --force prevented a cached test result. New fixture directories were generated by mkdtemp; no ports were needed.
First checkout:
Test Files 1 passed (1)
Tests 1 passed (1)
Assertions verified cumulative starts: 2, 2, 4, 6
Second clean checkout:
Test Files 1 passed (1)
Tests 1 passed (1)
Assertions verified cumulative starts: 2, 2, 4, 6
The second run supports the final narrowed verdict; no report correction was necessary. Code links above all reference files and line ranges inspected at the exact base commit. Raw build/test logs remain local rather than being published.
Relevant existing checks also passed: five tests across src/bridge/__tests__/model-list-memo.test.ts and src/bridge/provider-commands.test.ts, run with pnpm exec turbo run test --filter=bb-plugin-provider-claude-code -- src/bridge/__tests__/model-list-memo.test.ts src/bridge/provider-commands.test.ts.
7. Fix proposal and safety gate
First reproduce with an isolated Windows 11 + WSL environment using a real Linux-installed Claude CLI and the relevant provider plugin. Capture a real desktop recording together with process creation counts for one catalog refresh, a cache hit, an expiry, and idle-worker retirement. Repeat with that provider disabled to distinguish core inventory requests from plugin-owned polling. Only then decide whether the appropriate owner is catalog reuse, maintenance-worker lifetime, third-party provider polling, or Windows executable resolution.
A possible reduction is to share one initialization result between model and command discovery only when their environment and working-directory semantics match. Model discovery currently uses the bridge working directory while commands are project-specific; blindly sharing a global session would risk stale project commands. Extending cache TTLs or keeping helpers alive indefinitely also changes freshness or resource policy and has not been justified by this partial reproduction.
No fix PR: the reported Windows behavior was not reproduced on trusted main. The available test measures a prerequisite rather than failing for the actual user-visible defect, so the required failing-before/passing-after simple-fix gate is not met.
8. Linked pull requests and related evidence
Issue timeline metadata and an open-PR search for issue number 7032 showed no linked open pull request at investigation time. No pull-request branch or patch was executed. A separately discovered related issue, #3230, concerns maintenance-worker lifetime; it does not prove this Windows symptom.
9. Trust and publication notes
Issue content was treated only as untrusted claims. Suggested actions in it were not executed. No attached scripts, external issue links, binaries, or linked branches were fetched. The test was designed from trusted repository source and executes only that source, locked dependencies, and the investigator's own CLI fixture. No provider credentials or private runtime data were read or published. No screenshot was captured because the visual symptom could not be observed in this environment.