ColtenOuO opened a new pull request, #71734:
URL: https://github.com/apache/airflow/pull/71734

   ### Sumarry
   
   `LLMFileAnalysisOperator.execute()` was the only `require_approval`-capable 
operator in `providers/common/ai` that didn't validate the prompt before doing 
any real work. Its four siblings (`LLMOperator`, `LLMBranchOperator`, 
`LLMSqlOperator`, `LLMSchemaCompareOperator`) all call 
`validate_approval_prompt()` as the first line of `execute()`, so a non-string 
prompt (e.g. from a native-templating render that resolves to a 
`Sequence[UserContent]`) is rejected immediately.
   
   `LLMFileAnalysisOperator` only discovered the same error later, inside 
`defer_for_approval()` -- by which point it had already read the target file(s) 
from storage and made a real (possibly multimodal) LLM call, only to then 
reject the output because `require_approval=True` doesn't support a non-string 
prompt.
   
   ### What
   
   Add the same `validate_approval_prompt()` preflight to 
`LLMFileAnalysisOperator.execute()`, mirroring the other four operators,
   plus a regression test (`TestLLMFileAnalysisOperatorMultimodalPromptGuard`) 
asserting the failure happens before 
`build_file_analysis_request`/`agent.run_sync` are ever called.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to