Repository navigation
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Merging this PR will not alter performance1 warning
Performance Changes
Comparing Footnotes |
|
bugbot run |
[Medium impact] The PR appears safe to merge, with no new actionable issues found SummaryAdds opt-in Database diagnostics wait until privacy settings are resolved. Shadow warnings remain available after a failed configuration load No new actionable issues were found. The earlier startup-output and database-setting findings are addressed in the current code. Historical live-provider results are clearly labeled with their tested commit
Reviews (5) · Last reviewed commit: "fix(logging): preserve deferred config w..." · Reviewed by Greptile |
|
bugbot run |
|
bugbot run |
|
bugbot run |
Merge current main and retain both sets of request-processing tests Emit shadow warnings after runtime validation so retries do not lose them
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c3ed358. Configure here.

Operators can enable detailed diagnostics while keeping prompts, replies, and exception text out of LiteLLM-owned diagnostics. The new setting is off by default and leaves provider requests, client responses, and the existing logging-integration setting unchanged
Details
TLDR
Problem this solves:
How it solves it:
Intentional product change: opting in removes free-form diagnostic text, model names, base URLs, raw exceptions, correlation identifiers, and custom extras; selected operational events remain available
User Flow
Before: detailed logging exposes content even with logging-integration message suppression enabled
POST https://example.com/v1/chat/completions(alsoPOST https://example.com/v1/responsesandPOST https://example.com/v1/messages)After: the operator can keep detailed logging without content in built-in diagnostics
redact_messages_in_debug_logs: trueand restarts the proxyPOST https://example.com/v1/chat/completions(alsoPOST https://example.com/v1/responsesandPOST https://example.com/v1/messages)Relevant issues
Fixes #42896
Pre-Submission checklist
Validation
Current tip
98cbd9af71ef0a23c4d643609d6294297d65f773fixes Bugbot's DeepEval retry finding. The original exception chooses the diagnostic branch; only the logged text is redacted. Missing and null exceptions continue to produce the ordinary retry message with privacy enabled. The two regression cases failed before the fix.pytest tests/unit/integrations/test_deepeval.py -q --tb=shortnow reports 8 passed, covering missing, null and real exceptions with privacy off and on. Fullmake checkpassesThe earlier
c3ed358cmerge includes main60601ca9950and preserves both sets of tests from the request-processing conflict. Its config-warning fix passed 924 tests with two skipped after two before-fix failures. The current branch also merges cleanly with main89ca8d83f89, verified locally after pushGreptile's updated review gives 5/5 to
c3ed358c. Both Bugbot follow-up findings are fixed and their threads resolved. CI and bot results for the current tip are pending. The prior Codecov result at9cc438cwas 91.84% against the 89.25% targetThe upstream OpenTelemetry test fix #49129 is included. The previous Rust beta-header failure reproduced on clean main and remains outside this PR's scope. The additional real-database retry probe was inconclusive because the pre-fix checkout's Prisma engine connection failed before exercising the regression. Its disposable databases were stopped and removed. No new live-database or provider proof is claimed for these follow-ups
Screenshots / Proof of Fix
E2E exception at
98cbd9af71ef0a23c4d643609d6294297d65f773: the latest follow-up restores the existing DeepEval diagnostic branch without changing requests, responses or retries. There are no internal callers of this helper. The focused tests exercise the real logger across all three exception cases with privacy off and on: two failures before the fix, eight passes after. Fullmake checkpassesThe live-provider proof below was recorded at
9cc438c. Subsequent main merges, the config-warning retry fix and the DeepEval diagnostic fix are validated separately above. These historical results are not presented as a live run of the current tipBoth legs use two proxy workers, the same 241 installed package versions and locked Python dependencies and real
chatgpt/gpt-6.1-solcalls. This uses an explicitly authorized existing subscription, with no token refresh or auth-file writes. Chat Completions and Messages exercise bridges; this is not native Anthropic or metered OpenAI API proofShared setup uses environment credentials,
turn_off_message_logging: true,redact_messages_in_debug_logs: true, and--detailed_debug --num_workers 2.$PORTidentifies the isolated leg and$QA_MASTER_KEYits temporary master key. Each payload asks for a synthetic marker. No real user content is usedShared configuration, response projection and exact headline request payloads
project_headline.pySet
LITELLM_MASTER_KEYto the temporary key used by the curl header, then start the isolated proxy with the configuration above. The access token is supplied throughQA_CHATGPT_ACCESS_TOKENin the process environmentpython litellm/proxy/proxy_cli.py --config config.yaml --host 127.0.0.1 --port "$PORT" --num_workers 2 --detailed_debugchat_completions_False_0.request.json
{ "model": "qa-model", "stream": false, "messages": [ { "role": "user", "content": "Reply with exactly this text and no other words: SYNTHETIC_PRIVATE_42896_chat_False_0" } ] }responses_False_0.request.json
{ "model": "qa-model", "stream": false, "input": "Reply with exactly this text and no other words: SYNTHETIC_PRIVATE_42896_responses_False_0" }messages_False_0.request.json
{ "model": "qa-model", "stream": false, "messages": [ { "role": "user", "content": "Reply with exactly this text and no other words: SYNTHETIC_PRIVATE_42896_messages_False_0" } ], "max_tokens": 128000 }The displayed response projections use
python3 project_headline.py RESPONSE_FILE, which selects only returned text and core input/output token counts. They exclude response IDs and usage attribution objectsThe operator checks the complete captured log with:
grep -c 'SYNTHETIC_PRIVATE_42896_chat_False_0' proxy.logBefore (83d6779)
Chat Completions
grep -creturns10for the Chat Completions marker){ "text": "SYNTHETIC_PRIVATE_42896_chat_False_0", "usage": { "completion_tokens": 18, "prompt_tokens": 1653, "total_tokens": 1671 } }Responses
@responses_False_0.request.jsonand/v1/responses{ "text": "SYNTHETIC_PRIVATE_42896_responses_False_0", "usage": { "input_tokens": 1654, "output_tokens": 19, "total_tokens": 1673 } }Messages
@messages_False_0.request.jsonand/v1/messages. The required output limit uses the model's documented native maximum{ "text": "SYNTHETIC_PRIVATE_42896_messages_False_0", "usage": { "input_tokens": 245, "output_tokens": 18 } }After (9cc438c)
Chat Completions
grep -creturns0for the Chat Completions marker){ "text": "SYNTHETIC_PRIVATE_42896_chat_False_0", "usage": { "completion_tokens": 18, "prompt_tokens": 1653, "total_tokens": 1671 } }Responses
{ "text": "SYNTHETIC_PRIVATE_42896_responses_False_0", "usage": { "input_tokens": 1654, "output_tokens": 19, "total_tokens": 1673 } }Messages
{ "text": "SYNTHETIC_PRIVATE_42896_messages_False_0", "usage": { "input_tokens": 245, "output_tokens": 18 } }Extended API cases and observed results
These cases use the actual stdlib HTTP runner rather than claim additional curl runs. The runner only sends HTTP and observes client responses and the operator's logs; it does not substitute provider responses
record_marker, put a marker in its description, and require the model to call it with that marker. All three APIs return the exact argument Before and After; only Before logs the markerlitellm_request_debug: truewith JSON logging and legacy verbose enabled. Before and After return200; only Before logs the promptinvalid_request_errorwith the marker in the client error; only Before logs itWith two workers, startup-only INFO on current main logs
qa-modeltwice with either flag value. The updated PR logs it twice with privacy off and zero times with privacy on. Startup probes make no provider requests. The real provider400 failure logs at ERROR. All temporary proxies stoppedThe after log retains these observed operational fields (projected from its safe diagnostic messages):
Actual extended runner commands, with the authorized credential supplied only in the process environment:
All 15 paired request bodies are identical. The actual returned tool calls and parsed arguments match on all three APIs. Complete opt-in logs have zero synthetic markers, configured model names, formatter errors or tracebacks
DB-only configuration regression, previous PR versus final tip
This additional regression compares the previous PR at
56372ea04f955ad8f2caf602bc2f9a636395c76cwith9cc438c228c1fb8d03dbee107b0ad2e53684296e. Both boot two workers against the same disposable PostgreSQL16 database and call the real provider on all three API routesThe saved
litellm_settingscontainsredact_messages_in_debug_logs: trueandmodel_alias_map: {SYNTHETIC_PRIVATE_DB_ALIAS_42896: qa-model}. A savedgeneral_settings.custom_authcontains the deliberately rejected synthetic values3://example-bucket/SYNTHETIC_PRIVATE_DB_CONFIG.py. YAML omits the privacy flag and enablesstore_model_in_db. The database URL is supplied only through the environment--detailed_debug --num_workers 2Previous PR output
Final tip output
The previous PR exposes the alias key in a DEBUG config row and the rejected path in a WARNING before applying DB-only privacy. The final tip omits both. The rejected remote auth value remains rejected, and requests still succeed. Both final log marker counts are zero, with no formatter errors or tracebacks
The disposable database was stopped and removed after verification. No persistent service was used
Functional and performance comparisons
A fresh component ABBA comparison at base
83d67791584and pre-follow-up head56372ea04f9, with 241 identical package versions and 20 samples per payload size, measures default-off INFO overhead of 24–32 ns per provider diagnostic helper call and an unchanged 64-byte temporary peak. At 8 MiB, opt-in DEBUG formatting falls from 26.81 ms to 0.037 ms and 25.17 MB to 8.5 KB temporary allocation. These are component measurements, not HTTP latency or total RSS. The final follow-up adds configuration-only diagnostic deferral and skips a streaming diagnosticPerformance measurements below are from
8d9bd9045a3d9fa13492fcd000266344add13fb0; live functional proof above was repeated on9cc438c228c1fb8d03dbee107b0ad2e53684296e.Synthetic HTTP: 24/24 response-semantic comparisons match; 16/16 canceled streams disconnect upstream within 70–75 ms. INFO opt-out log bytes match. ABBA uses two workers and 100 warm requests/case for the focused repeat. First-use 1 KiB nonstream ranges: baseline 96–98 ms, head 76–95 ms.
Initial random-seed runs showed 7–13% higher head medians on several INFO cases. Fixed-seed 1 MiB nonstream retained +4.5% and +0.20 ms CPU/request; identical-baseline control itself showed +3.6% and +0.20 ms. Profiling found constant microsecond guards, no added payload-scaled work. No attributable payload-scaled regression was found; zero overhead is not claimed. Process-tree RSS varied substantially across identical boots (roughly 1.6–2.1 GiB); these samples cannot establish zero RSS overhead.
Synthetic upstream HTTP measurements are separate from real-provider proof. They hold response content constant and compare first/warm p50/p95 latency, streaming delay, response semantics, cancellation propagation and process RSS. Diagnostic component measurements use the real logger/filter stack and compare CPU time and temporary allocations. No provider-latency speedup or universal zero-overhead guarantee is inferred
🆕 New Feature
Caveats
Severe
Medium
Low
turn_off_message_loggingFinal Attestation
Note
Medium Risk
Broad changes to logging filters and proxy config load ordering affect observability and startup diagnostics, but default-off behavior and extensive tests limit production impact.
Overview
Adds
litellm_settings.redact_messages_in_debug_logs(defaultfalse) so operators can run--detailed_debugwithout prompts, replies, or exception text appearing in LiteLLM-owned diagnostics. README documents pairing it with existingturn_off_message_loggingfor logging integrations.Central logging (
_logging.py) wiresMessageContentFilterand_redact_diagnostic_recordthrough secret/access/JSON formatters, startup output, and excepthooks: LiteLLM-scoped records becomeredacted-by-litellm, strip **exc_info/extras, and skip correlation IDs.log_safe_diagnosticemits structured events (request_sent,response_ready,retry,fallback, etc.) when privacy is on. The Rust bridge logger treats privacy mode as “diagnostics disabled” for native emits.Hot paths skip formatting payloads when enabled: proxy skips DEBUG request payload dumps;
litellm_loggingshort-circuits curl/RAW response debug and redacts optional stdout payload printing; router/proxy stream handlers log safe events instead of chunks. Dozens ofprint_verbose/ legacy stdout call sites gate on the flag; several integration loggers attachMessageContentFilter.Proxy config applies the flag from YAML/DB at runtime, redacts worker config for startup logs when privacy is on, and defers DB config DEBUG/WARNING lines until after privacy is resolved so DB overlay content is not logged before redaction applies.
Tests cover privacy on/off across streaming, proxy, config load, integrations, and MCP iterators while asserting client/provider behavior and in-memory data stay unchanged.
Reviewed by Cursor Bugbot for commit c3ed358. Bugbot is set up for automated code reviews on this repo. Configure here.