Skip to content

Fix missing task instance history for failed tasks outside of RUNNING state#67371

Open
kalluripradeep wants to merge 2 commits into
apache:mainfrom
kalluripradeep:fix-missing-ti-history-celery
Open

Fix missing task instance history for failed tasks outside of RUNNING state#67371
kalluripradeep wants to merge 2 commits into
apache:mainfrom
kalluripradeep:fix-missing-ti-history-celery

Conversation

@kalluripradeep
Copy link
Copy Markdown
Contributor

Brief description of the changes.

closes: #67238
closes: #65366

When a task fails from states like QUEUED or DEFERRED, or is failed by the executor or trigger, its state is not RUNNING. The history recording in fetch_handle_failure_context incorrectly assumed that only RUNNING tasks needed their history recorded, which led to missing tries in task_instance_history when CeleryExecutor or KubernetesExecutor failed tasks or triggers failed them. Now, we record history for all states except RESTARTING (since RESTARTING tasks were already cleared and had their history recorded).


… state

Closes apache#67238
Closes apache#65366

When a task fails from states like QUEUED or DEFERRED, or is failed by the executor or trigger, its state is not RUNNING. The history recording in fetch_handle_failure_context incorrectly assumed that only RUNNING tasks needed their history recorded, which led to missing tries in task_instance_history when CeleryExecutor or KubernetesExecutor failed tasks or triggers failed them. Now, we record history for all states except RESTARTING (since RESTARTING tasks were already cleared and had their history recorded).
@kalluripradeep kalluripradeep force-pushed the fix-missing-ti-history-celery branch from 3dc516e to 67fa256 Compare May 23, 2026 10:49
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

2 participants