Codex Desktop creates ~/.codex/sqlite/codex-dev.db despite custom CODEX_HOME

Open 💬 0 comments Opened Jul 28, 2026 by lancy69

What version of the Codex App are you using (From “About Codex” dialog)?

26.721.41059 (build 5848)

Bundled CLI: codex-cli 0.146.0-alpha.3.1

What subscription do you have?

ChatGPT Plus

What platform is your computer?

Darwin 25.5.0 arm64 arm

macOS 26.5.2 (25F84)

What issue are you seeing?

I configured Codex to use XDG-style storage:

XDG_DATA_HOME=$HOME/.local/share
CODEX_HOME=$HOME/.local/share/codex

Codex backend processes see the expected environment:

CODEX_HOME=$HOME/.local/share/codex
XDG_DATA_HOME=$HOME/.local/share
CODEX_SQLITE_HOME=<unset>

The core Codex databases are correctly stored under the custom CODEX_HOME:

$CODEX_HOME/state_5.sqlite
$CODEX_HOME/logs_2.sqlite
$CODEX_HOME/memories_1.sqlite
$CODEX_HOME/goals_1.sqlite
$CODEX_HOME/sqlite/codex-history-snapshots-dev.db

However, Codex Desktop separately creates:

$HOME/.codex/sqlite/codex-dev.db

In this setup, $HOME/.codex contains only this Desktop SQLite directory.

The database is valid (PRAGMA integrity_check returns ok) and contains nine Desktop-specific tables, including automations, automation_runs, inbox_items, local_thread_catalog, local_thread_catalog_hosts, local_thread_catalog_metadata, local_thread_catalog_sync_state, thread_timeline_ledger, and local_app_server_feature_enablement.

There appears to be an environment-resolution split:

# Inside a Codex-spawned process
CODEX_HOME=$HOME/.local/share/codex

# GUI launchd environment
launchctl getenv CODEX_HOME
# empty

The backend resolves the custom home through the shell environment, while the Electron/Desktop SQLite layer apparently falls back to $HOME/.codex.

What steps can reproduce the bug?

  1. Configure the login shell with:

``sh
export XDG_DATA_HOME="$HOME/.local/share"
export CODEX_HOME="$XDG_DATA_HOME/codex"
``

  1. Launch ChatGPT/Codex Desktop from Finder or the Dock.
  2. Start or open a local Codex task.
  3. Confirm that core databases are written under $CODEX_HOME.
  4. Observe that $HOME/.codex/sqlite/codex-dev.db is also created.
  5. Fully quit and reopen the app; the default-path database continues to be used or recreated.

What is the expected behavior?

All Codex local state, including the Desktop UI database, should use the resolved CODEX_HOME, or the Desktop app should consistently propagate the resolved home to every component.

Expected path:

$CODEX_HOME/sqlite/codex-dev.db

Additional information

The result is two independent Codex homes:

$HOME/.local/share/codex          # backend/core state
$HOME/.codex/sqlite/codex-dev.db # Desktop UI state

Potentially related reports:

  • #28479 — Desktop component lacks CODEX_HOME/CODEX_SQLITE_HOME
  • #29953 — Desktop helper creates a second SQLite home
  • #34070 — Windows Desktop ignores CODEX_HOME

I am not attaching the raw database because thread_timeline_ledger may contain task payloads and other private data.

View original on GitHub ↗