From 3cde5d4ccdc8daf06d3f9e83105d8649e07b715b Mon Sep 17 00:00:00 2001 From: zm-oai Date: Thu, 20 Aug 2026 23:08:10 +0000 Subject: [PATCH] Preserve WINDIR in core Windows shell environments (#39809) ## What changed - Add `WINDIR` to the Windows core environment variable allowlist. - Extend the Windows core-inheritance test to verify that a case-variant `WinDir` entry is retained. GitOrigin-RevId: 0305d8fa882ba2705a7ce7661098cedac1339c43 --- codex-rs/protocol/src/shell_environment.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codex-rs/protocol/src/shell_environment.rs b/codex-rs/protocol/src/shell_environment.rs index 6f886bf065..73d14a79fd 100644 --- a/codex-rs/protocol/src/shell_environment.rs +++ b/codex-rs/protocol/src/shell_environment.rs @@ -172,6 +172,7 @@ pub const WINDOWS_CORE_ENV_VARS: &[&str] = &[ "SHELL", "COMSPEC", "SYSTEMROOT", + "WINDIR", "SYSTEMDRIVE", // User context and profiles "USERNAME", @@ -218,6 +219,7 @@ mod windows_tests { let vars = make_vars(&[ ("Shell", "C:\\Program Files\\Git\\bin\\bash.exe"), ("SystemRoot", "C:\\Windows"), + ("WinDir", "C:\\Windows"), ("AppData", "C:\\Users\\codex\\AppData\\Roaming"), ("TmpDir", "C:\\Temp\\custom"), ("OPENAI_API_KEY", "secret"), @@ -237,6 +239,7 @@ mod windows_tests { "C:\\Program Files\\Git\\bin\\bash.exe".to_string(), ), ("SystemRoot".to_string(), "C:\\Windows".to_string()), + ("WinDir".to_string(), "C:\\Windows".to_string()), ( "AppData".to_string(), "C:\\Users\\codex\\AppData\\Roaming".to_string(),