Skip to content

Incorrect run ID in External DAG button in ExternalTaskSensor #66695

@farrukh-t

Description

@farrukh-t

Under which category would you file this issue?

Providers

Apache Airflow version

3.2.1

What happened and how to reproduce it?

The External DAG button that appears in Airflow UI under Details tab when selecting an ExternalTaskSensor task targets an incorrect logical date for the upstream DAG. It appears that the button targets a logical date of the DAG where the ExternalTaskSensor is created rather than the External (upstream) DAG.

Here is an example to reproduce - suppose you have 2 DAGs, upstream and downstream:

upstream.py:

from datetime import datetime

from airflow.providers.standard.operators.empty import EmptyOperator
from airflow.sdk import DAG

with DAG(
    dag_id="upstream",
    default_args={
        "depends_on_past": False,
        "retries": 0,
    },
    schedule="0 2 * * *",
    catchup=False,
    start_date=datetime(2026, 5, 1),
) as dag:
    start = EmptyOperator(task_id="start")
    finish = EmptyOperator(task_id="finish")

    start >> finish

downstream.py:

from datetime import datetime, timedelta

from airflow.providers.standard.operators.empty import EmptyOperator
from airflow.providers.standard.sensors.external_task import ExternalTaskSensor
from airflow.sdk import DAG

with DAG(
    dag_id="downstream",
    default_args={
        "depends_on_past": False,
        "retries": 0,
    },
    schedule="0 4 * * *",
    catchup=False,
    start_date=datetime(2026, 5, 1),
) as dag:
    wait_for_upstream = ExternalTaskSensor(
        task_id="wait_for_upstream",
        external_dag_id="upstream",
        external_task_id="finish",
        execution_delta=timedelta(hours=2),
        poke_interval=60,
        timeout=60 * 60,
        mode="reschedule",
    )

    process = EmptyOperator(task_id="process")
    finish = EmptyOperator(task_id="finish")

    wait_for_upstream >> process >> finish

Note the difference in the DAGs' schedules - upstream runs daily at 2 AM, downstream - daily at 4 AM. The downstream DAG has an ExternalTaskSensor task that waits for the upstream DAG.

The issue is that if you click the External DAG button on the ExternalTaskSensor task - it redirects you to a DAG run that doesn't exist - the time in the link is 04:00:00+00:00, but it should be 02:00:00+00:00:

Image Image Image

What you think should happen instead?

The External DAG button should point to the run ID of the upstream (target) DAG, not its own run ID.

Operating System

Debian GNU/Linux 12 (bookworm)

Deployment

Other Docker-based deployment

Apache Airflow Provider(s)

standard

Versions of Apache Airflow Providers

apache-airflow-providers-standard 1.12.3

Official Helm Chart version

Not Applicable

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions