Repository navigation
fix(logging): stop dumping the request body at every layer under --detailed_debug - #48973
Merged
ryan-crabbe-berri merged 3 commits intoOct 29, 2026
Merged
Conversation
…tailed_debug The proxy dumped the full request body at every layer it passed through (proxy entry, pre-call, router, SDK call echo, param mapping, logging object), so one Codex "hi" wrote over 500KB of debug log. Keep the inbound request line and the outgoing provider request, summarize large values in the SDK call echo, and stop per-request lines that report nothing (callback disable checks with no disable header, cost map name probes, response id decode misses, vector store path misses).
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
Author
|
@greptileai review |
Contributor
Author
|
bugbot run |
Contributor
[Medium impact] This PR appears safe to merge SummaryThis PR cuts repeated request-body debug logs and summarizes large arguments while keeping the received and outgoing request logs
Reviews (3) · Last reviewed commit: "perf(logging): build the param mapping d..." · Reviewed by Greptile |
Non-Default params and Final returned optional params still printed full tool definitions, so a Codex-style request repeated them twice more. Use the same size summary as the SDK call echo and cover tools in the test.
Contributor
Author
|
@greptileai re review |
Contributor
Author
|
bugbot run |
Contributor
Author
|
@greptileai re review |
Contributor
Author
|
bugbot run |
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6756dcb. Configure here.
ryan-crabbe-berri
enabled auto-merge (squash)
October 29, 2026 01:45
ryan-crabbe-berri
deleted the
litellm_quiet_detailed_debug_request_dumps
branch
October 29, 2026 02:30
3 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
--detailed_debugon, the proxy printed the full request body again at almost every step it passed through, so one Codex "hi" (a 34KB system prompt plus tools) wrote about 500KB of log. Now the body shows up where it enters the proxy and where it leaves for the provider, and a handful of lines that fire on every request with nothing to say are gone. Errors, warnings and info logs are untouchedDetails
TLDR
User Flow
Before: a developer debugging Codex through the proxy gets a wall of repeated prompt text for one "hi"
--detailed_debugand point Codex at itAfter: the same request gives a log where the prompt shows up once as received and once as sent
--detailed_debugand point Codex at itPre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Setup, shared by both runs. The proxy runs on port 4172 with no database and
--detailed_debug, logs go to a file. Two deployments, one native OpenAI Responses model and one that goes through the Responses to chat completions bridge (a translated path like the one Codex hits when its model has no native Responses API)The payloads mimic Codex. Each has a 31,239 character system prompt (150 numbered rules, each starting "Rule N: You are a coding agent...") and the user turn "hi". The two /v1/responses payloads and the chat one also carry 4 tools (shell, apply_patch, view_image, update_plan), and the bridge ones set reasoning effort to none since that model rejects tools otherwise. Each request is sent once to warm up, then once more for the measurement.
measureslices out only the bytes the proxy logged for that one requestBefore (49ccce7)
/v1/responses through the chat completions bridge (Codex path)
measure /v1/responses req_bridge.json && jq -r '.output[] | select(.type=="message") | .content[0].text' resp.jsonprintsHi! How can I help?wc -lc < one_request.logprints102 544313grep -c "Rule 0" one_request.logprints9, the prompt is in "Request received by LiteLLM", "receiving data", "[PROXY] returned data from litellm_pre_call_utils", "Inside ageneric_api_call_with_fallbacks() ... kwargs", the greenlitellm.aresponses(...)andlitellm.acompletion(...)echoes, "Params passed to completion()", the outgoing curl, and the reply echogrep -c callback_controls one_request.logprints12, two "is this callback disabled" lines per callback with no disable header sentgrep -c "Run a shell command in the workspace" one_request.logprints12, the tool list repeats on top of the prompt copies/v1/responses native OpenAI
measure /v1/responses req_native.jsonreturnsHi! What can I help you build or fix?wc -lc < one_request.logprints252 493029grep -c "Rule 0" one_request.logprints9grep -c "Error decoding response_id" one_request.logprints1, logged for a normal OpenAI response id/v1/chat/completions
measure /v1/chat/completions req_chat.jsonreturnsHi! How can I help?wc -lc < one_request.logprints93 356843grep -c "Rule 0" one_request.logprints6grep -c potential_model_names one_request.logprints3grep -c "Run a shell command in the workspace" one_request.logprints9/v1/messages
measure /v1/messages req_msgs.json(model gpt-6.1-sol, no tools) returnsHi! What can I help you with?wc -lc < one_request.logprints180 496929grep -c "Rule 0" one_request.logprints9After (6756dcb)
/v1/responses through the chat completions bridge (Codex path)
measure /v1/responses req_bridge.json && jq -r '.output[] | select(.type=="message") | .content[0].text' resp.jsonprintsHi! How can I help?wc -lc < one_request.logprints79 115572grep -c "Rule 0" one_request.logprints3, the prompt is only in "Request received by LiteLLM", the outgoing curl, and the reply echogrep -c callback_controls one_request.logprints0grep -c "Run a shell command in the workspace" one_request.logprints3, the same three places as the promptone_request.log(lines cut at 140 chars). The SDK call echo now shows sizes instead of the prompt, and the outgoing curl still masks the keygrep -cF "$OPENAI_API_KEY" proxy.logprints0, same for the first 12 characters of the key)/v1/responses native OpenAI
measure /v1/responses req_native.jsonreturnsHi! What can I help you with?wc -lc < one_request.logprints233 148963grep -c "Rule 0" one_request.logprints4, received, sent, and the two reply lines (OpenAI echoes the instructions back in its reply)grep -c "Error decoding response_id" one_request.logprints0/v1/chat/completions
measure /v1/chat/completions req_chat.jsonreturnsHi! How can I help?wc -lc < one_request.logprints71 79582grep -c "Rule 0" one_request.logprints2grep -c potential_model_names one_request.logprints0grep -c "Run a shell command in the workspace" one_request.logprints2/v1/messages
measure /v1/messages req_msgs.jsonreturnsHi! What can I help you with?wc -lc < one_request.logprints161 107141grep -c "Rule 0" one_request.logprints3, received, sent, and the reply echoType
🐛 Bug Fix
Caveats (if any)
Medium
MAX_PAYLOAD_SIZE_FOR_DEBUG_LOGline, so it staysMAX_PAYLOAD_SIZE_FOR_DEBUG_LOG=0shrinks it to a size and keys summaryLow
Note
Low Risk
Changes are limited to debug logging and response-id decode error handling; request handling, auth, and credential redaction paths are not altered for normal operation.
Overview
Under
--detailed_debug, this PR cuts repeated full request-body andkwargsdumps so large prompts/tools are not logged at every proxy, router, and completion hop.Removed or narrowed debug noise includes proxy
receiving data/ pre-call fulldatalogs (including one that ran before credential overrides), logging ofoptional_params, per-request vector-store “nothing to do” lines, router “Inside …” lines that printed entirekwargs, search API fallback logs, and enterprise callback “checking disabled” lines when no disable header is set. Completion debug drops the extra “params passed” line and only logspotential_model_nameswhen a model lookup actually fails.Where debug still shows payloads,
_debug_arg_repr/_debug_params_reprinutils.pyreplace values longer than 500 characters with<type len=N>summaries in the greenlitellm.*(...)echo and non-default/optional param lines; credential redaction behavior is unchanged.decode_responses_api_response_idnow treatsValueErrorlike other decode failures (fallback id, no spurious “Error decoding response_id” for normal OpenAI ids).Tests assert callback-disable checks stay silent without a disable header and that a sentinel prompt appears only twice in debug logs (received + upstream send) for chat and responses routes.
Reviewed by Cursor Bugbot for commit 6756dcb. Bugbot is set up for automated code reviews on this repo. Configure here.