@@ -221,7 +221,12 @@ fn repair_tool_call_context(context: &mut Vec<crate::utils::ChatMessage>) {
221221 for id in missing {
222222 context. insert (
223223 j,
224- crate :: utils:: ChatMessage :: tool ( "[Cancelled — tool execution interrupted]" , & id, None ) , ) ;
224+ crate :: utils:: ChatMessage :: tool (
225+ "[Cancelled — tool execution interrupted]" ,
226+ & id,
227+ None ,
228+ ) ,
229+ ) ;
225230 j += 1 ;
226231 }
227232
@@ -1617,10 +1622,14 @@ impl AgentLogic {
16171622 }
16181623 }
16191624 }
1620-
1621- mem. add_message ( crate :: utils:: ChatMessage :: tool ( & inbound. content , id, tool_name_for_resume. as_deref ( ) ) )
1622- . await
1623- . map_err ( |e| format ! ( "Failed to inject tool response into memory: {}" , e) ) ?;
1625+
1626+ mem. add_message ( crate :: utils:: ChatMessage :: tool (
1627+ & inbound. content ,
1628+ id,
1629+ tool_name_for_resume. as_deref ( ) ,
1630+ ) )
1631+ . await
1632+ . map_err ( |e| format ! ( "Failed to inject tool response into memory: {}" , e) ) ?;
16241633 } else {
16251634 return Err ( format ! ( "Failed to get session {}" , session_key) ) ;
16261635 }
@@ -2271,8 +2280,12 @@ impl AgentLogic {
22712280 } ;
22722281 let _ = outbound_tx. send ( BusMessage :: Telemetry ( tfin. clone ( ) ) ) . await ;
22732282 hook_observe_telemetry ( hook_tool_ctx. as_ref ( ) , & inbound, is_subagent, tfin) ;
2274- mem. add_message ( crate :: utils:: ChatMessage :: tool ( & tool_result_text, & tc. id , Some ( tool_name. as_str ( ) ) ) )
2275- . await ?;
2283+ mem. add_message ( crate :: utils:: ChatMessage :: tool (
2284+ & tool_result_text,
2285+ & tc. id ,
2286+ Some ( tool_name. as_str ( ) ) ,
2287+ ) )
2288+ . await ?;
22762289 }
22772290 tool_invoked = true ;
22782291 } else {
@@ -2370,8 +2383,12 @@ impl AgentLogic {
23702383 let _ = outbound_tx. send ( BusMessage :: Telemetry ( tfin. clone ( ) ) ) . await ;
23712384 hook_observe_telemetry ( hook_tool_ctx. as_ref ( ) , & inbound, is_subagent, tfin) ;
23722385
2373- mem. add_message ( crate :: utils:: ChatMessage :: tool ( & tool_result_text, & tc. id , Some ( tool_name. as_str ( ) ) ) )
2374- . await ?;
2386+ mem. add_message ( crate :: utils:: ChatMessage :: tool (
2387+ & tool_result_text,
2388+ & tc. id ,
2389+ Some ( tool_name. as_str ( ) ) ,
2390+ ) )
2391+ . await ?;
23752392 tool_invoked = true ;
23762393 }
23772394 }
0 commit comments