#6107 · Pooled Codex provider identity cannot be resolved by a clean client
Trusted base: 9c3c56fa2b864b45104080a3a89ed39fb3196f0a
Verdict: REPRODUCED · Root-cause confidence: high. Same-agent verification repeated the result from a second clean trusted checkout.
1. TL;DR
Account Pooler makes the Codex bridge select a custom provider whose definition exists only in the launched process's configuration overrides. A real Codex session records that custom identity on disk. A second client reading the same isolated session directory cannot resolve the saved identity, so resume fails before any model request. Starting a normal local thread identifies the built-in provider; explicitly resuming the pooled session with that built-in identity succeeds. This reproduces the interoperability defect without an account, credentials, or the reporter's data.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| Pool-routed sessions retain a custom provider identity. | Verified | The actual launcher and Codex 0.159.0 produced both a thread response and a session metadata record identifying bb-account-pool. |
| A client without bb's launch overrides rejects that identity. | Verified | Both clean runs returned JSON-RPC -32600 and the missing-provider configuration error. |
| Omitting the provider argument is sufficient. | Not reproduced on the available version | Codex 0.159.0 still failed when the argument was omitted. Explicitly selecting the built-in provider succeeded. The reporter's newer client version was unavailable. |
| The desktop application's exact dialog and the reporter's affected-session count. | Unverified | Linux app-server reproduction only; no macOS desktop app or reporter account was accessed. |
| Persisting a global provider definition repairs existing sessions. | Not tested | No persistent user configuration was modified. The reproduction established the unresolved identity and a built-in-provider control, not a production-safe migration. |
3. Environment
- Public repository
get-bb/bb; trusted main commit9c3c56fa2b864b45104080a3a89ed39fb3196f0a, fetched directly from that repository. - Linux 4.19.0-gvisor, x86_64; Node.js v22.19.0; pnpm 9.15.0; Vitest 4.1.1; installed Codex CLI 0.159.0.
- Two separate detached worktrees at the same commit, each with a frozen dependency install. Each reproduction created a new temporary HOME, CODEX_HOME, workspace, and session store.
- No BB dev instance, public server, or listening port was started. Codex used stdio. The pool endpoint was an unused loopback port with a synthetic placeholder value, not real authentication.
- One turn was started only to cause session persistence; no successful inference or authenticated pool traffic was required or tested.
4. Minimal reproduction
- Install Codex CLI 0.159.0 on PATH, Node.js and pnpm. Work in a clean temporary checkout; do not use a personal Codex home.
- Prepare the trusted source and save the test from the next block at the stated path.
git clone --filter=blob:none https://github.com/get-bb/bb.git bb-6107 cd bb-6107 git checkout --detach 9c3c56fa2b864b45104080a3a89ed39fb3196f0a pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build:types --filter=@get-bb/plugin-sdk Save the complete test below as: plugins/provider-codex/src/bridge/issue-6107.repro.test.ts pnpm exec turbo run test --force --filter=bb-plugin-provider-codex -- src/bridge/issue-6107.repro.test.ts
- The test calls the actual BB launcher, starts a real Codex app-server, persists one thread, closes it, and starts a clean app-server against the same isolated session directory.
- Expected: resuming with the thread's recorded provider succeeds. Actual: the final assertion fails with the missing-provider error. The explicitly selected built-in-provider control succeeds first.
Complete reproduction test
import { spawn } from "node:child_process";
import { mkdtemp, mkdir, readFile, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { createInterface } from "node:readline";
import { expect, it } from "vitest";
import { z } from "zod";
import { resolveAppServerLaunch } from "./bridge.js";
const responseSchema = z.object({
id: z.number().optional(),
result: z.unknown().optional(),
error: z.object({ code: z.number(), message: z.string() }).optional(),
});
type Response = z.infer<typeof responseSchema>;
const threadSchema = z.object({
thread: z.object({
id: z.string(),
modelProvider: z.string(),
path: z.string().nullable(),
}),
});
function connect(args: string[], home: string, cwd: string) {
const child = spawn("codex", args, {
cwd,
env: {
PATH: process.env.PATH,
HOME: home,
CODEX_HOME: join(home, ".codex"),
CODEX_POOL_AUTH_TOKEN: "EXAMPLE-not-a-credential",
},
stdio: ["pipe", "pipe", "ignore"],
detached: true,
});
let nextId = 0;
const pending = new Map<number, (response: Response) => void>();
const lines = createInterface({ input: child.stdout });
lines.on("line", (line) => {
const parsed = responseSchema.safeParse(JSON.parse(line));
if (parsed.success && parsed.data.id !== undefined) {
pending.get(parsed.data.id)?.(parsed.data);
pending.delete(parsed.data.id);
}
});
return {
async request(method: string, params: object): Promise<Response> {
const id = ++nextId;
return new Promise((resolve, reject) => {
const timeout = setTimeout(
() => reject(new Error(`Timeout: ${method}`)),
15_000,
);
pending.set(id, (response) => {
clearTimeout(timeout);
resolve(response);
});
child.stdin.write(`${JSON.stringify({ id, method, params })}\n`);
});
},
async close() {
lines.close();
if (child.exitCode !== null || child.signalCode !== null) return;
const exited = new Promise<void>((resolve) =>
child.once("close", () => resolve()),
);
if (child.pid !== undefined) process.kill(-child.pid, "SIGKILL");
await exited;
},
};
}
async function initialize(client: ReturnType<typeof connect>) {
const response = await client.request("initialize", {
clientInfo: { name: "bb-repro-6107", version: "1.0.0" },
capabilities: { experimentalApi: true },
});
expect(response.error).toBeUndefined();
}
it("resumes a pooled thread in a clean client using its recorded provider", async () => {
const home = await mkdtemp(join(tmpdir(), "bb-6107-codex-"));
await mkdir(join(home, ".codex"));
const launch = resolveAppServerLaunch({
CODEX_OPENAI_BASE_URL: "http://127.0.0.1:1/pool/v1",
CODEX_POOL_AUTH_TOKEN: "EXAMPLE-not-a-credential",
});
const pooled = connect(launch.args, home, home);
let plain: ReturnType<typeof connect> | undefined;
try {
await initialize(pooled);
const started = await pooled.request("thread/start", {
cwd: home,
ephemeral: false,
experimentalRawEvents: true,
approvalPolicy: "never",
sandbox: "read-only",
});
expect(started.error).toBeUndefined();
const { thread } = threadSchema.parse(started.result);
console.log("Started thread provider:", thread.modelProvider);
const turn = await pooled.request("turn/start", {
threadId: thread.id,
input: [{ type: "text", text: "Reply only with ok.", text_elements: [] }],
});
expect(turn.error).toBeUndefined();
if (thread.path !== null) {
const sessionPath = thread.path;
const contents = await expect
.poll(async () => readFile(sessionPath, "utf8"), { timeout: 10_000 })
.toBeTruthy()
.then(() => readFile(sessionPath, "utf8"));
const metadata = z
.object({
payload: z.object({ model_provider: z.string() }),
})
.parse(JSON.parse(contents.split("\n")[0]));
console.log("Saved session provider:", metadata.payload.model_provider);
}
await pooled.close();
plain = connect(["app-server"], home, home);
await initialize(plain);
const explicit = await plain.request("thread/resume", {
threadId: thread.id,
modelProvider: thread.modelProvider,
});
console.log("Explicit provider resume:", explicit.error ?? "OK");
const defaulted = await plain.request("thread/resume", {
threadId: thread.id,
});
console.log("Default provider resume:", defaulted.error ?? "OK");
const local = await plain.request("thread/start", { cwd: home });
expect(local.error).toBeUndefined();
const localThread = threadSchema.parse(local.result).thread;
console.log("Unpooled provider:", localThread.modelProvider);
const builtin = await plain.request("thread/resume", {
threadId: thread.id,
modelProvider: localThread.modelProvider,
});
console.log("Built-in provider resume:", builtin.error ?? "OK");
expect(builtin.error).toBeUndefined();
expect(explicit.error).toBeUndefined();
} finally {
await pooled.close();
await plain?.close();
await rm(home, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
}
}, 60_000);
Observed output from both completed runs
These are the relevant stdout lines and final assertion from the two runs, with Turbo prefixes removed. Runtime-specific paths, timings, and session IDs are deliberately omitted.
Started thread provider: bb-account-pool
Saved session provider: bb-account-pool
Explicit provider resume: {
code: -32600,
message: 'failed to load configuration: Model provider `bb-account-pool` not found'
}
Default provider resume: {
code: -32600,
message: 'failed to load configuration: Model provider `bb-account-pool` not found'
}
Unpooled provider: openai
Built-in provider resume: OK
AssertionError: expected { code: -32600, …(1) } to be undefined
Test Files 1 failed (1)
Tests 1 failed (1)
5. Root cause
Account Pooler contributes the pool URL and machine-token environment values to Codex. resolveAppServerLaunch responds by selecting bb-account-pool and defining its endpoint, wire API, authentication requirements, websocket setting, and token-header mapping through process-local -c overrides. The bridge spawns the app-server with those arguments; this path does not install a durable provider definition for other clients.
model_provider="bb-account-pool" model_providers.bb-account-pool.requires_openai_auth=true model_providers.bb-account-pool.supports_websockets=false model_providers.bb-account-pool.env_http_headers.x-bb-account-pool-token="CODEX_POOL_AUTH_TOKEN"
The saved session_meta.payload.model_provider outlives the process-local provider registry. The next client sees the session but lacks the configuration needed to resolve that identity. The real missing-provider error and the successful built-in-provider control isolate provider resolution rather than absent session data or a need for a working model connection.
The current identity also carries authentication-related transport configuration: the hub authenticates the custom header or bearer value and rejects invalid tokens. A repair must retain that behavior, not merely remove the custom header or route requests differently.
6. Proposed fix and simple-fix gate
For future sessions, investigate retaining a provider identity that ordinary clients can resolve while preserving bb's endpoint, token-header mapping, and transport behavior. For existing saved sessions, separately define a safe compatibility policy: an explicit provider override, a non-secret durable compatibility definition, or a controlled session migration. The successful built-in-provider resume is evidence for the first experiment, not proof that every routing and authentication requirement is preserved.
No automatic pull request. A future-only launch rename leaves the already-saved sessions affected. A complete existing-session repair requires persistent Codex configuration/session changes or a product decision about cross-client compatibility; those violate this rule's no-stored-data/no-product-decision simple-fix conditions. No production fix, branch, commit, or dependency was created. There were no open linked pull requests in either the cross-reference timeline or an open-PR search when checked.
7. Verification
The same agent created a second clean detached checkout at 9c3c56fa2b864b45104080a3a89ed39fb3196f0a, installed frozen dependencies, copied only this agent-authored reproduction test, and reran it with --force to prevent a cached test result. Its temporary Codex home and session store were new. Both completed runs persisted the same provider identity, failed both the recorded-provider and omitted-provider resume attempts, succeeded with the built-in-provider override, and failed the intended final portability assertion.
pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build:types --filter=@get-bb/plugin-sdk pnpm exec turbo run test --force --filter=bb-plugin-provider-codex -- src/bridge/issue-6107.repro.test.ts First completed run: exit 1, intended missing-provider assertion Second completed run: exit 1, intended missing-provider assertion
During harness development, a start-only attempt had no rollout file yet. A turn-start step was added to ensure real persistence. A preliminary second run also exposed a cleanup race with subprocess descendants; the final harness kills its own detached process group and waits for pipe closure. Both final runs use that corrected harness. These harness corrections do not modify production code.
Report correction: omitting the provider does not avoid the error on the installed Codex version. The final report does not generalize the reporter's newer-client observation.
8. Related issues
An issue search found no separate duplicate of the same persisted-provider identity failure. #5690 concerns use of pooled credentials by Codex helpers, a related authentication subsystem but not a demonstrated duplicate.
9. Appendix
Relevant existing test command and actual summary:
pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/bridge/app-server-launch.test.ts src/bridge/bridge.model-list.test.ts Test Files 2 passed (2) Tests 15 passed (15)
The normal frozen install succeeded in both checkouts. The initial whole-repository build hit a missing SDK runtime artifact; after the SDK task completed, the build was rerun successfully:
pnpm exec turbo run build Tasks: 69 successful, 69 total Cached: 11 cached, 69 total
git diff --check passed in both checkouts. All root-cause links were checked against the recorded base files and line numbers. Source main was fetched again before publication and still pointed to the same commit.
Raw build/test logs and the reproduction source remain in local thread storage. In accordance with this public reports repository's rules, no log dump, test file, session file, screenshot substitute, or data directory is committed; the complete test and relevant observed output are inline above.
Trust boundary: issue content was treated solely as untrusted claims. No supplied issue command, configuration patch, URL, branch, or binary was executed. All executed source came from trusted main plus this isolated agent-authored harness. No real credentials, user runtime data, or reporter files were accessed.
> AGENT GENERATED