Commit graph

47609 commits

Author SHA1 Message Date
Yujong Lee
6fd590e247 fix(rust): satisfy strict lint budget 2026-09-08 09:20:04 -07:00
Yujong Lee
27bf5d9364 fix(rust): repair retained callback CI gates 2026-09-08 09:15:13 -07:00
Yujong Lee
3be0ced670 more xfail 2026-09-08 08:43:46 -07:00
Yujong Lee
d7b4cfb7f8 test(rust): xfail messages provider retry cases 2026-09-08 08:42:03 -07:00
Yujong Lee
d08d22642e fix(rust): preserve messages provider failures 2026-09-08 08:28:52 -07:00
Yujong Lee
42b8cd80be wip 2026-09-08 08:10:45 -07:00
Yujong Lee
a459ac932f fix(guardrails): validate logging-only mode with production integration coverage 2026-09-08 08:00:57 -07:00
Yujong Lee
02572d815f fix(rust): isolate callback tests and preserve messages logging lifecycle 2026-09-08 07:51:52 -07:00
Yujong Lee
aaace234bb fix(rust): type driver initialization errors 2026-09-07 23:42:53 -07:00
Yujong Lee
0688d9e309 test tooling 2026-09-07 23:38:31 -07:00
Yujong Lee
87d1997155 test(rust): expand callback lifecycle coverage 2026-09-07 23:38:20 -07:00
Yujong Lee
b02c53cebc fix(rust): satisfy CI quality gates 2026-09-07 23:31:04 -07:00
Yujong Lee
6f8f07433d refactor(ocr): inject upstream transport 2026-09-07 23:07:25 -07:00
Yujong Lee
aa8d8bf84b wip 2026-09-07 23:03:27 -07:00
Yujong Lee
94ce534b93 test(rust): strengthen native callback coverage 2026-09-07 22:41:27 -07:00
Yujong Lee
b1310a1bf8 refactor(rust): remove generic core cache 2026-09-07 22:38:45 -07:00
Yujong Lee
5b7ba86c30 wip 2026-09-07 22:02:46 -07:00
Yujong Lee
0a53a00edd refactor(ocr): fold execution into shared lifecycle 2026-09-07 21:38:57 -07:00
Yujong Lee
f1a5a6f47a test(rust): cover messages callbacks and streaming 2026-09-07 21:32:30 -07:00
Yujong Lee
969fa34968 wip 2026-09-07 20:58:41 -07:00
Yujong Lee
d02ec68372 wip 2026-09-07 20:34:07 -07:00
Yujong Lee
737c6946fb test(ocr): exercise native callbacks through public API 2026-09-07 19:55:27 -07:00
Yujong Lee
e1f009df86 remove bunch of wrong code 2026-09-07 19:50:22 -07:00
Yujong Lee
f250e3dded just pass lint 2026-09-07 19:49:54 -07:00
Yujong Lee
5afda69ca5 refactor test 2026-09-07 19:49:54 -07:00
Yujong Lee
993ddf7214 done 2026-09-07 19:49:54 -07:00
Yujong Lee
bdd98cef46 test(ocr): pin cancellation callback parity 2026-09-07 19:49:54 -07:00
Yujong Lee
99efd4113e test(ocr): cover terminal callback sources 2026-09-07 19:49:54 -07:00
Yujong Lee
b1f74b3603 wip 2026-09-07 19:49:54 -07:00
Yujong Lee
ff958cc30b lint 2026-09-07 19:49:54 -07:00
Yujong Lee
5cb55a5efd wip 2026-09-07 19:49:54 -07:00
Yujong Lee
5da66a7290 refactor(rust): harden retained callback adapter and dedupe test fixtures 2026-09-07 19:49:37 -07:00
Yujong Lee
bb3ac0fb74 fix(rust): install proxy extra for retained callback integration tests
The integration fixtures import litellm.proxy.* guardrails (crowdstrike,
purview, proxy.utils), which import fastapi at module load. The install
target only synced base SDK deps, so those 12 tests failed with a
ModuleNotFoundError on fastapi in CI.
2026-09-07 19:49:37 -07:00
Yujong Lee
036007a4e9 cleanup 2026-09-07 19:49:37 -07:00
Yujong Lee
415f6894a8 fix(rust): avoid retained adapter initialization deadlocks 2026-09-07 19:49:37 -07:00
Yujong Lee
391bb4cc74 wip 2026-09-07 19:49:37 -07:00
Yujong Lee
2ca2d106f7 wip 2026-09-07 19:49:37 -07:00
Yujong Lee
c6cd873266 wip 2026-09-07 19:49:19 -07:00
Yujong Lee
f1553ae9c3 wip 2026-09-07 19:49:05 -07:00
Yujong Lee
f854c38f36 await test 2026-09-07 19:49:05 -07:00
Yujong Lee
fc1877718d refactor(rust): complete retained callback lifecycle foundation 2026-09-07 19:49:05 -07:00
Yujong Lee
e399ec52f1 test(rust): run retained logging integration in CI 2026-09-07 19:49:05 -07:00
Yujong Lee
d4fb0921e1 refactor(rust): add retained callback invocation 2026-09-07 19:49:05 -07:00
yujonglee
13df85cceb
test: add Rust extension pytest contract (#40181)
* test: add Rust extension pytest contract

* test: prove native OCR execution

* test: isolate Rust extension pytest collection

* ci: register Rust extension test coverage

* test: prove native OCR at wire boundary
2026-09-07 18:46:29 -07:00
yucheng-berri
9bc9104102
fix(proxy): log budget reservation notice once at config load (#40167)
* fix(proxy): log disable_budget_reservation notice once at config load

The disabled-budget-reservation reminder fired as a WARNING inside request
authentication, so every authenticated request on a proxy that deliberately
set the flag produced one warning line. The notice now runs once per worker
when general_settings loads, at INFO, and the request path only skips the
reservation. Reservation skipping and read-time budget checks are unchanged

* fix(proxy): keep budget notice sentinel with constants

* fix(proxy): expose shared budget notice state
2026-09-07 18:18:28 -07:00
tin-berri
1761fe236f
feat(complexity_router): add declarative custom dimensions to the heuristic scorer (#40156)
Co-authored-by: Claude Code <noreply@anthropic.com>
2026-09-07 18:17:30 -07:00
tin-berri
7da6fe54b5
fix: skip one-shot Claude Code cache injection (#40175) 2026-09-07 18:03:43 -07:00
Mateo Wang
26d589cd28
Merge pull request #39234 from BerriAI/litellm_fix_agent_mcp_grants
fix(mcp): clear error when an agent-bound key is denied a scoped MCP server + agent MCP grants in the UI
2026-09-07 18:02:16 -07:00
yucheng-berri
1009976c49
fix(bedrock): keep x-amzn-RequestId on chat error responses (#40089)
* fix(bedrock): keep x-amzn-RequestId on chat error responses

Bedrock chat error paths built BedrockError from only a status code and a
message, so the provider response headers were gone before exception mapping
ran and the proxy had nothing to forward. AWS support needs x-amzn-RequestId
to investigate a server-side error.

- converse and invoke chat handlers pass the real headers and response when
  they turn an httpx.HTTPStatusError into a BedrockError, and read the body
  through error_response_text so a streamed body nobody read does not throw
- every bedrock chat get_error_class honors the headers it is already handed:
  invoke, moonshot, bedrock-hosted openai, agentcore and the invoke agent
- BedrockError carries those headers into the response it synthesizes when a
  caller has headers but no response, skipping values httpx cannot carry
- the bedrock 500 mapping forwards the provider response like its 4xx and 503
  siblings instead of fabricating a blank one

The proxy now returns llm_provider-x-amzn-requestid on Bedrock chat errors.

* fix(bedrock): keep request-id on text-classified errors

The context-window and image branches of _map_bedrock_exception built their
litellm exception without the provider response, so a Bedrock 400 classified
by its body text lost x-amzn-RequestId while the sibling branches kept it.

Also narrows the new BedrockError types and trims its docstrings.

* chore(bedrock): drop the docstrings on the new error helpers

* fix(bedrock): keep request-id on every error path that has one

The ticket's root cause is that every BedrockError raise site under
litellm/llms/bedrock/ was built from status and message alone. The first
commits covered the chat and invoke handlers; this covers the rest.

Embeddings, rerank, image generation, image edit, count tokens, search and
the transformation layers now hand on the provider response or its headers,
and both bedrock_mantle configs return a BedrockError instead of the
OpenAI error that drops them.

Two blockers surfaced while verifying the streaming path. The trailing
`except Exception` in make_call and make_sync_call swallowed the BedrockError
raised a few lines above, relabelling a provider status as a 500, and the
non-200 branch read an unread streamed body, which throws.

The raise sites left alone have no provider response to carry: timeouts,
credential and config errors, and mid-stream event frames.

* fix(bedrock): forward provider headers from the count tokens route

The count tokens route converts BedrockError into an HTTPException, and dropped
the headers the handler had just kept, so that route still lost the request id.

get_response_headers now takes a Mapping so an httpx.Headers can be handed to it
without a copy.

* fix(bedrock): classify every bedrock surface through BedrockError

Eleven bedrock configs still inherited a provider-agnostic get_error_class
that builds a blank response, so the request id was gone before the proxy
read it. Claude platform, bedrock anthropic-messages, both image edit
configs, passthrough, realtime, vector stores and agentcore search now
return BedrockError, and a parametrized audit drives all 36 configs.

* fix(proxy): keep provider headers on the httpx status error branch

_handle_llm_api_exception forwards safe_headers on every branch except the
httpx.HTTPStatusError one, which the bedrock passthrough route reaches, so
the request id was dropped before the client saw the response.

* fix(bedrock): keep the request id on the timeout mappings

Timeout takes no response argument, so the three bedrock timeout branches
dropped the provider headers even when the upstream answered 408 or 504
with an x-amzn-RequestId. They now ride on the exception, already
llm_provider-prefixed, which is the form the proxy emits.

* fix(bedrock): keep the provider response on mapped timeouts

The previous round attached llm_provider-prefixed headers directly to the
Timeout. That shadowed the raw upstream headers for _get_response_headers,
so router cooldown and fallback cooldown stopped honouring retry-after on
bedrock 408/504 replies.

Give Timeout an optional response instead, the way every other mapped
bedrock exception already carries one. Retry logic reads the raw
retry-after off the response, and the proxy prefixes those headers on the
way out, so clients still see llm_provider-x-amzn-requestid.

* chore(bedrock): drop the explanatory comment on Timeout.response
2026-09-07 17:16:47 -07:00
mateo-berri
e01bb98960 merge: bring litellm_internal_staging into litellm_fix_agent_mcp_grants again
Staging moved by the auto-router classifier cost change (#40168) between the
first merge and its push; this merge picks it up so the PR merges cleanly
2026-09-07 16:36:55 -07:00