Fix missing task instance history for non-running retries#67831
Fix missing task instance history for non-running retries#67831GayathriSrividya wants to merge 5 commits into
Conversation
4f8abb1 to
cad74e7
Compare
… 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).
cad74e7 to
fff8a5b
Compare
|
The guard flip from |
Thanks for validating the guard change and the test fix. I’ll wait for formal review and follow up if anything else comes up. |
Cherry-picks the proposed fix from #67371 for priority issue #67238.
This updates failure handling to preserve task instance history for retry paths when the task is not in RUNNING state (except RESTARTING, which is already handled).
Also includes the companion test adjustment to avoid detached-session behavior in test_taskinstance.py.
Related: #67238
Related: #65366
Local validation