Commit graph

16155 commits

Author SHA1 Message Date
Kerry Lu
d4e083348c revert: drop the create-release.yml gating and E2E_REDIS_CHAOS opt-in
create-release.yml is back to calling the chaos test through no mechanism at
all; it never called it. Also drops the E2E_REDIS_CHAOS opt-in gate itself:
the redis_chaos marker still exists for -m selection and is still excluded
from the per-PR selector by path (tests/e2e/(ui|claude_code|load)/), but the
test no longer needs an env var to run once its file is targeted.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-11 15:16:00 -07:00
Kerry Lu
7d8f2c9ad3 ci(e2e): drop the weekly cron for the Redis chaos test
Now that create-release.yml gates stable and RC releases on this test directly,
the weekly schedule is redundant: every release gets a run against its own
commit instead of whatever happened to be on the default branch that Saturday.
workflow_dispatch stays for manual runs.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-11 15:00:57 -07:00
Kerry Lu
93c8ef1beb docs(e2e): note the release gate in the load/ harness guide
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-11 14:40:08 -07:00
Kerry Lu
0ea18f28af test(e2e): tighten chaos log-bytes ceiling to 10 KB per request
Local runs measured 3.5 KB per request, so 10 KB keeps close to 3x headroom
while tightening from the earlier 12 KB.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-11 13:45:42 -07:00
Kerry Lu
a1f9f4cbe8 test(e2e): tighten chaos latency ceilings to 1s/2s/3s
Local runs measured p50 0.19s, p90 0.23s, p99 0.69s, so 2s/3s/5s left several
times that as slack. 1s/2s/3s keeps a comfortable margin while catching a
smaller regression than the looser ceilings would have.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-11 13:45:11 -07:00
Kerry Lu
e81a788776 test(e2e): hold chaos CPU per request to 2x
Three local runs measured 1.33x-1.36x, so 2x is the tightest bound the data
supports and still catches a regression far smaller than 4x would. Noted in the
comment that this is the ceiling to loosen first if a weekly run trips it,
since core count shifts how much of baseline CPU is fixed per-request work.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-11 13:43:53 -07:00
Kerry Lu
1d71006567 test(e2e): tighten chaos RSS and CPU ceilings to what runs actually measured
RSS moved 0.91x-1.40x across three identical local runs, so it stays loose at
2x rather than the arbitrary 1.5x carried over from the pre-padding-payload
calibration. CPU per request held steady at 1.33x-1.36x across the same runs,
so 4x replaces the looser 6x it inherited from stale numbers.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-11 13:43:18 -07:00
Kerry Lu
cc1d2c66c8 test(e2e): bound chaos latency and log volume with flat ceilings
A ratio against the healthy phase cannot bound either metric. Once the Redis
circuit breaker opens, a request skips Redis instead of waiting on its socket
timeout, so the chaos phase can measure cheaper than the baseline it is compared
against: local runs came in at 0.61x baseline p90 while a log-bytes ratio read
724x. Splitting Budget into RatioBudget and AbsoluteBudget lets RSS and CPU keep
the ratio they need, since both are machine-shaped, while latency and log volume
get the wall-clock ceiling a user actually cares about.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-11 13:38:01 -07:00
Kerry Lu
66980bbb87 test(e2e): address Redis chaos PR review, add log-bytes budget
Pad the locust payload to tens of KB so per-request bookkeeping cost scales with
body size instead of hiding behind a 40-byte prompt. Turn on
use_redis_transaction_buffer in the chaos config and JSON_LOGS in the workflow so
the spend buffer, pod lock, and JSON-encoded breaker tracebacks are all part of
the measured chaos cost. Add a log-bytes-per-request budget alongside latency,
RSS, and CPU, reading the proxy's log file size at each phase split; its ceiling
is uncalibrated since no chaos run has measured it yet.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-11 12:40:25 -07:00
Kerry Lu
1270ecb781 test(load): drive /v1/messages alongside /chat/completions in the Redis chaos test
The Anthropic Messages route reaches the same Redis touchpoints and cost-tracking
callback through its own request path, so a failure-path regression there would not
surface from chat completions alone. Each simulated user now picks one endpoint round
robin and stays on it, and the per-endpoint split is asserted and reported so a run
that silently drove only one route fails instead of passing.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-11 12:28:02 -07:00
Kerry Lu
1699f2d6dc Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_e2e_redis_timeout
# Conflicts:
#	uv.lock
2026-09-11 11:38:22 -07:00
joshua-berri
6882f057b4
Merge pull request #40440 from BerriAI/litellm_mcp_upstream_error_log_detail
fix(mcp): log upstream request method, body and response on tool-list and OAuth2 token failures
2026-09-11 11:24:42 -07:00
Kerry Lu
5f17261534 test(load): pause Redis outright and budget the chaos phase against the baseline
CLIENT PAUSE ALL for the length of the chaos phase instead of CLIENT PAUSE WRITE, so every Redis touchpoint on the request path times out rather than just the writes. The pause is sized to the phase because it freezes the control connection too; teardown's CLIENT UNPAUSE is a safety net for a phase that overran

Latency, RSS and CPU are now budgeted as chaos-over-baseline ratios (p50/p90/p99 for latency and RSS, CPU seconds per request once) through a small phase_budget module, replacing the machine-shaped absolutes. The Redis timeout rate is reported but no longer asserted

The final /metrics scrape waits for litellm_deployment_failure_responses_total to stop moving, since that counter is bumped from the async logging queue and lagged the load generator by thousands of increments. The model group carries a unique marker so a deployment left behind by an aborted run cannot absorb this run's retries

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-11 11:06:06 -07:00
joshua-berri
3f81ba3d30
Merge pull request #40679 from BerriAI/litellm_fix_mcp_oauth_registration_7498
fix(mcp): explain refused OAuth registration and bound discovery retries
2026-09-11 10:51:31 -07:00
devin-ai-integration[bot]
9316b4194a
perf(proxy): register liveness and core inference routes first (#40687)
Starlette scans the route table in registration order, so a request pays one
regex match per route registered ahead of its own. The proxy registers several
hundred routes and left the liveness probe near position 280 and the lazy
loaded /v1/messages at the very end. Move /health/liveliness, /health/liveness,
/v1/chat/completions, /chat/completions and /v1/messages to the front of the
route table after startup registration and again after a lazy router loads.

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-11 17:10:38 +00:00
devin-ai-integration[bot]
db3338b206
feat(proxy): make the in-memory management cache capacity configurable (#40725)
* feat(proxy): make the in-memory management cache capacity configurable

Add general_settings.user_api_key_cache_max_size (positive int, default 200) to resize the
in-memory tier of the shared user_api_key_cache at startup and on DB config reloads, expose it
in the Admin UI general settings, and cover it with behavioral tests. Prior art: #34726

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(caching): resize the in-memory tier from DualCache so any cache instance honours the cap

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* style(proxy): wrap the cache capacity field description to the 120 col limit

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-11 09:55:30 -07:00
devin-ai-integration[bot]
de79310954
feat(secret_managers): support customer-managed KMS key for virtual keys stored in AWS Secrets Manager (#40475)
Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-11 09:54:08 -07:00
devin-ai-integration[bot]
47bba14336
fix(passthrough): parse Bedrock stream spend incrementally instead of buffering the whole response (#40724)
* fix(passthrough): parse Bedrock stream spend incrementally instead of buffering the whole response

Bedrock pass-through streaming kept every relayed chunk in memory until EOF and
then decoded, parsed and translated the whole stream again for spend logging.
Large or concurrent streams could exhaust proxy worker memory.

Sync and async passthrough wrappers now hand each chunk to a provider stream
collector as it is relayed. Bedrock decodes event-stream frames incrementally,
folds consecutive text deltas, and keeps only what stream_chunk_builder needs
for usage, tool calls and metadata. Text deltas are no longer retained in the
Bedrock and Anthropic stream decoders either. Providers without a collector
keep the previous raw-bytes behavior. Collector failures are isolated so spend
tracking can never interrupt the customer stream

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(passthrough): assert the spend payload the collector builds instead of mock internals

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(passthrough): type the Bedrock collector helpers by the collector protocol instead of asserting the class

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-11 09:53:37 -07:00
devin-ai-integration[bot]
3df127b439
fix(proxy): give user-key objects their own in-memory cache partition (#40713)
Key objects share the 200-entry UserApiKeyCache in-memory store with teams,
end users, tags and memberships, so churn in those objects evicts hot keys
and forces a LiteLLM_VerificationToken lookup on the next request. Route
bare hashed-token keys to a dedicated InMemoryCache inside UserApiKeyCache
while keeping Redis, TTL, serialization and invalidation shared

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-11 09:52:09 -07:00
devin-ai-integration[bot]
729ea6b832
perf(proxy): lazy-load provider passthrough routes (#40691)
Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-11 09:48:53 -07:00
Joshua Valluru
3883a891f0 fix(mcp): redact compact credential field names 2026-09-11 08:10:19 -07:00
Joshua Valluru
5c190e69bf fix(mcp): preserve timeout fallback on Python 3.10 2026-09-11 08:00:39 -07:00
Joshua Valluru
e8c411fb43 test(mcp): cover deeply nested credential inspection limits 2026-09-11 07:32:38 -07:00
Joshua Valluru
5b13dfcc59 fix(mcp): omit credential-bearing paths from failure logs 2026-09-11 07:27:10 -07:00
Joshua Valluru
0ee9e1e448 fix(mcp): redact reflected credentials and avoid import cycles 2026-09-11 07:20:48 -07:00
Joshua Valluru
40f01e2fa5 chore: merge current staging into MCP OAuth fix 2026-09-11 07:07:07 -07:00
Joshua Valluru
8d5a675878 fix(mcp): expire temporary OAuth discovery results 2026-09-11 07:02:11 -07:00
Joshua Valluru
eec7c1e7f8 chore: merge current staging for MCP diagnostic compatibility 2026-09-11 07:01:06 -07:00
Joshua Valluru
3fc483d424 fix(mcp): capture bounded error diagnostics without exposing credentials 2026-09-11 06:58:40 -07:00
mateo
8762c664b7 test(registry): cover nemotron reasoning, v4-flash vision and xai/groq deprecation dates
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-11 13:28:35 +00:00
mateo
598e863510 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_registry_audit_2026_09_10b 2026-09-11 13:04:19 +00:00
joshua-berri
9a715df212
Merge pull request #40665 from BerriAI/litellm_fix_openapi_mcp_health_4896
fix(mcp): check OpenAPI specifications without native MCP handshakes
2026-09-10 22:02:45 -07:00
Kerry Lu
33ec56ed75 test(e2e): rewrite the Redis timeout test as a locust chaos load test
The sequential version sent one request at a time, so a Redis outage never
reached the concurrency where the failed-tracking alert body actually grows.
This drives the proxy with locust against one model group of three mock
deployments, two failing at order 1 and one serving at order 2, so every
request spends its retries on the failing pair and lands on the serving
deployment through the order-based fallback. Two phases, a healthy baseline
and a CLIENT PAUSE WRITE window, and every request must succeed in both.

Latency, RSS and CPU are reported as p50/p90/p99 per phase rather than
asserted on: RSS and CPU come from psutil on the proxy's process tree, since
a multi-worker proxy serves /metrics from the prometheus multiprocess
collector and that drops the process collector's series. Thresholds stay open
until weekly runs give real baselines.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-10 21:55:23 -07:00
Joshua Valluru
f04fb748c5 fix(mcp): explain refused OAuth registration and bound discovery retries 2026-09-10 21:02:46 -07:00
Joshua Valluru
ca03c889c9 fix(mcp): avoid caching cancelled OpenAPI health probes 2026-09-10 20:26:53 -07:00
joshua-berri
acb9086f29
Merge pull request #40664 from BerriAI/litellm_fix_mcp_vscode_dcr_7449
fix(mcp): accept VS Code OAuth registration callbacks
2026-09-10 20:17:46 -07:00
Joshua Valluru
da1dfcdb24 refactor(mcp): reuse the shared HTTP handler for bounded probes 2026-09-10 19:59:07 -07:00
Joshua Valluru
576c1bc5d6 fix(mcp): bound and coalesce OpenAPI health probes 2026-09-10 19:45:44 -07:00
mateo-berri
fdd423128e Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_redis_breaker_open_silent_miss 2026-09-10 19:40:52 -07:00
Joshua Valluru
5735587133 chore(ui): sync API descriptions with the current default branch 2026-09-10 19:30:10 -07:00
Joshua Valluru
fc95d22367 fix(mcp): accept VS Code OAuth registration callbacks 2026-09-10 19:28:40 -07:00
mateo-berri
2fc520329f fix(router): keep the budget push off the request callback path
The provider budget push runs inside the request success callback, so
awaiting the Redis pipeline there made every request wait for the round
trip. Hand it back to a task whose failure is logged through the breaker
aware logger, so an open breaker stays a debug line and a real Redis error
is one error line instead of an unretrieved task traceback
2026-09-10 19:26:28 -07:00
tin-berri
7419a536ad
fix(auto-router): omit Claude Code system text from classifier (#40655)
Co-authored-by: Claude Code <noreply@anthropic.com>
2026-09-10 19:18:25 -07:00
Joshua Valluru
8c82c325ac fix(mcp): check OpenAPI specifications without native MCP handshakes 2026-09-10 19:18:19 -07:00
mateo-berri
0ffe6512de fix(router): keep the routing and budget sync loops quiet while the Redis breaker is open 2026-09-10 19:15:40 -07:00
mateo-berri
01c6b50564 fix(caching): let a Redis breaker success count only for the state that admitted the call 2026-09-10 18:57:24 -07:00
devin-ai-integration[bot]
880ccc76a5
fix(streaming): keep admitted mock streams alive with empty stream_options and honor zero prompt counts (#40650)
* fix(streaming): keep usage-only chunks from crashing streams with empty stream_options

The usage-only chunk branch in CustomStreamWrapper.chunk_creator indexed stream_options["include_usage"] directly, so a caller passing stream_options={} hit a KeyError that surfaced as MidStreamFallbackError. Streaming mock_response with an admission input_tokens count (#40637) now always emits such a chunk, which made the crash reachable. Reuse the send_stream_usage policy computed at init instead. Also annotate the #40637 test bindings with Final.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(streaming): report admitted zero prompt tokens instead of recounting in mock streams

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-10 18:37:39 -07:00
mateo-berri
dcdd884352 fix(caching): let only the recovery probe close a half-open Redis breaker
A call admitted before the breaker opened could finish while the breaker was
HALF_OPEN and close it before the designated probe reported, so Redis traffic
resumed on a stale answer. The admission now records whether the call is the
probe and only the probe's success closes a half-open breaker.

The cron job lock manager also logged an error every cycle the open breaker
refused its Redis call, one line per job per pod. That refusal is now a debug
line like every other guarded call, while real Redis errors still log at error
2026-09-10 18:36:19 -07:00
yuneng-jiang
41b0deb627
Merge pull request #40643 from BerriAI/litellm_fix_optional_logging_assertions
test: respect optional logging payload fields
2026-09-10 18:27:51 -07:00
mateo-berri
7169ddaef6 fix(router): treat a breaker-refused Redis read as a miss in the health state cache
The sync Redis read now raises while the circuit breaker is open, and the
health state merge caught that as a generic error, skipping the local write
and logging an error on every background health check cycle. Read the shared
snapshot through a helper that treats the refused read as a miss so the merge
falls back to the pod-local copy the way a swallowed connection error already did
2026-09-10 18:16:59 -07:00