fix(aliases): stop rewriting canonical claude-opus-4-6-thinking
The claude-thinking-legacy-alias pattern previously matched both claude-opus-4-6-thinking and claude-opus-4-7-thinking and mapped them to claude-opus-4-7. After models.dev started shipping claude-opus-4-6-thinking as a real canonical model (e.g. 302ai/claude-opus-4-6-thinking), the pattern collides with the snapshot and trips the pattern-alias-collides-with-snapshot guardrail in collectModelCapabilityGuardrailIssues, which is what has been failing the refresh-model-capabilities cron since 2026-04-20. Tightening the regex to only match claude-opus-4-7-thinking preserves the legacy-id rewrite for the still-non-canonical 4-7-thinking form while letting 4-6-thinking resolve to itself. Refs #3635
This commit is contained in:
@@ -107,4 +107,14 @@ describe("model-capability-aliases", () => {
|
||||
ruleID: "claude-thinking-legacy-alias",
|
||||
})
|
||||
})
|
||||
|
||||
test("treats claude-opus-4-6-thinking as canonical, not as a legacy alias", () => {
|
||||
const result = resolveModelIDAlias("claude-opus-4-6-thinking")
|
||||
|
||||
expect(result).toEqual({
|
||||
requestedModelID: "claude-opus-4-6-thinking",
|
||||
canonicalModelID: "claude-opus-4-6-thinking",
|
||||
source: "canonical",
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -41,8 +41,8 @@ const EXACT_ALIAS_RULES_BY_MODEL: ReadonlyMap<string, ExactAliasRule> = new Map(
|
||||
const PATTERN_ALIAS_RULES: ReadonlyArray<PatternAliasRule> = [
|
||||
{
|
||||
ruleID: "claude-thinking-legacy-alias",
|
||||
description: "Normalizes legacy Claude Opus thinking suffixes (4-6, 4-7) to the canonical snapshot ID.",
|
||||
match: (normalizedModelID) => /^claude-opus-4-(?:6|7)-thinking$/.test(normalizedModelID),
|
||||
description: "Normalizes the legacy claude-opus-4-7-thinking id to the canonical snapshot ID.",
|
||||
match: (normalizedModelID) => /^claude-opus-4-7-thinking$/.test(normalizedModelID),
|
||||
canonicalize: () => "claude-opus-4-7",
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user