“Continue in worktree” creates a worktree, but Codex keeps working in the original checkout

Open
#34,352 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
git, rust

Research direction

Start by tracing the Continue in worktree transition and compare the thread’s worktree metadata with the agent shell, writable workspace root, Environment panel, Copy working directory, and Open in IntelliJ paths. Reproduce the steps and verify that the agent’s pwd, file changes, branches, terminal commands, and repository context all use the worktree and that the Environment panel identifies it as a worktree.

Written by the indexing model from the issue text.

Description

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

26.715.52143

What subscription do you have?

Pro 200$

What platform is your computer?

Darwin 25.5.0 arm64 arm

What issue are you seeing?
Description

I started a thread in a normal local checkout and then selected Continue in worktree. The worktree was created, but the thread entered an inconsistent state where different features referred to different directories.

This has happened more than once.

Observed behavior
  • The thread list item indicates that the thread is in a worktree.
  • Open in IntelliJ opens the worktree directory.
  • Copy working directory copies the path of the original, non-worktree checkout.
  • The Environment panel still shows Local.
  • The agent’s shell working directory and writable workspace root remain pointed at the original checkout.
  • Consequently, the agent creates branches, edits files, runs tests, and starts builds in the original checkout.

This suggests that the thread’s worktree metadata and IDE integration are updated, while its runtime environment remains attached to the original directory.

Expected behavior

After selecting Continue in worktree, every part of the thread should consistently use the new worktree:

  • Agent working directory
  • Writable workspace root
  • Terminal and command execution
  • Copy working directory
  • Open in IntelliJ
  • Environment panel
  • Thread list indicator
  • Repository and Git context

The environment should identify itself as a worktree rather than continuing to display Local.

What steps can reproduce the bug?
Steps to reproduce
  1. Start a thread in a normal local repository checkout.
  2. Select Continue in worktree.
  3. Confirm that the thread list displays the worktree indicator.
  4. Compare the results of:
    • Open in IntelliJ
    • Copy working directory
    • pwd in the agent’s shell
    • The Environment panel
  5. Ask the agent to modify files or create a branch.
  6. Observe that the changes are made in the original checkout rather than the worktree.
What is the expected behavior?

No response

Additional information

No response

Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

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.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.