1414 get_lint_cmd ,
1515 read_yaml_config ,
1616)
17+ from agent .agents import AgentReturn
1718import json
1819import subprocess
1920from agent .agents import AiderAgents
@@ -62,7 +63,7 @@ def run_agent_multiple_times_on_same_inquiry(
6263 repeat_times_for_each_inquiry : int ,
6364 backend : str ,
6465 commit0_config_file : str ,
65- ) -> None :
66+ ) -> AgentReturn | None :
6667 """Run agent multiple times on the same inquiry and return the best performing agent return"""
6768 if repeat_times_for_each_inquiry == 1 :
6869 return agent .run (
@@ -71,10 +72,9 @@ def run_agent_multiple_times_on_same_inquiry(
7172 else :
7273 commit_before_run = repo .head .commit .hexsha
7374 commit_results = {}
74- best_commit_diff = None
75+ best_commit_diff = ""
7576 best_eval_result = float ("-inf" )
7677 best_agent_return = None
77-
7878 for attempt in range (repeat_times_for_each_inquiry ):
7979 agent_return = agent .run (
8080 message ,
@@ -221,6 +221,7 @@ def run_agent_for_repo(
221221 if agent_config is None :
222222 raise ValueError ("Invalid input" )
223223
224+ agent_return = None
224225 if agent_config .run_tests :
225226 update_queue .put (("start_repo" , (repo_name , len (test_files ))))
226227 # when unit test feedback is available, iterate over test files
@@ -260,7 +261,11 @@ def run_agent_for_repo(
260261 update_queue .put (
261262 (
262263 "update_money_display" ,
263- (repo_name , test_file , agent_return .last_cost ),
264+ (
265+ repo_name ,
266+ test_file ,
267+ agent_return .last_cost if agent_return is not None else 0 ,
268+ ),
264269 )
265270 )
266271 elif agent_config .run_entire_dir_lint :
@@ -300,7 +305,11 @@ def run_agent_for_repo(
300305 update_queue .put (
301306 (
302307 "update_money_display" ,
303- (repo_name , lint_file , agent_return .last_cost ),
308+ (
309+ repo_name ,
310+ lint_file ,
311+ agent_return .last_cost if agent_return is not None else 0 ,
312+ ),
304313 )
305314 )
306315 else :
@@ -373,7 +382,11 @@ def run_agent_for_repo(
373382 update_queue .put (
374383 (
375384 "update_money_display" ,
376- (repo_name , file_name , agent_return .last_cost ),
385+ (
386+ repo_name ,
387+ file_name ,
388+ agent_return .last_cost if agent_return is not None else 0 ,
389+ ),
377390 )
378391 )
379392 if agent_config .record_test_for_each_commit :
0 commit comments