Repository navigation
Description
What version of the Codex App are you using (From “About Codex” dialog)?
Desktop app version not verified. Bundled Codex CLI version: 0.163.0-alpha.10.2
What subscription do you have?
Plus
What platform is your computer?
Windows, OS build 26200, native PowerShell environment.
What issue are you seeing?
Summary
The desktop application's local Codex agent cannot create or update files inside an explicitly writable project under Documents. Reading the same project works.
The same apply_patch tool successfully created, read back, and deleted a harmless diagnostic file in the session's permitted visualizations directory. The failure therefore appears path/access-context dependent, rather than a complete failure of apply_patch.
Observed on 18 October 2026, Europe/Madrid.
Environment
- Desktop UI labelled ChatGPT, using the local Codex backend.
- Bundled executable reports: codex-cli 0.163.0-alpha.10.2.
- Desktop application version: not independently verified.
- Windows OS version reported locally: Microsoft Windows NT 10.0.26200.0.
- Native PowerShell environment.
- Workspace-write filesystem sandbox.
- The target project is explicitly listed among writable roots.
- Project location, with personal details redacted:
C:\Users<user>\Documents\Codex<date><project> - No Git repository is active in this project.
Expected behaviour
An authorised apply_patch operation should create or update a file inside the writable project, or return a specific actionable explanation for denying the operation.
Actual behaviour
apply_patch repeatedly returns:
“Failed to write file C:\Users<user>\Documents\Codex<date><project>\office<filename>.json”
Attempts to update existing files also failed. Absolute and relative paths were tested.
For the new JSON file, a subsequent filesystem check confirmed that it had not been created. An existing authorisation file's SHA-256 remained unchanged.
Checks and recovery attempts already performed
- Reading project files succeeds.
- The inspected file was not marked read-only.
- Opening and closing a write-access file handle succeeded WITHOUT writing bytes. This does not prove that actual writes succeed.
- Scoped write permissions for the specific target files were explicitly granted in one attempt; apply_patch still failed.
- Restarting the desktop application did not resolve the problem.
- Forking into another chat using the same directory did not resolve it.
- Both absolute and relative patch paths failed.
- The existing folder was subsequently added through File → Open folder.
- The project then appeared in the application's project inventory with the correct directory.
- The current chat was associated with that project.
- Another turn was started with the project explicitly present in writable roots. apply_patch still failed.
- A separate apply_patch probe in the session's permitted .codex\visualizations directory succeeded. Its content was read back, and the temporary probe was deleted successfully. It contained no project data.
Diagnostic comparison
Inside the restricted agent environment, codex doctor reported:
- Access denied while managing .codex\tmp\arg0-windows aliases/temp directories.
- Internal SQLite databases could not be opened:
“(code: 14) unable to open database file”. - Connectivity and security-inspection limitations.
These results do NOT establish database corruption. The checks ran inside a restricted environment.
The user separately ran this installed executable in a normal external PowerShell window, without administrator elevation:
codex doctor --summary --ascii --no-color
The reported summary was:
“20 ok | 1 idle | 5 notes | 4 warn | 0 fail degraded”
That external run reported:
- Sandbox configuration OK.
- WebSocket connected, HTTP 101.
- Active provider endpoints reachable.
- No locally visible recent Codex security enforcement found.
- Optional MCP configuration warnings remained.
This comparison may help distinguish restrictions affecting diagnostics from a problem in the installation itself. It does not identify the root cause.
Impact and safety
Project edits and progress-record updates are blocked.
No database files were deleted or repaired. No antivirus/security settings were disabled. No installations, financial operations, or project service restarts were performed as a workaround.
The root cause remains unconfirmed. Please investigate the effective filesystem permissions and execution context used by apply_patch for this project, including why the visualizations-directory probe succeeds while the explicitly writable project fails.
What steps can reproduce the bug?
Open an existing local project located under C:\Users\Documents\Codex.
Associate the current chat with that project.
Use workspace-write permissions with the project explicitly included in writable roots.
Ask the local agent to create a small new JSON file inside the project's office directory using apply_patch.
The operation fails with “Failed to write file …”. A subsequent filesystem check confirms that the new file does not exist.
The failure persisted with absolute and relative paths, explicit scoped write approval, an application restart, and a forked chat.
As a comparison, the same apply_patch tool successfully created a harmless test file in the session's permitted .codex\visualizations directory. Its content was read back and the test file was deleted successfully.
What is the expected behavior?
The agent should be able to create or update authorised files inside the explicitly writable local project. If an additional restriction blocks writing, the tool should provide a specific, actionable explanation instead of only “Failed to write file …”.
Additional information
Bundled CLI: codex-cli 0.163.0-alpha.10.2.
Reading project files works. Both creating new files and updating existing files failed.
Inside the restricted agent environment, Codex Doctor reported access-denied warnings for .codex\tmp\arg0-windows and SQLite code 14, “unable to open database file”. These errors do not establish database corruption.
The user ran the installed executable separately in normal PowerShell, without administrator elevation:
codex doctor --summary --ascii --no-color
External result:
20 ok | 1 idle | 5 notes | 4 warn | 0 fail degraded
The external run reported sandbox configuration OK, successful WebSocket and endpoint connectivity, and no locally visible recent Codex security enforcement.
The existing project was successfully added to the application's project inventory and the current chat was associated with it. A subsequent turn still could not write to the project.
No databases were deleted or repaired, no security settings were disabled, and no project services were restarted. The root cause remains unconfirmed.
Activity
github-actions commentedon Oct 17, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
JBTradesOA commentedon Oct 25, 2026
I can reproduce a closely related failure in the Windows Codex desktop app.
A local project under
C:\Users\<redacted>\Documents\Codex\...is explicitly included in the writable workspace roots. Reading files works, butapply_patchrepeatedly fails when updating the existing file:outputs\market_brief_tool\OA_BASE_BETA_DEVIATION_LOG.mdThe tool reports:
Failed to write file C:\Users\<redacted>\Documents\Codex\...\outputs\market_brief_tool\OA_BASE_BETA_DEVIATION_LOG.mdA separate attempt to create a minimal new file in the same project also failed.
Checks already completed:
Platform reported by the local environment:
Microsoft Windows NT 10.0.26300.0 x64This blocks project logging and safe isolated test work. Related in-app feedback session ID:
01a023b8-e406-71f2-a1e2-109593d215b8baghnon85-boop commentedon Oct 25, 2026
Additional sanitized diagnostics from a later reproduction:
codex-cli 0.164.0-alpha.11.1.codex doctor --json --summary:elevated; provisioning reported complete.apply_patchCREATE attempt still fails inside explicitly writable roots withFailed to write file ....failed to clean up stale arg0 temp dirs: Access is denied. (os error 5)could not create PATH aliases: Access is denied. (os error 5)%USERPROFILE%\.codex\tmp\arg0-windows\codex-arg0*.Modify, whilearg0-windowsgrants that group onlyReadAndExecute, Synchronize.orchestrator_helper_exit_nonzero: setup helper exited with status Some(1).codex doctoralso reported SQLite code 14 for internal state databases, but independent read-only immutablePRAGMA quick_checkreturnedokfor each inspected database. Database corruption is therefore not established, and no database was moved or modified.Please advise a supported repair for the arg0/PATH-alias provisioning context that does not require manual ACL edits, moving state databases, disabling the sandbox, or using a shell-based patch workaround.
Privacy/safety: no session context, project names, source code, local user name, Drive identifiers, raw logs, or attachments are included.
JBTradesOA commentedon Oct 26, 2026
I found a working workaround for my affected Windows Codex Desktop setup.
I installed Ubuntu under WSL2, completed the initial Ubuntu user setup, changed Codex Desktop’s integrated terminal shell from PowerShell to WSL, and fully restarted Codex Desktop.
After the restart, the local project was accessed through its WSL path:
/mnt/c/Users/<user>/Documents/Codex/<project>apply_patchcan now create and update files in the same project that previously failed under the native Windows/PowerShell execution context. Project logging and normal workspace edits are working again.This does not identify or repair the underlying Windows sandbox/
arg0-windowsissue. It only changes the execution environment and should therefore be treated as a workaround. The original failure remains relevant for users who need or prefer the native Windows environment.No manual ACL changes, database modifications, sandbox disabling, or Full Access setting were used.