mirror of
https://github.com/openai/codex.git
synced 2026-11-20 23:08:21 +00:00
fix: reject legacy profile selectors (#24059)
## Why `--profile` now selects `<name>.config.toml`, so the legacy `profile` selector should not be reintroduced through config write or MCP tool paths. A matching legacy selector in base user config also needs the same migration guard as a matching legacy `[profiles.<name>]` table so profile loading fails with one clear migration error instead of mixing the old and new profile models. ## What - reject non-null app-server config writes to the top-level legacy `profile` selector - make `--profile <name>` reject base user config that still selects the same legacy `profile = "<name>"` value, alongside the existing matching legacy profile-table guard - reject removed MCP `codex` tool fields such as `profile` by denying unknown tool-call parameters and exposing that restriction in the generated schema - add regression coverage for the app-server write paths, config loader guard, and MCP tool input/schema behavior ## Verification - targeted regression tests cover the new app-server, config loader, and MCP rejection paths
This commit is contained in:
1 parent
47476e8a8a
commit
932f72c225
5 files changed
+180
-16
No files matched your search
@@ -225,21 +225,26 @@ pub async fn load_config_layers_state(
|
||||
)
|
||||
.await?;
|
||||
if let Some(active_user_profile) = active_user_profile.as_ref()
|
||||
&& base_user_layer.config.as_table().is_some_and(|config| {
|
||||
config
|
||||
.get("profiles")
|
||||
.and_then(TomlValue::as_table)
|
||||
.is_some_and(|profiles| profiles.contains_key(active_user_profile.as_str()))
|
||||
})
|
||||
&& let Some(base_user_config) = base_user_layer.config.as_table()
|
||||
{
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::InvalidData,
|
||||
format!(
|
||||
"--profile `{active_user_profile}` cannot be used while {} contains legacy `[profiles.{active_user_profile}]` config; move those settings into {} or remove `[profiles.{active_user_profile}]`. See https://developers.openai.com/codex/config-advanced#profiles for more information.",
|
||||
base_user_file.as_path().display(),
|
||||
active_user_file.as_path().display()
|
||||
),
|
||||
));
|
||||
let legacy_profile_is_selected = base_user_config
|
||||
.get("profile")
|
||||
.and_then(TomlValue::as_str)
|
||||
.is_some_and(|profile| profile == active_user_profile.as_str());
|
||||
let legacy_profile_table_exists = base_user_config
|
||||
.get("profiles")
|
||||
.and_then(TomlValue::as_table)
|
||||
.is_some_and(|profiles| profiles.contains_key(active_user_profile.as_str()));
|
||||
if legacy_profile_is_selected || legacy_profile_table_exists {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::InvalidData,
|
||||
format!(
|
||||
"--profile `{active_user_profile}` cannot be used while {} contains legacy `profile = \"{active_user_profile}\"` or `[profiles.{active_user_profile}]` config; move those settings into {} and remove the legacy profile selector/table. See https://developers.openai.com/codex/config-advanced#profiles for more information.",
|
||||
base_user_file.as_path().display(),
|
||||
active_user_file.as_path().display()
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
layers.push(base_user_layer);
|
||||
|
||||
|
||||
Reference in new issue
Block a user