Description
If you have used a model from one provider and later change your config to declare only a different provider, opencode keeps starting sessions on the old model. I hit this moving from Anthropic to a local OpenAI-compatible endpoint: my config lists only the local provider, but new sessions still came up on claude-sonnet-4-5.
In defaultModel (packages/opencode/src/provider/provider.ts) the recently-used list is walked before Object.keys(cfg.provider) is computed, and the loop never consults it. The configured-provider allowlist only gates the fallback path below the loop, so anything in the recent list wins regardless of what the config says.
OpenCode version
1.18.7 (reproduced on dev @ 55b0211)
Steps to reproduce
- Use a model from provider A at least once so it lands in the recent-models list (
model.json in opencode's state dir).
- Change your config so
provider contains only provider B.
- Start a new session without
-m.
Expected: a model from provider B. Actual: the provider A model from step 1.
Operating System
macOS 26.5.2
Description
If you have used a model from one provider and later change your config to declare only a different provider, opencode keeps starting sessions on the old model. I hit this moving from Anthropic to a local OpenAI-compatible endpoint: my config lists only the local provider, but new sessions still came up on
claude-sonnet-4-5.In
defaultModel(packages/opencode/src/provider/provider.ts) the recently-used list is walked beforeObject.keys(cfg.provider)is computed, and the loop never consults it. The configured-provider allowlist only gates the fallback path below the loop, so anything in the recent list wins regardless of what the config says.OpenCode version
1.18.7 (reproduced on
dev@ 55b0211)Steps to reproduce
model.jsonin opencode's state dir).providercontains only provider B.-m.Expected: a model from provider B. Actual: the provider A model from step 1.
Operating System
macOS 26.5.2