Add support for AI models accessible only by GitLab team members

What does this MR do and why?

This MR enables GitLab team members to access development AI models that are not exposed to external users.

Currently, all AI models configured for a group are visible to all users within that group. This prevents GitLab team members from experimenting with new or unstable models without making them available to customers.

This MR introduces team-member-only model access by:

  • Adding developer-only group_ids and selectable_models to model definitions
  • Implementing conditional model merging based on GitLab team membership
  • Allowing team members in specified groups to access development models while keeping the standard model set for regular users

References

Screenshots or screen recordings

Before After
Screenshot_2025-10-29_at_16.05.02 Screenshot_2025-10-29_at_16.06.51

How to set up and validate locally

The following steps require a working GitLab Development Kit (GDK) that you can access locally.

  1. Set up AI Gateway in your GDK. Make sure to have this in your env.runit file:

    export FETCH_MODEL_SELECTION_DATA_FROM_LOCAL=1
  2. Modify any feature in <gdk_dir>/gitlab-ai-gateway/ai_gateway/model_selection/unit_primitives.yml to allow certain models for team members only. For example:

    • Change duo_chat:

      - feature_setting: "duo_chat"
        unit_primitives:
          - "ask_build"
          - "ask_commit"
        default_model: "claude_sonnet_4_20250514_vertex"
        selectable_models:
          - "claude_sonnet_3_7_20250219"
          - "claude_sonnet_3_7_20250219_vertex"
          - "claude_sonnet_4_20250514"
          - "claude_sonnet_4_20250514_vertex"
        dev: # <------ new models available only for team members
          selectable_models:
            - "claude_sonnet_4_5_20250929"
            - "claude_haiku_4_5_20251001"
          group_ids: # <------ group IDs where these models are accessible by team members
            - 1000000
    • Change 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"
          - "claude_sonnet_4_5_20250929_vertex"
        dev: # <------ new models available only for team members
          selectable_models:
            - "claude_haiku_4_5_20251001"
            - "gpt_5"
            - "gpt_5_codex"
            - "gpt_5_mini"
          group_ids: # <------ group IDs where these models are accessible by team members
            - 1000000
  3. Go to GitLab repository and checkout to this MR branch:

    cd <gdk_dir>/gitlab
    git checkout add-support-for-ai-models-accessible-only-by-gitlab-team-members
  4. Open <gdk_dir>/gitlab/ee/lib/gitlab/graphql/representation/model_selection/feature_settings.rb and change L72 as follows:

    def use_dev_overrides? #L71
      return false unless true # current_user&.gitlab_team_member? 

    Note: This step is necessary because the root user is not a GitLab team member.

  5. Restart your GDK and go to the Model Selection area of the GitLab Duo group (group ID=1000000): http://gdk.test:3000/groups/gitlab-duo/-/settings/gitlab_duo/model_selection. Then click on Configure AI Features.

  6. If this MR works correctly, the GitLab Duo Chat > General Chat should display the following models:

    Screenshot 2025-10-29 at 16.46.20.png

    Similarly, GitLab Duo Agent Platform and the Duo Agent Chat in the right panel should look as follows:

    Screenshot 2025-10-30 at 17.10.17.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.

Edited by Fabrizio J. Piva

Merge request reports

Loading