mirror of
https://github.com/openai/codex.git
synced 2026-11-11 14:32:25 +00:00
config: remove legacy profile v1 resolution (#24051)
## Why [#23883](https://github.com/openai/codex/pull/23883) moved user-facing `--profile` selection onto profile v2, and [#23886](https://github.com/openai/codex/pull/23886) removed the old CLI `config_profile` override path. Core still had a second legacy path: `profile = "..."` could select `[profiles.*]` values while runtime config was built. Keeping that resolver alive preserves the old precedence model and profile-carrying surfaces even though profile selection now points at `$CODEX_HOME/<name>.config.toml`. ## What - Reject legacy top-level `profile = "..."` config while loading runtime config, with an error that points callers at `--profile <name>` and `<name>.config.toml` in the [core load path](https://github.com/openai/codex/blob/3d923366eca10a29143623124c6c6e538f058269/codex-rs/core/src/config/mod.rs#L2524-L2531). - Remove the remaining profile-v1 merge points from runtime config resolution, including features, permissions, model/provider selection, web search, Windows sandbox settings, TUI settings, role reloads, and OSS provider lookup. - Drop the leftover profile override surface from [`ConfigOverrides`](https://github.com/openai/codex/blob/3d923366eca10a29143623124c6c6e538f058269/codex-rs/core/src/config/mod.rs#L2118-L2148) and from the MCP server `codex` tool schema. - Prune profile-precedence tests that only exercised the removed resolver and replace them with rejection coverage for the legacy selector. ## Testing - Not run in this metadata pass. - Added [`legacy_profile_selection_is_rejected`](https://github.com/openai/codex/blob/3d923366eca10a29143623124c6c6e538f058269/codex-rs/core/src/config/config_tests.rs#L7942-L7965) coverage for the new runtime guard.
This commit is contained in:
1 parent
ed80e5f558
commit
fd72e99384
10 files changed
+110
-1766
No files matched your search
@@ -78,29 +78,6 @@ fn legacy_mode_supports_alias_key() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_windows_sandbox_mode_prefers_profile_windows() {
|
||||
let cfg = ConfigToml {
|
||||
windows: Some(WindowsToml {
|
||||
sandbox: Some(WindowsSandboxModeToml::Unelevated),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
let profile = ConfigProfile {
|
||||
windows: Some(WindowsToml {
|
||||
sandbox: Some(WindowsSandboxModeToml::Elevated),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
resolve_windows_sandbox_mode(&cfg, &profile),
|
||||
Some(WindowsSandboxModeToml::Elevated)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_windows_sandbox_mode_falls_back_to_legacy_keys() {
|
||||
let mut entries = BTreeMap::new();
|
||||
@@ -114,61 +91,15 @@ fn resolve_windows_sandbox_mode_falls_back_to_legacy_keys() {
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
resolve_windows_sandbox_mode(&cfg, &ConfigProfile::default()),
|
||||
resolve_windows_sandbox_mode(&cfg),
|
||||
Some(WindowsSandboxModeToml::Unelevated)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_windows_sandbox_mode_profile_legacy_false_blocks_top_level_legacy_true() {
|
||||
let mut profile_entries = BTreeMap::new();
|
||||
profile_entries.insert(
|
||||
"experimental_windows_sandbox".to_string(),
|
||||
/*value*/ false,
|
||||
);
|
||||
let profile = ConfigProfile {
|
||||
features: Some(FeaturesToml::from(profile_entries)),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let mut cfg_entries = BTreeMap::new();
|
||||
cfg_entries.insert(
|
||||
"experimental_windows_sandbox".to_string(),
|
||||
/*value*/ true,
|
||||
);
|
||||
let cfg = ConfigToml {
|
||||
features: Some(FeaturesToml::from(cfg_entries)),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
assert_eq!(resolve_windows_sandbox_mode(&cfg, &profile), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_windows_sandbox_private_desktop_prefers_profile_windows() {
|
||||
let cfg = ConfigToml {
|
||||
windows: Some(WindowsToml {
|
||||
sandbox: Some(WindowsSandboxModeToml::Unelevated),
|
||||
sandbox_private_desktop: Some(false),
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
let profile = ConfigProfile {
|
||||
windows: Some(WindowsToml {
|
||||
sandbox: Some(WindowsSandboxModeToml::Elevated),
|
||||
sandbox_private_desktop: Some(true),
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
assert!(resolve_windows_sandbox_private_desktop(&cfg, &profile));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_windows_sandbox_private_desktop_defaults_to_true() {
|
||||
assert!(resolve_windows_sandbox_private_desktop(
|
||||
&ConfigToml::default(),
|
||||
&ConfigProfile::default()
|
||||
&ConfigToml::default()
|
||||
));
|
||||
}
|
||||
|
||||
@@ -182,8 +113,5 @@ fn resolve_windows_sandbox_private_desktop_respects_explicit_cfg_value() {
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
assert!(!resolve_windows_sandbox_private_desktop(
|
||||
&cfg,
|
||||
&ConfigProfile::default()
|
||||
));
|
||||
assert!(!resolve_windows_sandbox_private_desktop(&cfg));
|
||||
}
|
||||
Reference in new issue
Block a user