litellm/tests/test_litellm/proxy/policy_engine
mateo-berri b3d9ba9e7b fix(policy_engine): deliver guardrail text rewrites on multi-choice, unfinished, and envelope-less streams
Post-call pipeline rewrites on buffered streams failed open on three shapes:
chat streams with n > 1 (the rebuilt response collapsed every choice into
index 0), streams that ended without a finish marker, and Responses streams
whose final event carried no response envelope.

The chat handler now rebuilds the ended stream one choice index at a time and
writes each choice's rewrite back to that choice's buffered deltas. The
Anthropic handler writes an unended stream's rewrite across its text deltas.
The Responses handler spreads an envelope-less rewrite over the buffered
output_text events, still failing open when a scanned event cannot be placed.

Tool-call rewrites on n > 1 chat streams keep failing open.
2026-09-18 22:59:52 -07:00
..
__init__.py
test_attachment_registry.py feat(policy_engine): bound priority to int32 and expose it in the Admin UI 2026-09-17 06:47:53 +00:00
test_condition_evaluator.py
test_pipeline_executor.py fix(policy_engine): deliver guardrail text rewrites on multi-choice, unfinished, and envelope-less streams 2026-09-18 22:59:52 -07:00
test_policy_engine_endpoints.py
test_policy_matcher.py
test_policy_resolver.py
test_policy_validator.py
test_policy_versioning.py
test_policy_versioning_e2e.py
test_response_retrieval.py fix(proxy): type the new pipeline tests and keep tag values out of the deferral warning 2026-09-08 19:59:09 -07:00