Skip to content

fix(ai-anthropic): accept unknown refusal categories - #11400

Merged
tim-smart merged 2 commits into
mainfrom
agent/effect-bot/eb7da308c582
Dec 3, 2026
Merged

tim-smart merged 2 commits into
mainfrom
agent/effect-bot/eb7da308c582

Conversation

@effect-bot

Copy link
Copy Markdown
Contributor

Anthropic adds refusal categories over time. The generated RefusalCategory and BetaRefusalCategory schemas accepted only the categories listed in the pinned spec, so a refusal with a newer category failed the whole turn with InvalidResponseError instead of finishing with finishReason: "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-filter mapping 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.ts includes only the refusal-category hunks. Regenerating on main also produces unrelated generator drift, such as new *PathParams exports, which is out of scope here.

Closes #11391
Closes EFF-5164

effect-bot and others added 2 commits December 3, 2026 01:42
Co-authored-by: Alexander Kachkaev <608862+kachkaev@users.noreply.github.com>
@effect-janitor effect-janitor Bot added the 4.0 label Dec 3, 2026
@tim-smart
tim-smart enabled auto-merge (squash) December 3, 2026 01:49
@tim-smart
tim-smart merged commit 7834148 into main Dec 3, 2026
24 checks passed
@tim-smart
tim-smart deleted the agent/effect-bot/eb7da308c582 branch December 3, 2026 01:52
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 40.45 KB 40.45 KB 0.00 KB (0.00%)
basic.ts 6.66 KB 6.66 KB 0.00 KB (0.00%)
batching.ts 11.90 KB 11.90 KB 0.00 KB (0.00%)
brand.ts 6.91 KB 6.91 KB 0.00 KB (0.00%)
cache.ts 12.16 KB 12.16 KB 0.00 KB (0.00%)
config.ts 23.89 KB 23.89 KB 0.00 KB (0.00%)
differ.ts 22.75 KB 22.75 KB 0.00 KB (0.00%)
http-client.ts 28.90 KB 28.90 KB 0.00 KB (0.00%)
http-router.ts 39.57 KB 39.57 KB 0.00 KB (0.00%)
logger.ts 12.34 KB 12.34 KB 0.00 KB (0.00%)
metric.ts 10.16 KB 10.16 KB 0.00 KB (0.00%)
optic.ts 7.14 KB 7.14 KB 0.00 KB (0.00%)
pubsub.ts 16.89 KB 16.89 KB 0.00 KB (0.00%)
queue.ts 13.71 KB 13.71 KB 0.00 KB (0.00%)
schedule.ts 12.46 KB 12.46 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.50 KB 14.50 KB 0.00 KB (0.00%)
schema-binary.ts 43.50 KB 43.45 KB +0.05 KB (+0.12%)
schema-class.ts 22.50 KB 22.50 KB 0.00 KB (0.00%)
schema-codegen.ts 33.86 KB 33.86 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 30.95 KB 30.95 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.69 KB 28.69 KB 0.00 KB (0.00%)
schema-string-transformation.ts 16.26 KB 16.26 KB 0.00 KB (0.00%)
schema-string.ts 12.78 KB 12.78 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.86 KB 16.86 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 40.00 KB 40.00 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.64 KB 21.64 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.81 KB 21.81 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.90 KB 21.90 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.94 KB 26.94 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.96 KB 21.96 KB 0.00 KB (0.00%)
schema.ts 21.61 KB 21.61 KB 0.00 KB (0.00%)
stm.ts 14.96 KB 14.96 KB 0.00 KB (0.00%)
stream.ts 10.70 KB 10.70 KB 0.00 KB (0.00%)
supervisor.ts 12.13 KB 12.13 KB 0.00 KB (0.00%)

UI Bundle Size

Vite 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).

App Chunks Raw bytes Gzip bytes Added gzip B Δ raw bytes Δ gzip bytes
counter 1 175640 60597 33189 0 0
features 1 185292 64062 36654 0 0
menu 1 290090 98782 71374 0 0

@kachkaev

kachkaev commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Written by Claude Opus 5.5 on behalf of @kachkaev.

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 string also drops the five known names from the type and their descriptions from the docs. #2568 opened Model by keeping the literals and adding a string branch ("claude-…" | (string & {}) in the type), which keeps editor completion and the per-category descriptions while still accepting new values. That took generator work there, so plain string is a reasonable trade-off for a field that is only informational. If the generator now handles open enums generally, the same shape might fit here too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ai-anthropic: a refusal category the generated schema doesn't list fails the turn

3 participants