Ban AI features based on project settings
What does this MR do and why?
On !144931 (merged) we introduced a cascading setting so users can mark on which projects and groups they want AI features disabled. Here, we introduce the logic that reads that setting and enables or disables AI features based on its value
Closes #441486 (closed)
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.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
duo_features_enabled=false
Generate issue description on project with
duo_features_enabled=false
Summarize notes on an Issue whose project has
Ideally, the button wouldn't be visible to begin with
duo_features_enabled=false
Use Chat on an Issue whose project has Screen_Recording_2024-02-20_at_13.06.54
Note that the UX here isn't great at present, with the error message replacing the user prompt, and the Chat window hanging on "working on an answer..." until the user reloads. A follow-up issue is needed
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Open a
rails console
- Modify the project or group setting with
.update
(there's currently no UI for this). E.g.:
Group.find_by_full_path('gitlab-org').namespace_settings.update(duo_features_enabled: false)
Project.find_by_full_path('gitlab-org/gitlab-test').update(duo_features_enabled: false)
- Try to use any AI feature involving that project/group, it should fail
Note: When testing chat, make sure to /reset
the conversation if you had asked about the resource before changing the setting, so that the Assistant doesn't get the data from the conversation history