Fix agentic chat model picker showing SaaS models on self-hosted gateway

What does this MR do and why?

On cloud-connected self-managed instances with a self-hosted AI Gateway, the VS Code Agentic Chat model picker showed the full SaaS model catalog instead of being hidden. This was misleading for customers with compliance requirements who need to demonstrate they're not using SaaS models.

Root cause: AvailableModelsResolver was populating selectableModels from the SaaS model catalog regardless of whether user model selection was available. When Ai::FeatureSetting (self-hosted path) is returned, user_model_selection_available? is hardcoded false — this already prevented pinnedModel from being set, but selectableModels was still populated. The LSP interprets { selectableModels: [full list], pinnedModel: null } as list of models available and renders the dropdown.

Fix: Extracts selectable_models_data as a private method (consistent with pinned_model_data) that gates on user_model_selection_available?. Returns [] when false, so the LSP's hasChatAvailableModels check (Boolean(selectableModels.length)) is false and the dropdown is not rendered.

References

Fixes #598659 (closed).

Screenshots or screen recordings

SM with self-hosted AIGW pure SM and SaaS
Screenshot_2026-05-12_at_3.51.37_PM Screenshot_2026-05-12_at_3.53.10_PM

How to set up and validate locally

Prerequisites:

  • Have the GitLab Duo Workflow extension setup in your VSCode and authenticated to your GDK instance.

Steps:

  • Start GDK on SM mode: GITLAB_SIMULATE_SAAS=0 gdk start
  • Select a self-hosted model for agentic chat feature setting in /admin/gitlab_duo/model_selection.
  • In your VSCode, open up the DAP panel. Observe model selection button is not rendered.
  • To test out pure SM instance:
    • Remove self-hosted AIGW URL in /admin/gitlab_duo/configuration
    • Select a GitLab managed model for agentic chat feature setting in /admin/gitlab_duo/model_selection
    • Restart VSCode extension. Open DAP panel and observe model selection button is rendered and shows list of available models.
  • To test out SaaS:
    • Start GDK on SaaS mode: GITLAB_SIMULATE_SAAS=1 gdk start
    • Restart VSCode extension. Open DAP panel and observe model selection button is rendered and shows list of available models.

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.

Edited by Cindy Halim

Merge request reports

Loading