From e9e644a119f2d2e89e6eb45db07d3da27a30ce33 Mon Sep 17 00:00:00 2001 From: zhao-oai Date: Tue, 18 Nov 2025 09:28:26 -0800 Subject: [PATCH] fixing localshell tool calls (#6823) - Local-shell tool responses were always tagged as `ExecCommandSource::UserShell` because handler would call `run_exec_like` with `is_user_shell_cmd` set to true. - Treat `ToolPayload::LocalShell` the same as other model generated shell tool calls by deleting `is_user_shell_cmd` from `run_exec_like` (since actual user shell commands follow a separate code path) --- codex-rs/core/src/tools/handlers/shell.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/codex-rs/core/src/tools/handlers/shell.rs b/codex-rs/core/src/tools/handlers/shell.rs index 173a3ccff..43b2bb129 100644 --- a/codex-rs/core/src/tools/handlers/shell.rs +++ b/codex-rs/core/src/tools/handlers/shell.rs @@ -117,7 +117,6 @@ impl ToolHandler for ShellHandler { turn, tracker, call_id, - false, ) .await } @@ -130,7 +129,6 @@ impl ToolHandler for ShellHandler { turn, tracker, call_id, - true, ) .await } @@ -178,7 +176,6 @@ impl ToolHandler for ShellCommandHandler { turn, tracker, call_id, - false, ) .await } @@ -192,7 +189,6 @@ impl ShellHandler { turn: Arc, tracker: crate::tools::context::SharedTurnDiffTracker, call_id: String, - is_user_shell_command: bool, ) -> Result { // Approval policy guard for explicit escalation in non-OnRequest modes. if exec_params.with_escalated_permissions.unwrap_or(false) @@ -285,12 +281,7 @@ impl ShellHandler { } } - // Regular shell execution path. - let source = if is_user_shell_command { - ExecCommandSource::UserShell - } else { - ExecCommandSource::Agent - }; + let source = ExecCommandSource::Agent; let emitter = ToolEmitter::shell(exec_params.command.clone(), exec_params.cwd.clone(), source); let event_ctx = ToolEventCtx::new(session.as_ref(), turn.as_ref(), &call_id, None);