fix(core): default CODEX_HOME to platform config dir with legacy ~/.codex fallback #4414
+235
−26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates Codex's default state directory to follow platform conventions while preserving backward compatibility.
Summary
CODEX_HOME
is set and non‑empty, use it (canonicalized).~/.codex
exists, continue using it.dirs::config_dir()/codex
(XDG on Linux;~/Library/Application Support/codex
on macOS;%AppData%\codex
on Windows).config.codex_home
as before.Why
$HOME
clutter and aligns with XDG/AppData/Library conventions.Details
codex-rs/core/src/config.rs::find_codex_home()
implements the new resolution order.~/.codex
references with$CODEX_HOME
and document platform defaults + legacy fallback.Compatibility & Migration
~/.codex
are unaffected (explicitly preferred).CODEX_HOME
is set.Verification
just fmt
.just fix -p codex-core
.cargo test -p codex-core
→ PASScargo test --all-features
(workspace) → PASSCloses #4407.