Allow AgenticChatModelMetadataService to use developer selectable models

What does this MR do and why?

This merge request (MR) updates AgenticChatModelMetadataService to use FeatureSetting.decorate instead of ModelDefinitionResponseParser when validating user-selected models. This MR is needed because the current implementation does not take into account developer selectable models introduced in !210909 (merged) when checking if a model is valid.

References

Screenshots or screen recordings

Before After
Screenshot 2025-11-21 at 17.13.31.png Screenshot 2025-11-21 at 17.14.26.png

How to set up and validate locally

The following steps require a working GitLab Development Kit (GDK) available locally:

  1. Set up AI Gateway in your GDK. In addition, make sure to have this in your env.runit file:

    export FETCH_MODEL_SELECTION_DATA_FROM_LOCAL=1
  2. Configure AI Gateway to return some developer-only models:

    Edit <gdk_dir>/gitlab-ai-gateway/ai_gateway/model_selection/unit_primitives.yml and add developer models for duo_agent_platform:

    - feature_setting: "duo_agent_platform"
      unit_primitives:
        - "duo_agent_platform"
      default_model: "claude_sonnet_4_20250514_vertex"
      selectable_models:
        - "claude_sonnet_3_7_20250219"
        - "claude_sonnet_4_20250514"
        - "claude_sonnet_4_20250514_vertex"
      dev:
        selectable_models:
          - "claude_haiku_4_5_20251001"  # Dev-only model
          - "gpt_5_codex"                 # Dev-only model
        group_ids:
          - 1000000  # GitLab Duo group ID (or use your test group ID)
  3. Bypass the team member check:

    Edit ee/lib/gitlab/graphql/representation/model_selection/feature_setting.rb:

    def use_dev_overrides?
      return false unless Gitlab::Saas.feature_available?(:gitlab_com_subscriptions)
      return false unless true # current_user&.gitlab_team_member? # <-- Change this line
  4. Ensure you're on GitLab.com.

  5. Check that developer-only models are accessible for Agentic Chat:

    1. Go to GitLab Duo group (group ID: 1000000c): http://gdk.test:3000/gitlab-duo

    2. Open GitLab Duo Chat and enable Agentic mode.

    3. Verify developer-only models are accessible in the UI:

      If this MR works as intended, you should see the developer models you listed in unit_primitives.yml along with the regular models in the model selection dropdown menu:

      Screenshot 2025-11-21 at 17.19.10.png

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.

Related to #581701

Edited by Fabrizio J. Piva

Merge request reports

Loading