Skip to content

Load the correct DAG version when a task starts from a trigger#69988

Open
seanghaeli wants to merge 3 commits into
apache:mainfrom
aws-mwaa:fix/triggerer-pin-dag-version
Open

Load the correct DAG version when a task starts from a trigger#69988
seanghaeli wants to merge 3 commits into
apache:mainfrom
aws-mwaa:fix/triggerer-pin-dag-version

Conversation

@seanghaeli

@seanghaeli seanghaeli commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

If the run and the task point at different DAG versions, the trigger should load the run's version.

@seanghaeli
seanghaeli force-pushed the fix/triggerer-pin-dag-version branch 4 times, most recently from 5e55a88 to f157049 Compare July 17, 2026 00:52
@seanghaeli
seanghaeli force-pushed the fix/triggerer-pin-dag-version branch from f157049 to ecbf158 Compare July 17, 2026 00:54
@seanghaeli
seanghaeli marked this pull request as ready for review July 17, 2026 00:59
@seanghaeli seanghaeli changed the title Pin triggerer start_from_trigger DAG resolution to the dagrun's version Load the correct DAG version when a task starts from a trigger Jul 17, 2026
@seanghaeli

Copy link
Copy Markdown
Contributor Author

@o-nikolas this one is similar in spirit to your PR #69941

@o-nikolas o-nikolas 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.

Seems like a reasonable change semantically. But someone who knows the trigger code better should review to see if this is what we want (it seems like it should be though to me at least). Maybe @vincbeck?

@viiccwen viiccwen 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.

left comments.

Comment thread airflow-core/tests/unit/jobs/test_triggerer_job.py Outdated
Comment on lines +879 to +880
version_id=trigger.task_instance.get_dagrun(session=session).created_dag_version_id
or trigger.task_instance.dag_version_id,

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.

created_dag_version_id is populated even for Dags with disable_bundle_versioning=True; dag_run.bundle_version is what determines
whether the run is pinned. This unconditional preference for created_dag_version_id therefore makes an unpinned start_from_trigger task load the Dag version from when the run was created, even after the scheduler has advanced the unfinished TI's dag_version_id following a reparse.

This differs from DBDagBag._version_from_dag_run(), which intentionally resolves the latest version when bundle_version is absent. Please use the run's created_dag_version_id only when the run is pinned, retain the TI version for unpinned runs, and cover both cases in the regression test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I believe this is addressed now, could you take a look?

Comment thread airflow-core/tests/unit/jobs/test_triggerer_job.py
@eladkal eladkal added this to the Airflow 3.3.1 milestone Jul 19, 2026
@eladkal eladkal added type:bug-fix Changelog: Bug Fixes backport-to-v3-3-test Backport to v3-3-test labels Jul 19, 2026
@potiuk

potiuk commented Jul 20, 2026

Copy link
Copy Markdown
Member

@seanghaeli — There are 3 unresolved review thread(s) on this PR from @viiccwen. Could you either push a fix or reply in each thread explaining why the feedback doesn't apply? Once you believe the feedback is addressed, mark the thread as resolved so the reviewer isn't re-pinged needlessly. Thanks!


Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Triggerer backport-to-v3-3-test Backport to v3-3-test type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants