Skip to content

Commit 749b27a

Browse files
committed
Fix tests
1 parent 1ad991b commit 749b27a

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

codex-rs/core/src/codex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ impl Session {
890890
if !self
891891
.services
892892
.unified_exec_manager
893-
.unified_exec_available(&hb_command)
893+
.unified_exec_available(&hb_command, &turn_context.shell_environment_policy)
894894
.await
895895
{
896896
turn_context.tools_config.shell_type = ConfigShellToolType::ShellCommand;

codex-rs/core/src/unified_exec/session_manager.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use tracing::warn;
1414
use crate::bash::extract_bash_command;
1515
use crate::codex::Session;
1616
use crate::codex::TurnContext;
17+
use crate::config::types::ShellEnvironmentPolicy;
1718
use crate::exec_env::create_env;
1819
use crate::exec_policy::create_exec_approval_requirement_for_command;
1920
use crate::protocol::BackgroundEventEvent;
@@ -79,28 +80,35 @@ struct PreparedSessionHandles {
7980
}
8081

8182
impl 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

Comments
 (0)