Skip to content

[airflow-ctl/v0-1-test] Add the awaiting_input task instance state (#68028) - #76118

Merged
shahar1 merged 1 commit into
apache:airflow-ctl/v0-1-testfrom
shahar1:ctl016-fix-ti-awaiting-input
Oct 31, 2026
Merged

shahar1 merged 1 commit into
apache:airflow-ctl/v0-1-testfrom
shahar1:ctl016-fix-ti-awaiting-input

Conversation

@shahar1

@shahar1 shahar1 commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Partial backport of #68028 to airflow-ctl/v0-1-test, following the precedent of #76076 (DagRunType for #63733): only the enum value and what is generated from it are backported, not the Human-in-the-loop feature itself.

airflowctl 0.1.x is generated from the 3.2.1 API spec, so its TaskInstanceState has no awaiting_input. Against an Airflow 3.3+ API server, taskinstances list and tasks states-for-dag-run crash with a pydantic ValidationError as soon as a Dag run contains a HITL task waiting for input. Adding the member lets 0.1.6 read those task instances from 3.3.x and 3.4.x servers while still working against 3.2.x (the value is never sent by older servers).

As in #76076, the core enum (airflow-core/src/airflow/utils/state.py), both OpenAPI yamls, the generated UI types and the task-sdk mirror are updated so airflow-ctl/src/airflowctl/api/datamodels/generated.py stays regenerable from this branch; the upstream State helper sets are intentionally not extended here (same choice as #76076).

Tested:

  • breeze testing airflow-ctl-tests: 562 passed (new test: test_task_instance_state_accepts_awaiting_input, which fails without the change).
  • Live, against real apache/airflow:3.3.2-python3.12 and 3.4.0rc1-python3.12 servers with a HITL task parked in awaiting_input: taskinstances list and tasks states-for-dag-run return the state instead of a traceback; against 3.2.2-python3.12 behaviour is unchanged.
  • breeze testing airflow-ctl-integration-tests against 3.2.2, 3.3.2 and 3.4.0rc1 with the three 0.1.6 fixes combined: identical results to the unpatched branch (the suite has no HITL case).

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Fable 5.1)

Generated-by: Claude Code (Fable 5.1) following the guidelines

Airflow 3.3.0+ servers emit the task-instance state awaiting_input for Human-in-the-loop tasks (upstream apache#68028, b64a0e6). airflowctl's TaskInstanceState lacked the value, so taskinstances list, tasks states-for-dag-run and the tasks clear preview crashed with a pydantic ValidationError whenever such a task instance existed on a 3.3.x or 3.4.0rc1 server. 3.2.x servers never emit the value, so the client is a strict superset there.

Only the enum value and what the branch's generators derive from it are backported, following 290f022: core utils/state.py (IntermediateTIState and TaskInstanceState, needed so the generate-openapi-spec output and the test_state union invariant stay consistent), both OpenAPI yamls, the UI openapi-gen ts files and the task-sdk datamodels. Left out on purpose because airflow-core, task-sdk and the UI are not released from this branch: the State.AWAITING_INPUT alias, the state_color and State.unfinished entries, TaskInstanceStateCount.awaiting_input, the UI icon and theme entries, the scheduler and HITL routes, and the edge3 provider spec (providers/edge3/.../v2-edge-generated.yaml), whose hook only fires on edge worker_api changes.

Widening IntermediateTIState also widens the execution API's TITargetStatePayload.state and the task-sdk model without a Cadwyn version bump, as upstream did; this has no runtime effect on this branch.
@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 Oct 31, 2026
@shahar1
shahar1 merged commit 5617f7f into apache:airflow-ctl/v0-1-test Oct 31, 2026
13 checks passed
@shahar1
shahar1 deleted the ctl016-fix-ti-awaiting-input branch October 31, 2026 07:28
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.

1 participant