vatsrahul1001 opened a new pull request, #67089: URL: https://github.com/apache/airflow/pull/67089
Backport of #66431 to `v3-2-test` for the 3.2.2 release. Regression fix for [#66374](https://github.com/apache/airflow/issues/66374): when a trigger fires and moves a deferred TI to `scheduled` (resume after defer) before the executor's `success` event 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 additional `ti_requeued` branch for the resume-after-defer case: TI is `scheduled` + `next_method is not None` + executor reports `success` → treat as a requeue, not a mismatch. ### Backport notes Tests required a small adapt for v3-2-test: - v3-2-test mocks stats via `@mock.patch(\"airflow.jobs.scheduler_job_runner.Stats.incr\")` (direct `Stats.incr` patch). `main` uses the newer `@mock.patch(\"airflow._shared.observability.metrics.stats._get_backend\")` indirection — that helper does not exist on v3-2-test. - The new test `test_process_executor_events_stale_success_when_scheduled_after_defer` is included verbatim from #66431, but its decorator + assertions are rewritten to use the v3-2-test `Stats.incr` mock pattern (drops the `MagicMock(spec=StatsLogger)` + `mock_get_backend.return_value = …` indirection; references `mock_stats_incr` directly). - The scheduler change in `scheduler_job_runner.py` auto-merged cleanly. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Opus 4.7 (1M context) Generated-by: Claude Opus 4.7 (1M context) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
