Skip to content

Conversation

@Lee-W
Copy link
Member

@Lee-W Lee-W commented Jul 28, 2025

Why

If we clear a HITLOperator task instance today, it breaks because there's an existing HITLDetail, and it is not allowed to add a new one.

What

The handling is now updated to the following

  1. If a HITLOperator task instance does not have a HITLDetail, a new HITLDetail is created without a response section.
  2. If a HITLOperator task instance has a HITLDetail but lacks a response, the existing HITLDetail is returned. This situation occurs when a task instance is cleared before a response is received.
  3. If a HITLOperator task instance has both a HITLDetail and a response section, the existing response is removed, and the HITLDetail is returned. This happens when a task instance is cleared after a response has been received. This design ensures that each task instance has only one HITLDetail.

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@Lee-W Lee-W requested review from amoghrajesh, ashb and kaxil as code owners July 28, 2025 15:58
@Lee-W Lee-W changed the title fix(hitl): handle hitl details when task instance is retried fix(hitl): handle HITLDetail when task instance is retried Jul 28, 2025
@Lee-W Lee-W requested review from jason810496 and jscheffl July 28, 2025 16:00
@Lee-W Lee-W moved this to In review in AIP-90 - Human in the loop Jul 28, 2025
Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except a mypy nit and two minor things looking good for me.

1. If a HITLOperator task instance does not have a HITLDetail,
    a new HITLDetail is created without a response section.
 2. If a HITLOperator task instance has a HITLDetail but lacks a response,
    the existing HITLDetail is returned.
    This situation occurs when a task instance is cleared before a response is received.
 3. If a HITLOperator task instance has both a HITLDetail and a response section,
    the existing response is removed, and the HITLDetail is returned.
    This happens when a task instance is cleared after a response has been received.
    This design ensures that each task instance has only one HITLDetail.
@Lee-W Lee-W force-pushed the handle-retry-cases-for-hitl-details branch from c207618 to f224de9 Compare July 29, 2025 02:29
@Lee-W Lee-W merged commit 6cc2232 into apache:main Jul 29, 2025
103 checks passed
@Lee-W Lee-W deleted the handle-retry-cases-for-hitl-details branch July 29, 2025 03:29
@github-project-automation github-project-automation bot moved this from In review to Done in AIP-90 - Human in the loop Jul 29, 2025
RoyLee1224 pushed a commit to RoyLee1224/airflow that referenced this pull request Jul 31, 2025
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 7, 2025
fweilun pushed a commit to fweilun/airflow that referenced this pull request Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants