Skip to content

Incorrect downstream clearing of a mapped task group task instance #64526

@lkindere

Description

@lkindere

Apache Airflow version

3.1.6

What happened and how to reproduce it?

When clearing a single failed task instance in a mapped task group with downstream option, it will clear all instances of the downstream task. For example if we have a mapped task group of 3 tasks:

Task1_A, Task1_B, Task1_C

Task2_A, Task2_B, Task2_C

Clearing Task1_B in the UI with downstream selected would clear Task1_B and Task2_A, Task2_B, Task2_C.
Excepted behaviour: Clearing Task1_B and Task2_B

Image Trying to clear only in index 0: Image

We see all 3 instances of the second task get selected:

Image

However if we clear the dag run itself for failed tasks for example:

Image Image

It is correctly resolving only these 2 failed tasks
Image

So it must be possible somehow but only the manual clearing of an individual task seems to be broken.

Example DAG:

from datetime import datetime

from airflow.exceptions import AirflowException
from airflow.sdk import dag, task, task_group

@dag(
    dag_id="test_task_group_clearing",
    start_date=datetime(2026, 1, 1),
    schedule=None,
    catchup=False,
)
def test_task_group_clearing():

    @task
    def get_items():
        return ["item_A", "item_B", "item_C"]

    @task_group(group_id="processing_group")
    def process_item_group(item: str):
        @task
        def step_1(val: str):
            if val == "item_B":
                raise AirflowException("Mock fail")
            return val

        @task
        def step_2(val: str):
            return val

        step_1(val=item) >> step_2(val=item)

    items = get_items()
    process_item_group.expand(item=items)

test_task_group_clearing()

What you think should happen instead?

No response

Operating System

No response

Versions of Apache Airflow Providers

No response

Deployment

None

Deployment details

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions