tkyoo opened a new issue, #64957: URL: https://github.com/apache/airflow/issues/64957
### Under which category would you file this issue? Airflow Core ### Apache Airflow version 3.2.0 ### What happened and how to reproduce it? [https://github.com/apache/airflow/blob/1ffd2da4fbe414ffe6822d52e86a77ab68257010/airflow-core/src/airflow/models/taskinstance.py#L784](https://github.com/apache/airflow/blob/1ffd2da4fbe414ffe6822d52e86a77ab68257010/airflow-core/src/airflow/models/taskinstance.py?utm_source=copilot.com#L784) During query creation in get_task_instance, the filter_by condition should also include dag_id. However, it was removed without explanation in the following commit: [https://github.com/apache/airflow/blob/d8a97a3082425bfc626776306ef7149567d5f9fc/airflow-core/src/airflow/models/taskinstance.py](https://github.com/apache/airflow/blob/d8a97a3082425bfc626776306ef7149567d5f9fc/airflow-core/src/airflow/models/taskinstance.py?utm_source=copilot.com) Currently, if there are two or more DAGs with the same run_id and task_id then get_or_none returns multiple results, causing the scheduler to terminate unexpectedly. ### What you think should happen instead? When creating a TaskInstance query in get_task_instance, the dag_id should also be passed to filter_by. The previous code was removed without any explanation. ### Operating System _No response_ ### Deployment None ### Apache Airflow Provider(s) _No response_ ### Versions of Apache Airflow Providers _No response_ ### Official Helm Chart version 1.20.0 (latest released) ### Kubernetes Version _No response_ ### Helm Chart configuration _No response_ ### Docker Image customizations _No response_ ### Anything else? _No response_ ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- 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]
