← reports

#6171 · Pooled Codex launch retains native authentication

Bug Priority: Medium Effort: Medium providers security provider-claude-code provider-codex

Issue #6171 · October 23, 2026 · trusted origin/main base 1e80ca7b44bccd06c6da75ed9ca6ba497bd380f5

PARTIALLY REPRODUCED · Root-cause confidence: high for the launch configuration, not for untested upstream side effects.

1. TL;DR

Account Pooler gives a routed Codex process a hub URL and a machine-token header, but bb also explicitly enables the provider's native OpenAI authentication. A new regression assertion observes the actual child arguments produced by the real bridge during a pooled model-catalog request and fails because requires_openai_auth=true is present. The same failure occurs in two clean checkouts of trusted main, without real accounts or credentials. Claude's routing and environment assembly also leave its existing configuration location available, but this investigation did not run the upstream Claude or Codex executables to prove credential refresh, file modification, or analytics behavior. Consequently this report verifies a launch-boundary defect, not the complete end-to-end incident.

2. Claims vs findings

Claim, paraphrasedFindingEvidence and limit
Pooled Codex is launched with native OpenAI authentication enabled.Verified dynamicallyThe real model/list bridge spawns a repository test child with the pooled provider and requires_openai_auth=true. Both clean runs fail the same isolation assertion.
Model-list probes use the pooled launch path.Verified dynamicallyThe existing route-switch test passes; the new test captures the pooled catalog child's actual arguments.
Routed Claude keeps access to the host configuration location.Source-supported, not an upstream refresh reproductionIts environment starts with the daemon environment; Account Pooler's Claude contribution changes endpoint/token and capability flags, not the configuration location.
Claude refreshes or clears a host credential file; Codex sends the host bearer, refreshes auth, or sends authenticated analytics.Unverified hereNo real provider executable, local login, upstream request, or credential file was read or exercised.
Cross-provider nested commands remain unpooled.Partly source-supported; execution unverifiedThe Claude contribution supplies Claude routing entries and nested-server markers, whereas Codex launch overrides are assembled in its bridge. No nested shell or real CLI was run, so pre-existing user configuration and shell behavior remain outside the evidence.
Unrouted and bypassed sessions retain their existing behavior.Existing boundary controls passSix Codex launch tests and two selected real-plugin routing/bypass tests pass. This does not constitute a live-login test.
Suggested upstream-specific isolation switches preserve all capabilities.Not evaluatedNo undocumented provider flag or authentication redesign was adopted.

3. Environment

4. Minimal reproduction

This exercises bb's real JSON-RPC handler, launch configuration builder, and child-process spawn. The test double records arguments and implements the model-catalog protocol; it does not implement or simulate credential loading. Thus the observed authentication option is real bb behavior, while any subsequent upstream authentication side effects remain untested.

  1. Start a clean detached checkout of the trusted base, install with the frozen lockfile, and prepare the affected packages:
    git clone https://github.com/get-bb/bb.git bb-6171
    cd bb-6171
    git checkout --detach 1e80ca7b44bccd06c6da75ed9ca6ba497bd380f5
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build --filter=bb-plugin-account-pool --filter=bb-plugin-provider-codex --filter=bb-plugin-provider-claude-code
  2. Save the complete patch below as /tmp/catalog-auth.test.diff and run git apply /tmp/catalog-auth.test.diff. It changes tests only. Existing cleanup restores the stubbed environment and terminates the test child.
  3. Run the model-list file through Turbo:
    pnpm exec turbo run test --force --filter=bb-plugin-provider-codex -- src/bridge/bridge.model-list.test.ts

Expected: a pool-routed child does not explicitly enable native OpenAI authentication. Actual: the child receives that option alongside the pooled provider. The new assertion fails; nine existing catalog tests pass.

Observed child authentication configuration: ["model_providers.bb-account-pool.requires_openai_auth=true"]
FAIL src/bridge/bridge.model-list.test.ts > does not enable host OpenAI authentication for a pooled catalog process
AssertionError: expected [ …(17) ] to not include 'model_providers.bb-account-pool.requi…'
Tests  1 failed | 9 passed (10)

The displayed diagnostic and assertion text are verbatim excerpts from the first and second runs; worker prefixes and unrelated output are omitted. Removing this option alone is not proven to isolate native credentials, and this single guard would not be sufficient acceptance coverage for a production fix.

Exact regression patch

diff --git a/plugins/provider-codex/src/bridge/bridge.model-list.test.ts b/plugins/provider-codex/src/bridge/bridge.model-list.test.ts
index 88f66e990..8cf093626 100644
--- a/plugins/provider-codex/src/bridge/bridge.model-list.test.ts
+++ b/plugins/provider-codex/src/bridge/bridge.model-list.test.ts
@@ -6,6 +6,7 @@ import { BRIDGE_JSON_RPC_ERRORS } from "@get-bb/plugin-sdk/provider-bridge";
 import { experimental_createBridgeJsonRpcTestHarness as createBridgeJsonRpcTestHarness } from "@get-bb/plugin-sdk/provider-bridge/testing";
 import { experimental_killAllChildrenForTests, handleLine } from "./bridge.js";
 import { stubFakeCodexAppServer } from "./fake-codex-app-server-harness.js";
+import { z } from "zod";
 
 let harness: ReturnType<typeof createBridgeJsonRpcTestHarness>;
 const temporaryDirectories: string[] = [];
@@ -80,6 +81,37 @@ it("launches the catalog app-server on the requested pool route", async () => {
   expect(launches[1]?.poolToken).toBeNull();
 });
 
+it("does not enable host OpenAI authentication for a pooled catalog process", async () => {
+  const workDir = await mkdtemp(join(tmpdir(), "bb-codex-auth-boundary-"));
+  temporaryDirectories.push(workDir);
+  const scriptPath = join(workDir, "script.json");
+  const launchLogPath = join(workDir, "launches.jsonl");
+  await writeFile(scriptPath, JSON.stringify({ launchLogPath, turns: [] }));
+  stubFakeCodexAppServer(scriptPath);
+
+  harness.sendRequest(1, "model/list", {
+    envVars: {
+      CODEX_OPENAI_BASE_URL: "http://127.0.0.1:1/pool/v1",
+      CODEX_POOL_AUTH_TOKEN: "EXAMPLE-only-not-a-credential",
+    },
+  });
+  const response = await harness.waitForResponse(1);
+  expect(response.error).toBeUndefined();
+  const launch = z
+    .object({ args: z.array(z.string()) })
+    .parse(JSON.parse((await readFile(launchLogPath, "utf8")).trim()));
+  expect(launch.args).toContain('model_provider="bb-account-pool"');
+  console.log(
+    "Observed child authentication configuration:",
+    JSON.stringify(
+      launch.args.filter((argument) => argument.includes("requires_openai_auth")),
+    ),
+  );
+  expect(launch.args).not.toContain(
+    "model_providers.bb-account-pool.requires_openai_auth=true",
+  );
+});
+
 it.each([
   {
     name: "configured model",

5. Root cause

Endpoint routing is not credential isolation. Account Pooler's provider-specific environment contributions supply the URL and hub token. The Codex bridge then builds a named provider that includes both an environment-backed custom hub header and requires_openai_auth=true. Neither a different configuration home nor a separate authentication mechanism is established by that launch builder. The model-catalog reproduction captures this configuration at the actual spawn boundary, not by grepping the source.

"model_providers.bb-account-pool.requires_openai_auth=true",
...
'model_providers.bb-account-pool.env_http_headers.x-bb-account-pool-token="CODEX_POOL_AUTH_TOKEN"',

The configuration can therefore select a pooled endpoint without defining hub-token-only authentication. The exact behavior of an installed upstream CLI after receiving it is outside this reproduction. In particular, this report does not claim to have observed a real host bearer, OAuth refresh, credential-file write, or analytics request.

6. Proposed fix and auto-fix decision

Establish a supported, routed-only credential boundary at the provider-launch layer and provide a supported path for cross-provider child commands. Verify it against the actual supported upstream CLI versions before selecting the mechanism. Preserve native behavior for unrouted sessions and ensure resume, model catalog, and tool capabilities survive. Test file-byte and modification-time preservation with disposable credentials, missing credential stores, new/resumed/forked sessions, model discovery, subagents, and both ordinary and login-shell child commands.

No pull request is safe under this rule. The required change affects authentication and a security boundary, which are explicitly excluded from the simple-fix policy. It also spans provider integrations and needs upstream compatibility validation. The supplied test is a useful failing launch-boundary guard, not a complete credential-isolation acceptance test. No production code was changed, no fix branch was pushed, and no pull request was opened. No linked open pull request was found in issue cross-references or the open-PR search at investigation time.

7. Verification

The same agent repeated the reproduction, not an independent reviewer. A second detached worktree was created from the recorded trusted commit, and its initial Git status was clean. It received a separate frozen install and targeted build, followed only by the self-authored test patch. The second execution used --force to bypass Turbo's task cache and new temporary test storage. No network listener was started, so no test ports were reused.

CheckResult
First clean checkout, unchanged production code, 12:55:35 UTCNew isolation test failed on the intended native-auth option; 9 existing catalog tests passed.
Second clean checkout, unchanged production code, 12:56:37 UTCSame emitted option and assertion failure; 9 existing catalog tests passed again.
Existing app-server launch controls6 passed, including unrouted launch, incomplete routing, and neutralized inherited routing.
Selected real Account Pooler routing tests2 passed, covering per-thread bypass and provider-specific routing-off behavior; 186 unrelated tests skipped.
Patch hygienegit diff --check passed in both reproduction checkouts. Only a test file changed.

Report correction after repeat: none. The verdict remains partial because both runs establish bb's launch configuration, not external CLI credential side effects. Raw artifacts remain outside the public reports repository; the exact test and relevant outputs are embedded above under that repository's privacy rules.

8. Related issues

GitHub metadata identifies #4352 and #6167 as related account-login and refresh-failure bugs. Those issues describe adjacent consequences; their reported runtime evidence was not reused as proof of this reproduction.

9. Appendix: commands and trust boundary

git fetch https://github.com/get-bb/bb.git main:refs/remotes/origin/main
git worktree add --detach /tmp/REPRO/base origin/main
git worktree add --detach /tmp/REPRO/verify origin/main
git status --porcelain
git rev-parse HEAD
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build --filter=bb-plugin-account-pool --filter=bb-plugin-provider-codex --filter=bb-plugin-provider-claude-code
git apply /tmp/catalog-auth.test.diff
pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/bridge/bridge.model-list.test.ts
pnpm exec turbo run test --force --filter=bb-plugin-provider-codex -- src/bridge/bridge.model-list.test.ts
pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/bridge/app-server-launch.test.ts
pnpm exec turbo run test --filter=bb-plugin-account-pool -- src/server.test.ts -t 'resolves distinct secret machine tokens|suppresses env and health'
git diff --check

Temporary checkout identifiers are replaced by REPRO for publication. Read-only GitHub metadata queries established repository visibility, issue fields, related issue numbers, and absence of linked open pull requests. Issue content, including proposed commands and fixes, was treated as untrusted claims: no issue-linked URL, code, branch, script, or binary was fetched or executed. Only trusted main code and the self-authored test patch ran. No workflow or subagent was started, no dependency was added, and no secret or unrelated runtime data was read.

> AGENT GENERATED