litellm/litellm/rust_bridge
yuneng-jiang a4e0570bea
fix(logging): keep the async request's logging payload when the sync success thread runs late (#47019)
* fix(logging): keep the async request's logging payload when sync callbacks run late

Treat the "cache" success callback as internal when deciding whether to start
the sync success thread for async requests. It has no branch in the sync
handler, so with `cache: true` that thread did nothing except rebuild and
overwrite model_call_details["standard_logging_object"].

When the sync handler does run for an async request (a real sync-only logger
is configured), it now builds its own payload and hands it only to its own
callbacks. The async handler keeps sole ownership of the shared payload, so
edits made by async logging hooks (for example the v3 rate limiter's mirrored
x-ratelimit headers that Prometheus reads) are no longer discarded. Sync
requests keep their existing behavior.

* fix(logging): keep sync cache hits logged and isolate the async-request payload build

The sync completion cache-hit path reused handle_sync_success_callbacks_for_async_calls,
so treating "cache" as internal silently dropped sync callbacks on sync cache hits. It now
submits the sync handler through its own method, as it effectively always did.

For async requests the sync handler builds its payload from a copy of the call details, so
message redaction cannot rewrite the shared standard_logging_object, and when it builds no
payload its callbacks keep the shared one instead of getting None.

* test(caching): lock sync cache-hit logging for completion, embedding and text_completion

* test(logging): keep sync hook edits off a caller-supplied payload for async requests

* fix(logging): give sync hooks a copy of the async payload when the thread builds none

* test(logging): check every legacy sync logger gets the thread's own payload

* test(logging): cover traceloop and supabase sync logging for async requests
2026-10-17 06:39:35 +00:00
..
chat_completions refactor(rust-bridge): move the route host modules under host/routes (#46786) 2026-10-15 18:27:06 -07:00
embeddings refactor(rust-bridge): return an unstarted Execution from native entrypoints and drive it in Python (#46299) 2026-10-14 17:50:44 -07:00
host fix(logging): keep the async request's logging payload when the sync success thread runs late (#47019) 2026-10-17 06:39:35 +00:00
messages refactor(rust-bridge): move the route host modules under host/routes (#46786) 2026-10-15 18:27:06 -07:00
ocr refactor(rust-bridge): move the route host modules under host/routes (#46786) 2026-10-15 18:27:06 -07:00
responses refactor(rust-bridge): move the route host modules under host/routes (#46786) 2026-10-15 18:27:06 -07:00
transcription refactor(rust-bridge): unify native call inputs and Messages settings (#45126) 2026-10-07 15:05:43 -07:00
__init__.py feat(python): rename Rust rollout API (#39704) 2026-09-04 08:40:44 -07:00
_native.pyi refactor(rust-bridge): return an unstarted Execution from native entrypoints and drive it in Python (#46299) 2026-10-14 17:50:44 -07:00
AGENTS.md refactor(rust-bridge): return an unstarted Execution from native entrypoints and drive it in Python (#46299) 2026-10-14 17:50:44 -07:00
bindings.py Merge pull request #39334 from BerriAI/litellm_rust_opt_in_configuration 2026-09-02 16:26:36 -07:00
catalog.py refactor(rust-bridge): remove the LoggerRule concept from the catalog (#46711) 2026-10-15 17:49:51 +00:00
clickhouse.py refactor(lens): connect LiteLLM to the independent Lens service (#45529) 2026-10-09 16:17:05 -07:00
configuration.py feat(tokenizer): preserve Python defaults with opt-in Rust dispatch (#42174) 2026-09-22 04:41:11 +00:00
diagnostics.py refactor(rust-bridge): remove the LoggerRule concept from the catalog (#46711) 2026-10-15 17:49:51 +00:00
dispatch.py refactor(rust-bridge): remove the LoggerRule concept from the catalog (#46711) 2026-10-15 17:49:51 +00:00
execution.py refactor(rust-bridge): return an unstarted Execution from native entrypoints and drive it in Python (#46299) 2026-10-14 17:50:44 -07:00
failures.py chore(lint): remove the LIT002 mutable-construction rule (#43971) 2026-10-01 12:24:02 -07:00
fork_guard.py wip 2026-09-19 10:36:59 -07:00
loader.py refactor(tests): restructure rust python harness around strategy definitions (#39628) 2026-09-03 21:15:01 -07:00
logger.py feat(lint): add LIT013 flagging *-ok suppressions that suppress nothing and remove the 240 stale ones (#42793) 2026-09-23 17:50:09 -07:00
preflight.py refactor(rust): move credential inheritance and the SDK limits out of the legacy callback crate into a driver preflight (#43259) 2026-09-26 01:09:36 +00:00
public_call.py refactor(rust-bridge): let each route host pick the body params (#46787) 2026-10-15 18:27:06 -07:00
response_metadata.py feat(cache): select Rust caching through explicit cache objects (#43601) 2026-09-29 00:01:44 +00:00
runtime.py feat(rust_bridge): read secrets through Python from Rust routes and declare Rust-only routes with NO_PYTHON (#43057) 2026-09-24 18:18:50 -07:00
token_counter.py feat(tokenizer): preserve Python defaults with opt-in Rust dispatch (#42174) 2026-09-22 04:41:11 +00:00
tokenizer.py refactor(sdk): separate core AWS and tokenizer dependencies (#44447) 2026-10-08 19:07:57 -07:00