On Windows, Codex could edit the project, but Git could not create its lock file and pytest stopped before the first test. I compared both failures in the same repository and Python environment.
Table of Contents
The code was ready. All that remained was to run the tests and commit. When Git could not write index.lock, I wondered whether the repository corruption I had dealt with before was back. But git status listed the changes and the object database passed its integrity check. In a separate command, pytest exited while setting up its own temporary directory. Both commands were part of my daily workflow, and both failed well before reaching the code I had changed.
01A writable checkout can have read-only Git metadata
I tested the write with a throwaway index. I gave it a different name inside .git so the real index stayed out of the experiment. The process could read HEAD. As soon as Git tried to create a lock for the temporary index, it got Permission denied. Earlier that day, a pull in another checkout had failed to write .git/FETCH_HEAD. A successful git status only established that the read path worked.
Under the default workspace-write policy, Codex protects .git at the workspace root as read-only. In a linked worktree, that protection also covers the real directory the .git file points to. Both git add and git commit need to write repository metadata, so editing a file and committing the change require different permissions. OpenAI released Codex CLI in April 2025. By September, its docs described this macOS restriction, and a November issue recorded the same index.lock symptom. The Windows desktop app shipped in March 2026. An April Windows report recorded a similar failure, with a linked-worktree reproduction added later.
The Codex CLI launch announcement
Codex configuration docs from 2025
Windows desktop launch announcement
The Windows Git report and linked-worktree reproduction
02pytest never reached the first test
I kept the project's Python 3.13 and started with a small set of tests, then explicitly enabled MXC on Windows. pytest-xdist began starting workers, and pytest reported could not create numbered dir with prefix pytest-. The path was under the Packages\sandbox.{…}\AC\Temp directory supplied by MXC. No application assertions had run by that point.
Pointing only PYTEST_DEBUG_TEMPROOT into the project got the workers started, but project fixtures still failed on temporary-directory permissions. They also used Python's tempfile. I pointed TMPDIR at the same writable directory and kept all four workers. I added a set of path tests, and all 13 targeted tests finished. That result applies to this MXC reproduction on my machine. In another Windows report, the legacy sandbox still denied access to private directories created by Python and pytest after the temp root had been moved into the workspace.
Windows pytest temp-file failures had been reported by January 2026. In early November, a separate report documented an unusable AC\Temp supplied by MXC. OpenAI's November 18 engineering post confirmed the move from the older restricted Windows account design to MXC. The public reports establish that other users hit similar symptoms, but they cannot tell me how many installations were affected or when the failure started on mine.
The January 2026 Windows pytest report
The pytest-xdist temp-directory reproduction
OpenAI's explanation of the MXC transition
03What I changed
A project-local temp directory got this pytest run moving. Git still needed a separate permission change. I wanted one setup for the projects on this development machine, so I chose user-level Full access. I added these lines at the top of ~/.codex/config.toml. The first removes Codex's local sandbox restrictions. The second turns off command approval prompts. Commands can then use my Windows account's file and network access beyond the repository.
default_permissions = ":danger-full-access"
approval_policy = "never"I started a fresh Codex process, created a disposable checkout outside the original project, made a commit, and pushed it to a local bare repository. I also verified writes outside that checkout, pytest's tmp_path, and Python's temp directories. All four pytest workers finished. The original project's full run reached the assertions: 7,528 passed, one assertion failed, and 15 were skipped. Once the suite could finish, I traced the failing assertion to an outdated prompt string. After updating it and integrating the upstream changes, the full run finished with 7,537 passing tests and 15 skips.
I wish Codex had identified the blocked resource on the first failure: Git metadata or the temp directory supplied to the test process. In the terminal both can show up as a permission error, yet they call for very different fixes.