@@ -246,6 +246,7 @@ def __init__(
246246 self .executor = concurrent .futures .ThreadPoolExecutor (
247247 max_workers = n_tests + 3 if self .experiment_id is None else n_tests + 4
248248 )
249+ self .optimization_review = ""
249250
250251 def can_be_optimized (self ) -> Result [tuple [bool , CodeOptimizationContext , dict [Path , str ]], str ]:
251252 should_run_experiment = self .experiment_id is not None
@@ -1517,17 +1518,17 @@ def process_review(
15171518 raise_pr = not self .args .no_pr
15181519 staging_review = self .args .staging_review
15191520 opt_review_response = ""
1520- # Skip optimization review for async functions for now
1521- if (raise_pr or staging_review ) and not self .function_to_optimize .is_async :
1522- data ["root_dir" ] = git_root_dir ()
1523- try :
1524- opt_review_response = self .aiservice_client .get_optimization_review (
1525- ** data , calling_fn_details = function_references
1526- )
1527- except Exception as e :
1528- logger .debug (f"optimization review response failed, investigate { e } " )
1529- # Always set optimization_review in data (empty string for async functions)
1521+ # this will now run regardless of pr, staging review flags
1522+ try :
1523+ opt_review_response = self .aiservice_client .get_optimization_review (
1524+ ** data , calling_fn_details = function_references
1525+ )
1526+ except Exception as e :
1527+ logger .debug (f"optimization review response failed, investigate { e } " )
15301528 data ["optimization_review" ] = opt_review_response
1529+ self .optimization_review = opt_review_response
1530+ if raise_pr or staging_review :
1531+ data ["root_dir" ] = git_root_dir ()
15311532 if raise_pr and not staging_review and opt_review_response != "low" :
15321533 # Ensure root_dir is set for PR creation (needed for async functions that skip opt_review)
15331534 if "root_dir" not in data :
0 commit comments