From e1205c0b8650c9619e193fcfabd85ef62d57791a Mon Sep 17 00:00:00 2001 From: David Wiesen Date: Sat, 25 Apr 2026 20:41:46 -0700 Subject: [PATCH] fix(windows): launch sandbox runner from local cwd --- .../windows-sandbox-rs/src/elevated/runner_client.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/codex-rs/windows-sandbox-rs/src/elevated/runner_client.rs b/codex-rs/windows-sandbox-rs/src/elevated/runner_client.rs index f296e6b6e8..3a8522b4cc 100644 --- a/codex-rs/windows-sandbox-rs/src/elevated/runner_client.rs +++ b/codex-rs/windows-sandbox-rs/src/elevated/runner_client.rs @@ -75,7 +75,7 @@ impl RunnerTransport { pub(crate) fn spawn_runner_transport( codex_home: &Path, - cwd: &Path, + _cwd: &Path, sandbox_creds: &SandboxCreds, log_dir: Option<&Path>, ) -> Result { @@ -90,6 +90,11 @@ pub(crate) fn spawn_runner_transport( .to_str() .map(str::to_owned) .unwrap_or_else(|| "codex-command-runner.exe".to_string()); + // Launch the helper from a guaranteed-local directory instead of the requested workspace. + // Mapped drive letters can disappear in the alternate logon session used by + // `CreateProcessWithLogonW`, even though the runner can still switch into the real workspace + // later using the spawn request's `cwd`. + let runner_launch_cwd = runner_exe.parent().unwrap_or(codex_home); let runner_full_cmd = format!( "{} {} {}", quote_windows_arg(&runner_cmdline), @@ -98,7 +103,7 @@ pub(crate) fn spawn_runner_transport( ); let mut cmdline_vec = to_wide(&runner_full_cmd); let exe_w = to_wide(&runner_cmdline); - let cwd_w = to_wide(cwd); + let cwd_w = to_wide(runner_launch_cwd); let user_w = to_wide(&sandbox_creds.username); let domain_w = to_wide("."); let password_w = to_wide(&sandbox_creds.password);