litellm/tests/test_litellm/proxy/policy_engine
Yassin Kortam c14329128b
fix(guardrails): match policy-pipeline block response to direct guardrail attachment (#31421)
When a guardrail blocked a request through a flow-builder policy pipeline, the
proxy discarded the guardrail's own exception and synthesized a generic
guardrail_pipeline_error response, so the same guardrail produced a different
HTTP response and trace span depending on whether it was attached directly or
via a policy. The pipeline now carries the guardrail's original exception and
re-raises it verbatim on block, enriching it with the blocking guardrail's name
and mode exactly as the direct path does, so the two attachment methods are
indistinguishable to clients and tracing. The generic pipeline error remains
only as a fallback for blocks with no underlying exception (e.g. a guardrail
that could not be found).

Resolves LIT-4041
2026-06-26 14:25:10 -07:00
..
__init__.py [Feat] New LiteLLM Policy engine - create policies to manage guardrails, conditions - permissions per Key, Team (#19612) 2026-01-22 19:49:53 -08:00
test_attachment_registry.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_condition_evaluator.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_pipeline_executor.py fix(guardrails): match policy-pipeline block response to direct guardrail attachment (#31421) 2026-06-26 14:25:10 -07:00
test_policy_matcher.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_policy_resolver.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_policy_validator.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_policy_versioning.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_policy_versioning_e2e.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00