Skip to content

Conversation

@DevajMody
Copy link
Contributor

Fixes #17418

Pre-Submission checklist

  • I have Added testing in the tests/litellm/ directory
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible

Type

🐛 Bug Fix
✅ Test

Changes

Problem: With DEFAULT_FAILURE_THRESHOLD_PERCENT=0.5 (50%), a deployment gets cooled down after just 1 failed request because 1/1 = 100% > 50%.

Fix: Added DEFAULT_FAILURE_THRESHOLD_MINIMUM_REQUESTS constant (default: 5) to require a minimum number of requests before applying error rate-based cooldown. This prevents cooldown from triggering on the first failure.

Files changed:

  • litellm/constants.py - Added new configurable constant
  • litellm/router_utils/cooldown_handlers.py - Added threshold check to cooldown condition
  • tests/router_unit_tests/test_router_cooldown_utils.py - Added test for new behavior

Test screenshot:
Screenshot 2025-12-04 at 1 22 20 AM

  Fixes BerriAI#17418

  - Add DEFAULT_FAILURE_THRESHOLD_MINIMUM_REQUESTS constant (default: 5)
  - Require minimum requests before applying error rate cooldown
  - Prevents cooldown from triggering on first failure
@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Dec 4, 2025 6:25am

@ellis-zhang
Copy link

@DevajMody thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Error Rate Cooldown Triggers on First Failed Request (Missing Minimum Request Threshold)

2 participants