Skip to content

Native Codex provider drops project-scoped CODEX_HOME when launching app-server #6866

Closed

Description

@Karabur

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 main at 6e77fce8c7a0a3bd71b66edfd5f223f5f92cc632. 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)

  1. At the commit above, take appServerLaunchEnv from plugins/provider-codex/src/bridge/bridge.ts unchanged into a small test with its two pool environment-name constants.
  2. In the test process only, set process.env.CODEX_HOME to /tmp/bb-profile-repro-personal.
  3. Call appServerLaunchEnv({ CODEX_HOME: "/tmp/bb-profile-repro-work" }).
  4. Inspect the returned CODEX_HOME: it is /tmp/bb-profile-repro-personal.
  5. Delete process.env.CODEX_HOME and repeat the call. The returned CODEX_HOME is undefined, 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)

  1. Authenticate two separate Codex homes with different accounts, for example ~/.codex and ~/.codex-work.
  2. In BB, open the work project's Project settings → Advanced settings → Environment variables.
  3. Set CODEX_HOME to the absolute path of the existing work home, such as /Users/example/.codex-work.
  4. Start a new thread using the native Codex provider.
  5. 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

  • appServerLaunchEnv and buildAppServerEnv inherit process.env and merge only CODEX_OPENAI_BASE_URL and CODEX_POOL_AUTH_TOKEN from the supplied environment. CODEX_HOME is omitted.
  • constructionSignature tracks pool routing changes but not CODEX_HOME. Lifecycle behavior also needs consideration when an effective home changes.
  • Investigation: BB thread thr_qstjdcxswd (Personal project, environment env_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

Requested fix and acceptance criteria

  • Forward the effective project/session CODEX_HOME into 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

  1. added theissue type on Nov 2, 2026
  2. added
    providers
    provider-codex
    confirmed-repro
    on Nov 2, 2026
  3. bb-slop-cop commented on Nov 2, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority: Medium · Effort: Medium. Applied labels: providers, provider-codex, confirmed-repro.
    • Report: https://get-bb.github.io/reports/issues/6866.html
    • Verdict: REPRODUCED · Confidence: high. Two clean checkouts of trusted main produced nine failing regression cases and two passing default-home controls; 29 relevant existing tests pass.
    • Root cause: The child-launch environment forwards only pool-routing overrides, dropping 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.
    • No PR: Changing authentication/configuration homes and saved-session affinity exceeds this rule's simple-fix safety boundary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-reproprovider-codexproviders

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions