Skip to content

[codex] Move config loading into codex-config#19487

Merged
pakrym-oai merged 4 commits intomainfrom
pakrym/config-loaders-config-crate-full-ci
Apr 26, 2026
Merged

[codex] Move config loading into codex-config#19487
pakrym-oai merged 4 commits intomainfrom
pakrym/config-loaders-config-crate-full-ci

Conversation

@pakrym-oai
Copy link
Copy Markdown
Collaborator

@pakrym-oai pakrym-oai commented Apr 25, 2026

Why

Config loading had become split across crates: codex-config owned the config types and merge logic, while codex-core still owned the loader that assembled the layer stack. This change consolidates that responsibility in codex-config, so the crate that defines config behavior also owns how configs are discovered and loaded.

To make that move possible without reintroducing the old dependency cycle, the shell-environment policy types and helpers that codex-exec-server needs now live in codex-protocol instead of flowing through codex-config.

This also makes the migrated loader tests more deterministic on machines that already have managed or system Codex config installed by letting tests override the system config and requirements paths instead of reading the host's /etc/codex.

What Changed

  • moved the config loader implementation from codex-core into codex-config::loader and deleted the old core::config_loader module instead of leaving a compatibility shim
  • moved shell-environment policy types and helpers into codex-protocol, then updated codex-exec-server and other downstream crates to import them from their new home
  • updated downstream callers to use loader/config APIs from codex-config
  • added test-only loader overrides for system config and requirements paths so loader-focused tests do not depend on host-managed config state
  • cleaned up now-unused dependency entries and platform-specific cfgs that were surfaced by post-push CI

Testing

  • cargo test -p codex-config
  • cargo test -p codex-core config_loader_tests::
  • cargo test -p codex-protocol -p codex-exec-server -p codex-cloud-requirements -p codex-rmcp-client --lib
  • cargo test --lib -p codex-app-server-client -p codex-exec
  • cargo test --no-run --lib -p codex-app-server
  • cargo test -p codex-linux-sandbox --lib
  • cargo shear
  • just bazel-lock-check

Notes

  • I did not chase unrelated full-suite failures outside the migrated loader surface.
  • cargo test -p codex-core --lib still hits unrelated proxy-sensitive failures on this machine, and Windows CI still shows unrelated long-running/timeouting test noise outside the loader migration itself.

@pakrym-oai pakrym-oai marked this pull request as ready for review April 25, 2026 04:03
@pakrym-oai pakrym-oai requested a review from a team as a code owner April 25, 2026 04:03
Comment thread codex-rs/config/src/loader/mod.rs Outdated

#[cfg(unix)]
fn system_config_toml_file() -> io::Result<AbsolutePathBuf> {
#[doc(hidden)]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed Codex likes to add these sometimes. We should add something to our AGENTS.md about this? Please don't add them: they're just distracting in our case and I worry others will copy the pattern.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current status:

$ rg '#\[doc\(hidden\)\]' | wc -l
      12

@@ -26,17 +26,8 @@ where
let mut env_map = populate_env(vars, policy, thread_id);

if cfg!(target_os = "windows") {
// This is a workaround to address the failures we are seeing in the
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct to remove?

@@ -706,7 +706,7 @@ fn notification_sender(inner: &Inner) -> Option<RpcNotificationSender> {
#[cfg(test)]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by comment: please adopt the _tests.rs pattern in the exec-server crate!

Comment thread codex-rs/core/src/lib.rs Outdated
Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the refactor!

@pakrym-oai pakrym-oai merged commit 9c3abcd into main Apr 26, 2026
45 of 50 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/config-loaders-config-crate-full-ci branch April 26, 2026 22:10
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants