Skip to content

Codex desktop on Windows reports malformed cwd for worktree threads and can target the wrong checkout #16525

Open

Description

@cmeeren

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

26.325.31654

What subscription do you have?

Pro

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

Session ID: 019d4953-4d9d-7740-b715-ab2a7d189db4

I hit a Windows Codex desktop issue when working in a Git worktree.

Actual behavior after repro below:

  • The thread reported an invalid cwd that appeared to concatenate the worktree path and the main checkout path:
C:\Users\cmeer\.codex\worktrees\bbc1\IT6A\?\C:\Users\cmeer\Source\Repos\IT6A
  • That path is not valid on Windows.
  • apply_patch failed when using the thread’s default workspace context.
  • git worktree list showed the real worktree existed and was valid:
    • main checkout: C:\Users\cmeer\Source\Repos\IT6A
    • worktree: C:\Users\cmeer\.codex\worktrees\bbc1\IT6A
  • Because the default cwd was broken, work had to be recovered manually by extracting the intended edits and replaying them into the real worktree.

Impact:

  • Workspace-relative edits can fail.
  • The assistant can lose confidence about which checkout is active.
  • This increases the risk of applying changes in the main checkout instead of the intended worktree.

Workaround:

  • Ignore the broken default cwd.
  • Manually verify the real paths with git worktree list.
  • Use the real worktree path explicitly for commands until the app/thread is fixed.

Additional note:

  • After manually moving the changes into the real worktree, the worktree behaved normally when addressed with its explicit path.

What steps can reproduce the bug?

  1. Open a repo with a main checkout plus a Git worktree on Windows.
  2. Start a Codex desktop thread that is supposed to be attached to the worktree.
  3. Check the thread/environment cwd.
  4. Observe that the cwd is malformed and includes both the worktree path and the main checkout path.
  5. Try a workspace-relative edit operation such as apply_patch.
  6. Observe failure or incorrect workspace targeting.

What is the expected behavior?

  • A thread opened for a worktree should use that worktree as its current working directory.
  • File edits and workspace-relative tools should target the worktree checkout.

Additional information

No response

Activity

  1. added
    appIssues related to the Codex desktop app
    on Apr 2, 2026
  2. added
    bugSomething isn't working
    windows-osIssues related to Codex on Windows systems
    on Apr 2, 2026
  3. github-actions commented on Apr 2, 2026

    @github-actions
    Contributor
  4. cmeeren commented on Apr 2, 2026

    @cmeeren
    Author

    I believe this issue is distinct from those issues.

  5. cmeeren commented on Apr 7, 2026

    @cmeeren
    Author

    Note that this is a regression, not sure from which version, probably 1-2 releases earlier?

    Also, it impacts hand-off/commit availability in the UI - these operations are not available in worktrees created with this bug present, since the working dir is malformed.

    Image
  6. cmeeren commented on Apr 8, 2026

    @cmeeren
    Author

    Seems the following is a workaround: Don't select "New worktree" in the lower left when starting a new chat. That triggers the bug. Instead, start new chats using "Local", then immediately stop, switch to a worktree using "Hand off", and as the agent to continue.

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

    appIssues related to the Codex desktop appbugSomething isn't workingwindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions