hussein-awala opened a new pull request, #72849: URL: https://github.com/apache/airflow/pull/72849
Late trigger results could overwrite a concurrent task transition because event and failure submission selected deferred tasks without locking them. A task cleared, failed, resumed, or attached to a replacement trigger after that read could be scheduled again, or receive stale terminal callbacks and XComs. Lock matching task instances in a consistent order and refresh their cached values before applying an event or failure. Both submission paths share the selection logic. Locks cover only task instances and wait for competing transactions, allowing the database to recheck the deferred state and trigger ID before dispatch. Validation through Breeze with Python 3.10: - All 18 new regression cases fail against the original source. - Trigger model suite: 62 passed on PostgreSQL 14 and 62 passed on MySQL 8. - Trigger model and triggerer suites on SQLite: 157 passed, with 17 row-locking cases skipped. - Concurrent tests cover task failure, clearing, resumption, and replacement triggers; late terminal results produce no callbacks or XComs. - Regular and manual prek checks passed, including Ruff and airflow-core mypy. Selective checks request the full core CI matrix, which was not run locally. Related to #71391, which retries transient deadlocks; this change prevents stale task updates. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Codex (GPT-6) Generated-by: Codex (GPT-6) 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]
