kaxil opened a new pull request, #68492:
URL: https://github.com/apache/airflow/pull/68492

   A task that reaches the `awaiting_input` state (Human-in-the-loop, #68028) 
hangs `airflow dags test` forever: nothing can resume it, so the command logs 
[`No tasks to run. unrunnable tasks: 
...`](https://github.com/apache/airflow/blob/a5ffa6c794/task-sdk/src/airflow/sdk/definitions/dag.py#L1404-L1406)
 once per second indefinitely. The in-process task runner also swallows 
SIGTERM, so `timeout` cannot stop it.
   
   `dag.test()` now treats parked HITL tasks as waiting rather than unrunnable, 
and never resolves them itself: the run stays alive, logging which tasks await 
input, until a response recorded from outside flips them back to SCHEDULED -- 
the existing loop then resumes them. This is the same contract a parked task 
has on a real deployment, where the API response handler or the scheduler's 
timeout sweep performs the resume.
   
   Because the resume is the standard transition, the existing response 
channels work with `dags test` unchanged: the Required Actions UI or the [HITL 
REST 
API](https://github.com/apache/airflow/blob/a5ffa6c794/airflow-core/src/airflow/api_fastapi/core_api/routes/public/hitl.py#L149-L248)
 of an api-server sharing the metadata database (e.g. `airflow standalone`). 
Verified end to end in breeze: `airflow dags test` parks and logs `Waiting for 
Human-in-the-loop input for tasks: ['wait_approval']`, a `PATCH 
.../hitlDetails` with `{"chosen_options": ["Approve"]}` against a locally 
started `airflow api-server` resumes it, the downstream task runs, and the run 
finishes successfully. This also gives AI agents a clean way to drive HITL 
pipelines locally: run `dags test`, surface the request to a human, submit the 
answer through the API.
   
   The change is deliberately minimal -- one hunk in the `dag.test()` loop plus 
a contract test. Interactive console prompting in the `dags test` CLI (and any 
API additions it needs) is left for follow-up PRs.
   


-- 
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]

Reply via email to