@@ -614,8 +614,14 @@ mod tests {
614614 #[ tokio:: test]
615615 async fn test_conversation_state_history_handling_truncation ( ) {
616616 let tool_manager = ToolManager :: default ( ) ;
617- let mut conversation_state =
618- ConversationState :: new ( Context :: new_fake ( ) , tool_manager. load_tools ( ) . await . unwrap ( ) , None ) . await ;
617+ let buf = Vec :: < u8 > :: new ( ) ;
618+ let mut output = std:: io:: BufWriter :: new ( buf) ;
619+ let mut conversation_state = ConversationState :: new (
620+ Context :: new_fake ( ) ,
621+ tool_manager. load_tools ( & mut output) . await . unwrap ( ) ,
622+ None ,
623+ )
624+ . await ;
619625
620626 // First, build a large conversation history. We need to ensure that the order is always
621627 // User -> Assistant -> User -> Assistant ...and so on.
@@ -636,8 +642,14 @@ mod tests {
636642 async fn test_conversation_state_history_handling_with_tool_results ( ) {
637643 // Build a long conversation history of tool use results.
638644 let tool_manager = ToolManager :: default ( ) ;
639- let mut conversation_state =
640- ConversationState :: new ( Context :: new_fake ( ) , tool_manager. load_tools ( ) . await . unwrap ( ) , None ) . await ;
645+ let buf = Vec :: < u8 > :: new ( ) ;
646+ let mut output = std:: io:: BufWriter :: new ( buf) ;
647+ let mut conversation_state = ConversationState :: new (
648+ Context :: new_fake ( ) ,
649+ tool_manager. load_tools ( & mut output) . await . unwrap ( ) ,
650+ None ,
651+ )
652+ . await ;
641653 conversation_state. append_new_user_message ( "start" . to_string ( ) ) . await ;
642654 for i in 0 ..=( MAX_CONVERSATION_STATE_HISTORY_LEN + 100 ) {
643655 let s = conversation_state. as_sendable_conversation_state ( ) . await ;
@@ -659,8 +671,12 @@ mod tests {
659671 }
660672
661673 // Build a long conversation history of user messages mixed in with tool results.
662- let mut conversation_state =
663- ConversationState :: new ( Context :: new_fake ( ) , tool_manager. load_tools ( ) . await . unwrap ( ) , None ) . await ;
674+ let mut conversation_state = ConversationState :: new (
675+ Context :: new_fake ( ) ,
676+ tool_manager. load_tools ( & mut output) . await . unwrap ( ) ,
677+ None ,
678+ )
679+ . await ;
664680 conversation_state. append_new_user_message ( "start" . to_string ( ) ) . await ;
665681 for i in 0 ..=( MAX_CONVERSATION_STATE_HISTORY_LEN + 100 ) {
666682 let s = conversation_state. as_sendable_conversation_state ( ) . await ;
@@ -697,7 +713,10 @@ mod tests {
697713 ctx. fs ( ) . write ( AMAZONQ_FILENAME , "test context" ) . await . unwrap ( ) ;
698714
699715 let tool_manager = ToolManager :: default ( ) ;
700- let mut conversation_state = ConversationState :: new ( ctx, tool_manager. load_tools ( ) . await . unwrap ( ) , None ) . await ;
716+ let buf = Vec :: < u8 > :: new ( ) ;
717+ let mut output = std:: io:: BufWriter :: new ( buf) ;
718+ let mut conversation_state =
719+ ConversationState :: new ( ctx, tool_manager. load_tools ( & mut output) . await . unwrap ( ) , None ) . await ;
701720
702721 // First, build a large conversation history. We need to ensure that the order is always
703722 // User -> Assistant -> User -> Assistant ...and so on.
0 commit comments