diff --git a/codex-rs/core/src/tools/runtimes/unified_exec.rs b/codex-rs/core/src/tools/runtimes/unified_exec.rs index 2050ec6969..fbf7c2a84b 100644 --- a/codex-rs/core/src/tools/runtimes/unified_exec.rs +++ b/codex-rs/core/src/tools/runtimes/unified_exec.rs @@ -280,7 +280,7 @@ impl<'a> ToolRuntime for UnifiedExecRunt if let UnifiedExecShellMode::ZshFork(zsh_fork_config) = &self.shell_mode { let command = build_sandbox_command(&command, &req.cwd, &env, req.additional_permissions.clone()) - .map_err(|_| ToolError::Rejected("missing command line for PTY".to_string()))?; + .map_err(|_| ToolError::Codex(CodexErr::InvalidRequest("missing command line for PTY".into())))?; let options = unified_exec_options(attempt.network_denial_cancellation_token.clone()); let mut exec_env = attempt .env_for(command, options, managed_network) @@ -319,7 +319,7 @@ impl<'a> ToolRuntime for UnifiedExecRunt network_policy_decision: None, })) } - other => ToolError::Rejected(other.to_string()), + other => ToolError::Codex(CodexErr::Fatal(other.to_string())), }); } None => { @@ -331,7 +331,7 @@ impl<'a> ToolRuntime for UnifiedExecRunt } let command = build_sandbox_command(&command, &req.cwd, &env, req.additional_permissions.clone()) - .map_err(|_| ToolError::Rejected("missing command line for PTY".to_string()))?; + .map_err(|_| ToolError::Codex(CodexErr::InvalidRequest("missing command line for PTY".into())))?; let options = unified_exec_options(attempt.network_denial_cancellation_token.clone()); let mut exec_env = attempt .env_for(command, options, managed_network) @@ -353,7 +353,7 @@ impl<'a> ToolRuntime for UnifiedExecRunt network_policy_decision: None, })) } - other => ToolError::Rejected(other.to_string()), + other => ToolError::Codex(CodexErr::Fatal(other.to_string())), }) } } diff --git a/codex-rs/core/src/unified_exec/process_manager.rs b/codex-rs/core/src/unified_exec/process_manager.rs index c1c927ab58..e77b1924d6 100644 --- a/codex-rs/core/src/unified_exec/process_manager.rs +++ b/codex-rs/core/src/unified_exec/process_manager.rs @@ -398,14 +398,13 @@ impl UnifiedExecProcessManager { } Err(err) => { let failure = match &err { - UnifiedExecError::MissingCommandLine => ToolEventFailure::Rejected { - message: "missing command line for unified exec request".to_string(), - applied_patch_delta: None, - }, UnifiedExecError::Rejected { message } => ToolEventFailure::Rejected { message: message.clone(), applied_patch_delta: None, }, + UnifiedExecError::SandboxDenied { output, .. } => { + ToolEventFailure::Output(output.clone()) + } _ => ToolEventFailure::Message(format!("execution error: {err:?}")), }; emitter