mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
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)
This commit is contained in:
@@ -117,7 +117,6 @@ impl ToolHandler for ShellHandler {
|
|||||||
turn,
|
turn,
|
||||||
tracker,
|
tracker,
|
||||||
call_id,
|
call_id,
|
||||||
false,
|
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -130,7 +129,6 @@ impl ToolHandler for ShellHandler {
|
|||||||
turn,
|
turn,
|
||||||
tracker,
|
tracker,
|
||||||
call_id,
|
call_id,
|
||||||
true,
|
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -178,7 +176,6 @@ impl ToolHandler for ShellCommandHandler {
|
|||||||
turn,
|
turn,
|
||||||
tracker,
|
tracker,
|
||||||
call_id,
|
call_id,
|
||||||
false,
|
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -192,7 +189,6 @@ impl ShellHandler {
|
|||||||
turn: Arc<TurnContext>,
|
turn: Arc<TurnContext>,
|
||||||
tracker: crate::tools::context::SharedTurnDiffTracker,
|
tracker: crate::tools::context::SharedTurnDiffTracker,
|
||||||
call_id: String,
|
call_id: String,
|
||||||
is_user_shell_command: bool,
|
|
||||||
) -> Result<ToolOutput, FunctionCallError> {
|
) -> Result<ToolOutput, FunctionCallError> {
|
||||||
// Approval policy guard for explicit escalation in non-OnRequest modes.
|
// Approval policy guard for explicit escalation in non-OnRequest modes.
|
||||||
if exec_params.with_escalated_permissions.unwrap_or(false)
|
if exec_params.with_escalated_permissions.unwrap_or(false)
|
||||||
@@ -285,12 +281,7 @@ impl ShellHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regular shell execution path.
|
let source = ExecCommandSource::Agent;
|
||||||
let source = if is_user_shell_command {
|
|
||||||
ExecCommandSource::UserShell
|
|
||||||
} else {
|
|
||||||
ExecCommandSource::Agent
|
|
||||||
};
|
|
||||||
let emitter =
|
let emitter =
|
||||||
ToolEmitter::shell(exec_params.command.clone(), exec_params.cwd.clone(), source);
|
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);
|
let event_ctx = ToolEventCtx::new(session.as_ref(), turn.as_ref(), &call_id, None);
|
||||||
|
|||||||
Reference in New Issue
Block a user