@@ -83,15 +83,34 @@ pub(crate) async fn execute_call(
8383
8484 // validate runtime requirements
8585 let container = function. function . container . as_ref ( ) ;
86- let needs_container = ssh. is_none ( ) // if ssh is set we don't need a container
87- && (
86+ let mut needs_container = false ;
87+ let mut can_ssh = false ;
88+
89+ if let Some ( ssh) = ssh. as_ref ( ) {
90+ // if ssh is set we don't need a container
91+ can_ssh = ssh. app_in_path ( & command_line. app ) . await ?;
92+ if !can_ssh {
93+ log:: warn!(
94+ "{} not found in $PATH on {}" ,
95+ command_line. app,
96+ ssh. to_string( )
97+ ) ;
98+ }
99+ }
100+
101+ // we are not going to use ssh, so we need to check if we need a container
102+ if !can_ssh {
103+ if command_line. sudo && !interactive {
88104 // we're running in non-interactive mode, can't sudo
89- ( command_line. sudo && !interactive)
90- // app not in $PATH
91- || !command_line. app_in_path
105+ needs_container = true ;
106+ } else if !command_line. app_in_path {
107+ // app not in $PATH, we need a container
108+ needs_container = true ;
109+ } else if container. is_some ( ) && container. unwrap ( ) . force {
92110 // forced container use
93- || ( container. is_some ( ) && container. unwrap ( ) . force )
94- ) ;
111+ needs_container = true ;
112+ }
113+ }
95114
96115 let command_line = if needs_container {
97116 let container = match container {
@@ -116,7 +135,7 @@ pub(crate) async fn execute_call(
116135 command_line
117136 } ;
118137
119- if ssh . is_some ( ) {
138+ if can_ssh {
120139 log:: warn!(
121140 "executing (as {}): {}" ,
122141 ssh. as_ref( ) . unwrap( ) . to_string( ) ,
@@ -140,7 +159,12 @@ pub(crate) async fn execute_call(
140159 }
141160
142161 // finally execute the command line
143- let content = command_line. execute ( ssh) . await ?;
162+ let content = command_line
163+ . execute ( match can_ssh {
164+ true => ssh,
165+ false => None ,
166+ } )
167+ . await ?;
144168 Ok ( openai:: CallResultMessage {
145169 role : "tool" . to_string ( ) ,
146170 call_id : call. id . clone ( ) ,
0 commit comments