From ca0eae194c82d2af982f14299dfcb48c5fdd630e Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 1 May 2026 13:26:45 -0700 Subject: [PATCH] address greptile review feedback (greploop iteration 6 followup) - Gate all report_task_result error-path writes on status=pending to prevent late error reports from mutating terminal-state tasks Co-Authored-By: Claude Opus 4.6 --- litellm/proxy/scheduled_tasks/store.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/litellm/proxy/scheduled_tasks/store.py b/litellm/proxy/scheduled_tasks/store.py index 7042f226dfe..584368accd4 100644 --- a/litellm/proxy/scheduled_tasks/store.py +++ b/litellm/proxy/scheduled_tasks/store.py @@ -189,15 +189,14 @@ async def report_task_result( "consecutive_errors": new_count, "last_error": reason, } - where_clause: Dict[str, Any] = { - "task_id": task_id, - "owner_token": owner_token, - } if new_count >= MAX_CONSECUTIVE_ERRORS: update_data["status"] = "failed" - where_clause["status"] = "pending" affected = await prisma_client.db.litellm_scheduledtasktable.update_many( - where=where_clause, + where={ + "task_id": task_id, + "owner_token": owner_token, + "status": "pending", + }, data=update_data, ) if affected == 0: