fix: hide and reject chat models from disabled AI providers - #27070
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00f216757a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec46e50453
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96aacc468f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29ef7f6c4c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66528f0c45
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 495c32dfab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7517ac6a1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Disabling an AI provider left its enabled model configs selectable in the frontend and accepted by the API, producing an unclear runtime failure. Model selectors now filter by provider row (instance) state, and the create-chat, send-message, edit-message, subagent/advisor override endpoints reject model configs whose provider is disabled with a clear 400. - codersdk: expose provider enabled state on UserChatProviderConfig - site: skip disabled-provider configs in model option builders, the subagent/advisor override selectors, and the model form provider select (create flow only); invalidate chat queries on AI provider mutations - coderd: validate explicit model_config_id at admission using the existing availability check; advisor override PUT now requires an enabled config + provider - admin model-config list keeps returning provider-disabled configs so the ModelsPage management view can show them Fixes coder/internal#CODAGT-601
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 562ef458cd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Extract validateExplicitChatModelConfigAvailable for the send/edit admission checks, route getModelOptionsFromConfigs through filterConfigsWithEnabledProvider, pass precomputed enabledModelConfigs to AdvisorSettings instead of refiltering, and parallelize provider mutation query invalidations. No behavior changes.
… info The user provider key configs endpoint omits disabled providers unless the user has a key for them, so a missing provider row means the provider is disabled or deleted. Treating missing rows as enabled let admins select models under a disabled provider whenever another enabled provider of the same type kept the catalog type available.
The Coder Agents settings page filters model configs by provider enablement, but only reported the model config query's loading and error state. While the provider query was still loading or after it failed, the filter saw an empty provider map and hid every model, which made saved subagent and advisor overrides look unavailable and could let AdvisorSettings clear a valid override on save. Combine both queries' loading, fetching, and error state so the sections stay in their loading or error UI until provider data is ready.
The add-model page derives its provider selection from the ?provider= query param, and canManageProviderModels did not check provider enablement, so a disabled provider stayed selectable and the form could submit a create request the backend rejects. Treat disabled providers as unmanageable, keep the selected disabled provider visible only in edit mode, and explain the disabled state in the add-page fallback.
When a chat omitted model_config_id, admission reused the chat's last model via a lookup that only excluded deleted configs, so chats whose model or provider was disabled kept sending requests through the disabled provider. Resolve the fallback through the enabled-config lookup: a disabled last model now falls back to the default, and a disabled default is rejected with ErrNoDefaultChatModelConfig instead of being admitted and failing at generation time.
Creating a chat without model_config_id resolved the default model without checking that it and its provider are enabled, so disabling the default model's provider let POST /chats create a running chat that only failed later at generation time. Validate the resolved default through the enabled-config lookup and reject the request with a 400 at admission, matching the send-message fallback behavior.
Sending a message without an explicit model can now fail with ErrNoDefaultChatModelConfig when the chat's last model and the default are both unavailable. The send handler did not map that error, so users got a generic 500 instead of the admission error chat creation returns for the same state.
Editing a message without model_config_id preserved the edited message's original model without checking that it is still usable, so edits kept routing through disabled models or providers and failed at generation time. Resolve the preserved model through the send-message fallback (disabled model falls back to the default, disabled default is rejected) and map the rejection to a 400 in the edit handler.
562ef45 to
7611114
Compare
Documentation CheckUpdates Needed
Automated review via Coder Agents |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b70bd3705c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Disabling an AI provider did not remove its models from the chat model selector, the subagent override selectors, or the advisor settings, and the API still accepted requests that resolved to a model under a disabled provider. Sending a message with such a model only failed later in generation with
chat failed unexpectedly.The frontend now filters model options down to configs whose provider row is enabled and present (chat picker, subagent overrides, advisor settings), folds provider-query loading and error state into the Coder Agents settings sections, blocks disabled providers on the add-model path, and invalidates chat model queries when providers change. The models management view intentionally keeps listing configs of disabled providers.
The backend rejects unusable models with a 400 at admission on every path instead of failing at generation time:
model_config_idat chat create, send message, edit message, and the subagent/advisor override endpointsCloses https://linear.app/codercom/issue/CODAGT-601/disabled-providers-still-expose-selectable-models