Uh oh!
There was an error while loading. Please reload this page.
Fix ti.start_date showing deferral-resume time instead of original start time - #63247
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes inaccurate context["ti"].start_date for deferred task instances by propagating the original TI start time from the Execution API to the Task SDK supervisor so resumed-from-deferral runs don’t appear to “start” at resume time.
Changes:
- Extend
TIRunContext(Execution API + Task SDK generated models) with an optionalstart_date. - Populate
TIRunContext.start_datefrom the Execution API when resuming from deferral. - Teach the Task SDK supervisor to prefer
ti_context.start_dateoverdatetime.now()when provided.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
task-sdk/src/airflow/sdk/execution_time/supervisor.py | Uses ti_context.start_date (when present) as the startup start time sent to the child process. |
task-sdk/src/airflow/sdk/api/datamodels/_generated.py | Adds start_date to the generated TIRunContext model. |
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py | Adds start_date to the ti_run response context when resuming from deferral. |
airflow-core/src/airflow/api_fastapi/execution_api/datamodels/taskinstance.py | Documents and exposes start_date on the server-side TIRunContext model. |
You can also share your feedback on Copilot code review. Take the survey.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
3be3946 to
2e458c5Compare2e458c5 to
6611e25Comparearnoldmr01
commented
Mar 19, 2026
LGTM!Thanks for your work. |
arnoldmr01
commented
Mar 19, 2026
Would it make sense to add a test here to verify that StartupDetails.model_construct uses ti_context.start_date as start_date? Just a personal thought. I'm not sure if it is necessary |
henry3260
commented
Mar 28, 2026
Thanks for your review! I will add a test case for this |
jason810496
left a comment
There was a problem hiding this comment.
Nice! The patch make sense to me overall.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
1ffebc5 to
cdee639Comparecdee639 to
8fa7aa0Comparehenry3260
commented
Mar 31, 2026
Thanks for the review, Jason! I've addressed all the comments. |
jason810496
left a comment
There was a problem hiding this comment.
Thanks for the update, left a final nit before we merge.
Uh oh!
There was an error while loading. Please reload this page.
b09f837 to
cccf0b5CompareUh oh!
There was an error while loading. Please reload this page.
… original start time (apache#63247) * Fix ti.start_date showing deferral-resume time instead of original start time * Add API migration * Add unit test * add unit test to verify the resume start date behavior (cherry picked from commit a90202d) Co-authored-by: Henry Chen <henryhenry0512@gmail.com>
… original start time (apache#63247) * Fix ti.start_date showing deferral-resume time instead of original start time * Add API migration * Add unit test * add unit test to verify the resume start date behavior (cherry picked from commit a90202d) Co-authored-by: Henry Chen <henryhenry0512@gmail.com>
… original start time (apache#63247) * Fix ti.start_date showing deferral-resume time instead of original start time * Add API migration * Add unit test * add unit test to verify the resume start date behavior (cherry picked from commit a90202d) Co-authored-by: Henry Chen <henryhenry0512@gmail.com>
… original start time (#63247) (#65491) * [v3-2-test] Bump actions/github-script in the github-actions-updates group (#65150) (#65160) Bumps the github-actions-updates group with 1 update: [actions/github-script](https://github.com/actions/github-script). Updates `actions/github-script` from 8.0.0 to 9.0.0 - [Release notes](https://github.com/actions/github-script/releases) - [Commits](actions/github-script@ed59741...3a2844b) (cherry picked from commit e5a047c) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [v3-2-test] Added breeze generate issue content for airflow-ctl (#65042) (#65241) * Add breeze generate issue content for airflow-ctl * add new command to doc (cherry picked from commit b24538b) Co-authored-by: Justin Pakzad <114518232+justinpakzad@users.noreply.github.com> * [v3-2-test] Run release calendar verification on its own schedule (#65118) (#65242) * Move release calendar verification to its own scheduled workflow Run dev/verify_release_calendar.py from a dedicated daily scheduled workflow instead of as a canary job in the main CI pipeline, and notify the #release-management Slack channel when the check fails so the issue is surfaced to release managers directly. * Include wiki and calendar links in release calendar Slack alert (cherry picked from commit 048e9a1) * [v3-2-test] Fix ti.start_date showing deferral-resume time instead of original start time (#63247) * Fix ti.start_date showing deferral-resume time instead of original start time * Add API migration * Add unit test * add unit test to verify the resume start date behavior (cherry picked from commit a90202d) Co-authored-by: Henry Chen <henryhenry0512@gmail.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jarek Potiuk <jarek@potiuk.com> Co-authored-by: Justin Pakzad <114518232+justinpakzad@users.noreply.github.com> Co-authored-by: Henry Chen <henryhenry0512@gmail.com>
… original start time (#63247) (#65491) * [v3-2-test] Bump actions/github-script in the github-actions-updates group (#65150) (#65160) Bumps the github-actions-updates group with 1 update: [actions/github-script](https://github.com/actions/github-script). Updates `actions/github-script` from 8.0.0 to 9.0.0 - [Release notes](https://github.com/actions/github-script/releases) - [Commits](actions/github-script@ed59741...3a2844b) (cherry picked from commit e5a047c) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [v3-2-test] Added breeze generate issue content for airflow-ctl (#65042) (#65241) * Add breeze generate issue content for airflow-ctl * add new command to doc (cherry picked from commit b24538b) Co-authored-by: Justin Pakzad <114518232+justinpakzad@users.noreply.github.com> * [v3-2-test] Run release calendar verification on its own schedule (#65118) (#65242) * Move release calendar verification to its own scheduled workflow Run dev/verify_release_calendar.py from a dedicated daily scheduled workflow instead of as a canary job in the main CI pipeline, and notify the #release-management Slack channel when the check fails so the issue is surfaced to release managers directly. * Include wiki and calendar links in release calendar Slack alert (cherry picked from commit 048e9a1) * [v3-2-test] Fix ti.start_date showing deferral-resume time instead of original start time (#63247) * Fix ti.start_date showing deferral-resume time instead of original start time * Add API migration * Add unit test * add unit test to verify the resume start date behavior (cherry picked from commit a90202d) Co-authored-by: Henry Chen <henryhenry0512@gmail.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jarek Potiuk <jarek@potiuk.com> Co-authored-by: Justin Pakzad <114518232+justinpakzad@users.noreply.github.com> Co-authored-by: Henry Chen <henryhenry0512@gmail.com>
… original start time (#63247) (#65491) * [v3-2-test] Bump actions/github-script in the github-actions-updates group (#65150) (#65160) Bumps the github-actions-updates group with 1 update: [actions/github-script](https://github.com/actions/github-script). Updates `actions/github-script` from 8.0.0 to 9.0.0 - [Release notes](https://github.com/actions/github-script/releases) - [Commits](actions/github-script@ed59741...3a2844b) (cherry picked from commit e5a047c) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [v3-2-test] Added breeze generate issue content for airflow-ctl (#65042) (#65241) * Add breeze generate issue content for airflow-ctl * add new command to doc (cherry picked from commit b24538b) Co-authored-by: Justin Pakzad <114518232+justinpakzad@users.noreply.github.com> * [v3-2-test] Run release calendar verification on its own schedule (#65118) (#65242) * Move release calendar verification to its own scheduled workflow Run dev/verify_release_calendar.py from a dedicated daily scheduled workflow instead of as a canary job in the main CI pipeline, and notify the #release-management Slack channel when the check fails so the issue is surfaced to release managers directly. * Include wiki and calendar links in release calendar Slack alert (cherry picked from commit 048e9a1) * [v3-2-test] Fix ti.start_date showing deferral-resume time instead of original start time (#63247) * Fix ti.start_date showing deferral-resume time instead of original start time * Add API migration * Add unit test * add unit test to verify the resume start date behavior (cherry picked from commit a90202d) Co-authored-by: Henry Chen <henryhenry0512@gmail.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jarek Potiuk <jarek@potiuk.com> Co-authored-by: Justin Pakzad <114518232+justinpakzad@users.noreply.github.com> Co-authored-by: Henry Chen <henryhenry0512@gmail.com>
Why
When a task resumes from a deferred state, the
/execution/task-instances/{id}/runendpoint currently fails to include the originalstart_datein the returned context. This causes the Task SDK to receive incomplete or incorrect time information, which impacts the consistency of execution time semantics (i.e., thestart_dateshould always reflect the task's initial start time, not the time it resumed).What
TI.start_dateto the select statement inti_runto ensure the original task start time is properly fetched from the database.context.start_date = ti.start_datein theTIRunContextresponse during the resume scenario (whennext_methodis present).TI.start_datein the database is strictly preserved and not overwritten when a task resumes.closes: #63240
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.