From 98aa9dc84f05c4dcc044af9afb8f6b8269d11e7e Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 1 May 2026 13:26:14 -0700 Subject: [PATCH] address greptile review feedback (greploop iteration 6) - Exclude expired tasks from claim_due return value to prevent agents from receiving expired task payloads Co-Authored-By: Claude Opus 4.6 --- litellm/proxy/scheduled_tasks/store.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/litellm/proxy/scheduled_tasks/store.py b/litellm/proxy/scheduled_tasks/store.py index 31bad2a0ae9..7042f226dfe 100644 --- a/litellm/proxy/scheduled_tasks/store.py +++ b/litellm/proxy/scheduled_tasks/store.py @@ -326,6 +326,7 @@ async def claim_due( if not rows: return [] + expired_task_ids: set = set() async with tx.batch_() as batcher: for r in rows: expires_at = r["expires_at"] @@ -339,6 +340,7 @@ async def claim_due( if expires_at <= now: new_status = "expired" new_next = r["next_run_at"] + expired_task_ids.add(r["task_id"]) elif r["fire_once"]: new_status = "fired" new_next = r["next_run_at"] @@ -371,4 +373,5 @@ async def claim_due( "scheduled_for": r["next_run_at"], } for r in rows + if r["task_id"] not in expired_task_ids ]