Repository navigation
Commit 7d9e192
fix(anthropic): classify capitalized/dotted Claude ids as adaptive thinking (lidge-jun#2483)
* fix(anthropic): classify capitalized/dotted Claude ids as adaptive thinking
claudeFamilyVersion only matched lowercase `claude-\<family>-\<major>-\<minor>`
ids. Vendor ids such as `Claude-Opus-4.8-joybuilder` failed both the
case-sensitive prefix match and the dotted minor parse (4.8 -> minor 0),
so usesAdaptiveThinking() returned false and the adapter sent the legacy
`thinking: {type: "enabled", budget_tokens}` wire shape to models that
reject it (Bedrock 400: "thinking.type.enabled is not supported for this
model. Use thinking.type.adaptive and output_config.effort").
Make the parser case-insensitive, accept `.` as a minor separator, and
lowercase the captured family before table lookup. Date-pinned ids
(claude-opus-4-20250514) and legacy families (opus <= 4.6) keep their
previous classification.
* test(anthropic): cover capitalized/dotted Claude ids in thinking wire-shape matrix
Regression for the family parser fix: Claude-Opus-4.8-joybuilder and
claude-opus-4.8-joybuilder must pick the adaptive wire shape, while
Claude-Opus-4.6-joybuilder (below the adaptive threshold) must stay on
the legacy thinking.enabled shape.
* fix(anthropic): reject a longer number, not any dot, in the family tail
The capitalization and dotted-minor repair is right, but widening the
tail from (?!\d) to (?![\d.]) to stop "claude-opus-4.20250514" also
rejected "claude-opus-4-8.1": the minor group matches "8", the tail sees
the following dot, the match is discarded, and the regex backtracks to a
major-only "4.0". That id parsed as Opus 4.8 before this PR, so it would
newly take the legacy thinking.enabled wire shape — the exact 400 this
change exists to prevent, reintroduced for a different id family.
A dotted suffix after a dashed minor is not a dotted minor. The tail's
job is to reject a longer NUMBER, which the original (?!\d) already did;
the dotted-minor support belongs entirely to the [.-] separator. Keeping
(?!\d) and adding only [.-] and /i covers every id the PR intended,
preserves every id the old regex classified correctly, and additionally
recovers "claude-opus-4.20250514" and "claude-opus-4.8.1", which the
wider tail turned into no match at all.
Tests: the adaptive matrix gains the dashed-capitalized and end-of-string
dotted cells so the capitalization and separator axes are covered
independently, plus "claude-opus-4-8.1" as the regression for the above.
The legacy matrix gains a capitalized date-pinned id, which previously
reached that branch by failing to parse rather than by parsing correctly.
The lidge-jun#545 explicit-disable matrix gains "Claude-Sonnet-5" — the only case
that exercises claudeFamilyVersion's second caller, where a miss is
invisible because the request simply goes out without the disable.
Verified red-then-green: with the original tail restored, only the
claude-opus-4-8.1 case fails (59 pass, 1 fail); with this correction,
60 pass, 0 fail. tsc --noEmit clean.
---------
Co-authored-by: liyongjie.103 <[email protected]>
Co-authored-by: bitkyc08-arch <[email protected]>1 parent 27efbba commit 7d9e192
2 files changed
Lines changed: 36 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
472 | | - | |
| 472 | + | |
473 | 473 | | |
474 | 474 | | |
475 | | - | |
| 475 | + | |
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
60 | 77 | | |
61 | 78 | | |
62 | 79 | | |
| |||
275 | 292 | | |
276 | 293 | | |
277 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
278 | 304 | | |
279 | 305 | | |
280 | 306 | | |
| |||
319 | 345 | | |
320 | 346 | | |
321 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
322 | 356 | | |
323 | 357 | | |
324 | 358 | | |
| |||
0 commit comments