Hi, I've opened PR #77562 to introduce BaseTrigger.on_timeout(), allowing triggers to clean up external resources when a deferred task exceeds its execution_timeout, before the trigger is removed.
Currently, timeout handling across deferrable operators is inconsistent. Some providers, such as Airbyte and dbt Cloud, use workarounds that pass an execution_deadline to the trigger, which then emits a timeout event for the operator to handle. Others lack equivalent handling, potentially leaving external jobs running after the Airflow task has timed out. These workarounds exist because Airflow core does not currently handle `execution_timeout` cleanup for deferrable tasks in the same way as synchronous tasks, where a worker can invoke cleanup logic. PR #77562 aims to address this gap by introducing a core timeout lifecycle hook that providers can use to clean up external resources. Once this is available, I'd like to propose gradually standardising timeout handling across providers by migrating existing `execution_deadline` workarounds to `on_timeout()` and addressing gaps in operators that currently lack timeout cleanup. Ideally, this would also become the recommended approach for new deferrable operators that manage external resources. I've started with PR #77737, which migrates Airbyte's existing workaround to the new method. The intention is not to require every trigger to implement `on_timeout()`, but rather those associated with external resources that require explicit cleanup, such as cancelling a running job. I'd welcome feedback on this direction, particularly on the provider migrations and missing cleanup implementations once the core PR is merged. Kindly note that this is adjacent to AIP-121, not a part of that proposal. I have read the initial feedback on the DISCUSS thread for that AIP and I will respond once I have a fully formed response. Thanks, Sameer. Links PR #77562: https://github.com/apache/airflow/pull/77562 PR #77737: https://github.com/apache/airflow/pull/77737
