@@ -360,13 +360,14 @@ def approve_retail_task_plan(self):
360360 if clarification_input .is_visible (timeout = 5000 ) and clarification_input .is_enabled ():
361361 logger .warning ("⚠ Clarification input is enabled - Task plan may require additional clarification" )
362362 # Don't raise error - this is expected for some teams like HR
363- return True # Indicates clarification is needed
364- logger . info ( "✓ No clarification required - task completed successfully" )
365- return False # No clarification needed
363+ # Callers should handle clarification as needed
364+ else :
365+ logger . info ( "✓ No clarification required - task completed successfully" )
366366 except (TimeoutError , Exception ) as e :
367367 # No clarification input detected, proceed normally
368368 logger .info (f"✓ No clarification input detected - proceeding normally: { e } " )
369- return False
369+
370+ logger .info ("Retail task plan approval and processing completed successfully!" )
370371
371372 def approve_task_plan (self ):
372373 """Approve the task plan and wait for processing to complete (without clarification check)."""
@@ -468,13 +469,14 @@ def approve_rfp_task_plan(self):
468469 if clarification_input .is_visible (timeout = 5000 ) and clarification_input .is_enabled ():
469470 logger .warning ("⚠ Clarification input is enabled - RFP Task plan may require additional clarification" )
470471 # Don't raise error - this is expected for some workflows
471- return True # Indicates clarification is needed
472- logger . info ( "✓ No clarification required - task completed successfully" )
473- return False # No clarification needed
472+ # Callers should handle clarification as needed
473+ else :
474+ logger . info ( "✓ No clarification required - task completed successfully" )
474475 except (TimeoutError , Exception ) as e :
475476 # No clarification input detected, proceed normally
476477 logger .info (f"✓ No clarification input detected - proceeding normally: { e } " )
477- return False
478+
479+ logger .info ("RFP task plan approval and processing completed successfully!" )
478480
479481 def approve_contract_compliance_task_plan (self ):
480482 """Approve the Contract Compliance task plan and wait for processing to complete."""
@@ -500,13 +502,14 @@ def approve_contract_compliance_task_plan(self):
500502 if clarification_input .is_visible (timeout = 5000 ) and clarification_input .is_enabled ():
501503 logger .warning ("⚠ Clarification input is enabled - Contract Compliance Task plan may require additional clarification" )
502504 # Don't raise error - this is expected for some workflows
503- return True # Indicates clarification is needed
504- logger . info ( "✓ No clarification required - task completed successfully" )
505- return False # No clarification needed
505+ # Callers should handle clarification as needed
506+ else :
507+ logger . info ( "✓ No clarification required - task completed successfully" )
506508 except (TimeoutError , Exception ) as e :
507509 # No clarification input detected, proceed normally
508510 logger .info (f"✓ No clarification input detected - proceeding normally: { e } " )
509- return False
511+
512+ logger .info ("Contract Compliance task plan approval and processing completed successfully!" )
510513
511514 def validate_retail_customer_response (self ):
512515 """Validate the retail customer response."""
@@ -888,14 +891,21 @@ def validate_rai_error_message(self):
888891 continue
889892
890893 if not error_found :
891- # Check if plan creation didn't start (another valid rejection state)
894+ # Try to confirm plan creation started (to rule out silent acceptance)
895+ # Wait briefly to see if plan creation becomes visible
892896 try :
893- if not self .page .locator (self .CREATING_PLAN ).is_visible (timeout = 2000 ):
894- logger .warning ("⚠ No explicit error message, but plan creation didn't start - input may have been silently rejected or truncated" )
897+ # If plan creation becomes visible, the input was accepted (not blocked by RAI)
898+ if self .page .locator (self .CREATING_PLAN ).is_visible (timeout = 3000 ):
899+ logger .error ("✗ Plan creation started - RAI did not block the prompt as expected" )
900+ error_found = False # This is actually a failure case
901+ else :
902+ # Plan creation didn't start within timeout - likely rejected
903+ logger .info ("✓ Plan creation did not start - input appears to have been rejected" )
895904 error_found = True
896905 except Exception as e :
897- # Ignore failures in this secondary check, but log for troubleshooting
898- logger .debug ("Failed to verify CREATING_PLAN visibility while checking for RAI rejection state: %s" , e )
906+ # If we can't determine, treat as ambiguous but log it
907+ logger .warning ("⚠ Could not verify CREATING_PLAN state: %s - assuming rejection" , e )
908+ error_found = True
899909
900910 if not error_found :
901911 logger .error ("✗ No RAI error or rejection state detected; prompt appears to have been accepted unexpectedly" )
0 commit comments