litellm/tests/test_litellm_rust/ocr
Nate Armstrong 1ddc913002
fix(messages): log native messages success once, after the proxy releases it (#50420)
* fix(messages): log native messages success once, after the proxy releases it

The proxy defers non-stream success logging past post-call guardrails, but the native host parked its log in its own slot and the release only ran for OCR, so a unary /v1/messages call served by Rust logged no success event, no SpendLogs row and no key, team, user or end-user spend. A deferred native success now parks in enqueue_deferred_logging with deferred_success_result, the same slots Python uses, so the proxy releases it like any other call and its guardrail step pruning and cost preparation see it too

Python runs sync success callbacks inside the deferred logging closure, so a post-call hook that blocks the response drops them. A parked native success now carries its sync callbacks and runs them on release

A refused first attempt and its fallback share one logger. Python logs the async success once, for the first attempt, so the native adapter now claims the async success log once across fallback attempts. Like Python, an attempt that loses the claim runs its sync callbacks only when logging is not deferred, and an internal call logs nothing

* test(messages): cover the deferred native success park and release
2026-11-09 16:06:53 -08:00
..
__init__.py test(ocr): isolate native Rust bridge contracts (#40410) 2026-09-10 16:51:37 -07:00
conftest.py test(rust-bridge): select native routes per test without LITELLM_RUST (#46620) 2026-10-15 09:12:08 -07:00
data.py test(rust-bridge): pin Messages and Responses callback contracts on the native path (#46443) 2026-10-14 17:07:20 -07:00
test_callbacks.py fix(logging)!: fire one CustomLogger failure hook per async call outside the async flag list (#47124) 2026-10-20 15:19:14 -07:00
test_dispatch.py refactor(rust-bridge): decide native routing in the catalog, drop the bypass predicates (#46750) 2026-10-20 15:06:24 -07:00
test_failures.py feat(ocr)!: support outputContentFormat=markdown for Azure Document Intelligence (#48926) 2026-10-28 20:38:23 -07:00
test_guardrails.py test(rust-bridge): pin Messages and Responses callback contracts on the native path (#46443) 2026-10-14 17:07:20 -07:00
test_lifecycle.py fix(messages): log native messages success once, after the proxy releases it (#50420) 2026-11-09 16:06:53 -08:00
test_passthrough.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
test_requests.py feat(ocr)!: support outputContentFormat=markdown for Azure Document Intelligence (#48926) 2026-10-28 20:38:23 -07:00
test_settings.py test(rust-bridge): pin Messages and Responses callback contracts on the native path (#46443) 2026-10-14 17:07:20 -07:00