Repository navigation
Conversation
Add layered configuration loading to support project-specific settings alongside global user configuration: Config loading: - Add project_config_path field to LoaderOverrides - Load from ./.codex/config.toml (project-local) - Merge project config over user config, with managed layers on top - Add tests: merges_project_overrides_user, managed_overrides_project Prompts discovery: - Implement discover_prompts_merged() to combine global and local prompts - Add project_prompts_dir_for() helper for ./.codex/prompts/ - Project-local prompts override global when names collide - Add tests: merges_global_and_local, local_wins_on_conflict Documentation: - Update docs/config.md with precedence rules - Update docs/prompts.md with dual-directory behavior Precedence order (highest to lowest): 1. CLI overrides 2. Managed preferences (macOS) 3. Managed config file 4. Project-local config (./.codex/config.toml) 5. Global user config (~/.codex/config.toml) 6. Built-in defaults
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
💡 Codex Review
codex/codex-rs/core/src/config.rs
Lines 310 to 326 in 3ef81a4
The new docs say CLI overrides should have the highest precedence, but apply_overlays still merges managed_config and managed_preferences after the CLI values. That means any value set via --config can be overwritten by a device-managed file or profile, contradicting the documented precedence and surprising users who expect the flag to win. Reordering the merge so managed layers are applied first and CLI overrides last would make runtime behaviour match the documented order.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…edence Reorder overlay application in `apply_overlays` so managed layers (managed_config + managed_preferences) merge first, and CLI `--config` key=value overrides apply last. This ensures flags always win over device-managed config, matching docs/config.md precedence. Also adds a test (`cli_overrides_take_highest_precedence_over_managed_layers`) to codex-core validating the new order.
|
I've updated the PR according to the #5341 (review). |
|
Finally someone decided to do it 🔥 |
|
Hi @aibrahim-oai / @joshka-oai / @nornagon-openai / ... , can you take a look? Thanks! |
|
Thanks for the contribution, and apologies for the slow response. We've updated our contribution guidelines to clarify that we're currently accepting contributions for bugs and security fixes, but we're not generally accepting new features at this time. We need to make sure that all new features compose well with both existing and upcoming features and fit into our roadmap. The feature you're implementing in this PR has received (and continues to receive) a lot of upvotes, so it's likely something that will receive attention by the codex team in the near future. We'll need to do some design work to ensure that the feature composes well with other features that we have in the works — and that it works well across all our local surfaces (CLI and IDE extensions). We're using this feature request to track this feature. I've added a link to this PR, which I think is a good proof of concept. In the meantime, I'm going to close this PR in an effort to manage the backlog. |
Add layered configuration loading to support project-specific settings alongside global user configuration:
Config loading:
project_config_pathfield toLoaderOverrides./.codex/config.toml(project-local)merges_project_overrides_user,managed_overrides_projectPrompts discovery:
discover_prompts_merged()to combine global and local promptsproject_prompts_dir_for()helper for./.codex/prompts/merges_global_and_local,local_wins_on_conflictDocumentation:
docs/config.mdwith precedence rulesdocs/prompts.mdwith dual-directory behaviorPrecedence order (highest to lowest):
./.codex/config.toml)~/.codex/config.toml)