litellm/tests/test_litellm/proxy/guardrails/guardrail_hooks
Ali Ahmed a677242d6f
fix(headroom): stop re-compressing retrieved CCR content in client tool loops (#38591)
When the headroom_retrieve tool is exposed to a client that runs its own
tool-execution loop (the LiteLLM MCP gateway path), the client executes the
retrieve call and sends the recovered original content back as a tool result
on the next turn. The guardrail then compressed that row again, and because
CCR is content-addressed it collapsed back to the exact same hash it was just
retrieved from. The model never saw the expansion and the agent looped.

Hold tool-result rows that carry headroom_retrieve output back from the
compression service, the same way the live turn and trailing tool exchange are
already protected, so the expansion survives. Retrieve calls are matched by the
direct headroom_retrieve name and the mcp__<server>__headroom_retrieve gateway
name. Because a long gateway name is truncated past 64 chars in the
OpenAI-translated view the guardrail scans, the pairing also falls back to the
tool-call id read from the request's own untranslated messages, which is never
truncated.

Fixes #38558
2026-09-02 12:07:13 -07:00
..
azure feat(guardrails): track Azure Prompt Shield usage and cost with spend isolation (#38387) 2026-08-26 17:42:17 -07:00
content_filter test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
guardrails_ai style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
openai fix(guardrails): surface post-flush stream blocks as in-stream error frames and keep guardrail_information in spend logs 2026-08-29 01:25:08 -07:00
unified_guardrails test(guardrails): update chat eos block tests for finish-chunk withholding 2026-08-31 17:31:59 -07:00
_cisco_ai_defense_test_utils.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
code_execution_compliance_dataset.json feat(add-new-block_code_execution-guardrail): prevent agent from executing code (#22154) 2026-02-25 22:02:14 -08:00
test_aim.py fix(guardrails): walk Responses-API text taxonomy in shared content helpers (#32542) 2026-07-08 23:24:11 -07:00
test_alice.py feat(guardrails): add Alice guardrail (#38898) 2026-09-01 12:33:39 -07:00
test_bedrock_guardrails.py Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_stream_modify_response_chunks 2026-09-01 14:49:06 -07:00
test_bedrock_invoke_guardrail_checks.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_block_code_execution.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_block_code_execution_compliance.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_cato_networks.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_cisco_ai_defense_chat.py test: drop the leftover set_verbose from eleven test files (#37845) 2026-08-22 08:23:27 -07:00
test_cisco_ai_defense_mcp.py feat(guardrails): add Cisco AI Defense integration (#28249) (#30338) 2026-06-12 23:21:23 -07:00
test_compresr.py fix(guardrails): preserve cache_control breakpoints in compresr write-back 2026-07-25 14:47:25 -07:00
test_crowdstrike_aidr.py fix(guardrails): add fail-open mode to CrowdStrike AIDR guardrail (#38568) 2026-08-27 17:57:35 -07:00
test_deepkeep.py test(guardrails): stop five guardrail test files leaking env vars on failure (#37828) 2026-08-21 21:29:31 -07:00
test_dynamoai.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_enkryptai.py test: require a match= on broad pytest.raises, and drop duplicate parametrize cases (#37769) 2026-08-20 20:24:49 -07:00
test_generic_guardrail_api.py test: require a match= on broad pytest.raises, and drop duplicate parametrize cases (#37769) 2026-08-20 20:24:49 -07:00
test_grayswan.py fix(guardrails): forward grayswan scan id header (#32544) 2026-07-08 15:05:27 -07:00
test_headroom.py fix(headroom): stop re-compressing retrieved CCR content in client tool loops (#38591) 2026-09-02 12:07:13 -07:00
test_hiddenlayer.py fix(guardrails): exclude images from HiddenLayer v1 scans (#29210) 2026-08-31 12:50:42 -07:00
test_lakera_ai_v2.py fix(guardrails): stop Lakera monitor mode forwarding unmasked PII on Responses-API bodies (#38841) 2026-08-29 17:07:39 -07:00
test_lasso.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_mcp_end_user_permission.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_mcp_security.py Add MCP Security guardrail to block unregistered MCP servers (#21429) 2026-02-17 21:19:13 -08:00
test_microsoft_purview.py test: enforce PT012 so a pytest.raises block cannot hide dead assertions (#37748) 2026-08-20 19:36:26 -07:00
test_model_armor.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_noma.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_noma_v2.py perf(guardrails): stop sending the conversation twice in the noma v2 payload (#36764) 2026-08-17 15:37:17 -07:00
test_onyx.py test(guardrails): stop five guardrail test files leaking env vars on failure (#37828) 2026-08-21 21:29:31 -07:00
test_ovalix.py feat: litellm oss 110626 (#30202) 2026-06-11 22:30:26 -07:00
test_pangea.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_panw_prisma_airs.py test: require a match= on broad pytest.raises, and drop duplicate parametrize cases (#37769) 2026-08-20 20:24:49 -07:00
test_presidio.py fix(presidio): chunk oversized text before /analyze so large content blocks do not fail (#38483) 2026-08-27 17:41:55 -07:00
test_presidio_union_fix.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_promptguard.py Add PromptGuard guardrail integration (#24268) 2026-04-09 08:12:24 -07:00
test_qualifire.py feat(guardrails): add Lakera v2 skip-message honoring and advisory (inject_system_message) mode (#34940) 2026-08-28 14:13:49 -07:00
test_repelloai.py test(guardrails): stop five guardrail test files leaking env vars on failure (#37828) 2026-08-21 21:29:31 -07:00
test_response_rejection_guardrail_code.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_singulr.py chore(ci): merge oss branch (#33784) 2026-07-17 23:22:13 +00:00
test_straiker.py test: require a match= on broad pytest.raises, and drop duplicate parametrize cases (#37769) 2026-08-20 20:24:49 -07:00
test_structured_messages_writeback.py fix(guardrails/headroom): stop compressing the turn the model must act on (#35294) 2026-07-30 18:53:31 -07:00
test_tool_permission.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_tool_policy_guardrail.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_vigil_guard.py Litellm OSS Staging 010626 (#29422) 2026-06-01 21:42:51 -07:00
test_xecguard.py fix(xecguard): sanitize scan result before recording it for logging (#32935) 2026-07-12 02:46:02 +00:00