@@ -14,6 +14,7 @@ use tracing::warn;
1414use crate :: bash:: extract_bash_command;
1515use crate :: codex:: Session ;
1616use crate :: codex:: TurnContext ;
17+ use crate :: config:: types:: ShellEnvironmentPolicy ;
1718use crate :: exec_env:: create_env;
1819use crate :: exec_policy:: create_exec_approval_requirement_for_command;
1920use crate :: protocol:: BackgroundEventEvent ;
@@ -79,28 +80,35 @@ struct PreparedSessionHandles {
7980}
8081
8182impl UnifiedExecSessionManager {
82- pub ( crate ) async fn unified_exec_available ( & self , command : & [ String ] ) -> bool {
83+ pub ( crate ) async fn unified_exec_available (
84+ & self ,
85+ command : & [ String ] ,
86+ shell_environment_policy : & ShellEnvironmentPolicy ,
87+ ) -> bool {
8388 {
8489 let availability = self . availability . lock ( ) . await ;
8590 if let Some ( available) = * availability {
8691 return available;
8792 }
8893 }
8994
90- let available = Self :: probe_unified_exec_heartbeat ( command) . await ;
95+ let available = Self :: probe_unified_exec_heartbeat ( command, shell_environment_policy ) . await ;
9196
9297 let mut availability = self . availability . lock ( ) . await ;
9398 * availability = Some ( available) ;
9499 available
95100 }
96101
97- async fn probe_unified_exec_heartbeat ( command : & [ String ] ) -> bool {
102+ async fn probe_unified_exec_heartbeat (
103+ command : & [ String ] ,
104+ shell_environment_policy : & ShellEnvironmentPolicy ,
105+ ) -> bool {
98106 let Some ( ( program, args) ) = command. split_first ( ) else {
99107 warn ! ( "unified exec heartbeat failed: missing command" ) ;
100108 return false ;
101109 } ;
102110 let cwd = std:: env:: current_dir ( ) . unwrap_or_else ( |_| PathBuf :: from ( "." ) ) ;
103- let env = HashMap :: new ( ) ;
111+ let env = apply_unified_exec_env ( create_env ( shell_environment_policy ) ) ;
104112
105113 match codex_utils_pty:: spawn_pty_process ( program, args, & cwd, & env, & None ) . await {
106114 Ok ( spawned) => {
0 commit comments