From f4e18a95bb0496aeee91ffee27092d2d215c3898 Mon Sep 17 00:00:00 2001 From: Brent Traut Date: Fri, 2 Oct 2026 16:24:11 +0000 Subject: [PATCH] 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 --- codex-rs/config/src/key_aliases.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/codex-rs/config/src/key_aliases.rs b/codex-rs/config/src/key_aliases.rs index 3d0bf1ed7d..d1d02a96e6 100644 --- a/codex-rs/config/src/key_aliases.rs +++ b/codex-rs/config/src/key_aliases.rs @@ -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();