Skip to content

App seems to use the envrionment file from the main project no matter what branch is selected #11718

@heddendorp

Description

@heddendorp

What version of the Codex App are you using (From “About Codex” dialog)?

26.212.1823 (661)

What subscription do you have?

Business

What issue are you seeing?

When starting a new Codex thread in a Git worktree and selecting a specific branch/environment, the Codex app appears to always use the environment/configuration files from the main checkout (the currently checked-out branch), rather than from the branch selected for the new worktree.

For example, if my main project checkout is on a feature branch with different setup or environment files, and I create a new worktree targeting main, Codex still uses the files from the feature branch checkout. This can lead to incompatibilities when the environment/setup differs between branches.

I would expect Codex to load the environment/setup files from the branch/worktree that was selected when creating the new thread, not from whatever branch is currently checked out in the main repository.

What steps can reproduce the bug?

  1. Open a project in the Codex desktop app.
  2. In the main repository checkout, switch to a non-main branch (e.g. a feature branch) that has different environment/setup files.
  3. Create a new Codex thread using the “new thread in Git worktree” workflow.
  4. Select the main branch (or another branch different from the one currently checked out in the main repo) as the target environment/branch.
  5. Start the thread.

Observed: Codex still uses the environment/setup files from the main checkout’s currently selected branch, not from the selected worktree branch.

Reproducibility: Happens consistently whenever the main checkout is not on the same branch as the newly created worktree.

What is the expected behavior?

Codex should use the environment/setup/configuration files from the branch/worktree that is selected when creating the new thread.

If I create a new worktree targeting main, Codex should load the environment as it exists on main, regardless of which branch is currently checked out in the main project directory.

Additional information

This seems related to how Codex resolves environment/config files when initializing a new worktree-based thread. It may be incorrectly referencing the main checkout directory instead of the newly created worktree directory.

This can be problematic in workflows where branches have different dependencies or setup requirements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions