Skip to content

[v3-3-test] Respect retries when a deferrable trigger ends a task with TaskFailedEvent (#69821) - #71163

Merged
vatsrahul1001 merged 1 commit into
v3-3-testfrom
cherry-pick-69821-v3-3-test
Aug 5, 2026
Merged

[v3-3-test] Respect retries when a deferrable trigger ends a task with TaskFailedEvent (#69821)#71163
vatsrahul1001 merged 1 commit into
v3-3-testfrom
cherry-pick-69821-v3-3-test

Conversation

@vatsrahul1001

Copy link
Copy Markdown
Contributor

Backport of #69821 to v3-3-test for the 3.3.1 patch release.

A deferrable task whose trigger ends it with a TaskFailedEvent was routed straight to FAILED, ignoring remaining retries. This computes retry eligibility (loading the serialized task, same as the normal task path) and sends the callback as UP_FOR_RETRY when the task is still eligible, archiving the finished try to task_instance_history so prior-try log lookups keep working.

Cherry-picked with -x from dd1f84ab2034a14164e4d09310fba8fe1fa0395e. Conflict resolution: the dag_version/version_data context around the callback (and its dedicated test) is a main-only feature that does not exist on v3-3-testTaskCallbackRequest here has no version_data field — so that part was dropped, keeping only the retry fix (task_callback_type=callback_type) and reading bundle_name/bundle_version the v3-3-test way. The full test_trigger.py suite (38 tests) passes.

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

…Event (#69821)

* Respect retries when a deferrable trigger ends a task with TaskFailedEvent

When a deferrable operator's trigger yields a terminal TaskFailedEvent, the task
was always marked failed and on_failure_callback ran, even with retries remaining.
A worker-side failure with retries left instead goes up_for_retry and runs
on_retry_callback. Route trigger-emitted failures through TaskInstance.handle_failure
(the path the scheduler has used since #56586) so retry-eligibility is respected and
the callback runs on_retry_callback vs on_failure_callback accordingly.

closes: #69819

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Preserve retry history for trigger-ended deferred failures

* Fix stale trigger callback comment

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit dd1f84a)
@vatsrahul1001 vatsrahul1001 added the type:bug-fix Changelog: Bug Fixes label Aug 5, 2026
@vatsrahul1001 vatsrahul1001 added this to the Airflow 3.3.1 milestone Aug 5, 2026
@vatsrahul1001
vatsrahul1001 requested a review from eladkal August 5, 2026 09:02
@vatsrahul1001
vatsrahul1001 merged commit 7aee7d6 into v3-3-test Aug 5, 2026
76 checks passed
@vatsrahul1001
vatsrahul1001 deleted the cherry-pick-69821-v3-3-test branch August 5, 2026 13:20
vatsrahul1001 added a commit that referenced this pull request Aug 5, 2026
…Event (#69821) (#71163)

* Respect retries when a deferrable trigger ends a task with TaskFailedEvent

When a deferrable operator's trigger yields a terminal TaskFailedEvent, the task
was always marked failed and on_failure_callback ran, even with retries remaining.
A worker-side failure with retries left instead goes up_for_retry and runs
on_retry_callback. Route trigger-emitted failures through TaskInstance.handle_failure
(the path the scheduler has used since #56586) so retry-eligibility is respected and
the callback runs on_retry_callback vs on_failure_callback accordingly.

closes: #69819



* Preserve retry history for trigger-ended deferred failures

* Fix stale trigger callback comment

---------


(cherry picked from commit dd1f84a)

Co-authored-by: Hemkumar Chheda <95332229+hkc-8010@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Triggerer type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants