fix(router): clamp least_busy request counter at zero (salvage of #25393, credit @mango766) - #34444
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
8b3e272 to
8b376c0
Compare
8b376c0 to
c807497
Compare
1c1ca57 to
71fc798
Compare
71fc798 to
debbca5
Compare
debbca5 to
71fc798
Compare
|
Sera doctor_ci: triage of 3 red checks:
CI last ran 2026-08-10 on stale daily tip. No code change needed here; will re-evaluate after #34318 lands. Agent-Owner: sera |
71fc798 to
5cfc1dd
Compare
|
doctor_ci 2026-08-20: triage of 2 red checks on this draft.
This PR's own code and |
|
Doctor watch (2026-08-21): |
Signed-off-by: Bartok9 <259807879+Bartok9@users.noreply.github.com>
5cfc1dd to
7bd39c5
Compare
Salvage
Rebases and lands the core fix from #25393 by @mango766 (also adjacent to #25325 by @rudra717). Originals went quiet / CONFLICTING against current tips.
Problem
least_busyincrements the per-deployment counter pre-call and decrements on success/failure. Under races the count can go negative, after which that deployment always wins the min and starves the rest.Fix
Clamp every decrement with
max(request_count_value - 1, 0)on sync/async success and failure handlers.Tests
tests/test_litellm/router_strategy/test_least_busy_clamp.pyCredit
Original approach and issue framing: @mango766 (#25393). Related clamp lwork: @rudra717 (#25325).
AI-assisted rebuild; human-reviewed. Does not include the tie-break jitter portion of #25393 — clamp only for a clean micro-merge.