guan404ming commented on code in PR #72155:
URL: https://github.com/apache/airflow/pull/72155#discussion_r3969345773
##########
providers/common/ai/docs/operators/llm.rst:
##########
@@ -198,7 +198,11 @@ Set ``require_approval=True`` to pause the task after the
LLM generates its
output and wait for a human reviewer to approve or reject it via the Airflow
HITL interface. Optionally allow the reviewer to edit the output before
approving with ``allow_modifications=True``, and set a deadline with
-``approval_timeout``:
+``approval_timeout``.
+
+When ``approval_timeout`` expires without a review, the task fails by default.
+Set ``on_approval_timeout="approve"`` or ``"reject"`` to answer the review with
+that option instead, so an unattended pipeline keeps moving:
Review Comment:
Split the sentence, "reject" now documented as failing here; example
switched to "approve"; llm_sql.rst updated.
##########
providers/common/ai/src/airflow/providers/common/ai/mixins/approval.py:
##########
@@ -179,14 +189,13 @@ def defer_for_approval(
trigger=HITLTrigger(
ti_id=ti_id,
options=[LLMApprovalMixin.APPROVE, LLMApprovalMixin.REJECT],
- defaults=None,
+ defaults=timeout_defaults,
Review Comment:
Guarded Case 1 for a missing responder, emits timedout=True; covered in
test_hitl.py.
##########
providers/common/ai/src/airflow/providers/common/ai/mixins/approval.py:
##########
@@ -219,10 +229,12 @@ def execute_complete(self, context: Context,
generated_output: str, event: dict[
responded_by_user = event.get("responded_by_user")
chosen = event["chosen_options"]
if self.APPROVE not in chosen:
+ if event.get("timedout"):
+ raise HITLRejectException("Output was rejected by the approval
timeout default.")
Review Comment:
Reject message names the setting; approval and LLMBranchOperator logs name
the timeout default.
##########
providers/common/ai/src/airflow/providers/common/ai/mixins/approval.py:
##########
@@ -42,6 +42,7 @@ class DeferForApprovalProtocol(Protocol):
approval_timeout: timedelta | None
allow_modifications: bool
+ on_approval_timeout: str
Review Comment:
Protocol now uses the same Literal as LLMOperator.
--
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]