Skip to content

Bug in Patching DagRun + Mark dag as success and failed have different behaviours #67695

Closed

Description

@DonHaul

Under which category would you file this issue?

Providers

Apache Airflow version

3.2.1

What happened and how to reproduce it?

Issue 1:

In the ui. If a dagrun has already succeeded we cannot "remark" it as succeeded which makes sense. However through the API patch_dag_run, when sending a payload such as

{
        "state": "success",
        "note": note,
    }

It allows dag to be "remarked" as success. This has the unwanted effect of marking tasks that in the initial dag run were skipped or failed, to now be shown as success.

Issue 2:

When marking through the ui a dagrun that is currently running as success and failed we get different results.

  • When doing mark as failed all the tasks that haven't yet been executed get skipped and the dag gets failed as failed - OK - See Image 2
  • When doing mark as success, all the tasks, even the ones that have been previously executed and succeeded/ failed or got skipped change their status to success. - This is misleading, as a task that has already happened should not have its status changed - See Image 3

Dag example. The ui is pressed once the dag is on task_mark_dag_here

from airflow.sdk import dag, task
import time

@dag
def test_short_circuit_dag():

    @task.branch
    def task_branch():
        return "task_succeeds"

    @task
    def task_succeeds():
       pass

    @task
    def task_skipped():
       pass

    @task(trigger_rule="all_done")
    def task_fails_successfully():
        raise Exception

    @task(trigger_rule="one_failed")
    def task_succeeds2():
        pass


    @task
    def task_mark_dag_here():
        time.sleep(5)
    
    @task
    def task_not_executed():
        pass

    task_succeeds_1 = task_succeeds()

    task_branch() >> [task_succeeds_1, task_skipped()]
    task_succeeds_1 >> task_fails_successfully() >> task_succeeds2() >> task_mark_dag_here() >> task_not_executed()  >> task_not_executed() 

test_short_circuit_dag()

Image 1 - "Initial State"

Image

Image 2 - Marking as Failed

Image

Image 3 - Marking as Success

Image

What you think should happen instead?

Issue 1:

if a dag has already succeeded sending a patch_dag_rung with the "state": "success" in the payload should not do anything.

Issue 2:

If the dag is running, pressing mark as success should:

  • mark all next tasks as skipped
  • not alter states of tasks that already executed
  • mark dag as success

Operating System

No response

Deployment

None

Apache Airflow Provider(s)

No response

Versions of Apache Airflow Providers

No response

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

Activity

  1. added
    kind:bug
    needs-triage
    on May 29, 2026
  2. added
    area:API
    on May 29, 2026
  3. Cloud-Architect-Emma commented on May 29, 2026

    @Cloud-Architect-Emma
    Contributor

    Hi @DonHaul, thanks for the detailed report. I'd like to work on this. Before I start, could you or a maintainer confirm the preferred fix approach for Issue 2, specifically whether mark as success should use the same task-skipping logic that mark as failed already applies correctly?

    Happy to submit a PR once the approach is agreed.

  4. pierrejeambrun commented on Jul 1, 2026

    @pierrejeambrun
    Member

    In the ui. If a dagrun has already succeeded we cannot "remark" it as succeeded which makes sense.

    I believe we can.

  5. removed
    needs-triage
    on Jul 1, 2026
  6. added this to the Airflow 3.3.1 milestone on Jul 1, 2026
  7. pierrejeambrun commented on Jul 9, 2026

    @pierrejeambrun
    Member

    Closed by #68666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:APIarea:corekind:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions