@@ -340,34 +340,34 @@ def _collect_failed_tool_calls(messages):
340340 if "tool_call" in content and "function" in content .get ("tool_call" , {}):
341341 tc = content ["tool_call" ]
342342 name = tc .get ("function" , {}).get ("name" , "" ) or ""
343- tcid = tc .get ("id" )
343+ call_id = tc .get ("id" )
344344 else :
345345 name = content .get ("name" , "" ) or ""
346- tcid = content .get ("tool_call_id" )
347- if tcid is not None :
348- id_to_name [tcid ] = name
346+ call_id = content .get ("tool_call_id" )
347+ if call_id is not None :
348+ id_to_name [call_id ] = name
349349 status = content .get ("status" )
350350 if isinstance (status , str ) and status in _FAILED_RUNTIME_STATUSES :
351- if tcid is not None :
352- failed_ids .append (tcid )
351+ if call_id is not None :
352+ failed_ids .append (call_id )
353353 elif name :
354354 failed_names_without_id .append (name )
355355
356356 for msg in messages :
357357 if not isinstance (msg , dict ) or msg .get ("role" ) != "tool" :
358358 continue
359- tcid = msg .get ("tool_call_id" )
359+ call_id = msg .get ("tool_call_id" )
360360 for content in msg .get ("content" , []) or []:
361361 if not isinstance (content , dict ) or content .get ("type" ) != "tool_result" :
362362 continue
363363 status = content .get ("status" )
364- if isinstance (status , str ) and status in _FAILED_RUNTIME_STATUSES and tcid is not None :
365- failed_ids .append (tcid )
364+ if isinstance (status , str ) and status in _FAILED_RUNTIME_STATUSES and call_id is not None :
365+ failed_ids .append (call_id )
366366
367367 ordered = []
368368 seen = set ()
369- for tcid in failed_ids :
370- label = id_to_name .get (tcid ) or tcid
369+ for call_id in failed_ids :
370+ label = id_to_name .get (call_id ) or call_id
371371 if label and label not in seen :
372372 seen .add (label )
373373 ordered .append (label )
0 commit comments