openai / openai/codex

Codex Desktop local environment actions run from the base checkout instead of the active managed worktree

Open
#43,051 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug config Linux
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

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

26.901.41600

What subscription do you have?

ChatGPT Pro

What platform is your computer?

Linux 7.1.6-arch1-1 x86_64 unknown

What issue are you seeing?

A Local Environment action started from a task running in a Codex-managed worktree executes from the repository's base checkout instead of the task's active worktree.

The integrated terminal opened manually with Ctrl+J starts in the correct worktree. The problem affects actions configured in .codex/environments/environment.toml.

Generated command:

cd "/home/<user>/path/to/base-checkout/." && npm run dev

The task's actual workspace is:

/home/<user>/.codex/worktrees/<id>/<project-name>
What steps can reproduce the bug?
  1. In a Git repository, configure this Local Environment action:
[[actions]]
name = "Start project"
icon = "run"
command = '''
npm run dev'''
  1. Create a new Codex Desktop task using Worktree mode.
  2. Open the integrated terminal with Ctrl+J and confirm it starts in /home/<user>/.codex/worktrees/<id>/<project-name>.
  3. Run the configured Start project action.
  4. Inspect the generated command. It changes directory to the base checkout before running npm run dev.

The behavior reproduces with newly created worktrees and after restarting Codex Desktop.

What is the expected behavior?

The action should execute from the active managed worktree:

cd "/home/<user>/.codex/worktrees/<id>/<project-name>" && npm run dev

The action cwd, terminal session workspace binding, and task workspace should resolve to the same canonical path.

Additional information
  • The issue reproduces in fresh worktrees and after restarting Codex Desktop.
  • A terminal opened manually with Ctrl+J uses the correct worktree.
  • A local diagnostic patch that selects the task workspace root instead of the base repository root makes the Run action use the correct worktree, suggesting the correct path is already present in task metadata.
  • The terminal may additionally show a workspace-mismatch warning; that separate behavior appears to be covered by #42335.
  • All paths and project identifiers above are privacy-sanitized.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Local Environment action execution and how it selects the repository root versus the active task workspace, then compare that with the integrated terminal's worktree binding. Done means configured actions run from the active managed worktree, with the action cwd, terminal workspace, and task workspace resolving to the same path; add regression coverage if the relevant test entry point is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.