Repository navigation
Conversation
`toSdkModelId('claude-fable-5-1[1m]')` returned `claude-fable-5`: the
bracketed context tag blocked the major-minor pattern, so the major-only
pattern swallowed `1[1m]` as a modifier and dropped it. The native Fable
row ran Fable 5 instead of 5.1, and `claude-opus-5-5[1m]` became
`claude-opus-5`.
Split a trailing `[1m]`/`[2m]` tag off before pattern matching. Keep it in
the SDK id, where the CLI uses it to enable the 1M context beta, and drop
it from the endpoint id, since the CLI strips it before calling the
Messages API. Restrict modifiers to dash-separated alphanumerics so
malformed ids pass through unchanged instead of being truncated.
Fixes microsoft#334750
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: TylerLeonhardtMatched files:
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused parser change resolves the truncation while preserving existing endpoint normalization behavior.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes Claude model normalization for bracketed context suffixes without truncating minor versions.
Changes:
- Separates
[1m]/[2m]suffixes before parsing. - Preserves context tags for SDK IDs while removing them from endpoint IDs.
- Adds regression and malformed-input tests.
| File | Description |
|---|---|
src/vs/platform/agentHost/node/claude/claudeModelId.ts |
Updates model-ID parsing and formatting. |
src/vs/platform/agentHost/test/node/claudeModelId.test.ts |
Covers context suffixes and invalid forms. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #334750
Problem
When the Claude CLI is configured with a model id that has both a minor version and Claude Code's
[1m]context tag,toSdkModelIdtruncated the minor version. This affects both current flagship models: Fable 5.1 (claude-fable-5-1[1m], the id from the issue) becameclaude-fable-5, and Opus 5.5 (claude-opus-5-5, whose[1m]form follows the same shape) becameclaude-opus-5. Sonnet 5.5 and Haiku 5.5 would hit the same path once released.claude-fable-5-1[1m]claude-fable-5claude-fable-5-1[1m]claude-opus-5-5[1m]claude-opus-5claude-opus-5-5[1m]claude-opus-4-8[1m]claude-opus-4claude-opus-4-8[1m]The
[1m]directly after the minor version stopped Pattern 1 (name-major-minor) from matching, so Pattern 4 (name-major[-mod]) matched instead, took1[1m](or5[1m]) as a modifier, and dropped it. As a result, the native Anthropic "Fable" row ran Fable 5 instead of Fable 5.1, and an Opus 5.5 selection ran Opus 5.Fix
[1m]/[2m]tag off before the version patterns run. The pattern matches the Claude Code CLI's own model-id regex ((?:\[[12]m\])?$), where the tag always comes after any date suffix.[1m]in the model id to enable thecontext-1m-2025-08-07beta, so removing it would silently lose the 1M context window. Native ids fromsupportedModels()now round-trip unchanged.modelwhen building Messages API requests and sends the beta header instead, so the Copilot proxy never receives the bracket form. Dropping it intoEndpointModelIdmatches what reaches CAPI.opus[1m]andfable[1m](returned bysupportedModels()) still pass throughtoSdkModelIdunchanged rather than losing the tag.[1m][1m],[foo],[1m]-<date>) and Vertex-styleclaude-opus-4-1@20250805now pass through unchanged instead of being cut down to the major version. The CLI doesn't produce these forms, so this is defence in depth.Validation
claudeModelId.test.ts: added a snapshot test covering the ids from the issue plus Opus/Sonnet/Haiku 5.5, and a test that malformed or non-Claude bracketed ids returnundefined. Addedclaude-fable-5-1[1m]to the existingtoSdkModelIdpass-through test.npm run test-node -- --run src/vs/platform/agentHost/test/node/<suite>.test.ts:claudeModelId: 43 passingclaudeModelSelection: 13 passingclaudeProxyService: 46 passingclaudeAgent: 296 passingclaude-fable-5-1(wasclaude-fable-5before this change)claude-opus-5-5[1m]→claude-opus-5-5.