Skip to content

Add DagRunType for operator#63733

Open
henry3260 wants to merge 3 commits intoapache:mainfrom
henry3260:add-run-type-operator
Open

Add DagRunType for operator#63733
henry3260 wants to merge 3 commits intoapache:mainfrom
henry3260:add-run-type-operator

Conversation

@henry3260
Copy link
Contributor

@henry3260 henry3260 commented Mar 16, 2026

Why

  • The Execution API previously used the MANUAL run type for operator-triggered DAG runs, which caused ambiguity and made it difficult to distinguish between user-initiated and operator-initiated runs.

What

  • Added OPERATOR to the DagRunType enum and updated all relevant code paths to use OPERATOR for operator-triggered DAG runs.
  • Updated the Execution API route to strictly enforce OPERATOR as the only allowed run type.
Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@boring-cyborg boring-cyborg bot added area:airflow-ctl area:API Airflow's REST/HTTP API area:task-sdk area:UI Related to UI/UX. For Frontend Developers. labels Mar 16, 2026
@henry3260 henry3260 changed the title Execution API: Enforce OPERATOR run type for operator-triggered DAG runs Add DagRunType for operator Mar 16, 2026
@henry3260 henry3260 force-pushed the add-run-type-operator branch from 6382118 to d1e4052 Compare March 16, 2026 15:03
@henry3260 henry3260 marked this pull request as ready for review March 16, 2026 16:24
Copilot AI review requested due to automatic review settings March 16, 2026 16:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new DAG run type (operator) so that DAG runs created via TriggerDagRunOperator/execution API can be distinguished from manual/UI/CLI triggers across Python, OpenAPI clients, and the UI.

Changes:

  • Add DagRunType.OPERATOR = "operator" across core + generated client datamodels.
  • Update the Execution API trigger endpoint to create operator-typed DagRuns and enforce allowed_run_types accordingly.
  • Regenerate/update OpenAPI artifacts and UI rendering for the new run type.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
task-sdk/src/airflow/sdk/api/datamodels/_generated.py Adds operator to generated DagRunType for the Task SDK models.
airflow-ctl/src/airflowctl/api/datamodels/generated.py Adds operator to generated DagRunType for airflowctl models.
airflow-core/src/airflow/utils/types.py Adds DagRunType.OPERATOR in core enum.
airflow-core/src/airflow/api/common/trigger_dag.py Allows callers to specify run_type (default manual) and validates against allowed_run_types.
airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_runs.py Execution API now triggers runs as run_type=operator and enforces operator run permission.
airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_dag_runs.py Asserts triggered run uses DagRunType.OPERATOR and adds additional denial coverage.
airflow-core/tests/unit/api/common/test_trigger_dag.py Adds unit test for operator run denial when only manual is allowed.
airflow-core/src/airflow/ui/src/components/RunTypeIcon.tsx Displays an icon for run_type="operator".
airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts Updates generated TS union type to include operator.
airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts Updates generated TS schema enum to include operator.
airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml Adds operator to DagRunType enum in generated OpenAPI.
airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml Adds operator to DagRunType enum in UI OpenAPI.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM overall!

@henry3260 henry3260 force-pushed the add-run-type-operator branch 3 times, most recently from 5147f3e to f47fb76 Compare March 17, 2026 07:48
@henry3260 henry3260 force-pushed the add-run-type-operator branch 7 times, most recently from e5a7cc7 to 937a827 Compare March 17, 2026 17:34
@henry3260 henry3260 force-pushed the add-run-type-operator branch from 937a827 to db40fd0 Compare March 17, 2026 17:54
@henry3260 henry3260 requested a review from jason810496 March 18, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:airflow-ctl area:API Airflow's REST/HTTP API area:task-sdk area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants