Skip to content

Conversation

@nothingmin
Copy link
Contributor

This PR resolves the issue reported in #54134, where attempting to clear task instances from the Airflow UI using both dag_run_id and include_past/include_future resulted in a 400 error. This prevented users from clearing past or future task instances via the UI, which was possible in previous Airflow versions.

With this fix:

The API now correctly allows the use of include_past/include_future together with dag_run_id, as long as the DAG run has a valid logical_date (i.e., for scheduled DAG runs).
For manually triggered DAG runs (where logical_date is None), the API still returns a 400 error to protect against accidental clearing of unrelated task instances—preventing the original bug from resurfacing.

closes: #54134

스크린샷 2025-08-12 오후 11 36 53

@boring-cyborg
Copy link

boring-cyborg bot commented Aug 12, 2025

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg bot added the area:API Airflow's REST/HTTP API label Aug 12, 2025
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks.

A few comments to address before we can merge.

Also I just started the CI and it will need fixing (code formatting etc...)

@nothingmin
Copy link
Contributor Author

@pierrejeambrun
Thanks for the review!
I’ve addressed all the feedback
All review comments should now be resolved

@pierrejeambrun pierrejeambrun added the backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch label Sep 2, 2025
@pierrejeambrun pierrejeambrun added this to the Airflow 3.0.7 milestone Sep 2, 2025
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please fix the CI?

Tested locally, looks good. Just a few things to adjust, we can merge then.

@pierrejeambrun
Copy link
Member

Screenshot 2025-09-04 at 17 03 53

While it should be like this after the clearing request:
Screenshot 2025-09-04 at 17 04 06

@pierrejeambrun
Copy link
Member

Issue here #55267

@pierrejeambrun pierrejeambrun merged commit f5d0b17 into apache:main Sep 4, 2025
107 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Sep 4, 2025

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@github-actions
Copy link

github-actions bot commented Sep 4, 2025

Backport failed to create: v3-0-test. View the failure log Run details

Status Branch Result
v3-0-test Commit Link

You can attempt to backport this manually by running:

cherry_picker f5d0b17 v3-0-test

This should apply the commit to the v3-0-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

@pierrejeambrun
Copy link
Member

Manual backport #55272

pierrejeambrun added a commit that referenced this pull request Sep 5, 2025
…#54416) (#55272)

Co-authored-by: Gwak Beomgyu <67548026+nothingmin@users.noreply.github.com>
RoyLee1224 pushed a commit to RoyLee1224/airflow that referenced this pull request Sep 8, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
@kaxil kaxil modified the milestones: Airflow 3.0.7, Airflow 3.1.0 Sep 13, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Sep 30, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 1, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 2, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 3, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 4, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 7, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 8, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 9, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 10, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 11, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 12, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 14, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 15, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 17, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 19, 2025
…apache#54416)

* Fix clearTaskInstances API: Restore include_past/include_future support on UI

* style: fix formatting

* chore: fix typo

* chore: remove comment

* chore: fix comment DX to TX

* refactor: remove verbose handling future or past

* refactor: remove verbose handling future or past

* refactor: use hardcoded test result

* fix(test_task_instances.py): correct test comment

* fix(test_task_instances.py): fix typo

* fix(test_task_instances.py): fix typo

* fix(task_instances.py): make sure start_date, end_date to None

* fix(task_instances.py): fix inaccurate response

* fix(task_instances.py): fix inaccurate response

---------

Co-authored-by: bggwak <bggwak@hyundai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Airflow 3 Clear Task Instance for past or future doesn't work

4 participants