[v3-2-test] fix(scheduler): ignore stale executor success after defer reschedule (#66431)#67089
Merged
Merged
Conversation
…66431) * fix(scheduler): ignore stale executor success after defer reschedule When a trigger moves a deferred task back to scheduled before the scheduler processes the executor success from the worker defer exit, treat it as benign (same try_number, next_method set) instead of state mismatch failure. Closes #66374 Co-authored-by: Cursor <cursoragent@cursor.com> * Remove newsfragment for bugfix (per review) --------- Co-authored-by: Cursor <cursoragent@cursor.com> (cherry picked from commit ac39596)
vatsrahul1001
added a commit
that referenced
this pull request
May 20, 2026
…66431) (#67089) * fix(scheduler): ignore stale executor success after defer reschedule When a trigger moves a deferred task back to scheduled before the scheduler processes the executor success from the worker defer exit, treat it as benign (same try_number, next_method set) instead of state mismatch failure. Closes #66374 * Remove newsfragment for bugfix (per review) --------- (cherry picked from commit ac39596) Co-authored-by: /-\ - Pedro Henrique Klein <pedrohenriquekleinphg@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
vatsrahul1001
added a commit
that referenced
this pull request
May 20, 2026
…66431) (#67089) * fix(scheduler): ignore stale executor success after defer reschedule When a trigger moves a deferred task back to scheduled before the scheduler processes the executor success from the worker defer exit, treat it as benign (same try_number, next_method set) instead of state mismatch failure. Closes #66374 * Remove newsfragment for bugfix (per review) --------- (cherry picked from commit ac39596) Co-authored-by: /-\ - Pedro Henrique Klein <pedrohenriquekleinphg@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
vatsrahul1001
added a commit
that referenced
this pull request
May 21, 2026
…66431) (#67089) * fix(scheduler): ignore stale executor success after defer reschedule When a trigger moves a deferred task back to scheduled before the scheduler processes the executor success from the worker defer exit, treat it as benign (same try_number, next_method set) instead of state mismatch failure. Closes #66374 * Remove newsfragment for bugfix (per review) --------- (cherry picked from commit ac39596) Co-authored-by: /-\ - Pedro Henrique Klein <pedrohenriquekleinphg@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Open
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #66431 to
v3-2-testfor the 3.2.2 release.Regression fix for #66374: when a trigger fires and moves a deferred TI to
scheduled(resume after defer) before the executor'ssuccessevent from the pre-defer worker exit is processed, the scheduler treated the stale success as a state mismatch and would kill the task externally. The fix adds an additionalti_requeuedbranch for the resume-after-defer case: TI isscheduled+next_method is not None+ executor reportssuccess→ treat as a requeue, not a mismatch.Backport notes
Tests required a small adapt for v3-2-test:
@mock.patch(\"airflow.jobs.scheduler_job_runner.Stats.incr\")(directStats.incrpatch).mainuses the newer@mock.patch(\"airflow._shared.observability.metrics.stats._get_backend\")indirection — that helper does not exist on v3-2-test.test_process_executor_events_stale_success_when_scheduled_after_deferis included verbatim from fix(scheduler): ignore stale executor success after defer reschedule #66431, but its decorator + assertions are rewritten to use the v3-2-testStats.incrmock pattern (drops theMagicMock(spec=StatsLogger)+mock_get_backend.return_value = …indirection; referencesmock_stats_incrdirectly).scheduler_job_runner.pyauto-merged cleanly.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Opus 4.7 (1M context) following the guidelines