#7294 · Credential-store health detection
Verdict: PARTIALLY REPRODUCED · Root-cause confidence: high for the file-only backend decision. Native macOS Keychain login and desktop rendering were not reproduced.
1. TL;DR
The provider health check treats an absent credential file as a signed-out account, even when a controlled CLI fixture reports that it is logged in. Two clean runs of the real BB health function confirm this backend behavior on trusted main. Source tracing explains why onboarding then offers sign-in rather than marking the provider ready. This Linux investigation did not access a real credential store, run a native Codex login, or capture the desktop screen, so the complete macOS scenario remains unverified.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| BB's health check derives account state from a credential file. | Verified | The real file reader returns missing; the real health function returns unauthenticated in both runs. |
| A successful CLI-reported login can disagree with BB's health result when the file is absent. | Verified under a controlled boundary fixture | The fixture's status command succeeds, but the real BB health result remains signed out. This proves the file-only behavior, not native CLI or Keychain correctness. |
| A configured macOS Keychain account has no file credentials after successful native sign-in. | Unverified | No macOS host or disposable Keychain account was available. The provider executable in this test is explicitly a fixture, not Codex. |
| Onboarding displays an installed-but-signed-out state for this health value. | Source-confirmed only | The onboarding model maps unauthenticated to signIn, and the view renders the signed-out copy. No live UI or screenshot verification. |
| The installed release behaves the same way. | Unverified | This investigation tested source main only; no installed desktop release was exercised. |
3. Environment
- Trusted source: public
get-bb/bb, fetched main at713ee7884df77729ab75c21057f15b01829db7a8. - Linux x86_64; Node
v22.19.0; pnpm9.15.0; Vitest4.1.12; provider packagebb-plugin-provider-codex, version0.1.1. - CLI fixture advertises
codex-cli 0.150.0, matching the existing maintenance test fixture and exceeding the supported minimum. It contains no credentials and does not implement Keychain. - No server, browser, listening ports, real account, or production runtime data was used. Each run creates and removes its own temporary HOME, CODEX_HOME, and executable directory.
- Type/Priority/Effort were initially empty and were set to Bug/Medium/Medium. Existing classifications were not overwritten. The scope is limited, and a fix needs credential-store integration verification rather than a cosmetic UI change.
4. Minimal reproduction
This is a backend reproduction, not a native Keychain or visual reproduction. The only simulated boundary is the external executable; readCodexAuthFile() and getCodexProviderHealth() execute unchanged repository code.
- Create a clean checkout of the public repository and the recorded trusted commit:
git clone https://github.com/get-bb/bb.git bb-7294 cd bb-7294 git switch --detach 713ee7884df77729ab75c21057f15b01829db7a8 pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build:types --filter=@get-bb/plugin-sdk pnpm exec turbo run build
- Save the complete test below as
plugins/provider-codex/src/bridge/issue-7294-repro.test.ts. Its temporary config requests the keyring store, but BB does not consult that config on this health path. - Run the focused test through the repository's normal orchestration:
pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/bridge/issue-7294-repro.test.ts
- Expected: the readiness assertion succeeds for a provider whose authoritative external login status is authenticated. Actual: exit code 1, one test fails because health is
unauthenticated. This desired assertion is a candidate regression specification; it is not evidence that the native CLI contract was validated.
Complete reproduction test
import { execFile } from "node:child_process";
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { promisify } from "node:util";
import { afterEach, expect, it, vi } from "vitest";
import { readCodexAuthFile } from "../ai/codex-auth.js";
import { getCodexProviderHealth } from "./provider-maintenance.js";
const execute = promisify(execFile);
let scratch: string | undefined;
afterEach(async () => {
vi.unstubAllEnvs();
if (scratch !== undefined) {
await fs.rm(scratch, { recursive: true, force: true });
scratch = undefined;
}
});
it("recognizes a CLI-reported login without file credentials", async () => {
scratch = await fs.mkdtemp(path.join(os.tmpdir(), "bb-7294-"));
const binDir = path.join(scratch, "bin");
const codexHome = path.join(scratch, "codex-home");
await fs.mkdir(binDir);
await fs.mkdir(codexHome);
await fs.writeFile(
path.join(codexHome, "config.toml"),
'cli_auth_credentials_store = "keyring"\n',
);
const executable = path.join(binDir, "codex");
await fs.writeFile(
executable,
[
"#!/bin/sh",
'if [ "$1" = "--version" ]; then',
' echo "codex-cli 0.150.0"',
'elif [ "$1" = "login" ] && [ "$2" = "status" ]; then',
' echo "Logged in using ChatGPT" >&2',
"else",
" exit 2",
"fi",
"",
].join("\n"),
{ mode: 0o755 },
);
vi.stubEnv("HOME", scratch);
vi.stubEnv("USERPROFILE", scratch);
vi.stubEnv("CODEX_HOME", codexHome);
vi.stubEnv("PATH", `${binDir}${path.delimiter}${process.env.PATH ?? ""}`);
const login = await execute(executable, ["login", "status"]);
expect(login.stderr.trim()).toBe("Logged in using ChatGPT");
const auth = await readCodexAuthFile();
expect(auth.state).toBe("missing");
const result = await getCodexProviderHealth();
console.log(
JSON.stringify({
fixtureLoginStatus: login.stderr.trim(),
authFileState: auth.state,
health: result,
}),
);
expect(result).toMatchObject({
supported: true,
health: { status: "ready", installedVersion: "0.150.0" },
});
});
The public report repository forbids standalone test/log artifacts. The full test is therefore embedded here; private working copies and complete logs remain outside the report repository.
Observed output, identical in both runs
{"fixtureLoginStatus":"Logged in using ChatGPT","authFileState":"missing","health":{"supported":true,"health":{"status":"unauthenticated","statusMessage":null,"accountEmail":null,"planLabel":null,"internal_DO_NOT_USE_setupGuidePlanLabel":null,"installedVersion":"0.150.0","minimumSupportedVersion":"0.136.0","canInstall":true,"canUpdate":true,"loginCommand":"codex login --device-auth","localLoginCommand":"codex login"}}}
Verbatim assertion diff (terminal color codes omitted):
{
"health": {
"installedVersion": "0.150.0",
- "status": "ready",
+ "status": "unauthenticated",
},
"supported": true,
}
Test Files 1 failed (1)
Tests 1 failed (1)
5. Root cause
- The file path is derived from the effective Codex home. There is no alternative credential-store query in this health path.
- The credential reader only opens the file and classifies ENOENT as missing:
raw = await fs.readFile(authPath, "utf8"); ... return errnoCode(error) === "ENOENT" ? { state: "missing", authPath } : { state: "unreadable", authPath, error: toError(error) }; - The maintenance adapter discards the distinction between an absent file and unusable credentials:
case "missing": case "unusable": return null;
- The health function interprets null as unauthenticated:
const credentials = await readCredentials(); if (credentials === null) { return healthResult("unauthenticated", { installedVersion: version }); } - The onboarding model translates this into a sign-in state; the view selects the installed-but-signed-out copy.
The deeper error is treating one storage implementation's missing artifact as authoritative evidence about the account. The provider can be installed and above the minimum version while this account check still rejects every login not represented by that file. High confidence refers to this observed branch and source chain, not to native Keychain behavior or real CLI output.
6. Proposed fix and safety gate
Have the health check ask Codex for its supported, noninteractive authenticated-account state instead of inferring sign-out solely from a missing file. First validate that interface on macOS with a disposable keyring-backed account; cover timeouts, unavailable credential stores, actual signed-out accounts, API-key accounts, and expired logins. Keep status detection separate from direct credential access used by usage fetching, and do not turn a failed probe into a false ready result.
No automatic fix or pull request. The complete native scenario was not reproduced. Changing how authenticated account state is determined also falls outside this rule's authentication-change exclusion. No production files were patched, and no fix branch was pushed. GitHub cross-reference metadata and open-PR search showed no linked open pull request for this issue at investigation time.
7. Verification
The same investigating agent repeated the test in a second initially clean detached worktree at exactly 713ee7884df77729ab75c21057f15b01829db7a8. This is a clean repeat, not an independent investigation. The second checkout had its own installation, build outputs, and newly generated temporary fixture directories. No server ports were required.
| Check | Result |
|---|---|
| First frozen install | Passed. |
| First full build attempt | Failed while plugins could not resolve the SDK runtime. Building SDK types and rerunning the normal build resolved setup without source changes. |
| First full build after setup | 73 successful tasks, exit 0. |
| Existing credential and maintenance tests | 2 files, 17 tests passed, exit 0. |
| First focused regression | Expected failure: ready vs unauthenticated; 1 failed test, exit 1. |
| Second clean checkout frozen install and full build | Passed; 73 successful build tasks, exit 0. |
| Second focused regression, cache bypassed with --force | Same expected failure and identical diagnostic JSON; 1 failed test, exit 1. |
| Root-cause permalinks | Every linked file and line range was checked against the recorded trusted commit. |
| Later main check | Main advanced during investigation; no intervening changes touched the two credential/health implementation files. |
No report conclusion needed correction after the repeat. The verdict deliberately remains partial because a simulated executable cannot prove native Keychain behavior. There are no screenshots or live UI claims.
8. Related issues
Related reports were not independently evaluated. No issue-supplied external links, attachments, scripts, or pull-request branches were fetched or executed. Issue content was treated only as untrusted claims to test; investigation commands and the reproduction were derived locally from trusted repository code.
9. Appendix: repeatable checks
After creating the test, the relevant existing suite was run separately:
pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/bridge/provider-maintenance.test.ts src/ai/codex-auth.test.ts
Test Files 2 passed (2)
Tests 17 passed (17)
The second checkout used the same trusted base, not a linked branch:
git worktree add --detach /tmp/bb-7294-verify 713ee7884df77729ab75c21057f15b01829db7a8 cd /tmp/bb-7294-verify pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build # Save the complete reproduction test from section 4 in this checkout. pnpm exec turbo run test --filter=bb-plugin-provider-codex --force -- src/bridge/issue-7294-repro.test.ts
The reproduction artifact has identical SHA-256 in both checkouts. Complete raw logs are retained locally rather than published; the report embeds the diagnostic output, assertion failure, and check summaries needed to reproduce the finding. No credentials were read or printed. Build-generated unrelated route ordering was discarded during cleanup.