Skip to content

fix: show all chat models and handle auto-resolved model not in cache#1577

Draft
jellydn with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-models-list-error
Draft

fix: show all chat models and handle auto-resolved model not in cache#1577
jellydn with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-models-list-error

Conversation

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown

On accounts where the Copilot API returns model_picker_enabled: false for all models, the picker showed only "Auto (Copilot)", and selecting it crashed with Resolved model not found: <model-id>.

Changes

lua/CopilotChat/config/providers.luaget_models

Previously filtered strictly to model_picker_enabled = true. Now uses a two-pass approach: prefer picker-enabled models, but fall back to all chat models when none are picker-enabled. This ensures real models appear in the picker for restricted accounts.

-- Before: empty list when model_picker_enabled is false for all models
:filter(function(model)
  return model.capabilities.type == 'chat' and model.model_picker_enabled
end)

-- After: fall back to all chat models
local all_chat_data = vim.tbl_filter(function(m) return m.capabilities and m.capabilities.type == 'chat' end, data)
local picker_data   = vim.tbl_filter(function(m) return m.model_picker_enabled end, all_chat_data)
vim.iter(#picker_data > 0 and picker_data or all_chat_data):map(...)

lua/CopilotChat/client.luaClient:ask

When resolve_model returns a model id not present in the cache (because it was filtered out), previously errored hard. Now falls back to the originating model's config (e.g. the auto entry) so the request proceeds with the correct model id set in options.model.id.

-- Before: hard error
model_config = models[opts.model]
if not model_config then error('Resolved model not found: ' .. opts.model) end

-- After: graceful fallback to original config
model_config = models[opts.model] or model_config

pre-commit-ci Bot and others added 2 commits July 2, 2026 03:02
…d accounts

- client.lua: when resolve_model returns a model not in the cache (e.g.
  because model_picker_enabled is false for all models on a restricted
  account), fall back to the original model config so the request can
  still proceed with the correct model id.
- providers.lua: when no models have model_picker_enabled=true, fall back
  to all chat models so the picker shows useful options instead of only
  showing Auto (Copilot).

Fixes: Resolved model not found error when using Auto model on accounts
where model_picker_enabled is false for all API models.
Copilot AI changed the title [WIP] Fix models list to display all available options fix: show all chat models and handle auto-resolved model not in cache Jul 2, 2026
Copilot AI requested a review from jellydn July 2, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Models list shows only "Auto (Copilot)", selecting it throws "Resolved model not found" error

2 participants