Add fallback message when blocking service returns empty explanation

Prevents whitespace-only violation message when the tool blocking
service blocks tools but returns an empty content field.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joseph Barker 2026-04-07 13:39:32 -07:00
parent fe47a37c9c
commit d2d6e6f22a

View file

@ -453,7 +453,8 @@ class RubrikLogger(CustomGuardrail, CustomBatchLogger):
if len(allowed_tools) == len(all_tool_calls):
return None
explanation = blocking_explanation or "Tool call blocked by policy."
return BlockedToolsResult(
allowed_tools=allowed_tools,
explanation=f"\n\n{blocking_explanation}",
explanation=f"\n\n{explanation}",
)