jason810496 commented on code in PR #68012:
URL: https://github.com/apache/airflow/pull/68012#discussion_r3978184670


##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -309,6 +309,8 @@ def ti_run(
             xcom_keys_to_clear=xcom_keys,
             should_retry=_is_eligible_to_retry(previous_state, ti.try_number, 
ti.max_tries),
         )
+        if first_task_reschedule_start_date is not None:
+            context.first_task_reschedule_start_date = 
first_task_reschedule_start_date

Review Comment:
   It should be safe to define as
   
   ```
   TIRunContext(
       task_reschedule_count=task_reschedule_count,
       first_task_reschedule_start_date=first_task_reschedule_start_date,
       max_tries=ti.max_tries,
   ```



##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -690,6 +690,12 @@ def get_first_reschedule_date(self, context: Context) -> 
AwareDatetime | None:
             # If the task has not been rescheduled, there is no need to ask 
the supervisor
             return None
 
+        if from_server := self._ti_context_from_server:
+            # Servers older than the 2026-10-30 API version omit this, so fall 
through to
+            # asking the supervisor below.
+            if (first_reschedule_date := 
from_server.first_task_reschedule_start_date) is not None:
+                return first_reschedule_date

Review Comment:
   nit:
   ```suggestion
           if self._ti_context_from_server:
               # Servers older than the 2026-10-30 API version omit this, so 
fall through to asking the supervisor below.
               if (first_reschedule_date := 
self._ti_context_from_server.first_task_reschedule_start_date) is not None:
                   return first_reschedule_date
   ```



##########
airflow-core/tests/unit/api_fastapi/execution_api/versions/v2026_10_30/test_task_instances.py:
##########
@@ -17,10 +17,14 @@
 
 from __future__ import annotations
 
+from uuid import uuid4

Review Comment:
   nit:
   
   ```suggestion
   from uuid6 import uuid7
   ```



-- 
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