Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Skip local shell snapshots for remote unified exec (#17217)

jif-oaic0b5d8d24a16
diff --git a/codex-rs/core/src/tools/runtimes/unified_exec.rs b/codex-rs/core/src/tools/runtimes/unified_exec.rs
index 86b6163b87..fd12607c1b 100644
--- a/codex-rs/core/src/tools/runtimes/unified_exec.rs
+++ b/codex-rs/core/src/tools/runtimes/unified_exec.rs
@@ -202,13 +202,22 @@ impl<'a> ToolRuntime<UnifiedExecRequest, UnifiedExecProcess> for UnifiedExecRunt
) -> Result<UnifiedExecProcess, ToolError> {
let base_command = &req.command;
let session_shell = ctx.session.user_shell();
- let command = maybe_wrap_shell_lc_with_snapshot(
- base_command,
- session_shell.as_ref(),
- &req.cwd,
- &req.explicit_env_overrides,
- &req.env,
- );
+ let environment_is_remote = ctx
+ .turn
+ .environment
+ .as_ref()
+ .is_some_and(|environment| environment.is_remote());
+ let command = if environment_is_remote {
+ base_command.to_vec()
+ } else {
+ maybe_wrap_shell_lc_with_snapshot(
+ base_command,
+ session_shell.as_ref(),
+ &req.cwd,
+ &req.explicit_env_overrides,
+ &req.env,
+ )
+ };
let command = if matches!(session_shell.shell_type, ShellType::PowerShell) {
prefix_powershell_script_with_utf8(&command)
} else {