kaxil opened a new pull request, #75413: URL: https://github.com/apache/airflow/pull/75413
A Human-in-the-loop task can write its request from a running task, but it cannot read the answer. The task supervisor serves `CreateHITLDetailPayload` and rejects `GetHITLDetailResponse` with `400 Unhandled request`: until now only the triggerer needed to read a response, so `test_registered_message_types` left it out on purpose. This PR lets a running task read its own response, and makes the UI and the response endpoint handle a task that is still running while it waits. That is what an operator needs to check for a quick answer before it parks in `awaiting_input`, instead of always going back through the scheduler. The provider side (`response_poll_window` on the HITL operators) is the follow-up PR stacked on this one. ## Design rationale **Reading the response.** The supervisor gains a `GetHITLDetailResponse` handler with a `HITLDetailResponseResult` reply type in the Task SDK comms. The Execution API route it calls is already scoped to `ti:self`, so a task can only read its own response. **Why the triggerer keeps its own `HITLDetailResponseResult`.** `airflow-core` pins `apache-airflow-task-sdk>=1.4.0,<1.5.0`. If the triggerer imported the new SDK class, a core release could be installed with a Task SDK that does not have it. The two classes have the same shape and discriminator. **When a running task counts as waiting.** "Running" alone is not enough: a cleared or retried attempt is also running before it rewrites its request, and a task resumed after a timeout with no defaults runs `execute_complete` with the request still unanswered. So a running task counts as waiting only while the attempt that wrote the request runs it for the first time: `next_method` is unset and the request's `created_at` is at or after the attempt's `start_date`. `awaiting_response_clause()` in `models/hitl.py` is the SQL form, used by the Dags list "needs review" filter and its pending actions. `HITLDetail.is_awaited_by_running_task()` is the Python form. **The response endpoint now refuses two answers it used to accept.** For a running task outside that window it returns `409`. Before, it stored the answer and then lost it: the retry's request upsert cleared it, or the resumed run failed with `HITLTimeoutError` regardless. Answers to deferred, `awaiting_input` and finished tasks behave as before. **UI.** `isHITLPending` takes the HITL detail and applies the same `start_date` rule; the response form, the Required Actions list and the tab count use it. The Required Actions list and the needs-review button now request `running` rows from the server alongside `deferred` and `awaiting_input`. The UI has no `next_method`, so for the moment a resumed run lasts it can show the form; the server refuses that answer. **Supervisor schema.** `HITLDetailResponseResult` is a new body, so `schema.json` and the vendored Go and TypeScript copies are regenerated, and the Go models with them. The in-progress `v2026_10_30.py` lists the new body in its docstring: a new body needs no `VersionChange`, but `check-supervisor-schemas-versions` requires a change under `versions/` whenever the snapshot differs from `main`. ## Gotchas - `2026-10-30` is the in-progress supervisor schema version on `main`, and 3.4.0b2 already ships it. Unless this is backported to 3.4, `main` and 3.4 will carry different bodies under the same date. --- * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#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](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed. * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x). * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
