Skip to content

UI: Add 'Mark as Skipped' option to Task Instance actions - #72425

Merged
bbovenzi merged 8 commits into
apache:mainfrom
ccoliu:ui-mark-task-as-skipped
Oct 7, 2026
Merged

bbovenzi merged 8 commits into
apache:mainfrom
ccoliu:ui-mark-task-as-skipped

Conversation

@ccoliu

@ccoliu ccoliu commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

closes: #72386

Description

Currently, the Airflow 3 UI only allows operators to manually mark a Task Instance as Success or Failed, but does not expose the option to mark it as Skipped.

However, the backend API (PatchTaskInstanceBody.validate_new_state) already accepts TaskInstanceState.SKIPPED as a valid target state. Marking a task as SUCCESS vs SKIPPED has distinct semantics in execution history, audit logs, and downstream trigger rule evaluation (e.g., none_failed vs none_skipped).

This PR:

  1. Splits allowedStates in src/components/MarkAs/utils.ts into:
    • allowedRunStates: ["success", "failed"] (maintaining the existing constraint that Dag Runs cannot be marked skipped)
    • allowedTaskStates: ["success", "failed", "skipped"] (enabling skipped for task instances and task groups)
  2. Updates MarkTaskInstanceAsButton, MarkTaskGroupAsButton, and BulkMarkTaskInstancesAsButton to use allowedTaskStates.
  3. Adds the missing tooltip translation for skipped in en/dags.json.

Screenshots

Before After
Only Success / Failed in Mark As menu Success / Failed / Skipped (pink badge) available
{94EAE782-BE3C-496C-90DB-0FA077C88D4E}
Was generative AI tooling used to co-author this PR?
  • Yes (Claude Opus 5)

Generated-by: Antigravity IDE following the guidelines

@ccoliu ccoliu mentioned this pull request Sep 2, 2026
2 tasks done
ccoliu and others added 3 commits September 2, 2026 22:09
The previous prettier auto-fix collapsed the translate() call but also
dropped the blank line before return, tripping padding-line-between-statements.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ccoliu

ccoliu commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

This PR has been open for a bit and all CI checks are now green (Static checks, and Chromium/Firefox/WebKit UI e2e tests). It's a small, self-contained UI addition — exposing the existing "skipped" state (already supported by the backend API) as a "Mark as Skipped" option for Task Instances, matching the existing "Mark as Success/Failed" pattern.

Would appreciate a review when anyone has a moment! cc @bbovenzi @pierrejeambrun (saw you both active on related MarkAs/multi-team UI work recently)

@bbovenzi

Copy link
Copy Markdown
Contributor

Sorry, I think this feature request needed more of a discussion before a code review. I am not sure if Mark as skipped is something we want to allow.

@ccoliu

ccoliu commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look, and no problem — agreed it makes sense to settle the behavior first. I'll convert this to a draft and follow the discussion on #72386.

For context, the public API's PATCH task instance endpoint already accepts skipped as new_state (see PatchTaskInstanceBody.validate_new_state), so this PR only exposes that existing capability in the UI. If the consensus is to restrict it — e.g. only for task instances that haven't started yet — I'm happy to adjust the PR accordingly, or close it if it's not something we want.

@ccoliu
ccoliu marked this pull request as draft September 24, 2026 06:33

@pierrejeambrun pierrejeambrun left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Following the discussion on the linked issue do you mind updating the doc as well to highlight the common pitfall / nuances.

Also we might want to add an "info" text in the modal to highlight what 'mark as skip' is doing and also explain the gotchas there.

Also need gate on the tasks states we're setting to 'pending' (as mentioned in the discussion)

@ccoliu

ccoliu commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review and the discussion on #72386! Before updating the PR, I'd like to confirm two details:

  1. Which states count as "pending"? I'm thinking: allow none, scheduled, up_for_reschedule (and possibly up_for_retry); disallow queued (could be picked up any moment), running, deferred, restarting, and all finished states. Does that match what you had in mind?
  2. Where should the gate live? Since the dialog can also include upstream/downstream/past/future task instances, a check on the selected task alone in the UI isn't enough. Should we enforce it in the PATCH task instance endpoint when new_state is skipped (rejecting, or filtering out, non-pending TIs), or keep it UI-only for now?

I'd also suggest limiting this PR to single task instances (dropping skipped from the task group and bulk actions) to keep the scope manageable, unless you'd prefer otherwise.

Then I'll add the info text in the modal and a docs note on the cascade-skip behavior with the default all_success trigger rule.

@bbovenzi

bbovenzi commented Oct 6, 2026

Copy link
Copy Markdown
Contributor
  1. We already have a isStatePending() util in the UI project. But sounds like that its too expansive so I trust the states you picked.
  2. Ideally we check this on the API but we can pre-empt the errors in the UI by only showing the skipped option depending on TI.state and that its a TI and not any group. Once we open the modal we can disable all the options that allow one to affect other TIs.

@ccoliu

ccoliu commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @bbovenzi and @pierrejeambrun! Updated following the discussion:

  • Pending-only: "Skipped" is offered only for a single task instance with no state, scheduled, up_for_reschedule or up_for_retry (a narrower list than isStatePending(), which also includes running/queued/deferred states). It was removed from the task group, Dag run and bulk actions.
  • No effect on other TIs: when marking as skipped, the past/future/upstream/downstream options are disabled and always sent as false, even if the user's default options include them.
  • Info text in the modal explaining what skipping does and the trigger-rule pitfall.
  • Docs: added a "Marking a Task Instance as skipped" section to core-concepts/tasks.rst.

I kept the gate in the UI for now; enforcing it in the PATCH endpoint could be a follow-up PR if you'd like.

Verified locally with a Dag mirroring the use case from #72386 (wait_for_file_b sensor in reschedule mode → ingestion_b → transformations, plus ingestion_a → transformations):

Sensor in up_for_reschedule Already-succeeded task
wait_for_file_b_menu ingestion_a_menu

Mark as skipped dialog:
wait_for_file_b_dialog

After confirming, ingestion_b and transformations were skipped via the default all_success trigger rule, and the Dag run finished as success:
after_confirm

@ccoliu
ccoliu marked this pull request as ready for review October 7, 2026 07:20
@bbovenzi bbovenzi added this to the Airflow 3.4.0 milestone Oct 7, 2026
@bbovenzi
bbovenzi merged commit 19d20a0 into apache:main Oct 7, 2026
91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:translations area:UI Related to UI/UX. For Frontend Developers. translation:default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "Mark as Skipped" action for Task Instances in the Airflow 3 UI

3 participants