Thank you Jarek and David for the feedback. I think both of your concerns can be organized under the following sections. I've summarized your feedback and provided my response to each below:
1) Backwards compatibility and provider adoption Feedback: Providers need to be able to adopt PollingTrigger without waiting for a new minimum supported Airflow version. Response: Agreed. I've updated the AIP to expose the PollingTrigger class through common.compat, which imports the Core implementation when available and falls back to a compatible implementation otherwise. I've opened POC PRs for both: - Core: https://github.com/apache/airflow/pull/77906/changes/f2888440362705b402a11c353544b6e443ad1bae - Common Compat: https://github.com/apache/airflow/pull/77988/changes/342875a89573c6fd171b43f918ee4d87eb23bfe3 Whilst I was working on them before sending this email, Kaxil mentioned that they were already beginning to diverge (In reality, I was just further refining one of the implementations based on feedback but I see his point). So I've also added a source-equivalence test to ensure the two implementations remain synchronized. 2) Scope and existing abstractions Feedback: Clarify the relationship with AwsBaseWaiterTrigger and BaseEventTrigger, and consider extracting retry/back-off handling for reuse. Response: I've clarified that PollingTrigger is intended for finite polling operations, not long-lived event-driven triggers such as IBM MQ's AwaitMessageTrigger. AwsBaseWaiterTrigger is useful prior art, but I don't think migrating existing AWS triggers should be a requirement of this AIP. They can be evaluated for migration separately. I personally would request feedback from the AWS team on this. Migrating the AWS triggers would not be as beneficial as the problem that is trying to be addressed via this AIP has effectively been solved by AwsBaseWaiterTrigger. I also see the potential benefit of extracting retry/back-off handling into a reusable component, but would prefer to leave that for a follow-up rather than expand the initial scope. 3) Polling contract and event handling Feedback: Reduce the number of hooks and provide default event builders. Response: Agreed. I've simplified the interface to: async def poll(self) -> TriggerEvent | None: Subclasses return None while polling should continue or a TriggerEvent when the operation completes. I've also introduced default error and timeout event builders, which providers can override to preserve their existing event payloads. 4) Retry handling Feedback: Define retry configuration, defaults, restart behaviour and how retries interact with existing hook/SDK retries. Response: I've introduced max_retries, defaulting to zero, and is_retryable_error() for explicit exception classification. The retry counter resets after a successful poll and is not serialized, meaning a triggerer restart resets the retry budget. This is now documented. The POC uses the configured polling interval between retries rather than introducing a separate back-off policy. I agree that providers should avoid unnecessarily stacking retries across hooks, triggers and tasks. Existing hook/SDK retry mechanisms should generally be preferred where appropriate. However, one disadvantage I want to raise about hook/SDK level retry mechanisms (say using custom methods or libraries like tenacity) is that they end up being implemented (or not) idiosyncratically. The retries introduced by PollingTrigger will always be there and not left to the whims of contributors and reviewers. 5) Deadline handling and timeout precedence Feedback: Fix timezone handling, prevent timeout overshooting and preserve terminal events returned after a deadline. Clarify the choice of wall-clock deadlines and compatibility with existing epoch timestamps. Response: I've updated the implementation to require a UTC-aware datetime, use datetime.now(UTC) and bound sleep duration by the remaining deadline. I've also adopted David's suggested precedence: check the deadline before polling and after exceptions, but preserve a terminal event returned by a successful poll. Absolute deadlines are intentional because queueing and triggerer restarts should count towards the timeout. Providers using epoch timestamps can convert these at their boundaries while preserving their existing serialized arguments. 6) Remote job cancellation Feedback: Timeout events do not automatically cancel external jobs, and on_kill() is not invoked for execution timeouts. Response: I think we should distinguish between a trigger-managed end_time and a task-level execution_timeout. For end_time, PollingTrigger emits a timeout event, and the operator's execute_complete() remains responsible for cancelling the remote operation where appropriate. For execution_timeout, I've opened a separate DISCUSS thread and PR to address this centrally: - DISCUSS: https://lists.apache.org/thread.html/2mcmwod93l7sjmfl7krypm87c2kj67nn - PR: https://github.com/apache/airflow/pull/77562 The PR introduces BaseTrigger.on_timeout() to support cleanup when a deferred task exceeds its execution timeout, while distinguishing this from user cancellations and trigger reassignment. I've also manually validated this using a deferrable Airbyte sync, confirming that the external job is cancelled when execution_timeout is exceeded. I think this is better handled centrally in Core so that all deferrable triggers can benefit, rather than making it specific to PollingTrigger. Triggers not implementing the semantics of execution_timeout has been a longstanding gap in the core framework that has forced me and many other contributors to implement workarounds at provider level. But it is not in scope for this AIP though I agree it is an important adjacent gap to address since we are discussing deferrable mode. 7) Provider migrations Feedback: Demonstrate the abstraction through real provider migrations, showing reduced duplication while preserving existing behaviour and event payloads. Response: I've opened three POC migration PRs across different providers: - Airbyte: https://github.com/apache/airflow/pull/77910/changes/94419e4a729f551cb234d0153a4d5821ff09ad27 - dbt Cloud: https://github.com/apache/airflow/pull/78073/changes/e29d6e316fb9d971cfef6db69305a8f0df61c1b9 - Databricks: https://github.com/apache/airflow/pull/78158/changes/1ca52a2b013c4517f597b0b06515546f8d61be33 These migrations are intended to demonstrate how the framework removes duplicated polling logic while preserving the existing provider-specific behaviour and event contracts. They should also help identify any limitations in the proposed interface before it is finalized. Also, I should mention that the dbt cloud and Airbyte triggers have lost around ~30 lines of code each, which is a good heuristic to judge the effectiveness of a new shared abstraction. Additionally, writing these triggers using the PollingTrigger is much simpler as you do not need to worry about the precedence of timeouts vs state checks or handling different errors effectively. Reviewing them also goes from checking for subtle bugs to just validating the poll and event building methods against the relevant API/SDK. 8) Logging and metrics Feedback: The Motivation mentions centralized logging and metrics without specifying their implementation. Response: I have realized adding logging to the original scope was unnecessary. I have removed any mention of it from the AIP. I have made a few updates to the AIP document and its appendix (which inculcates more comprehensive responses to your feedback; if anything is missed here, its likely covered in that). Kaxil had 2 comments on confluence which I have addressed in both the PoCs and the document. I would appreciate another look. Also, for the PoC PRs, I believe you can't use github stack PRs across forks so I had to manually stack each PR (so core PR first, then common compat then finally each provider trigger). However, I have provided the links to the relevant commits so you can click on them and see the changes I want you to see. Thanks, Sameer On Mon, 30 Nov 2026 at 10:22, David Blain via dev <[email protected]> wrote: > Hi Sameer, > > +1 on the direction, and +1 on Jarek's points, in particular deciding > the common.compat route now and showing a few real migrations. I won't > repeat those; here is what I would add. > > 1. Timeout taking precedence over a terminal state. The loop checks the > deadline after a poll has returned and before it looks at the state. > If the poll comes back with a success a few milliseconds after > end_time, the task fails although the remote job is done, and a task > retry then reruns a job that already succeeded. Existing triggers > behave the other way round: Databricks only checks before it starts a > poll [1], so a result in hand is used. What is the reason for the > stricter rule? I would propose to check before a poll and after an > error, and never between a successful poll and its state. > > 2. The deadline, beyond the naive/aware fix Jarek mentioned. The > existing triggers pass a float epoch compared with time.time() > [1][2], so a datetime changes the serialized arguments of triggers > that are in flight during an upgrade; the migration section should > say how that is handled. Also, the OpenAI batch trigger deprecated > end_time in favour of a timeout measured with time.monotonic(), > because wall-clock deadlines move with NTP corrections and VM pauses > [3]. The AIP makes the opposite choice for a good reason (queueing > and triggerer restarts should count), but it would help to name that > trade-off and that precedent. > > 3. Who cancels the remote job on a timeout. on_kill() does not fire on a > trigger timeout [4], so after the timeout event the remote job keeps > running unless the operator cancels it when it resumes. One sentence > saying that the operator's completion method owns that cancel would > close the gap, and it is the real advantage of end_time over > defer(timeout=...). > > 4. Retry layers. On top of what Jarek wrote about the retry design: many > async hooks and SDKs already retry internally, so retries multiply > (hook, trigger, task). The AIP says it does not override the hooks' > behaviour; a recommendation for one layer would help authors. > > 5. On the scope question (Jarek's point 6), a concrete example: the IBM > MQ AwaitMessageTrigger [5]. It waits for the next message without a > deadline, and its hook retries with exponential back-off from 1 s to > 60 s without a budget [6], so it cannot use PollingTrigger. I think > out of scope is the right answer for such triggers, but they need the > same error classification and back-off. Could retry and back-off be a > piece of their own that PollingTrigger uses, so that a later base > class for message-wait triggers can reuse it with an unbounded > budget? > > 6. On the number of hooks, an alternative to consider next to default > event builders: the text describes the provider part as "return > either continue or the appropriate TriggerEvent", which is a single > method: > > async def poll(self) -> TriggerEvent | None > > The framework never needs the state itself, only "done or not". > > One small one: the logging and metrics promised in the Motivation are > not specified yet (names, tags). > > Regards, > David > > [1] > https://github.com/apache/airflow/blob/main/providers/databricks/src/airflow/providers/databricks/triggers/databricks.py > [2] > https://github.com/apache/airflow/blob/main/providers/airbyte/src/airflow/providers/airbyte/triggers/airbyte.py > [3] > https://github.com/apache/airflow/blob/main/providers/openai/src/airflow/providers/openai/triggers/openai.py > [4] > https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/triggers/base.py > (docstring of BaseTrigger.on_kill) > [5] > https://github.com/apache/airflow/blob/main/providers/ibm/mq/src/airflow/providers/ibm/mq/triggers/mq.py > [6] > https://github.com/apache/airflow/blob/main/providers/ibm/mq/src/airflow/providers/ibm/mq/hooks/mq.py > (aconsume) > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
