Skip to content

Read HITLOperator subject/body into the summary lazily#70345

Merged
shahar1 merged 2 commits into
apache:mainfrom
1fanwang:fix-hitl-init
Jul 24, 2026
Merged

Read HITLOperator subject/body into the summary lazily#70345
shahar1 merged 2 commits into
apache:mainfrom
1fanwang:fix-hitl-init

Conversation

@1fanwang

@1fanwang 1fanwang commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

subject and body are template fields, rendered after __init__ runs. hitl_summary was built in the constructor from self.subject/self.body, so it captured the un-rendered Jinja. OpenLineage reads hitl_summary when it builds the task START event, so a templated subject/body was emitted as raw {{ ... }} instead of the resolved value.

Make hitl_summary a property that reads subject/body at access time — after rendering — so listeners and the OpenLineage START event see the resolved values. Runtime and subclass additions (timeout_datetime, approved, branches_to_execute, …) go through a private _hitl_summary_extra dict that the property merges in; the summary keys are otherwise unchanged.

related: #70296

Testing Done

New test_summary_reflects_rendered_subject_body renders a templated subject/body and asserts the summary exposes the resolved values. RED on the pre-fix source, GREEN after the property:

# pre-fix: subject/body snapshotted un-rendered in __init__
assert op.hitl_summary["subject"] == "Review for 2020-01-01"
E   AssertionError: assert equals failed
E      -'Review for {{ ds }}'     +'Review for 2020-01-01'

# after: full suite
81 passed, 1 skipped

The example_openlineage_hitl_dag system DAG (all four HITL variants) drives the START/COMPLETE events end-to-end in CI and checks each event's hitl_summary carries the rendered subject. validate_operators_init.py on the operator exits 0.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: GitHub Copilot CLI following the guidelines

subject and body are template fields, rendered after __init__ runs. The
constructor built hitl_summary with self.subject/self.body, so a templated
subject or body was captured as its un-rendered Jinja expression -- and the
OpenLineage task START event, which reads hitl_summary, emitted the raw
template instead of the rendered value.

Make hitl_summary a property so subject/body are read at access time, after
rendering. Runtime and subclass additions go through a private
_hitl_summary_extra dict that the property merges in.

related: apache#70296
Signed-off-by: 1fanwang <1fannnw@gmail.com>
@1fanwang 1fanwang changed the title Add HITLOperator subject/body to summary after rendering Read HITLOperator subject/body into the summary lazily Jul 24, 2026
@1fanwang
1fanwang marked this pull request as draft July 24, 2026 05:47
Signed-off-by: 1fanwang <1fannnw@gmail.com>
@1fanwang
1fanwang marked this pull request as ready for review July 24, 2026 06:23
@shahar1 shahar1 removed the backport-to-v3-3-test Backport to v3-3-test label Jul 24, 2026
@shahar1
shahar1 requested a review from Lee-W July 24, 2026 08:05

@shahar1 shahar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Lee-W I'll be happy if you could take a second look

@shahar1
shahar1 merged commit 52e2718 into apache:main Jul 24, 2026
207 of 212 checks passed
shahar1 added a commit to shahar1/airflow that referenced this pull request Jul 24, 2026
apache#70345 turned hitl_summary into a computed property and moved runtime
and subclass additions into a private _hitl_summary_extra dict. That
left HITLOperator subclasses without a supported way to extend the
summary (the pattern the old attribute explicitly documented) and leaks
the private attribute name into OpenLineage include_full_task_info
events. The property change has not shipped in a provider release yet,
so renaming the dict to a public hitl_summary_extra establishes the
replacement contract while it is still free of any compatibility cost.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants