Skip to content

Codex desktop intermittently ignores project cwd and runs commands in stale directory #42001

Open

Description

@agrolsy

Component

Codex desktop app for Windows (local task execution)

  • App package: OpenAI.Codex_26.825.6671.0_x64
  • Executable file/product version: 151.0.7922.174
  • OS: Windows
  • Shell: PowerShell

Summary

A task created from a saved local project can have the correct project ID and correct persisted cwd, while a command launched with that same explicit cwd intermittently starts in a stale, unrelated collection directory.

This is not a symlink/junction or path-normalization issue. The command runner appears to ignore the requested working directory and inherit/reuse stale process state.

Expected behavior

When a project is saved as:

C:\Users\<user>\repo\BuildableCV

and a command execution declares that path as cwd, Get-Location and the process working directory should resolve to that directory.

Actual behavior

The task metadata contained:

projectId: 79e3bbab-b1a0-450a-af89-b18140e8d8b8
cwd: C:\Users\<user>\repo\BuildableCV

A diagnostic PowerShell command was also launched with:

cwd: C:\Users\<user>\repo\BuildableCV

but returned:

PWD=C:\Users\<user>\OneDrive - Buildable\Claude
RESOLVED=C:\Users\<user>\OneDrive - Buildable\Claude
GIT_ROOT=

The unexpected directory is a collection folder containing multiple repositories and temporary worktrees. It is not the selected project and is not itself a Git repository.

Another command in the same task was launched in a stale worktree beneath that collection folder:

C:\Users\<user>\OneDrive - Buildable\Claude\work\ai-review-rollout-20260825\buildablecv

Later commands began honoring the requested project cwd again, so the behavior is intermittent.

Verification performed

  • The saved project path is C:\Users\<user>\repo\BuildableCV.
  • The affected task's persisted cwd is the same path.
  • Both the intended checkout and collection folder are ordinary directories, not links or junctions.
  • git -C C:\Users\<user>\repo\BuildableCV rev-parse --show-toplevel returns the intended checkout.
  • Its remote is the expected Azure DevOps repository.
  • The collection folder has no Git root.
  • Explicit Set-Location -LiteralPath ... or git -C ... works around the problem.

Reproduction evidence

Affected task ID:

01a05b04-f306-78f0-9a16-011744968359

Diagnostic command execution ID where declared cwd was ignored:

exec-867cf63c-4362-459e-9679-4469553a8930

Impact

Commands may read or modify the wrong repository even though the user selected a specific project and the command payload contains the correct cwd. Repository-level instruction files may also be missed because discovery starts in the wrong directory.

Suggested fix

Before launching every local command, resolve and set the subprocess working directory from the task/command cwd; do not reuse a shell host's previous process directory. If initialization fails or the resolved directory differs, fail closed and surface the mismatch instead of running the command.

Activity

  1. added
    bug
    app
    windows-os
    tool-calls
    on Sep 1, 2026
  2. LyonWu21 commented on Sep 7, 2026

    @LyonWu21

    Same issue

  3. eness-1 commented on Oct 15, 2026

    @eness-1

    Related recovery tooling, with an important distinction from this report:

    In our macOS/Codex 0.162.1 codex agents case, the saved session cwd itself changed across unrelated sessions. That differs from this report's correct metadata but incorrect command execution, so we cannot claim the same cause or that our helper fixes this issue.

    We shared the observation and an unofficial skill/helper in #24855. Source and usage: https://gist.github.com/eness-1/0f310b964349bce17e209acfe73f252a

    It may help only when inspection confirms that the saved directory is wrong: it repairs explicitly selected session paths through local app-server RPCs, preserving IDs/history without direct DB edits or model turns. If the saved directory is already correct, this tool is not the appropriate fix. Recovery must also be checked after entering/switching sessions; updating saved state alone did not initially persist for us.

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

    appbugtool-callswindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions