Fix: self-hosted feature setting missing model_definitions
What does this MR do and why?
model_definitions is a virtual attribute defined in FeaturesConfigurable, included by InstanceModelSelectionFeatureSetting and NamespaceFeatureSetting — but not by Ai::FeatureSetting, which is used for self-hosted model configurations.
The FeatureSetting decorator unconditionally called feature_setting.model_definitions as a fallback when no model_definitions were passed in. On SM instances with a self-hosted model configured and an offline cloud license, FetchModelDefinitionsService returns success(payload: nil), causing the decorator to reach the fallback and crash:
Error: GraphQL request "query: lsp_aiChatAvailableModels" failed with Internal server error:
undefined method `model_definitions' for an instance of Ai::FeatureSettingThis MR replaces the direct feature_setting.model_definitions call with feature_setting.try(:model_definitions), which safely returns nil when the method doesn't exist — preserving the fallback behaviour for NamespaceFeatureSetting and InstanceModelSelectionFeatureSetting while avoiding the crash for Ai::FeatureSetting.
References
[IDE] aiChatAvailableModels query from LS retur... (#596569 - closed)
Screenshots or screen recordings
| Self-hosted models | User-level model selection |
|---|---|
![]() |
![]() |
How to set up and validate locally
Prerequisites:
- Offline license with DAP self-hosted add-on and an online license, you can use the ones here.
- GitLab Workflow extension installed in your VSCode
- Setup GitLab authentication with your instance:
- Open the command palette (Cmd+Shift+P) > type in
GitLab: Authenticate Manually enter instance URL> Enter your instance URL- Select
Create a token - Ensure the account you just authenticated with is selected.
- Open the command palette (Cmd+Shift+P) > type in
Steps:
- Run GDK on SM mode:
GITLAB_SIMULATE_SAAS=0 gdk start - Clone a project and open in VSCode
- Open agentic chat
- Observe no error message returned
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

