litellm/tests/integration/_support
moyai-devin-berriai[bot] 0b3fcc197d
fix(logging): redact nested callback input and provider response fields (#45923)
* fix(logging): redact nested callback input and provider response fields

* fix(logging): keep shared request body for per-callback redaction and drop hidden provider fields

The deprecated per-callback message_logging=False path ran perform_redaction on
the shared model_call_details, which now also redacted the nested
proxy_server_request body. The spend log Request column and
previous_response_id replay read that body, so one opted-out callback blanked
them for everyone. That path now keeps the shared body and hidden params, and
redact_streaming_responses_for_custom_logger hands the opted-out callback its
own redacted litellm_params.

Redacted litellm_params also clear provider_specific_fields copied into
metadata.hidden_params (Anthropic thinking text), in litellm_params and in the
nested request body, and the nested body redacts system and instructions.

* fix(logging): keep replayed instructions and router usage marker under redaction

The shared request body keeps system and instructions again, so spend logs
store them and previous_response_id follow-ups replay the real instructions.
Per-callback copies still redact them.

Provider-specific fields in metadata.hidden_params are cleared in place, so
the metadata dict keeps its identity and the router's counted-usage marker
stays visible to deployment_callback_on_success (no double tpm/rpm count).

* fix(logging): never copy shared metadata dicts during redaction

The shared redaction pass now leaves litellm_params metadata dicts as they
are, so a hidden_params write from the other success handler between the
in-place clear and the copy can no longer move the router usage marker to a
stale dict. The key-presence predicate change is reverted as unneeded.

* refactor(logging): redact nested request body and provider fields with the existing message rules

Run perform_redaction on a copy of proxy_server_request.body, the same call the
spend log already makes, and redact reasoning inside provider_specific_fields the
way the message's own reasoning_content and thinking_blocks are redacted, instead
of clearing every provider field. Opaque fields such as Gemini thought_signatures
stay, and the metadata dicts and streaming objects are handled as on main.

---------

Co-authored-by: moyai-devin-berriai[bot] <336287033+moyai-devin-berriai[bot]@users.noreply.github.com>
Co-authored-by: yucheng-berri <293926326+yucheng-berri@users.noreply.github.com>
2026-10-13 12:25:56 -07:00
..
__init__.py
actors.py
agentic_probe.py
anthropic_sse.py
anthropic_thinking.py
asgi.py
async_server.py
aws_control_plane.py
bedrock_discovery.py
bedrock_runtime_peer.py
browser_state.py
budget.py
claude_code.py
client.py
codex_vendor.py
daily_activity.py
daily_spend_rows.py
database.py
database_relay.py
device_login.py
forward_proxy.py
generation.py
interception_vendor.py
mail.py
manifest.py
mcp.py
mcp_e2e_upstream_server.py
mcp_grants.py
mcp_stdio_peer.py
oauth_server.py
openai_wire.py
ordering.py
otlp_sink.py
pdf_document.py
prisma_clients.py
process.py
prometheus_series.py
prompt_cache_breakpoint.py
provider.py
proxy.py
redaction_probe.py fix(logging): redact nested callback input and provider response fields (#45923) 2026-10-13 12:25:56 -07:00
redis_process.py
responses_stream.py
responses_vendor.py
routing.py
runtime.py
sagemaker_embedding.py
sharding.py
sigv4.py
timing.py
tls.py
tool_rows.py
upstream.py
vertex.py
wire.py
workers.py