litellm/litellm
Mateo Wang 4fbe2276a1
fix(logging): finish response metadata before the sync logging thread reads it (#39869)
* fix(logging): finish response metadata before the sync logging thread reads it

The async and sync client wrappers handed the response to the threaded success handler before computing its cost, call id, and api_base, so that thread inserted into the same metadata dict the request coroutine was still iterating and a finished chat completion turned into a 500 (dictionary changed size during iteration). Metadata is now finalized first, and the merge and header copies snapshot their dicts before iterating.

* fix(logging): snapshot metadata with a dict copy and drop redundant comment

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

* fix(logging): copy metadata via dict.copy and dedupe Final import

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:15:24 -07:00
..
a2a_protocol fix(bedrock): sign on a dedicated executor instead of the shared default one 2026-09-09 18:52:00 -07:00
anthropic_interface fix(anthropic_endpoints): return Anthropic type:error envelope for /v1/messages errors 2026-08-31 16:23:36 -07:00
assistants refactor(typing): replace Any with proven types in 89 more backend files 2026-09-02 23:08:42 +00:00
batch_completion
batches Merge pull request #39626 from BerriAI/litellm_batch_ui_logs 2026-09-08 15:19:25 -07:00
caching feat(proxy): offload spend tracking to a pod-local collector sidecar (#40545) 2026-09-10 17:14:13 -07:00
completion_extras fix(router): classify encrypted delegated tasks with native Responses 2026-09-10 12:32:09 -07:00
compression refactor(typing): replace Any with proven types in 89 more backend files 2026-09-02 23:08:42 +00:00
containers Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_decrease_anys_opus5_r4 2026-09-02 23:32:10 +00:00
endpoints/speech/speech_to_completion_bridge refactor(speech): freeze httpx response header dicts (LIT002) 2026-08-31 21:12:53 -07:00
evals
experimental_mcp_client fix(mcp): respect optional discovery capabilities and quiet unsupported methods 2026-09-09 20:21:19 -07:00
files test(batches): use immutable expectations with explicit test doubles 2026-09-07 16:36:27 -07:00
fine_tuning refactor(typing): replace Any with proven types in 89 more backend files 2026-09-02 23:08:42 +00:00
google_genai refactor(types): replace Any with precise types across 73 modules 2026-09-01 11:05:02 +00:00
images refactor(typing): replace Any with proven types in 89 more backend files 2026-09-02 23:08:42 +00:00
integrations feat(newrelic): export team max and remaining budget gauges to the Metric API (#40542) 2026-09-10 17:16:15 -07:00
interactions refactor(typing): replace Any with proven types in 42 more backend files 2026-09-02 15:35:01 +00:00
litellm_core_utils fix(logging): finish response metadata before the sync logging thread reads it (#39869) 2026-09-10 18:15:24 -07:00
llms test(proxy): fix marketplace request fixture after staging merge 2026-09-10 14:48:56 -07:00
models feat(proxy): granular key/team access control for Claude Code marketplace plugins (#40518) 2026-09-10 14:26:09 -07:00
ocr test(ocr): add SDK callback E2E parity (#40061) 2026-09-07 11:23:12 -07:00
passthrough Merge origin/litellm_internal_staging into litellm_techdebt_20260901 2026-09-01 19:38:19 +00:00
proxy fix(rate_limiter): skip non-Latin-1 x-litellm-priority header on /v1/messages (#40636) 2026-09-10 17:48:46 -07:00
proxy_auth
rag chore: merge origin/litellm_internal_staging into litellm_decrease_anys_opus5_r4 2026-09-04 18:59:35 -07:00
realtime_api Merge pull request #39851 from BerriAI/litellm_fix_realtime_backend_close_hang 2026-09-05 09:51:15 -07:00
repositories feat(proxy): granular key/team access control for Claude Code marketplace plugins (#40518) 2026-09-10 14:26:09 -07:00
rerank_api fix(rerank): adopt declared authenticating providers in arerank instead of resolving them 2026-09-01 14:47:59 -07:00
responses fix(router): honor Codex reminders and map classifier failures 2026-09-10 13:48:21 -07:00
router_strategy Merge pull request #40620 from BerriAI/litellm_redis_breaker_quiet_open 2026-09-10 15:52:09 -07:00
router_utils Merge pull request #39863 from BerriAI/litellm_lit_7022_azure_ai_passthrough_config 2026-09-09 20:56:57 -07:00
rust_bridge feat(rust_bridge): count budget-check input tokens in Rust on all LLM routes (#40381) 2026-09-10 13:56:30 -07:00
sandbox
search fix(search): forward search-tool params through the router, complete Parallel AI v1 param mapping (#37883) 2026-09-01 21:46:46 -07:00
secret_managers chore: merge origin/litellm_internal_staging into litellm_decrease_anys_opus5_r4 2026-09-04 18:59:35 -07:00
skills feat(skills): semantic search over the LiteLLM-hosted skill registry (#39401) 2026-09-07 12:28:38 -07:00
types feat(newrelic): export team max and remaining budget gauges to the Metric API (#40542) 2026-09-10 17:16:15 -07:00
vector_store_files refactor(typing): replace Any with proven types in 42 more backend files 2026-09-02 15:35:01 +00:00
vector_stores Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_python_version_ci 2026-09-03 00:16:19 -07:00
videos
__init__.py feat(pointfive): add batching logger callback 2026-09-10 14:02:35 +03:00
_internal_context.py fix(proxy): price one cost estimate at one moment 2026-09-07 18:38:12 -07:00
_lazy_imports.py fix(lazy_imports): type import_map as Mapping to stay under the LIT001 budget 2026-09-05 16:12:45 -07:00
_lazy_imports_registry.py Revert "perf: lazy-load SDK symbols so import litellm stays under 60 MB RSS (…" 2026-09-05 16:07:09 -07:00
_logging.py fix(proxy): stop leaking internal exception details to clients (#39380) 2026-09-02 17:32:00 -07:00
_redis.py fix(redis): accept every truthy flag and sign serverless ElastiCache caches 2026-09-10 10:13:03 -04:00
_redis_credential_provider.py fix(redis): accept every truthy flag and sign serverless ElastiCache caches 2026-09-10 10:13:03 -04:00
_service_logger.py chore: merge origin/litellm_internal_staging into litellm_decrease_anys_opus5_r4 2026-09-04 18:59:35 -07:00
_uuid.py
_version.py
anthropic_beta_headers_config.json
anthropic_beta_headers_manager.py
blog_posts.json
budget_manager.py
constants.py Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_sanitize_unknown_model_spend_rows 2026-09-10 15:47:55 -07:00
cost.json
cost_calculator.py Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_cost_estimate_cache_tokens 2026-09-09 10:05:48 -07:00
exceptions.py fix(bedrock): keep x-amzn-RequestId on chat error responses (#40089) 2026-09-07 17:16:47 -07:00
main.py perf(mock): emit admission-time usage chunk on streaming mock_response (#40637) 2026-09-11 00:48:25 +00:00
model_prices_and_context_window_backup.json feat(wandb): default unmapped W&B models to reasoning-capable 2026-09-10 16:40:07 -07:00
policy_templates_backup.json
provider_endpoints_support_backup.json fix(ocr): send each provider a health-check document it accepts 2026-09-04 22:52:12 -07:00
py.typed
router.py Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_redis_breaker_quiet_open 2026-09-10 15:21:19 -07:00
scheduler.py
setup_wizard.py feat(models): add Claude Fable 5.1 across Anthropic, Bedrock, Vertex AI, and Azure AI 2026-09-01 18:07:06 +00:00
timeout.py
utils.py fix(logging): finish response metadata before the sync logging thread reads it (#39869) 2026-09-10 18:15:24 -07:00