Skip to content

Fix Code Review AI features policies to check duo features enabled toggle

What does this MR do and why?

For self-managed, we should be respecting the instance-level setting that determines whether Duo features are enabled or not. If Duo features are disabled, Duo for CLI shouldn't work as well.

We should also be respecting the instance, group, or project setting that determines whether Duo features are enabled or not. If Duo features are disabled, generate commit message feature should not work.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Make sure your GDK is set up to test AI features: https://docs.gitlab.com/ee/development/ai_features/index.html#instructions-for-setting-up-gitlab-duo-features-in-the-local-development-environment.

Duo for CLI

  1. Go to http://gdk.test:3000/admin/application_settings/general#js-ai-powered-settings.

  2. Uncheck Enable GitLab Duo features and save.

  3. Using CLI, run GITLAB_HOST=http://gdk.test:3000 glab duo ask list last 10 commit title. You should get a response including the message:

    400 Bad request - AI features are not enabled or resource is not permitted to be sent.

  4. Go back to http://gdk.test:3000/admin/application_settings/general#js-ai-powered-settings.

  5. Toggle Enable GitLab Duo features to enable it and save.

  6. Run the same CLI command and it should work.

Generate Commit Message

  1. Go to http://gdk.test:3000/admin/application_settings/general#js-ai-powered-settings.
  2. Uncheck Enable GitLab Duo features and check Enforce Duo features setting for all subgroups and save.
  3. Open a MR under a group that has Duo features enabled.
  4. Edit commit message and it shouldn't show the button to generate commit message.
  5. Go back to http://gdk.test:3000/admin/application_settings/general#js-ai-powered-settings.
  6. Toggle Enable GitLab Duo features to enabled it and save.
  7. Open a MR under a group that has Duo features enabled.
  8. Edit commit message and it should show the button to generate commit message.

Related to #481955

Merge request reports

Loading