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

   `start_trigger_args` is a class attribute on `DateTimeSensorAsync`, 
`TimeSensor` and
   `FileSensor`, and each one assigned *through* it in `__init__`:
   
   ```python
   self.start_trigger_args.trigger_kwargs = dict(moment=self._moment, ...)
   ```
   
   That mutates the shared class-level object instead of creating an instance 
attribute, so
   every task built from the operator ends up advertising the arguments of 
whichever task was
   constructed last.
   
   Reproducer on `main`:
   
   ```python
   a = DateTimeSensorAsync(task_id="a", target_time=datetime(2030, 1, 1), 
start_from_trigger=True)
   b = DateTimeSensorAsync(task_id="b", target_time=datetime(2040, 6, 6), 
start_from_trigger=True)
   
   a.start_trigger_args is b.start_trigger_args        # True
   a.start_trigger_args.trigger_kwargs["moment"]       # 2040-06-06  <- b's 
moment
   ```
   
   With `start_from_trigger=True` the task starts directly in the triggerer 
from these
   arguments, so two `DateTimeSensorAsync` tasks in one Dag both wait for the 
same moment. The
   same applies to `TimeSensor`'s moment and to `FileSensor`'s `filepath`, 
`recursive`,
   `poke_interval` and `timeout`.
   
   Each sensor now replaces `start_trigger_args` with a fresh copy via 
`dataclasses.replace`,
   which binds an instance attribute and leaves the class-level template 
untouched for the next
   task built from it.
   
   Regression tests are added for all three sensors; each fails on `main`.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5)
   
   Generated-by: Claude Code (Opus 5) 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]

Reply via email to