eugeneo17 opened a new pull request, #71730: URL: https://github.com/apache/airflow/pull/71730
closes: #53402 TriggerDagRunOperator gains an opt-in auto_clear_failed_tasks flag (default False) that lets a parent-task retry resume a failed child run from its point of failure instead of dead-ending. **Motivation** Chained-DAG pipelines commonly pin the child's trigger_run_id (or its logical_date) so the child run is idempotent, one run per business date/key, so a parent retry doesn't spawn duplicate child runs. But with wait_for_completion=True, that same stability makes retries a dead end: once the pinned child run has failed, re-running the parent task raises DagRunAlreadyExists, and the only escape today is reset_dag_run=True, which wipes the whole child and re-runs tasks that already succeeded. There is no way to resume a failed child from where it stopped without manual cleanup. **What this does** On the parent task's retry, when the pinned child run already exists in a terminal failed state, auto_clear_failed_tasks=True clears only the failed tasks (and their downstream) of that run and re-runs them, preserving already-successful tasks - the child resumes rather than restarts or errors. The failed-only clear is delivered server-side via a new Execution API version (2026-11-13, AddOnlyFailedToClearDagRunPayload); the only_failed flag is threaded operator → task-runner → supervisor → SDK client, and on a 409 conflict the client routes the trigger to the /clear endpoint with only_failed=true. reset_dag_run keeps precedence: if both are set the whole run is cleared, and at most one clear ever happens. It is version-gated, against a core older than 2026-11-13 the operator raises NotImplementedError rather than silently downgrading to a whole-run clear. **Scope and notes** Synchronous only (wait_for_completion=True); not supported with deferrable=True (setting both raises ValueError). Because previously-successful child tasks are not re-run and failed ones are, the triggered DAG's tasks should be idempotent - called out in the operator docstring and the operator guide. A healed child run's final state reads success, so run-level alerting won't see the transient failure (per-attempt logs are preserved). Emitting a metric/event when a heal fires would close that gap and is proposed as a follow-up rather than part of this PR. **Testing** Unit tests for the operator, the Task SDK (comms/supervisor/task-runner/client), and the Execution API version + payload. Includes a regression test asserting the failed-only clear is reached when reset_dag_run=False (the auto_clear path), which fails against a client that gates the clear on reset_dag_run alone. Was generative AI tooling used to co-author this PR? [X] Yes (please specify the tool below) Generated-by: Claude Code (Opus 4.8) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
