litellm/tests/test_litellm/proxy/proxy_server
devin-ai-integration[bot] 9540f19e38
feat(proxy): add fail_closed_rate_limit_enforcement to reject requests with 503 while Redis rate limit counters are unreachable (#43251)
* feat(proxy): add fail_closed_rate_limit_enforcement to reject requests with 503 while Redis rate limit counters are unreachable

* fix(proxy): reject fail-closed rate limit checks before logging the in-memory fallback and pin the boot warning in the lifespan

* fix(proxy): coerce the fail-closed flag, fail closed on read-only checks, and refund partial cluster increments

* fix(proxy): window-guard rate limit refunds and catch the fail-closed rejection by type

* fix(proxy): read the compaction rate-limit gate's limiter from the proxy hook registry

* fix(proxy): count the pending request in read-only rate-limit checks and keep the compaction gate off the caller's parallel slot

The compaction polyfill's summary-model gate, once it ran against the real v3 limiter, showed two behaviors nobody had chosen. The read-only check compared the stored counter with the same `>` the increment path uses, but a read-only check decides a request that has not been counted yet, so a summary model exactly at its rpm limit still went out. The read-only path now adds the pending increment of 1 before comparing; the increment path is unchanged.

The gate also passed the key's max_parallel_requests gauge through, and the read-only gauge count includes the caller's own in-flight slot, so a key with max_parallel_requests: 1 never compacted. The gate now drops that gauge from its descriptors, since the summary call runs inside a request the limiter already admitted.

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-09-26 12:11:26 -07:00
..
.coverage_baseline
__init__.py
_coverage_check.py
_pin_check.py
conftest.py refactor(proxy): move login throttle sentinels into constants 2026-09-17 16:42:04 +00:00
test_background_health.py fix(proxy): release the health check save window lock on failure or cancel 2026-09-03 12:36:04 +02:00
test_exception_handlers.py fix(proxy): keep the submitted body out of 422 validation errors (#43231) 2026-09-25 17:05:53 -07:00
test_harness_smoke.py
test_lifecycle.py feat(proxy): add fail_closed_rate_limit_enforcement to reject requests with 503 while Redis rate limit counters are unreachable (#43251) 2026-09-26 12:11:26 -07:00
test_openapi_customization.py tests(proxy_server): surface current behavior in tests (#29309) 2026-05-29 23:17:24 -07:00
test_proxy_config.py feat(mcp): configure protocol versions and capability discovery (#43169) 2026-09-25 13:13:52 -07:00
test_routes_anthropic_beta.py tests(proxy_server): surface current behavior in tests (#29309) 2026-05-29 23:17:24 -07:00
test_routes_assistants.py tests(proxy_server): surface current behavior in tests (#29309) 2026-05-29 23:17:24 -07:00
test_routes_audio.py fix(proxy): narrow audio_speech response before reading upstream content-type 2026-08-30 12:46:11 -07:00
test_routes_chat_completions.py tests(proxy_server): surface current behavior in tests (#29309) 2026-05-29 23:17:24 -07:00
test_routes_completions.py tests(proxy_server): surface current behavior in tests (#29309) 2026-05-29 23:17:24 -07:00
test_routes_config.py fix(proxy): persist only the router settings keys the request set 2026-09-18 14:01:05 -07:00
test_routes_embeddings.py tests(proxy_server): surface current behavior in tests (#29309) 2026-05-29 23:17:24 -07:00
test_routes_invitation.py tests(proxy_server): surface current behavior in tests (#29309) 2026-05-29 23:17:24 -07:00
test_routes_login_sso.py test(proxy): give the faked login user the breach-check columns 2026-09-21 19:06:00 +00:00
test_routes_misc.py feat(ui): let admins supply a dark-mode variant of their custom logo (#37662) 2026-08-20 12:48:55 -07:00
test_routes_model_cost_map.py test(cost_map): assert provenance without patching module state 2026-09-08 12:47:31 -07:00
test_routes_model_info.py feat(proxy): let callbacks filter the model listing routes per caller (#43027) 2026-09-24 15:52:44 -07:00
test_routes_model_metrics.py fix(proxy): report a stored alerting value as db even when it is null 2026-09-21 14:24:32 -07:00
test_routes_models.py Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_v1_models_alias_resolution 2026-09-10 13:26:18 +02:00
test_routes_moderations.py tests(proxy_server): surface current behavior in tests (#29309) 2026-05-29 23:17:24 -07:00
test_routes_onboarding.py fix(proxy): keep the submitted body out of 422 validation errors (#43231) 2026-09-25 17:05:53 -07:00
test_routes_queue.py tests(proxy_server): surface current behavior in tests (#29309) 2026-05-29 23:17:24 -07:00
test_routes_threads.py tests(proxy_server): surface current behavior in tests (#29309) 2026-05-29 23:17:24 -07:00
test_routes_utils.py fix(router): match provider-prefixed fallback keys for bare model groups served by wildcard deployments (#43062) 2026-09-24 18:08:56 -07:00
test_spend_counters.py fix(proxy): fall back to direct spend increments once the early reconcile has finalized the reservation 2026-09-14 23:22:01 +00:00
test_streaming_helpers.py fix(proxy): end failed responses streams with [DONE] 2026-09-18 14:16:47 -07:00
test_team_model_name_translation.py perf(proxy): serialize /model/info listing once with orjson 2026-09-14 19:47:51 +00:00