mirror of
https://github.com/openai/codex.git
synced 2026-10-20 08:19:50 +00:00
Skip unrelated subtrees during config alias normalization (#50354)
Return a clone immediately when the current path is not a prefix of any registered legacy config key. This avoids recursively visiting unrelated subtrees while preserving alias normalization along matching paths. GitOrigin-RevId: 1c7e62898e12ab3f468b978f865805989914ac44
This commit is contained in:
@@ -61,6 +61,16 @@ pub(crate) fn normalize_key_aliases(value: &TomlValue) -> TomlValue {
|
||||
}
|
||||
|
||||
fn normalize_key_aliases_at_path(value: &TomlValue, path: &[String]) -> TomlValue {
|
||||
// Alias normalization cannot affect subtrees outside the registered legacy paths.
|
||||
if !CONFIG_KEY_ALIASES.iter().any(|alias| {
|
||||
alias
|
||||
.legacy
|
||||
.get(..path.len())
|
||||
.is_some_and(|prefix| path.iter().map(String::as_str).eq(prefix.iter().copied()))
|
||||
}) {
|
||||
return value.clone();
|
||||
}
|
||||
|
||||
match value {
|
||||
TomlValue::Table(table) => {
|
||||
let mut normalized = TomlMap::new();
|
||||
|
||||
Reference in New Issue
Block a user