VS Code extension repeatedly switches model away from configured default, ignoring settings.json and ANTHROPIC_MODEL

Status Open
Reported on v2.1.286
Maintainer reply None cached
Activity 1 comment · opened Oct 1, 2026

Environment

  • Extension: anthropic.claude-code 2.1.286 (darwin-arm64)
  • VS Code: 1.140.0
  • macOS: 26.6
  • Plan: Claude Enterprise, org default model is claude-sonnet-5-5 with override_user_selection: false

What I expected

A new chat, or a running session, stays on the model set in ~/.claude/settings.json ("model": "claude-sonnet-5"), unless I explicitly change it.

What happens instead

Confirmed trigger: quitting and relaunching VS Code resets the model to Opus, overriding both settings.json and a prior explicit /model choice. Steps:

  1. Set the model to Sonnet, either via "model": "claude-sonnet-5" in ~/.claude/settings.json, or by running /model claude-sonnet-5 in an active session.
  2. Fully quit VS Code (not just close the window).
  3. Relaunch VS Code and open a new Claude Code chat.
  4. The new chat comes up on Opus, first briefly as Opus 4.7, then settling on Opus 5.5, regardless of what was set in step 1.

This produced six unprompted model switches across one working day, between three different model names:

05:58  claude-opus-5-5
06:20  claude-sonnet-5
08:33  claude-sonnet-5-5
08:58  claude-opus-5-5
10:34  claude-sonnet-5
10:39  claude-opus-5-5

At the time of the 10:39 switch to Opus:

  • ~/.claude/settings.json had "model": "claude-sonnet-5" (confirmed on disk)
  • the process the extension launched had ANTHROPIC_MODEL=claude-sonnet-5 in its environment (confirmed via ps)
  • the org's own model default was claude-sonnet-5-5, explicitly configured with override_user_selection: false

Running /model claude-sonnet-5 fixes the current session, but does not survive the next VS Code restart.

What I've ruled out

  • ANTHROPIC_MODEL in .zshrc: confirmed present in the launched process's environment, no effect.
  • claudeCode.environmentVariables in VS Code settings: same underlying mechanism as above, so not expected to help either; the switching happens mid-session, after launch, not at launch.
  • Per-project override in ~/.claude.json: none present for this project.
  • Org-level forced default: explicitly not set to override user selection.

Impact

Each unplanned switch to a larger model (Opus) on a long-running session carries real cost, since a resumed session re-sends its accumulated context. This is part of a larger token-usage investigation; happy to share more data if useful.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗