guan404ming commented on code in PR #71046:
URL: https://github.com/apache/airflow/pull/71046#discussion_r3711358147
##########
providers/common/ai/src/airflow/providers/common/ai/mixins/approval.py:
##########
@@ -215,13 +227,17 @@ def execute_complete(self, context: Context,
generated_output: str, event: dict[
# when allow_modifications=False, bypassing the read-only approval
flow.
if getattr(self, "allow_modifications", False) and params_input:
modified = params_input.get("output")
+ if isinstance(modified, list) and all(isinstance(item, str) for
item in modified):
+ # Compact so an unchanged selection compares equal to
generated_output
+ modified = json.dumps(modified, separators=(",", ":"))
if modified is not None and not isinstance(modified, str):
# On the awaiting_input path nothing upstream schema-validates
params_input
# (HITLTrigger did on the legacy path), so enforce the string
contract here
# rather than returning a non-string as the task's output.
raise HITLTriggerEventError(
{
- "error": f"Modified output must be a string, got
{type(modified).__name__}.",
+ "error": f"Modified output must be a string or a list
of strings, "
Review Comment:
Fixed, the error now reports the offending item's type.
--
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]