Codex Desktop should avoid OneDrive-backed Documents as the default Windows project location
What version of Codex is running?
Codex Desktop on Windows. Exact Desktop build not included here because the issue is about the default workspace location behavior rather than a single runtime failure.
What platform is your computer?
Windows 11 with WSL2 enabled.
What issue are you seeing?
Codex Desktop can default or persist new/local project workspaces under the Windows Documents folder. On many Windows installs, Documents is redirected by OneDrive Known Folder Move, so the resulting workspace path becomes OneDrive-backed, for example:
C:\Users\<user>\OneDrive\Documents\<project>
This is a poor default for agent-driven coding work. Codex creates and modifies many files during normal operation, and Git repositories commonly keep frequently-open or lock-sensitive files under .git. OneDrive sync then becomes a source of persistent churn and fragility.
Why OneDrive-backed project folders are problematic
Observed/expected failure modes for Codex projects inside OneDrive-backed Documents:
- OneDrive may never reach a fully synced state while Git metadata and generated/temp files are open or changing.
- Git operations can become slow or flaky because the repository sits on a synced Windows filesystem.
- WSL-backed Codex sessions pay the additional
/mnt/cfilesystem performance cost, then add OneDrive sync overhead on top. - If OneDrive is paused, stopped, unavailable, or mid-conflict, the project can appear broken even though the issue is the sync layer.
- The default encourages users into a location that is actively hostile to local development workflows.
This is especially rough for Windows Desktop + WSL users. The better local default is usually a non-synced development folder, and for WSL-backed sessions it is often a native WSL path such as:
/home/<linux-user>/<project>
or, from the Windows UI side:
\\wsl.localhost\Ubuntu\home\<linux-user>\<project>
What steps can reproduce the issue?
- Use Codex Desktop on Windows where the user's Documents known folder is managed or redirected by OneDrive.
- Create/open a local Codex project using the default project location or recently persisted workspace root.
- Observe the workspace being placed or remembered under a OneDrive-backed Documents path.
- Use the workspace for a Git repository or agent-driven coding session.
- Observe OneDrive sync churn, open-file sync stalls, and poor Git/development ergonomics.
Expected behavior
Codex Desktop should avoid OneDrive-backed folders for new/default local project workspaces.
Possible fixes:
- Detect when the proposed default folder is under OneDrive and warn before creating or selecting it.
- Prefer a non-synced development default on Windows, such as
%USERPROFILE%\source,%USERPROFILE%\Code, or another local app-selected folder. - For WSL-enabled sessions, offer a WSL-native default such as
/home/<linux-user>/<project>and display it through the Windows UNC path when needed. - If a user explicitly chooses OneDrive anyway, allow it, but make it an intentional opt-in rather than the path of least resistance.
Actual behavior
Codex Desktop can persist and reopen a OneDrive-backed project root as the active/default workspace. Local state uses workspace-root fields equivalent to:
{
"electron-saved-workspace-roots": ["C:\\Users\\<user>\\OneDrive\\Documents\\<project>"],
"active-workspace-roots": ["C:\\Users\\<user>\\OneDrive\\Documents\\<project>"]
}
Additional context
This is not asking Codex to block OneDrive entirely. Some users may intentionally use synced folders. The issue is that OneDrive-backed Documents is a hazardous default for coding agents and Git workspaces, particularly on Windows + WSL setups where native WSL storage is materially better for development.
16 Comments
Additional code-level finding from inspecting the installed Codex Desktop bundle:
The previous workaround of changing persisted workspace roots does not affect Projects -> Start from scratch. That flow has a separate main-process path.
In the packaged Desktop app (
OpenAI.Codex_26.506.3741.0,app.asar), the relevant flow is:So the root cause is more specific than remembered workspace state: Start from scratch uses Electron
app.getPath("documents")as the hardcoded parent folder for new local projects. On Windows systems where Documents is redirected by OneDrive Known Folder Move,app.getPath("documents")resolves into a OneDrive-backed path, so Codex createsNew project,New project 2, etc. inside OneDrive.Related open issues:
~/Documents/Codex.Suggested implementation direction:
app.getPath("documents")resolves under OneDrive and warn or choose a safer local default./home/<linux-user>/..., displayed via\\wsl.localhost\...where the Windows UI needs it.This means users cannot currently fix this through
.codex-global-state.jsonworkspace roots alone; the Start from scratch code path needs its own configurable parent directory or OneDrive avoidance logic.Additional runtime evidence from Codex Desktop 26.506.3741.0 on Windows + WSL:
.codex-global-state.json,state_5.sqlitethreadcwd, session JSONL metadata, ambient suggestions,config.tomlproject trust entries, andcap_sidcwd capability mappings.C:\Users\<user>\OneDrive\Documents\New project, Desktop continues to launch WSL git probes against that root, for examplegit ls-files/git add -Awith temp index state. In this environment that left OneDrive stuck in an incomplete upload state and created open handles under.git/objects.This makes the upstream fix more than a UX default: Desktop should avoid OneDrive-backed known folders for new projects, expose a configurable default project root, and ideally provide a supported project-state migration path from OneDrive to a local/WSL-native location.
related: [Feature Request: [App] Make the "Chats" project directory configurable #19909 ](https://github.com/openai/codex/issues/19909)
Additional impact after migrating active work away from OneDrive/Documents.
The default-to-Documents behavior is especially harmful in Windows + WSL mode because it compounds two slow/fragile layers:
/mnt/c/..., triggering the WSL cross-filesystem performance warning and slower IO.In this setup the practical stable pattern is:
/home/<wsl-user>/<project>C:\Users\<user>\.codexonly for Desktop app state/configA better new-project flow would let Windows Desktop users choose a persistent default root and, when WSL mode is enabled, strongly prefer a WSL-native default such as
/home/<wsl-user>over Windows Documents/OneDrive.Ironically, I came here to file the exact opposite issue. I genuinely DO want my Codex projects in OneDrive, and on my machine they have been hardcoded to go into userprofile\Documents which is not where I want them. So I don't know if this is a simple default change or a deeper bug.
You're gonna be in a world of hurt if you move them into OneDrive unless you disable git, it's perpetual constant churn, I would batch copy backups to a OD folder but NOT keep it as a live project folder. Also Onedrive should be you default documents root, I'm surprised it's not mapped there? Either way I'd look at simply automating copying the actual project artifacts you want to backup to a OD destination instead of using it as a live folder. OD client is not made to handle the churn, you're talking about tens of thousands of git objects if not more for a typical project. Beyond that, your entire chat history will live there, which means if you turn off one drive or pause sync, your chat sessions will literally disappear if you launch it with OD paused or disabled. There's really no gain.
Oh wow, I didn't realize that start from scratch actually puts your git repo inside that folder. That is absolutely terrible just as you described. I keep my git repos in a separate tree and just want the workspace metadata to be persisted in OneDrive really. (so I can switch to a different computer and keep working) But yes, for this specific issue, git repos absolutely should not be placed inside OneDrive.
This also has historically affected macOS with OneDrive. Unsure of whether it still does, but I'd never suggest doing git repos in OneDrive for that reason. The macOS setup uses ~/Documents as a OneDrive hooked up location too, so this should be avoided / configurable.
Adding a concrete Windows datapoint that supports avoiding OneDrive-backed project roots for active coding work.
In my environment, a
New projectworkspace under a OneDrive-backed Documents path became effectively I/O-bound during normal JS project setup:pnpm installproduced a partially builtnode_modulesof about90,910files /2.8 GB;.worktreesaround250,160files /6.23 GB;.gitwas around2.44 GB;After stopping the stuck install and cloning/moving the active repo to a non-synced local path under
F:\openclaw\repos\newproject-fast, the same class of work became normal:17s;2sathttp://127.0.0.1:5173/.This was a separate issue from a degraded old Codex thread on the same machine, which is important: moving the repo out of OneDrive fixed the project I/O problem, but it did not make an already bloated long-context Desktop thread safe to continue.
Requested product behavior:
.git,.worktrees,node_modules, or large file counts are detected;Related narrower diagnostic-boundary issue: #28345.
I prepared a small patch for this, but GitHub is not letting my account open the upstream PR directly.
bdb39c2d18010437da18d5125cfbd8ec77c6ea1cTL;DR
Warn before opening Codex Desktop on Windows with a OneDrive-backed workspace.
codex app <path>currently opens Desktop without any signal when<path>is insideOneDriveorOneDrive - .... That is an easy trap for active coding work, since Git metadata, worktrees, and package-manager directories can create a lot of small-file churn in synced folders.What changed
OneDriveandOneDrive - ...path components on the Windowscodex apppathnode_modulesslow or fragileWhy
This keeps behavior unchanged and does not try to change Desktop's Start from scratch default location. It only makes the risk visible at the CLI boundary where the workspace path is already known.
Related: #28345.
Test plan
git diff --checkcargo fmt -p codex-clicargo test -p codex-cli desktop_app::windowsI could not run the Rust checks locally because this Windows machine does not currently have
cargo/rustupinstalled.I tried to open this as a PR, but GitHub returned
CreatePullRequestpermission errors for my account againstopenai/codex. If maintainers are open to the change, I can open the PR once invited/enabled, or the commit can be cherry-picked.I had this problem as described in https://github.com/openai/codex/issues/28729
Keeping human readable documents in a Onedrive scoped folder is proper behavior and is where users will expect to find docx, xlsx, pptx files.
Code files should rely on github etc coding specific backup systems. This is especially true for generated ephemera rather than files a human is likely to want to edit or otherwise manage by hand.
This is a situation where a warning is insufficient and likely to be ineffective. Codex should have a strong bias to keep generated, constantly changing files out of Onedrive et al while relatively stable files should be perfectly fine to live within it, especially given Windows love of making "Documents" a Onedrive folder.
Better harness defaults can prevent issues that make sense after you've experienced and diagnosed them but are incomprehensible and unexpected ahead of time.
I fixed the overall issue by creating a global codex rule that kept human readable artifacts in a OneDrive scoped folder while git internals and throwaway files went into C:\tmp.
This way I can easily find files in my Documents folder without breaking OneDrive sync. Output - xlsx, png, md, html, css - lives in an expected project related hierarchy.
FWIW same on Mac
Corroborating enterprise Windows data point: this can progress beyond ordinary Git slowness or transient sync churn into a OneDrive client failure that prevents new files from reaching SharePoint.
Environment: Windows 11, enterprise Microsoft 365/OneDrive Known Folder Move, Codex Desktop package
OpenAI.Codex 26.715.2305.0.We reproduced the following sequence:
The intervention and reversal make the agent-generated filesystem churn a demonstrated cause in this environment, rather than merely a correlated risk. SharePoint service throttling may compound incidents, but it was not required for this failure: the post-stall files had not reached SharePoint at all.
One affected machine was remediated preventively by moving its active Windows Documents location out of OneDrive, so newly created Codex workspaces now land in a local
Documents\Codextree. That works as an administrative workaround, but Codex should not require users to alter Known Folder configuration to obtain a safe agent workspace.The product characteristics that make this easy to trigger are:
Requested mitigations:
%LOCALAPPDATA%\OpenAI\Workspaces, with a configurable override.No raw logs or session data are attached because they may contain private enterprise content.
Follow-up after completing a controlled end-to-end recovery on an affected enterprise Windows endpoint:
The recovery succeeded. We rebuilt more than a dozen OneDrive/SharePoint relationships, restored dozens of endpoint-only files after exact remote checks, performed zero remote overwrites, and ended with stable relationships and no postponed file, folder, or migration records. Developer/runtime workspace material was retained locally and was deliberately not returned to synced folders.
A few findings may be useful for the product design:
The product mitigations I would prioritize are:
A warning at workspace selection would help, but safe defaults matter more: users generally cannot predict that an apparently normal Documents folder can eventually produce silent local-only files that never reach the cloud.
No enterprise files, raw logs, tenant identifiers, or recovery artifacts are included here.