Repository navigation
Description
Does this issue occur when all extensions are disabled?: Yes (the bug is in the server-side agent host, src/vs/platform/agentHost/node/claude/claudeModelId.ts; no extension is involved)
- VS Code Version: 1.137.0-insider, commit de8cc55 (2026-09-04), agent host reached via
code-insiders agent host --tunnel - OS Version: agent host on Ubuntu 24.04.4 LTS x64; client via insiders.vscode.dev
- Claude Agent SDK bundled by the agent host: 0.3.258 (Claude Code CLI 2.1.258)
Summary
When the Claude Code CLI on the machine is configured with a model that has a minor version and the [1m] context suffix (e.g. "model": "claude-fable-5-1[1m]" in ~/.claude/settings.json), the native (BYO-Anthropic) "Fable" row in the Claude harness model picker silently runs on Claude Fable 5 instead of Claude Fable 5.1. The same happens for claude-opus-4-8[1m] → claude-opus-4.
The cause is toSdkModelId() / tryParseClaudeModelId() in claudeModelId.ts. The ids in the native list come from Query.supportedModels() and are already SDK-format (the code comment in fromSdkModelInfo says "toSdkModelId is identity at this seam"), but the parser does not know the [1m] suffix form that Claude Code uses, so it is not an identity:
- Pattern 1 (
^claude-(\w+)-(\d+)-(\d+)(?:-(.+))?$) fails onclaude-fable-5-1[1m]because[1m]follows the minor version without a dash. - Pattern 4 (
^claude-(\w+)-(\d+)(?:-(.+))?$) then matches withmajor=5andmod="1[1m]". The minor version is swallowed into the modifier,extractValidSuffix('fable', '1[1m]')returns'', and the result isclaude-fable-5.
Ids without a minor version (claude-opus-5[1m], claude-sonnet-5[1m]) fall through all patterns and pass through unchanged, so those work by accident.
Steps to Reproduce
- On a Linux machine, set
"model": "claude-fable-5-1[1m]"in~/.claude/settings.jsonand provide a Claude subscription token (CLAUDE_CODE_OAUTH_TOKEN) so the native Anthropic transport is set up. - Run
code-insiders agent host --tunnel, open the Agents view, start a Claude harness session and select the "Fable" row under the native Anthropic models (not the Copilot-billed "Claude Fable 5.1"). - Ask "What model are you?".
Expected: the session runs on claude-fable-5-1.
Actual: the session runs on claude-fable-5. The Claude Code transcript (~/.claude/projects/<cwd>/<session>.jsonl) shows every assistant message with "model":"claude-fable-5", and the model replies that it is Fable 5. The AHP log confirms the picker sent "model":{"id":"@provider=anthropic:claude-fable-5-1%5B1m%5D"} and the session snapshot recorded "model":"claude-fable-5".
Running the bundled CLI directly with the same id works, which isolates the agent host:
$ .../claude-agent-sdk-linux-x64/claude -p --model 'claude-fable-5-1[1m]' --output-format json 'hi'
# modelUsage keys: claude-fable-5-1
Minimal repro of the parser (evaluated against the shipped agentHostMain.js normalizer)
claude-fable-5-1[1m] => claude-fable-5 (wrong; expected claude-fable-5-1 or unchanged)
claude-fable-5-1 => claude-fable-5-1
claude-opus-4-8[1m] => claude-opus-4 (wrong)
claude-opus-5[1m] => claude-opus-5[1m] (passes through)
claude-sonnet-5[1m] => claude-sonnet-5[1m] (passes through)
Suggested fix
Treat a trailing [...] as a modifier before pattern matching (Claude Code's own model-id regex accepts (?:\[[12]m\])?$), or skip toSdkModelId entirely for ids that came from supportedModels() on the native transport, since they are already SDK-canonical. A test case for claude-fable-5-1[1m] in claudeModelId.test.ts would catch this; the existing 1m tests only cover the -1m dash form.
Workaround: remove [1m] from the configured model (Fable 5.1 has a native 1M window, so nothing is lost there), then restart the agent host.
Possibly related: #334017 reports "Fable one is 5" in the Claude harness without a cause.
Activity
Eric-SHENNONGSHI commentedon Sep 29, 2026
Confirming on stable, with one addition to the repro: no
modelneeds to be set in~/.claude/settings.json.CLAUDE_CODE_OAUTH_TOKEN.claude-fable-5-1[1m]. I got the same value fromsupportedModels()withsettingSources: [], which is how the refresh query inagentHostMain.jsruns. So a stock configuration hits this once the bundled CLI is new enough to list Fable 5.1.agent-host-claude:@provider=anthropic:claude-fable-5-1%5B1m%5D, but every new session's transcript shows"model":"claude-fable-5". Re-selecting the model or switching away and back changes nothing.claude -p --model 'claude-fable-5-1[1m]'reportsclaude-fable-5-1.Workaround without editing VS Code (fragile, and it hardcodes the target id): the model is passed as a
--modellaunch argument, so a wrapper script at the cachedclaudepath can rewrite it.(
claude.realhere is a newer Claude Code binary copied over the bundled one.) ThemodelOverridesuser setting does not remap it; I tried{"claude-fable-5": "claude-fable-5-1"}and the CLI still reportedclaude-fable-5.— Claude (posted on Eric's behalf via Claude Code)