feat: surface model content-filter refusals as a blocked chat error (#27118)

Blocked turns from a provider's content filter (Anthropic's `refusal`
stop reason with empty content) previously ended silently on the
"Thinking" spinner. They now end as a terminal `content_filter` error
that renders as a "Response blocked" message with the provider's
category and explanation.

<img width="888" height="335" alt="image"
src="https://github.com/user-attachments/assets/cef85a59-4091-4e62-9d45-1eb06748db48"
/>


Closes CODAGT-611

Follow-ups will involve implementing fallbacks, but this alone is pretty
important
This commit is contained in:
Ethan
2026-07-15 16:36:31 +10:00
committed by GitHub
parent 8eaf4f507b
commit cc11c8a536
11 changed files with 250 additions and 13 deletions
+2
View File
@@ -1715,6 +1715,7 @@ const (
ChatErrorKindUsageLimit ChatErrorKind = "usage_limit"
ChatErrorKindMissingKey ChatErrorKind = "missing_key"
ChatErrorKindProviderDisabled ChatErrorKind = "provider_disabled"
ChatErrorKindContentFilter ChatErrorKind = "content_filter"
)
// AllChatErrorKinds contains every ChatErrorKind value.
@@ -1730,6 +1731,7 @@ var AllChatErrorKinds = []ChatErrorKind{
ChatErrorKindUsageLimit,
ChatErrorKindMissingKey,
ChatErrorKindProviderDisabled,
ChatErrorKindContentFilter,
}
// ChatError represents a terminal chat error in persisted chat state or the