Ignore stale executor success when TI is queued after defer
Fixes a race where the trigger resumes a deferred task to queued (rather than scheduled) before the scheduler processes the executor SUCCESS from the worker defer exit. The scheduler then treated queued vs executor success as a state mismatch and failed the TI (#67287).
The fix for #66374 (#66431) added handling for the scheduled variant. Under load the trigger may reschedule into either queued or scheduled depending on scheduler loop timing, so both states must be treated as stale defer-exit events when next_method is set.
Changes:
- Extend
ti_requeuedcondition inprocess_executor_eventsto includeTaskInstanceState.QUEUED - Add
test_process_executor_events_stale_success_when_queued_after_defer(positive + negative withoutnext_method) - Add newsfragment
67287.bugfix.rst
Testing:
pytest airflow-core/tests/unit/jobs/test_scheduler_job.py::TestSchedulerJob::test_process_executor_events_stale_success_when_queued_after_defer -q
- closes: #67287
Thanks for the review. I updated the commit message to remove the conventional commit style from the PR title as requested. Let me know if anything else needs adjustment.
Fixed the PR title to remove conventional commit style. Let me know if anything else needs adjustment.
Please stop merging main. This PR will never be merged if you keep doing this.
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.