mirror of
https://github.com/openai/codex.git
synced 2026-10-23 18:08:45 +00:00
## Why Executor config reads omitted the startup `features.prefer_mxc` override, so clients could not see the CLI sandbox preference. ## What changed - Include the explicit CLI `features.prefer_mxc` value in `environmentConfig/read` as a `session-flags` layer, above project config and below legacy managed file and MDM config. - Retain only this preference from startup overrides. - Expose `windows_mxc_allowed_by_config` to share MXC eligibility checks after callers resolve the active permission profile. ## Testing Add CLI and remote executor coverage for preference propagation and filtering, plus a unit test verifying that both legacy managed config sources retain precedence. GitOrigin-RevId: 5ac6f5257f1e807c2f197dcf5dcb2385cedca0ea
53 lines
2.0 KiB
Rust
53 lines
2.0 KiB
Rust
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
/// Legacy file and MDM values must still win after a CLI preference is projected.
|
|
#[test]
|
|
fn startup_preference_stays_below_both_managed_layers() -> anyhow::Result<()> {
|
|
let temp = tempfile::tempdir()?;
|
|
let cwd = AbsolutePathBuf::from_absolute_path(temp.path())?;
|
|
let project = ConfigLayerSource::Project {
|
|
dot_codex_folder: cwd.join(".codex"),
|
|
};
|
|
let file = ConfigLayerSource::LegacyManagedConfigTomlFromFile {
|
|
file: cwd.join("managed_config.toml"),
|
|
};
|
|
for managed in [file, ConfigLayerSource::LegacyManagedConfigTomlFromMdm] {
|
|
let mut layers = LocalConfigLayers {
|
|
config: LocalTomlLayerStack {
|
|
layers: vec![project.clone(), managed.clone()]
|
|
.into_iter()
|
|
.map(|source| LocalTomlLayer {
|
|
source,
|
|
base_dir: cwd.clone(),
|
|
toml: toml::Value::Table(toml::toml! { [features] prefer_mxc = false }),
|
|
})
|
|
.collect(),
|
|
cloud_insertion_index: 0,
|
|
},
|
|
requirements: LocalTomlLayerStack {
|
|
layers: Vec::new(),
|
|
cloud_insertion_index: 0,
|
|
},
|
|
};
|
|
include_startup_preference(&mut layers, &cwd, Some(true));
|
|
let projected = layers.project(&[vec!["features".into(), "prefer_mxc".into()]], &[]);
|
|
assert_eq!(
|
|
projected
|
|
.config
|
|
.layers
|
|
.iter()
|
|
.map(|l| &l.source)
|
|
.collect::<Vec<_>>(),
|
|
[&project, &ConfigLayerSource::SessionFlags, &managed],
|
|
);
|
|
let mut effective = toml::Value::Table(toml::map::Map::new());
|
|
for layer in projected.config.layers {
|
|
codex_config::merge_toml_values(&mut effective, &layer.toml);
|
|
}
|
|
assert_eq!(effective["features"]["prefer_mxc"].as_bool(), Some(false));
|
|
assert_eq!(projected.config.cloud_insertion_index, 0);
|
|
}
|
|
Ok(())
|
|
}
|