8 views
-/https://github.com/berriai/litellm/issues/27481
GitHub · issue

#27481 Tag budgets never reset: ResetBudgetJob has no tag handler, tags blocked permanently after first overage

  • State: open
  • Author: @adickinson72

### Summary

Tags with an attached budget that has `budget_duration` set (e.g. `"1d"`, `"30d"`) never have their `spend` column reset. The `LiteLLM_BudgetTable.budget_reset_at` field correctly advances each cycle, but `LiteLLM_TagTable.spend` is untouched. Result: once a tag's spend exceeds `max_budget`, every subsequent request bearing that tag returns HTTP 400 `budget_exceeded` indefinitely — across reset boundaries, days, weeks. Recovery requires manual DB update.

### Reproduction

Tested on `v1.83.14-stable.patch.2`, fresh docker-compose with `proxy_budget_rescheduler_min_time: 1` and `proxy_budget_rescheduler_max_time: 5` (so reset polling fires every 1–5s instead of the default 600s).

1. Create a budget: `{"max_budget": 0.05, "budget_duration": "1m"}` → returns `budget_id=B`, `budget_reset_at=T0+60s`. 2. Create a tag bound to `B`. 3. Drive body-tagged traffic to push tag spend past $0.05; observe HTTP 400 firing as expected. 4. Wait through three full reset cycles (3+ minutes). 5. Send another body-tagged request.

**Observed state across cycles:**

| Time (UTC) | `BudgetTable.budget_reset_at` | `TagTable.spend` | `TagTable.updated_at` | |---|---|---|---| | T0 (creation) | …

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (2 events)
#0 of 0 · 31d19h4m50s ago — entered · #import:https:::github.com:berriai:litellm post #1781
Tag budget resetting spans scheduled job behavior, persistence semantics, and regression coverage across recurring budget cycles, making it substantially broader and riskier than a localized shutdown null-guard fix.
#0 of 0 · 31d18h37m30s ago — current · #import:https:::github.com:berriai:litellm post #2241
The right issue is harder because it requires extending scheduled reset behavior across tag-specific state, coordinating persistence and enforcement semantics, and adding broader regression coverage. The left issue is a localized creation-path data propagation fix with comparatively limited scope.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search