From 5478bab4578440977235b641cb9a57362600e49f Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Fri, 17 Apr 2026 15:35:11 +0900 Subject: [PATCH] refactor(models): preserve legacy claude-opus-4-6 aliases and category mapping Addresses review feedback on #3486: 1. claude-thinking-legacy-alias now matches both claude-opus-4-6-thinking and claude-opus-4-7-thinking, canonicalizing both to claude-opus-4-7. The previous diff retargeted the regex to 4-7 only, which dropped backward compatibility for users still pinned to the 4-6 thinking suffix. 2. MODEL_TO_CATEGORY_MAP keeps the claude-opus-4-6 to unspecified-high entry alongside the new 4-7 entry. The map is order-independent from MODEL_VERSION_MAP, so preserving the 4-6 key avoids relying on a specific migration ordering for legacy agent configs. 3. Fix stale 'Claude Opus 4.6' labels and BDD test comments that the sed-based bump missed. --- src/hooks/think-mode/switcher.test.ts | 2 +- src/shared/connected-providers-cache.test.ts | 4 ++-- src/shared/migration/agent-category.ts | 1 + src/shared/model-capability-aliases.ts | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/hooks/think-mode/switcher.test.ts b/src/hooks/think-mode/switcher.test.ts index 94b5f115c..b462e76ff 100644 --- a/src/hooks/think-mode/switcher.test.ts +++ b/src/hooks/think-mode/switcher.test.ts @@ -38,7 +38,7 @@ describe("think-mode switcher", () => { }) it("should handle claude-opus-4-7 high variant", () => { - // given a Claude Opus 4.6 model ID + // given a Claude Opus 4.7 model ID const variant = getHighVariant("claude-opus-4-7") // then should return high variant diff --git a/src/shared/connected-providers-cache.test.ts b/src/shared/connected-providers-cache.test.ts index 7d3a7d780..36abdac26 100644 --- a/src/shared/connected-providers-cache.test.ts +++ b/src/shared/connected-providers-cache.test.ts @@ -61,7 +61,7 @@ describe("updateConnectedProvidersCache", () => { name: "Anthropic", env: [], models: { - "claude-opus-4-7": { id: "claude-opus-4-7", name: "Claude Opus 4.6" }, + "claude-opus-4-7": { id: "claude-opus-4-7", name: "Claude Opus 4.7" }, "claude-sonnet-4-6": { id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6" }, }, }, @@ -84,7 +84,7 @@ describe("updateConnectedProvidersCache", () => { { id: "gpt-5.4", name: "GPT-5.4" }, ], anthropic: [ - { id: "claude-opus-4-7", name: "Claude Opus 4.6" }, + { id: "claude-opus-4-7", name: "Claude Opus 4.7" }, { id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6" }, ], }) diff --git a/src/shared/migration/agent-category.ts b/src/shared/migration/agent-category.ts index 9960cfca4..f3ddf291a 100644 --- a/src/shared/migration/agent-category.ts +++ b/src/shared/migration/agent-category.ts @@ -16,6 +16,7 @@ export const MODEL_TO_CATEGORY_MAP: Record = { "google/gemini-3-flash": "writing", "openai/gpt-5.4": "ultrabrain", "anthropic/claude-haiku-4-5": "quick", + "anthropic/claude-opus-4-6": "unspecified-high", "anthropic/claude-opus-4-7": "unspecified-high", "anthropic/claude-sonnet-4-6": "unspecified-low", } diff --git a/src/shared/model-capability-aliases.ts b/src/shared/model-capability-aliases.ts index 01c7a23ba..fe7ef6b3b 100644 --- a/src/shared/model-capability-aliases.ts +++ b/src/shared/model-capability-aliases.ts @@ -41,8 +41,8 @@ const EXACT_ALIAS_RULES_BY_MODEL: ReadonlyMap = new Map( const PATTERN_ALIAS_RULES: ReadonlyArray = [ { ruleID: "claude-thinking-legacy-alias", - description: "Normalizes the legacy Claude Opus 4.6 thinking suffix to the canonical snapshot ID.", - match: (normalizedModelID) => /^claude-opus-4-7-thinking$/.test(normalizedModelID), + 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), canonicalize: () => "claude-opus-4-7", }, {