feat(core): add support for custom deny messages in policy rules (#17427)

This commit is contained in:
Allen Hutchison
2026-01-28 10:52:48 -08:00
committed by GitHub
parent 9e09db1ddb
commit 3787c71d15
8 changed files with 118 additions and 20 deletions
+3 -2
View File
@@ -404,15 +404,16 @@ export class Scheduler {
const callId = toolCall.request.callId;
// Policy & Security
const decision = await checkPolicy(toolCall, this.config);
const { decision, rule } = await checkPolicy(toolCall, this.config);
if (decision === PolicyDecision.DENY) {
const denyMessage = rule?.denyMessage ? ` ${rule.denyMessage}` : '';
this.state.updateStatus(
callId,
'error',
createErrorResponse(
toolCall.request,
new Error('Tool execution denied by policy.'),
new Error(`Tool execution denied by policy.${denyMessage}`),
ToolErrorType.POLICY_VIOLATION,
),
);