Codex Desktop Windows apply_patch fails with CryptUnprotectData after creating file
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- desktop, operating-systems, security, tooling
Research direction
Start by reproducing the Windows sandbox helper failure with apply_patch using the minimal create, read, and remove task in a local workspace. Trace the handling around CryptUnprotectData and verify the fix by confirming that the helper can read, edit, and delete a file it created.
Written by the indexing model from the issue text.
Description
What version of the Codex App are you using (From “About Codex” dialog)?
Powered by Codex & OWL Version 26.727.51351
What subscription do you have?
Pro
What platform is your computer?
No response
What issue are you seeing?
Environment:
- Official OpenAI Codex Desktop
- Windows
- Workspace: C:\Projects\Project Genesis
- Git repository is healthy
- npm install and npm run build succeed
- Direct terminal file writes succeed
- Workspace is local and no longer inside OneDrive
Summary:
The Codex apply_patch sandbox can create a file, but subsequent read or delete
operations fail with a Windows DPAPI error.
Reproduction:
- Open a local Git repository in Codex Desktop.
- Start a new task.
- Create codex-patch-test.tmp using apply_patch.
- Confirm the creation patch reports success.
- Attempt to remove the same file using apply_patch.
Actual result:
The removal fails because the sandbox cannot read the file:
apply_patch verification failed:
Failed to read C:\Projects\Project Genesis\codex-patch-test.tmp:
fs sandbox helper failed with status exit code: 1:
windows sandbox failed:
CryptUnprotectData failed: 2148073483
Expected result:
The patch sandbox should be able to read and remove a file that it just
created.
Additional observations:
- Direct terminal writes in the same workspace succeed.
- git status and production build work outside the broken sandbox.
- The issue persisted after moving the repository from OneDrive to a normal
local path. - The issue persisted across new Codex tasks.
- No source-code changes could be completed because project editing requires
apply_patch. - A temporary codex-patch-test.tmp file may remain after reproduction.
Impact:
Codex Desktop cannot modify the repository, so development work is blocked.
What steps can reproduce the bug?
Environment:
- Official OpenAI Codex Desktop app
- Windows 10/11
- Local Git workspace: C:\Projects\Project Genesis
- Repository is not inside OneDrive
- Git, npm, Prisma, and terminal file operations work normally
Steps to reproduce:
- Open the official Codex Desktop app on Windows.
- Create or open a Codex project using this local workspace:
C:\Projects\Project Genesis - Start a new Codex task.
- Ask Codex to verify patch access by creating a temporary file with apply_patch:
codex-patch-test.tmp - The creation patch reports success and the UI shows:
“Edited codex-patch-test.tmp +1 -0” - Ask Codex to remove the same file using apply_patch.
- The removal fails because the sandbox helper cannot read the file it just created.
Actual error:
apply_patch verification failed: Failed to read
C:\Projects\Project Genesis\codex-patch-test.tmp:
fs sandbox helper failed with status exit code: 1:
windows sandbox failed:
CryptUnprotectData failed: 2148073483
Expected behavior:
Codex should be able to read, edit, and delete a file that it created with
apply_patch in the active writable workspace.
Actual behavior:
The first creation patch can report success, but subsequent patch operations
that need to read the created file fail with CryptUnprotectData. This blocks
all source-code editing because Codex requires apply_patch for modifications.
Minimal reproduction task:
“Use apply_patch to create a file named codex-patch-test.tmp containing the
text test. Then use apply_patch to remove the same file.”
Relevant observations:
- The active workspace root is correctly reported as:
C:\Projects\Project Genesis git rev-parse --show-toplevelreturns the correct local path.git status --shortandgit diff --checkare clean before reproduction.- Direct terminal creation and deletion of files in the same directory work.
npm install,prisma generate, andnpm run buildsucceed.- The repository was previously copied from OneDrive to a normal local path,
but the error persists in newly created Codex projects and tasks. - Restarting Codex Desktop and creating new tasks did not resolve the issue.
- No application source-code changes are required to reproduce it.
- A temporary
codex-patch-test.tmpfile may remain after the failed removal.
Code snippet / reproduction instructions:
Workspace:
C:\Projects\Project Genesis
Task prompt:
1. Create codex-patch-test.tmp with apply_patch.
2. Read the file using the normal Codex sandbox.
3. Remove codex-patch-test.tmp with apply_patch.
4. Report any sandbox error.
### 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/codex
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug CLI windows-os
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
macOS sandbox blocks hw.optional.arm64 sysctl, causing Flutter to misdetect Apple Silicon as x64 Openbug CLI sandbox
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug CLI TUI
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
CLI config enhancement skills
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
A-linter
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
oxc-project/oxc#26863 ·