Skip to content

[v3-2-test] Return 410 Gone for heartbeat when cleared TI exists in TIH (#61631)#64693

Merged
potiuk merged 1 commit intov3-2-testfrom
backport-ce1270b-v3-2-test
Apr 8, 2026
Merged

[v3-2-test] Return 410 Gone for heartbeat when cleared TI exists in TIH (#61631)#64693
potiuk merged 1 commit intov3-2-testfrom
backport-ce1270b-v3-2-test

Conversation

@github-actions
Copy link
Copy Markdown

@github-actions github-actions bot commented Apr 3, 2026

  • Return 410 Gone for heartbeat when TI was cleared and moved to TIH

When a running task instance is cleared, its previous try is archived
to the Task Instance History table and the TI receives a new UUID.
Subsequent heartbeats from the old process get a 404 because the old
UUID no longer exists in the TI table.

This change improves the error handling by checking the TIH table when
a heartbeat TI is not found. If the UUID exists in TIH, return 410
Gone instead of 404 Not Found, giving the client a more specific
signal that the task was cleared rather than never existing.

  • Server: check TIH on heartbeat NoResultFound, return 410 if found
  • Supervisor: handle 410 Gone same as 404/409 (terminate process)
  • Keep 404 for TIs that genuinely never existed

closes: #53140

  • Update task_instances.py

Co-authored-by: Amogh Desai amoghrajesh1999@gmail.com

  • Update task_instances.py

Co-authored-by: Amogh Desai amoghrajesh1999@gmail.com

  • Update test_task_instances.py

Co-authored-by: Amogh Desai amoghrajesh1999@gmail.com

  • fix(api): use task_instance_id in heartbeat 410 path and align detail message
  • Replace undefined ti_id_str with task_instance_id in TIH query and log
  • Use task_instance_id (UUID) for TIH.task_instance_id comparison
  • Set 410 Gone detail message to match test expectation

(cherry picked from commit ce1270b)

Co-authored-by: André Ahlert andre@aex.partners
Co-authored-by: Amogh Desai amoghrajesh1999@gmail.com

…IH (#61631)

* Return 410 Gone for heartbeat when TI was cleared and moved to TIH

When a running task instance is cleared, its previous try is archived
to the Task Instance History table and the TI receives a new UUID.
Subsequent heartbeats from the old process get a 404 because the old
UUID no longer exists in the TI table.

This change improves the error handling by checking the TIH table when
a heartbeat TI is not found. If the UUID exists in TIH, return 410
Gone instead of 404 Not Found, giving the client a more specific
signal that the task was cleared rather than never existing.

- Server: check TIH on heartbeat NoResultFound, return 410 if found
- Supervisor: handle 410 Gone same as 404/409 (terminate process)
- Keep 404 for TIs that genuinely never existed

closes: #53140

* Update task_instances.py

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>

* Update task_instances.py

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>

* Update test_task_instances.py

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>

* fix(api): use task_instance_id in heartbeat 410 path and align detail message

- Replace undefined ti_id_str with task_instance_id in TIH query and log
- Use task_instance_id (UUID) for TIH.task_instance_id comparison
- Set 410 Gone detail message to match test expectation

---------
(cherry picked from commit ce1270b)

Co-authored-by: André Ahlert <andre@aex.partners>
Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
@jscheffl
Copy link
Copy Markdown
Contributor

jscheffl commented Apr 3, 2026

Leaveing as draft until 3.2.0 released.

@potiuk potiuk marked this pull request as ready for review April 8, 2026 11:29
@potiuk potiuk merged commit 1d4a552 into v3-2-test Apr 8, 2026
4 checks passed
@potiuk potiuk deleted the backport-ce1270b-v3-2-test branch April 8, 2026 11:30
vatsrahul1001 pushed a commit that referenced this pull request Apr 8, 2026
…IH (#61631) (#64693)

* Return 410 Gone for heartbeat when TI was cleared and moved to TIH

When a running task instance is cleared, its previous try is archived
to the Task Instance History table and the TI receives a new UUID.
Subsequent heartbeats from the old process get a 404 because the old
UUID no longer exists in the TI table.

This change improves the error handling by checking the TIH table when
a heartbeat TI is not found. If the UUID exists in TIH, return 410
Gone instead of 404 Not Found, giving the client a more specific
signal that the task was cleared rather than never existing.

- Server: check TIH on heartbeat NoResultFound, return 410 if found
- Supervisor: handle 410 Gone same as 404/409 (terminate process)
- Keep 404 for TIs that genuinely never existed

closes: #53140

* Update task_instances.py



* Update task_instances.py



* Update test_task_instances.py



* fix(api): use task_instance_id in heartbeat 410 path and align detail message

- Replace undefined ti_id_str with task_instance_id in TIH query and log
- Use task_instance_id (UUID) for TIH.task_instance_id comparison
- Set 410 Gone detail message to match test expectation

---------
(cherry picked from commit ce1270b)

Co-authored-by: André Ahlert <andre@aex.partners>
Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:task-sdk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants