Repository navigation
Handle Azure AI content safety blocks - #1456
Merged
BenjaminMichaelis merged 3 commits intoOct 5, 2026
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Non-streaming incomplete content-filter responses can still return partial or empty output with HTTP 200.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Adds application handling for Azure AI content-safety blocks across chat services, API endpoints, streaming, and UI behavior.
Changes:
- Classifies provider moderation failures using a domain exception.
- Returns generic JSON/SSE moderation errors and removes blocked partial replies.
- Adds endpoint contract tests and reusable test helpers.
| File | Description |
|---|---|
EssentialCSharp.Chat.Shared/Services/AIChatService.cs |
Classifies Azure content-filter failures. |
EssentialCSharp.Chat.Shared/Services/ChatBackendUnavailableException.cs |
Adds the moderation domain exception. |
EssentialCSharp.Web/Controllers/ChatController.cs |
Maps moderation failures to JSON or SSE errors. |
EssentialCSharp.Web/wwwroot/js/chat-module.js |
Handles moderation events and fragmented SSE data. |
EssentialCSharp.Web.Tests/ChatModerationTests.cs |
Tests endpoint moderation contracts. |
EssentialCSharp.Web.Tests/McpTestHelper.cs |
Generalizes authentication helpers for derived factories. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
BenjaminMichaelis
deleted the
benjaminmichaelis-content-safety-guardrails
branch
October 5, 2026 04:00
26 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
content_filteredresponse without returning provider details.This is the application-side change for #1065. The paired Terraform change lowers the four harmful-content prompt thresholds for Violence, Hate, Sexual, and Selfharm from High to Low in
IntelliTect-dev/EssentialCSharp.AzureResourceManagement.Validation
dotnet test EssentialCSharp.Chat.Tests— 32 passed.dotnet test EssentialCSharp.Web.Tests— 154 passed (serial run).node --check EssentialCSharp.Web/wwwroot/js/chat-module.js— passed.Azure policy enforcement for the deployed xAI/Grok model still requires environment verification.
Fixes: #1065