Repository navigation
fix(ai-anthropic): accept unknown refusal categories - #11400
Conversation
Co-authored-by: Alexander Kachkaev <608862+kachkaev@users.noreply.github.com>
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
UI Bundle SizeVite 8.4.0/Rolldown, production, default Oxc minification, es2023, ES modules, gzip level 9 per chunk. effect 4.2.0, Node v26.12.1. Effect-only client: 27408 B gzip (Δ 0 B vs base).
|
Thanks for the quick fix! It works for us as it is, so this is just a thought for awareness, not a request. Opening the category to plain |
Anthropic adds refusal categories over time. The generated
RefusalCategoryandBetaRefusalCategoryschemas accepted only the categories listed in the pinned spec, so a refusal with a newer category failed the whole turn withInvalidResponseErrorinstead of finishing withfinishReason: "content-filter". A fallback block whose trigger used a newer category failed the same way.The category is informational, so a codegen patch opens both schemas to any string. Nullability and the
stop_reason→content-filtermapping are unchanged. The existing streaming tests for refusal stop details and fallback blocks now use an unknown category, and the refusal test also asserts the finish reason.Generated.tsincludes only the refusal-category hunks. Regenerating onmainalso produces unrelated generator drift, such as new*PathParamsexports, which is out of scope here.Closes #11391
Closes EFF-5164