[BUG] Allow AvailableModelsResolver to Authorize by Project
What does this MR do and why?
When Duo features are set to "Off by default" on a root group, it has a cascading effect that also disables Duo on its projects. To re-enable Duo in the project, a user can enable the GitLab Duo toggle under Project > Settings > General > GitLab Duo
.
Due to a bug in AvailableModelsResolver
(a dependency of the model selection feature in the chat window), this was not working correctly. The resolver was set up for handling root namespaces only so when a chat window opened in a project context, it would return an auth error.
This MR fixes the issue by allowing the resolver to handle a project
resource and perform its auth check on it accordingly.
Screenshots or screen recordings
Before | After |
---|---|
Screen_Recording_2025-10-22_at_5.28.35_pm | Screen_Recording_2025-10-22_at_5.19.24_pm |
How to set up and validate locally
Set-up pre-requisites
- An active online cloud or legacy, Ultimate license.
- Duo Agent platform running in GDK
- Start GDK in saas mode
GITLAB_SIMULATE_SAAS=1 gdk start
- Run the Duo setup rake task
GITLAB_SIMULATE_SAAS=1 bundle exec 'rake gitlab:duo:setup'
to seed instance with a Duo test group (it will be calledgitlab-duo
). - Navigate to the test group's home page e.g
http://gdk.test:8080/gitlab-duo
and create a project within it by clicking the "Create project" button - Disable Duo on the group you just created. Do this by navigating to the Duo configuration page e.g
http://gdk.test:8080/groups/gitlab-duo/-/settings/gitlab_duo/configuration
and selecting "Off by default". Click "Save changes". - Navigate back to your project within the group and visit Settings > General > GitLab Duo.
- Click the GitLab Duo toggle to enable Duo and click "Save changes".
- Open the chat panel by clicking the chat icon on the top right corner of the page. Make sure the Agentic mode (beta) toggle is enabled.
- Validate that there are no errors in the chat window and you can use agentic chat as expected.
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.