opeida opened a new issue, #53579:
URL: https://github.com/apache/airflow/issues/53579

   ### Apache Airflow version
   
   3.0.3
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   A branch that begins with sensor is mistakenly skipped after 
BranchPythonOperator. The same code worked well on Airflow 2.10.5.
   
   DAG run graph:
   <img width="979" height="142" alt="Image" 
src="https://github.com/user-attachments/assets/421ac606-ec8c-4fd6-91aa-1d2a131cd415";
 />
   
   BranchPythonOperator returned `check_gcs_file` and the skipped branch should 
have been executed. Putting EmptyOperator between `is_process_data_exist` and 
`check_gcs_file` (as the first task in the branch) solves the issue. DAG run 
log:
   ```
   [2025-07-21, 09:05:37] INFO - Done. Returned value was: check_gcs_file: 
source="airflow.task.operators.airflow.providers.standard.operators.python.BranchPythonOperator"
   [2025-07-21, 09:05:37] INFO - Branch into check_gcs_file: 
source="airflow.task.operators.airflow.providers.standard.operators.python.BranchPythonOperator"
   [2025-07-21, 09:05:37] INFO - Following branch {'check_gcs_file'}: 
source="airflow.task.operators.airflow.providers.standard.operators.python.BranchPythonOperator"
   [2025-07-21, 09:05:37] INFO - Skipping tasks []: 
source="airflow.task.operators.airflow.providers.standard.operators.python.BranchPythonOperator"
   [2025-07-21, 09:05:37] INFO - Pushing xcom: 
ti="RuntimeTaskInstance(id=UUID('01982b91-4fdb-7a89-9d13-b4e5504eb64a'), 
task_id='is_process_data_exist', ...": source="task"
   ```
   
   ### What you think should happen instead?
   
   The skipped branch should have been executed.
   
   ### How to reproduce
   
   Simplified DAG to reproduce the issue:
   ```Python
   from airflow import DAG
   from airflow.providers.google.cloud.sensors.gcs import 
GCSObjectExistenceSensor
   from airflow.providers.standard.operators.empty import EmptyOperator
   from airflow.providers.standard.operators.python import BranchPythonOperator
   
   with DAG(
       "test_dag",
       schedule=None,
   ) as dag:
   
       start = EmptyOperator(task_id="start")
   
       is_process_data_exist = BranchPythonOperator(
           task_id="is_process_data_exist",
           python_callable=lambda: "check_gcs_file"
       )
   
       check_gcs_file = GCSObjectExistenceSensor(
           task_id="check_gcs_file",
           google_cloud_conn_id="",
           bucket="",
           object="",
       )
   
       end = EmptyOperator(task_id="end", trigger_rule="none_failed")
   
       start >> is_process_data_exist
       is_process_data_exist >> end
       (
           is_process_data_exist
           >> check_gcs_file
           >> end
       )
   
   if __name__ == "__main__":
       dag.test()
   ```
   
   ### Operating System
   
   Debian GNU/Linux 12 (bookworm)
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-celery==3.12.1
   apache-airflow-providers-common-compat==1.7.2
   apache-airflow-providers-common-io==1.6.1
   apache-airflow-providers-common-sql==1.27.3
   apache-airflow-providers-fab==2.3.0
   apache-airflow-providers-google==16.1.0
   apache-airflow-providers-http==5.3.2
   apache-airflow-providers-postgres==6.2.1
   apache-airflow-providers-redis==4.1.1
   apache-airflow-providers-smtp==2.1.1
   apache-airflow-providers-standard==1.4.0
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   Deployed on GKE with extended image based on 
`apache/airflow:slim-3.0.3-python3.12` and Helm chart 1.17.0
   
   ### 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]

Reply via email to