@@ -1277,8 +1277,6 @@ impl ChatSession {
12771277 } )
12781278 } else {
12791279 // Check for a pending tool approval
1280- let tool_denied_without_reason = [ "n" , "N" ] . contains ( & input) ;
1281-
12821280 if let Some ( index) = self . pending_tool_index {
12831281 let is_trust = [ "t" , "T" ] . contains ( & input) ;
12841282 let tool_use = & mut self . tool_uses [ index] ;
@@ -1289,21 +1287,6 @@ impl ChatSession {
12891287 tool_use. accepted = true ;
12901288
12911289 return Ok ( ChatState :: ExecuteTools ) ;
1292- // Prompt reason if no selected
1293- } else if tool_denied_without_reason {
1294- tool_use. accepted = false ;
1295- execute ! (
1296- self . output,
1297- style:: SetForegroundColor ( Color :: DarkGrey ) ,
1298- style:: Print (
1299- "\n Please provide a reason for denying this tool use, or otherwise continue your conversation:\n \n "
1300- ) ,
1301- style:: SetForegroundColor ( Color :: Reset ) ,
1302- ) ?;
1303-
1304- return Ok ( ChatState :: PromptUser {
1305- skip_printing_tools : true ,
1306- } ) ;
13071290 }
13081291 } else if !self . pending_prompts . is_empty ( ) {
13091292 let prompts = self . pending_prompts . drain ( 0 ..) . collect ( ) ;
@@ -1378,6 +1361,8 @@ impl ChatSession {
13781361 continue ;
13791362 }
13801363
1364+ self . pending_tool_index = Some ( i) ;
1365+
13811366 return Ok ( ChatState :: PromptUser {
13821367 skip_printing_tools : false ,
13831368 } ) ;
@@ -1871,6 +1856,7 @@ impl ChatSession {
18711856 }
18721857
18731858 self . tool_uses = queued_tools;
1859+ self . pending_tool_index = Some ( 0 ) ;
18741860 Ok ( ChatState :: ExecuteTools )
18751861 }
18761862
@@ -2393,13 +2379,11 @@ mod tests {
23932379 "/tools untrust fs_write" . to_string( ) ,
23942380 "create a file" . to_string( ) , // prompt again due to untrust
23952381 "n" . to_string( ) , // cancel
2396- "no reason" . to_string( ) , // dummy reason
23972382 "/tools trust fs_write" . to_string( ) ,
23982383 "create a file" . to_string( ) , // again without prompting due to '/tools trust'
23992384 "/tools reset" . to_string( ) ,
24002385 "create a file" . to_string( ) , // prompt again due to reset
24012386 "n" . to_string( ) , // cancel
2402- "no reason" . to_string( ) , // dummy reason
24032387 "exit" . to_string( ) ,
24042388 ] ) ,
24052389 false ,
@@ -2413,7 +2397,7 @@ mod tests {
24132397 )
24142398 . await
24152399 . unwrap ( )
2416- . next ( & mut ctx, & mut database, & telemetry)
2400+ . spawn ( & mut ctx, & mut database, & telemetry)
24172401 . await
24182402 . unwrap ( ) ;
24192403
@@ -2512,7 +2496,7 @@ mod tests {
25122496 )
25132497 . await
25142498 . unwrap ( )
2515- . next ( & mut ctx, & mut database, & telemetry)
2499+ . spawn ( & mut ctx, & mut database, & telemetry)
25162500 . await
25172501 . unwrap ( ) ;
25182502
@@ -2573,7 +2557,7 @@ mod tests {
25732557 SharedWriter :: stdout ( ) ,
25742558 None ,
25752559 InputSource :: new_mock ( vec ! [
2576- "/tools trustall " . to_string( ) ,
2560+ "/tools trust-all " . to_string( ) ,
25772561 "create a new file" . to_string( ) ,
25782562 "/tools reset" . to_string( ) ,
25792563 "create a new file" . to_string( ) ,
@@ -2590,7 +2574,7 @@ mod tests {
25902574 )
25912575 . await
25922576 . unwrap ( )
2593- . next ( & mut ctx, & mut database, & telemetry)
2577+ . spawn ( & mut ctx, & mut database, & telemetry)
25942578 . await
25952579 . unwrap ( ) ;
25962580
@@ -2646,7 +2630,7 @@ mod tests {
26462630 )
26472631 . await
26482632 . unwrap ( )
2649- . next ( & mut ctx, & mut database, & telemetry)
2633+ . spawn ( & mut ctx, & mut database, & telemetry)
26502634 . await
26512635 . unwrap ( ) ;
26522636
0 commit comments