core-agent-ide/codex-rs/app-server/tests/suite/v2
Michael Bolin b903285746
feat: migrate to new constraint-based loading strategy (#8251)
This is a significant change to how layers of configuration are applied.
In particular, the `ConfigLayerStack` now has two important fields:

- `layers: Vec<ConfigLayerEntry>`
- `requirements: ConfigRequirements`

We merge `TomlValue`s across the layers, but they are subject to
`ConfigRequirements` before creating a `Config`.

How I would review this PR:

- start with `codex-rs/app-server-protocol/src/protocol/v2.rs` and note
the new variants added to the `ConfigLayerSource` enum:
`LegacyManagedConfigTomlFromFile` and `LegacyManagedConfigTomlFromMdm`
- note that `ConfigLayerSource` now has a `precedence()` method and
implements `PartialOrd`
- `codex-rs/core/src/config_loader/layer_io.rs` is responsible for
loading "admin" preferences from `/etc/codex/managed_config.toml` and
MDM. Because `/etc/codex/managed_config.toml` is now deprecated in favor
of `/etc/codex/requirements.toml` and `/etc/codex/config.toml`, we now
include some extra information on the `LoadedConfigLayers` returned in
`layer_io.rs`.
- `codex-rs/core/src/config_loader/mod.rs` has major changes to
`load_config_layers_state()`, which is what produces `ConfigLayerStack`.
The docstring has the new specification and describes the various layers
that will be loaded and the precedence order.
- It uses the information from `LoaderOverrides` "twice," both in the
spirit of legacy support:
- We use one instances to derive an instance of `ConfigRequirements`.
Currently, the only field in `managed_config.toml` that contributes to
`ConfigRequirements` is `approval_policy`. This PR introduces
`Constrained::allow_only()` to support this.
- We use a clone of `LoaderOverrides` to derive
`ConfigLayerSource::LegacyManagedConfigTomlFromFile` and
`ConfigLayerSource::LegacyManagedConfigTomlFromMdm` layers, as
appropriate. As before, this ends up being a "best effort" at enterprise
controls, but is enforcement is not guaranteed like it is for
`ConfigRequirements`.
- Now we only create a "user" layer if `$CODEX_HOME/config.toml` exists.
(Previously, a user layer was always created for `ConfigLayerStack`.)
- Similarly, we only add a "session flags" layer if there are CLI
overrides.
- `config_loader/state.rs` contains the updated implementation for
`ConfigLayerStack`. Note the public API is largely the same as before,
but the implementation is quite different. We leverage the fact that
`ConfigLayerSource` is now `PartialOrd` to ensure layers are in the
correct order.
- A `Config` constructed via `ConfigBuilder.build()` will use
`load_config_layers_state()` to create the `ConfigLayerStack` and use
the associated `ConfigRequirements` when constructing the `Config`
object.
- That said, a `Config` constructed via
`Config::load_from_base_config_with_overrides()` does _not_ yet use
`ConfigBuilder`, so it creates a `ConfigRequirements::default()` instead
of loading a proper `ConfigRequirements`. I will fix this in a
subsequent PR.

Then the following files are mostly test changes:

```
codex-rs/app-server/tests/suite/v2/config_rpc.rs
codex-rs/core/src/config/service.rs
codex-rs/core/src/config_loader/tests.rs
```

Again, because we do not always include "user" and "session flags"
layers when the contents are empty, `ConfigLayerStack` sometimes has
fewer layers than before (and the precedence order changed slightly),
which is the main reason integration tests changed.
2025-12-18 10:06:05 -08:00
..
account.rs [app-server] make app server not throw error when login id is not found (#7831) 2025-12-10 16:19:40 -08:00
config_rpc.rs feat: migrate to new constraint-based loading strategy (#8251) 2025-12-18 10:06:05 -08:00
mod.rs feat[app-serve]: config management (#7241) 2025-11-25 09:29:38 +00:00
model_list.rs caribou (#8265) 2025-12-18 08:58:44 -08:00
rate_limits.rs fix: taking plan type from usage endpoint instead of thru auth token (#7610) 2025-12-04 23:34:13 -08:00
review.rs chore: review everywhere (#7444) 2025-12-02 11:26:27 +00:00
thread_archive.rs fix: add more fields to ThreadStartResponse and ThreadResumeResponse (#6847) 2025-11-18 21:18:43 -08:00
thread_list.rs fix: thread/list returning fewer than the requested amount due to filtering CXA-293 (#7509) 2025-12-10 23:06:32 +00:00
thread_resume.rs [app-server] feat: expose gitInfo/cwd/etc. on Thread (#7060) 2025-11-21 10:37:12 -08:00
thread_start.rs fix: add more fields to ThreadStartResponse and ThreadResumeResponse (#6847) 2025-11-18 21:18:43 -08:00
turn_interrupt.rs [app-server] feat: add thread_id and turn_id to item and error notifications (#7124) 2025-11-25 08:05:47 -08:00
turn_start.rs fix: introduce AbsolutePathBuf as part of sandbox config (#7856) 2025-12-12 15:25:22 -08:00