Repository navigation
Description
Summary
The native Codex provider ignores a project-scoped CODEX_HOME when launching codex app-server. Users with separate personal and work Codex homes therefore cannot select the intended account/configuration through BB's existing project environment settings; the agent instead inherits the provider bridge's CODEX_HOME, or falls back to Codex's default home.
This is a narrow provider-launch fix, independent of adding a new account/profile picker or using Account Pooler.
Versions and environment
- BB desktop package: 0.48.1, macOS app installation.
- macOS 26.5.1 (25F80).
- Codex CLI:
codex-cli 0.166.0. - Provider: native
codex; Account Pooler disabled. - Separate, already authenticated personal and work Codex home directories on the same host.
- Source-level reproduction tested against
mainat6e77fce8c7a0a3bd71b66edfd5f223f5f92cc632. The same launch behavior was inspected in the installed provider bundle. - Verification boundary: reproduced at the exact environment-building function, not through an end-to-end BB thread/account switch. No credentials or account settings were changed during the investigation.
Steps to reproduce
Source-level reproduction (verified)
- At the commit above, take
appServerLaunchEnvfromplugins/provider-codex/src/bridge/bridge.tsunchanged into a small test with its two pool environment-name constants. - In the test process only, set
process.env.CODEX_HOMEto/tmp/bb-profile-repro-personal. - Call
appServerLaunchEnv({ CODEX_HOME: "/tmp/bb-profile-repro-work" }). - Inspect the returned
CODEX_HOME: it is/tmp/bb-profile-repro-personal. - Delete
process.env.CODEX_HOMEand repeat the call. The returnedCODEX_HOMEisundefined, despite the explicit project/session override.
The test assertions executed successfully:
process.env.CODEX_HOME = "/tmp/bb-profile-repro-personal";
const result = appServerLaunchEnv({
CODEX_HOME: "/tmp/bb-profile-repro-work",
});
assert.equal(result.CODEX_HOME, "/tmp/bb-profile-repro-personal");
assert.notEqual(result.CODEX_HOME, "/tmp/bb-profile-repro-work");
delete process.env.CODEX_HOME;
assert.equal(
appServerLaunchEnv({ CODEX_HOME: "/tmp/bb-profile-repro-work" }).CODEX_HOME,
undefined,
);Corresponding user workflow (end-to-end verification still needed)
- Authenticate two separate Codex homes with different accounts, for example
~/.codexand~/.codex-work. - In BB, open the work project's Project settings → Advanced settings → Environment variables.
- Set
CODEX_HOMEto the absolute path of the existing work home, such as/Users/example/.codex-work. - Start a new thread using the native Codex provider.
- Check the app-server's effective home and account identity. Expected: the work home/account; the inspected launch path instead uses the bridge's inherited environment.
Expected vs actual
Expected: the native Codex app-server receives the effective project's CODEX_HOME, allowing simultaneous personal and work projects to use their respective existing logins and configurations.
Actual, verified at the launch function: the override is dropped. Test output:
Observed: project CODEX_HOME ignored; inherited CODEX_HOME retained.
Observed: with no inherited CODEX_HOME, project CODEX_HOME is still absent.
The account-selection consequence follows from the launch path; an actual wrong-account inference request was not made to validate this report.
Evidence
appServerLaunchEnvandbuildAppServerEnvinheritprocess.envand merge onlyCODEX_OPENAI_BASE_URLandCODEX_POOL_AUTH_TOKENfrom the supplied environment.CODEX_HOMEis omitted.constructionSignaturetracks pool routing changes but notCODEX_HOME. Lifecycle behavior also needs consideration when an effective home changes.- Investigation: BB thread
thr_qstjdcxswd(Personal project, environmentenv_xccb5pqa8i). The source-level test extracted the actual function from the pinned commit, removing only TypeScript parameter/return annotations for execution under Node.
What was ruled out
- Add named provider connections and explicit account routing #1447 requests broader named provider connections and explicit routing. This report concerns an existing project environment override being dropped before native Codex launch; it can be fixed without that UI/API expansion.
- Project-scoped CLAUDE_CONFIG_DIR is ignored when listing a project's provider skills and commands #3925 concerns provider skill/command enumeration. This report concerns the running Codex agent's configuration and authentication home.
- bb settings for model account usage don't respect CODEX_HOME #1324 concerns account usage lookup, not agent launch.
- Support per-thread MCP configuration at provider launch #4451 concerns per-thread MCP configuration, not project-level credential/configuration home selection.
- Codex AI service ignores configured custom provider auth and falsely asks for codex login #4484 concerns the separate Codex AI-service helper path, not native agent threads.
- Account Pooler was disabled; this is not pooled failover behavior.
- Open and closed issues were searched for
CODEX_HOMEand Codex project/profile support.
Requested fix and acceptance criteria
- Forward the effective project/session
CODEX_HOMEinto the native Codex app-server launch while preserving environment sanitization and pool routing behavior. - Verify two projects with different Codex homes can run concurrently without changing either project's account selection.
- Cover start, resume, fork, and provider lifecycle/model discovery where home selection matters.
- If an existing thread's home changes, handle its saved provider-session location explicitly; do not silently fall back to another account or lose the conversation.
- Add regression coverage for the launch override and lifecycle behavior. Default behavior should remain unchanged when no override is configured.
- No new profile-picker UI is required for this fix.
Checks
- Reproduced the source-level failure on current
main; end-to-end verification is explicitly marked pending. - Searched open and closed issues for the same problem.
- Linked the investigation thread and pinned source evidence.
AGENT GENERATED
Activity
bb-slop-cop commentedon Nov 2, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotproviders,provider-codex,confirmed-repro.CODEX_HOME; session reuse also omits the selected home from its construction signature. Verified start, resume, fork, model discovery, concurrent sessions, and home changes at the bridge/child-process boundary—not with real authenticated accounts.Launch Codex app-server on the project's CODEX_HOME (get-bb#6887)