avanish-garg opened a new issue, #72379: URL: https://github.com/apache/airflow/issues/72379
### Problem `on_task_instance_failed` fires identically whether a task instance is about to be automatically retried (state set to `UP_FOR_RETRY`) or has permanently failed (state set to `FAILED`). The hook call in `models/taskinstance.py` sits after the retry-eligibility branch and fires unconditionally either way, using the same hook name. This makes the listener API noisy for a common use case: an alerting/paging integration built on `on_task_instance_failed` gets triggered on every transient retry of a flaky task, not just the final terminal failure, which undermines the signal-to-noise of building alerting on this hook. ### Rough approach Airflow's listener spec already carves out sub-outcomes this way elsewhere — `on_task_instance_skipped` exists specifically to distinguish "skipped" from the generic success/failure buckets. Same pattern would fit here: add a new hookspec (naming open to discussion — something like `on_task_instance_up_for_retry`) fired when a task instance is set to `UP_FOR_RETRY`, and keep `on_task_instance_failed` scoped to the terminal-failure branch only. Want me to send a PR for this? -- 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]
