diff --git a/codex-rs/cli/src/debug_sandbox.rs b/codex-rs/cli/src/debug_sandbox.rs index 308e835837..72dd6baeb7 100644 --- a/codex-rs/cli/src/debug_sandbox.rs +++ b/codex-rs/cli/src/debug_sandbox.rs @@ -130,10 +130,7 @@ async fn run_command_under_sandbox( let sandbox_policy_cwd = cwd.clone(); let stdio_policy = StdioPolicy::Inherit; - let mut env = create_env(&config.shell_environment_policy, None); - if let Some(network) = config.network.as_ref() { - network.apply_to_env(&mut env); - } + let env = create_env(&config.shell_environment_policy, None); // Special-case Windows sandbox: execute and exit the process to emulate inherited stdio. if let SandboxType::Windows = sandbox_type { @@ -225,7 +222,7 @@ async fn run_command_under_sandbox( config.sandbox_policy.get(), sandbox_policy_cwd.as_path(), stdio_policy, - None, + config.network, env, ) .await? @@ -245,7 +242,7 @@ async fn run_command_under_sandbox( sandbox_policy_cwd.as_path(), use_bwrap_sandbox, stdio_policy, - None, + config.network, env, ) .await? diff --git a/codex-rs/core/src/tasks/user_shell.rs b/codex-rs/core/src/tasks/user_shell.rs index 02dd5fdf24..b0c505b64a 100644 --- a/codex-rs/core/src/tasks/user_shell.rs +++ b/codex-rs/core/src/tasks/user_shell.rs @@ -147,7 +147,7 @@ pub(crate) async fn execute_user_shell_command( &turn_context.shell_environment_policy, Some(session.conversation_id), ), - network: turn_context.config.network.clone(), + network: turn_context.network.clone(), // TODO(zhao-oai): Now that we have ExecExpiration::Cancellation, we // should use that instead of an "arbitrarily large" timeout here. expiration: USER_SHELL_TIMEOUT_MS.into(), diff --git a/codex-rs/core/src/tools/handlers/unified_exec.rs b/codex-rs/core/src/tools/handlers/unified_exec.rs index 0a88283fe9..c06889b37b 100644 --- a/codex-rs/core/src/tools/handlers/unified_exec.rs +++ b/codex-rs/core/src/tools/handlers/unified_exec.rs @@ -192,7 +192,7 @@ impl ToolHandler for UnifiedExecHandler { yield_time_ms, max_output_tokens, workdir, - network: context.turn.config.network.clone(), + network: context.turn.network.clone(), tty, sandbox_permissions, justification,