litellm/tests/test_litellm/proxy/utils/proxy_logging
devin-ai-integration[bot] f48d219c50
fix(guardrails): run policy pipelines when the caller sends its own metadata (/v1/messages, Claude Code) (#36889)
* fix(guardrails): resolve guardrail pipelines from the canonical metadata bucket

Policy-resolved pipelines are stored in litellm_metadata on routes like /v1/messages, but the pre_call reader fell back to the caller-supplied metadata field first, so a request that sends its own top-level metadata (Claude Code sends metadata.user_id) skipped every pipeline-managed guardrail.

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

* test(guardrails): drive the pipeline regression through a registered guardrail

Exercise the real executor with a guardrail in litellm.callbacks instead of patching PipelineExecutor.execute_steps at class scope.

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

* fix(guardrails): read pipeline state from the bucket the policy engine wrote

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

* fix(guardrails): type the policy pipeline state accessors

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

* fix(guardrails): annotate policy pipeline state casts

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

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-21 13:04:04 -07:00
..
__init__.py test(proxy/utils): pin ProxyLogging behavior (#29485) 2026-06-02 17:45:39 -07:00
_harness_smoke_test.py test(proxy/utils): pin ProxyLogging behavior (#29485) 2026-06-02 17:45:39 -07:00
conftest.py test(proxy/utils): pin ProxyLogging behavior (#29485) 2026-06-02 17:45:39 -07:00
test_alerting.py test(proxy/utils): pin ProxyLogging behavior (#29485) 2026-06-02 17:45:39 -07:00
test_callback_capabilities_class.py test: require a match= on broad pytest.raises, and drop duplicate parametrize cases (#37769) 2026-08-20 20:24:49 -07:00
test_callback_capabilities_dataclass.py test(proxy/utils): pin ProxyLogging behavior (#29485) 2026-06-02 17:45:39 -07:00
test_during_call_hook.py test(proxy/utils): pin ProxyLogging behavior (#29485) 2026-06-02 17:45:39 -07:00
test_guardrail_pipeline.py fix(guardrails): run policy pipelines when the caller sends its own metadata (/v1/messages, Claude Code) (#36889) 2026-08-21 13:04:04 -07:00
test_internal_usage_cache.py test(proxy/utils): pin ProxyLogging behavior (#29485) 2026-06-02 17:45:39 -07:00
test_lifecycle.py fix(slack_alerting): hold a pod lock so a fleet sends one deprecation alert per day 2026-08-15 17:10:12 +00:00
test_mcp_bridging.py fix(mcp): expose client HTTP headers to logging callbacks and hooks (#36724) 2026-08-13 20:07:16 -07:00
test_module_helpers.py test(proxy/utils): pin ProxyLogging behavior (#29485) 2026-06-02 17:45:39 -07:00
test_post_call_failure_hook.py test(proxy/utils): pin ProxyLogging behavior (#29485) 2026-06-02 17:45:39 -07:00
test_post_call_success_hook.py feat(guardrails): add run_in_parallel opt-in for concurrent pre_call and post_call guardrails (#33770) 2026-07-24 13:25:58 -07:00
test_pre_call_hook.py fix(proxy): scan batch records with the content hooks that are not guardrails (#37786) 2026-08-21 11:20:23 -07:00
test_streaming_hooks.py test(proxy/utils): pin ProxyLogging behavior (#29485) 2026-06-02 17:45:39 -07:00