File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
codex-rs/core/src/tools/handlers Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,20 @@ impl ToolHandler for ShellCommandHandler {
148148 matches ! ( payload, ToolPayload :: Function { .. } )
149149 }
150150
151+ fn is_mutating ( & self , invocation : & ToolInvocation ) -> bool {
152+ let ToolPayload :: Function { arguments } = & invocation. payload else {
153+ return true ;
154+ } ;
155+
156+ serde_json:: from_str :: < ShellCommandToolCallParams > ( arguments)
157+ . map ( |params| {
158+ let shell = invocation. session . user_shell ( ) ;
159+ let command = shell. derive_exec_args ( & params. command , params. login . unwrap_or ( true ) ) ;
160+ !is_known_safe_command ( & command)
161+ } )
162+ . unwrap_or ( true )
163+ }
164+
151165 async fn handle ( & self , invocation : ToolInvocation ) -> Result < ToolOutput , FunctionCallError > {
152166 let ToolInvocation {
153167 session,
You can’t perform that action at this time.
0 commit comments