Skip to content

Old DAG version used even when selecting Run with latest bundle version on task instance "clear" #67657

Closed

Description

@jroachgolf84

Under which category would you file this issue?

Airflow Core

Apache Airflow version

3.1.6

What happened and how to reproduce it?

User noted that a certain DAG picks up the outdated DAG Bundle even when "run_on_latest_version": true when retrying a Task after shipping a new version of the DAG in question. At the moment the user does not have clarity on how to reproduce the initial state for it (3 out of 30 failed dags exhibited this behavior in a 24 hour period).

How it manifests:

  1. Task fails run on V5 version of the DAG
  2. Deploy DAG version V6, new code is visible in the Airflow UI
  3. Clear task instance in Airflow UI with Run with latest bundle version option (confirmed by DAG audit log)
  4. Airflow starts Task on V5
  5. Repeat [3]
  6. Task still starts V5 code

The user then went to the DAG-level clear, picked the checkbox but did not clear the dag run, and the bug went away.

What you think should happen instead?

  1. Task fails run on V5 version of the DAG
  2. Deploy DAG version V6, new code is visible in the Airflow UI
  3. Clear task instance in Airflow UI with Run with latest bundle version option (confirmed by DAG audit log)
  4. Airflow starts Task on V6

Operating System

Linux (Astronomer)

Deployment

Astronomer

Apache Airflow Provider(s)

No response

Versions of Apache Airflow Providers

NA

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. Codingaditya17 commented on May 29, 2026

    @Codingaditya17
    Contributor

    I checked this against the existing fix in #65835. The fix is already present on newer branches, but it was missing from the v3-1-test line, which matches this report being on Airflow 3.1.6.

    I opened a backport PR against v3-1-test to bring over the backend DagVersion alignment fix for run_on_latest_version=True.

    The backport keeps the change focused to clear_task_instances, so cleared task instances use the latest dag_version_id, and queued/running DagRuns are aligned to the latest DAG/bundle version before the next task execution.

    PR: #67673

  2. added 4 commits that reference this issue on Jun 10, 2026
    b9c61be
    4c70555
    70b3715
    e09ad45
  3. added a commit that references this issue on Jun 15, 2026
    db58849
  4. added a commit that references this issue on Jun 16, 2026
    1cb6304
  5. added a commit that references this issue on Jun 16, 2026
    d815754
  6. added a commit that references this issue on Jun 16, 2026
    8e0aa0b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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