Skip to content

~/.codex/ treated as project config when running from home directory #9932

@0xble

Description

@0xble

What version of Codex is running?

codex-cli 0.91.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.2-codex

What platform is your computer?

macOS (Darwin 25.2.0), zsh, installed via Homebrew

What issue are you seeing?

When running codex from the home directory (~), the global config folder ~/.codex/ is treated as both a user config (trusted) and a project config (untrusted), causing this warning:

⚠ The following config folders are disabled:
1. /Users/username/.codex
   Add /Users/username as a trusted project in /Users/username/.codex/config.toml.

The ~/.codex/ folder is the canonical user config location and shouldn't require explicit trust as a "project."

Root cause

In codex-rs/core/src/config_loader/mod.rs, the config loading works as follows:

  1. User config is loaded from $CODEX_HOME/config.toml (lines 164-174) - always trusted
  2. Project configs are found by load_project_layers() walking from cwd up to project root, looking for .codex/ folders (lines 658-748)

When cwd is the home directory and no .git marker is found, find_project_root() returns cwd itself. Then load_project_layers() finds ~/.codex/ and treats it as a project config requiring trust.

The issue is that load_project_layers() doesn't check if the discovered .codex/ folder is the same as $CODEX_HOME.

Steps to reproduce

  1. cd ~
  2. Ensure ~ has no .git directory (or ancestors with .git)
  3. Run codex
  4. See the warning about disabled config folders

Expected behavior

~/.codex/ should not require trust when it's the user's global config directory. The load_project_layers() function should skip directories where dot_codex == codex_home.

Suggested fix

In load_project_layers(), add a check to skip when the discovered .codex/ folder matches $CODEX_HOME:

let dot_codex = dir.join(".codex");
let dot_codex_abs = AbsolutePathBuf::from_absolute_path(&dot_codex)?;

// Skip if this is the user's global config directory
if dot_codex_abs.as_path() == codex_home {
    continue;
}

Workaround

Add the home directory as a trusted project in ~/.codex/config.toml:

[projects."/Users/username"]
trust_level = "trusted"

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions