Skip to content

fix: ensure guardrail patterns persist on edit and mode toggle#19265

Merged
yuneng-jiang merged 1 commit intoBerriAI:mainfrom
naaa760:fix/guar-patt-edi
Jan 24, 2026
Merged

fix: ensure guardrail patterns persist on edit and mode toggle#19265
yuneng-jiang merged 1 commit intoBerriAI:mainfrom
naaa760:fix/guar-patt-edi

Conversation

@naaa760
Copy link
Contributor

@naaa760 naaa760 commented Jan 17, 2026

Type

🐛 Bug Fix : #19084

Changes

Fixed bug where custom regex patterns in Content Filter guardrails were cleared when:

  • Adding or modifying patterns and saving
  • Toggling guardrail mode between "mask" and "block" and saving
  • Combined operations (add pattern + toggle mode)

Root Cause: Patterns were only included in the update payload when they had changed. When only other fields (like mode) changed, patterns were omitted, causing data loss.

Solution: Always include patterns and blocked_words when updating a content filter guardrail, regardless of whether they've changed. This ensures patterns persist when other fields are updated.

Files Changed:

  • ui/litellm-dashboard/src/components/guardrails/guardrail_info.tsx - Updated handleGuardrailUpdate to always include patterns in the update payload

@vercel
Copy link

vercel bot commented Jan 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Error Error Jan 17, 2026 3:41am

Request Review

Copy link
Collaborator

@yuneng-jiang yuneng-jiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@yuneng-jiang yuneng-jiang merged commit 26a6b86 into BerriAI:main Jan 24, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Guardrail: patterns lost on edit or mode toggle

2 participants