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

#35569 [Bug]: Failed reservation cleanup can double-count actual spend

  • State: open
  • Author: @emerzon
  • Labels: proxy

### Check for existing issues

- [x] I searched open and closed issues before filing - [x] I found no issue covering the combined reconcile-failure and counter-invalidation-failure path

### What happened?

When post-call budget reservation reconciliation raises, `_reconcile_budget_reservation_for_counter_update` attempts to invalidate all reserved counters and then returns an empty reserved-key set so the caller applies the full actual cost directly

That fallback is correct only if invalidation succeeded for every reserved key. If invalidation also raises, the function still returns an empty set. Any counter that retained its original reservation is then incremented by the full actual cost, leaving `previous_spend + reserved_cost + actual_cost`

The invalidation helper processes keys sequentially, so this can also leave a mixed state where some scopes were deleted and others retained their reservation. Treating all keys as unreserved cannot reconcile that partial result safely

The consequence is conservative over-counting rather than lost billing, but it can produce false budget exhaustion and persistent 429 responses until a durable reseed repairs the affected counter

### Step…

GitHub resolver

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

Refresh page
vote history (3 events)
#0 of 0 · 31d18h24m45s ago — entered · #import:https:::github.com:berriai:litellm post #2436
The left issue requires careful failure-state handling, atomicity guarantees, and regression coverage across multiple budget-counter paths; the right is primarily a provider-parameter translation and compatibility change.
Issue #31833 is harder because it spans authentication, account recovery, administrative workflows, UI changes, API contracts, security-sensitive validation, persistence, audit behavior, and comprehensive end-to-end testing. Issue #35569 is narrower in scope, primarily requiring a careful correction to failure-state handling in budget accounting with targeted regression and concurrency tests.
#0 of 0 · 31d17h52m10s ago — current · #import:https:::github.com:berriai:litellm post #2993
The right issue is harder because it requires failure-safe reconciliation across partial cleanup, durable accounting state, and recovery behavior, whereas the left is primarily a localized authorization-path correction.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search