6 views
-/https://github.com/berriai/litellm/issues/35538
GitHub · issue

#35538 [Bug]: Tag spend counters are not reseeded from durable database spend

  • State: open
  • Author: @emerzon

### Summary

When the Redis spend counter for a tag is missing or expires, `SpendCounterReseed.from_db()` intentionally returns `None` for `spend:tag:*`. The budget path then falls back to the cached `LiteLLM_TagTable.spend` value instead of reseeding from the authoritative tag row

### Current behavior

`litellm/proxy/db/spend_counter_reseed.py` documents that end-user and tag counters are excluded from DB reseeding. For tags, `from_db()` returns `None` immediately

`get_tag_objects_batch()` is cache-first. When a tag object is already cached on a worker, the object can contain a stale `spend` value after another worker has written spend or after a budget reset

`_tag_max_budget_check()` calls:

~~~python tag_spend = await get_current_spend( counter_key=f"spend:tag:{tag_name}", fallback_spend=tag_object.spend or 0.0, max_budget=tag_object.litellm_budget_table.max_budget, fallback_authoritative=True, ) ~~~

On a clean Redis miss, the reseed path cannot query the tag row, and the stale cached `tag_object.spend` becomes the effective value

### Reproduction

Use a tag with a positive budget and two proxy workers:

1. Warm worker B's `tag:<name>` cache while its durabl…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d18h50m1s ago — entered · #import:https:::github.com:berriai:litellm post #2048
The session-timeout feature is harder because it spans authentication state, sliding-expiration semantics, client activity handling, security behavior, and end-to-end testing. The tag-counter fix is narrower, primarily involving distributed cache/database consistency and targeted regression coverage.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search