codex icon indicating copy to clipboard operation
codex copied to clipboard

Codex Windows App uses hardcoded %USERPROFILE%\.codex path — ignores CODEX_DIR / CODEX_HOME env vars

Open CTCycle opened this issue 4 months ago • 6 comments

Feature Request

The Codex Windows App stores its user data (sessions, logs, memories, auth) in a hardcoded %USERPROFILE%\.codex directory and ignores the CODEX_DIR and CODEX_HOME environment variables that the Codex CLI tool respects.

Use Case

Users on Windows with limited C: drive space (e.g. small SSDs) or specific data organization requirements need to relocate the .codex data directory to another drive or path. Currently the only workaround is a directory symlink/junction, which is fragile and not officially supported.

Requested Behaviour

The Codex Windows App should read one of the following (in priority order) to determine where to store its user data:

  1. A CODEX_DIR or CODEX_HOME environment variable (matching the CLI tool behaviour)
  2. A config.toml setting (e.g. data_dir = "D:\Codex\data")
  3. Fall back to the current hardcoded %USERPROFILE%\.codex default

Why This Matters

  • Disk space management: ~/.codex can exceed 2 GB (session databases, logs, plugin caches)
  • Organisation: Users may keep all app data on a dedicated data drive
  • Consistency: The CLI tool already honours CODEX_DIR; the Windows App should too
  • Sync control: Users may want to exclude .codex from cloud backup on C: while keeping it on a local-only data drive

Workaround (not ideal)

Currently the only option is to manually create a directory junction/symlink:

mklink /D "%USERPROFILE%\.codex" "D:\path\to\.codex"

This requires Developer Mode or admin privileges and is unsupported by the app.

Environment

  • Windows App version: 26.715.3651.0
  • Windows 10 (local terminal, not WSL)
  • The Codex CLI tool (invoked via codex from terminal) does respect CODEX_DIR

CTCycle avatar Jul 18 '26 21:07 CTCycle

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #33635

Powered by Codex Action

github-actions[bot] avatar Jul 18 '26 21:07 github-actions[bot]

Additional Windows Desktop failure case from a disk-cleanup attempt:

  • Codex Desktop build: 26.721.41059
  • Codex CLI: 0.145.0
  • Windows, native Desktop app
  • A user-level CODEX_HOME and CODEX_SQLITE_HOME were pointed at a copied alternate-drive directory to reduce C: usage.
  • The copied directory did not contain a fully consistent snapshot of all live authentication and SQLite state.
  • After the change, the user was unable to enter/use Codex normally for several hours and the app appeared disconnected from its expected login/local state.
  • Recovery was to remove both environment-variable overrides and return the live home to %USERPROFILE%\.codex. codex login status then reported Logged in using ChatGPT, and the active state database resumed writes under the default C: path.

This suggests relocation needs to be treated as an atomic, app-aware operation rather than a cache move. It would help if Desktop either:

  1. officially supported a single storage-location setting with atomic migration and validation, or
  2. rejected/warned about an incomplete alternate CODEX_HOME, clearly showing the active home path and offering a safe rollback.

Until then, moving the live home is not a safe disk-cleanup workaround. Only inactive session payloads should be archived, with authentication/configuration/live SQLite state kept in the default home.

xiaeducation9-maker avatar Jul 27 '26 08:07 xiaeducation9-maker

There is also an important multi-installation use case for this request.

On Windows, users may have both the stable ChatGPT/Codex desktop app and the beta app installed under the same Windows user account. These are useful as two independently configured clients: for example, stable connected to a WSL2 development environment and beta connected to the Windows-native environment.

At the moment, both app variants share %USERPROFILE%\\.codex, including config.toml and desktop state. As a result, changing the Agent Environment in one app changes the effective environment of the other app as well. This prevents users from running the two builds concurrently with different environments.

Please consider supporting an explicit per-app Codex home, for example:

  • Stable app: %USERPROFILE%\\.codex
  • Beta app: %USERPROFILE%\\.codex-beta

This could be implemented through an app-specific setting, a supported CODEX_HOME override honored by the desktop app, or another stable profile mechanism. The isolated root should cover configuration, auth, sessions, skills/plugins, caches, and SQLite state, with a safe first-run migration/copy flow.

This is not a request to use two Windows accounts. The goal is to keep both app variants usable at the same time under one Windows account, with one fixed to WSL and the other fixed to Windows native. If per-app isolation is not desired long-term, a single-app per-project Remote-WSL model would solve the underlying workflow problem; until then, isolated app roots would be a practical fallback.

tidytorch avatar Aug 06 '26 05:08 tidytorch

Hi @CTCycle, cross-platform WSL/Windows path mismatches often make healthy transcripts look broken when workspace contexts change. Codex Rescue Alpha5 explicitly separates transcript integrity from workspace path-family portability without rewriting saved paths.

If you'd like to check the local rollout safely:

pip install codex-rescue==0.1.0a5
codex-rescue doctor --latest

Please sanitize private paths before posting any output.

boombx403-byte avatar Aug 18 '26 12:08 boombx403-byte

I strongly support this feature request. As a Windows Codex Desktop user, I would like to choose where conversations, sessions, logs, and application data are stored. A built-in option to move existing data safely to another drive would be very helpful, especially when the system drive is running out of space. This should not require manually creating symbolic links or junctions.

danielmasse81-png avatar Oct 29 '26 17:10 danielmasse81-png

A real-world PC migration problem, not just a storage-location preference

I strongly support this issue, but I believe it highlights a much bigger problem: Codex Desktop does not provide a reliable, documented migration process when replacing a Windows PC.

I recently migrated my development environment from an older Windows computer to a new one, with a different Windows username and user profile.

My projects were deliberately organized on a separate D: drive, so that the entire project directory could be backed up and transferred to the replacement computer.

Unfortunately, copying the projects was not enough.

Codex-related state was also tied to the old Windows user profile and system-drive locations. The migration required substantial manual recovery and troubleshooting because the new computer did not have the same user paths.

Replacing a computer is a routine operation, not an edge case. Users should not need to understand Codex's internal SQLite databases, authentication storage, or undocumented directory structure to accomplish it.

I would strongly recommend that OpenAI provide:

  1. An officially supported migration/export-and-restore procedure covering sessions, configuration, skills, project associations, and other essential local state.
  2. Automatic detection and remapping of changed Windows usernames and project paths.
  3. A configurable data location consistently respected by the Windows Desktop app and CLI.
  4. Migration validation, clear error reporting, and safe rollback, rather than forcing users to troubleshoot broken installations.
  5. Clear documentation of what is stored locally, what is synchronized to the cloud, and what must be backed up. Sensitive credentials should be handled through secure re-authentication.
  6. Visibility and control over disk usage, so local session data and caches do not grow indefinitely on the system drive.

This is not merely a convenience feature. It is about data portability, reliability, and user trust.

Codex is intended for serious, long-running development work. Users should be confident that replacing their computer will not jeopardize that work or require an improvised migration procedure.

Please treat Windows PC migration as a first-class supported workflow, not an afterthought.

slartibartifasta-lab avatar Nov 30 '26 18:11 slartibartifasta-lab