Standardize shell execution on unified exec (#39772)

## What changed

- Use `exec_command` and `write_stdin` as the shell tool surface.
- Treat legacy `default`, `local`, and `shell_command` model metadata as `unified_exec`.
- Remove obsolete shell-selection configuration and runtime paths while preserving the feature and policy gates for zsh fork execution.

GitOrigin-RevId: d743cbe598630d73052f1fecad680c4cde17977d
This commit is contained in:
jif authored and copyberry committed 2026-08-20 18:29:35 +00:00
1 parent 5bcd7b0fbc
commit bce5f2fcfc
40 files changed
+189 -992

No files matched your search

+1 -1
View File
@@ -31,8 +31,8 @@ use std::collections::HashMap;
use std::path::Path;
pub(crate) mod apply_patch;
pub(crate) mod shell;
pub(crate) mod unified_exec;
pub(crate) mod zsh_fork;
pub(crate) fn exec_env_for_sandbox_permissions(
env: &HashMap<String, String>,
@@ -1,3 +0,0 @@
#[cfg(unix)]
pub(crate) mod unix_escalation;
pub(crate) mod zsh_fork_backend;
@@ -23,7 +23,7 @@ use crate::tools::runtimes::apply_zsh_fork_path_prepend;
use crate::tools::runtimes::disable_powershell_profile_for_elevated_windows_sandbox;
use crate::tools::runtimes::exec_env_for_sandbox_permissions;
use crate::tools::runtimes::maybe_wrap_shell_lc_with_snapshot;
use crate::tools::runtimes::shell::zsh_fork_backend;
use crate::tools::runtimes::zsh_fork;
use crate::tools::sandboxing::Approvable;
use crate::tools::sandboxing::ApprovalAction;
use crate::tools::sandboxing::ExecApprovalRequirement;
@@ -422,14 +422,8 @@ impl<'a> ToolRuntime<UnifiedExecRequest, UnifiedExecAttempt> for UnifiedExecRunt
)
.map_err(ToolError::Codex)?;
exec_env.exec_server_env_config = req.exec_server_env_config.clone();
match zsh_fork_backend::maybe_prepare_unified_exec(
req,
attempt,
ctx,
exec_env,
zsh_fork_config,
)
.await?
match zsh_fork::maybe_prepare_unified_exec(req, attempt, ctx, exec_env, zsh_fork_config)
.await?
{
Some(prepared) => {
if req.turn_environment.environment.is_remote() {
@@ -27,10 +27,14 @@ pub(crate) async fn maybe_prepare_unified_exec(
imp::maybe_prepare_unified_exec(req, attempt, ctx, exec_request, zsh_fork_config).await
}
#[cfg(unix)]
#[path = "zsh_fork/unix_escalation.rs"]
mod unix_escalation;
#[cfg(unix)]
mod imp {
use super::*;
use crate::tools::runtimes::shell::unix_escalation;
use crate::tools::runtimes::zsh_fork::unix_escalation;
use crate::unified_exec::SpawnLifecycle;
use codex_shell_escalation::ESCALATE_SOCKET_ENV_VAR;
use codex_shell_escalation::EscalationSession;