assign_reviewer quick action not working for groups: Could not apply assign_reviewer command. Failed to find users for 'GROUP_NAME'
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "type::bug" label: - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=type::bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary <!-- Summarize the bug encountered concisely. --> The `/assign_reviewer` quick action is no longer setting reviewers when a **group** is the intended reviewer. There are two failure modes: - In some situations, the `/assign_reviewer` (and equivalent quick actions) will fail silently. This happens if the quick action is part of a merge request template. - Attempting to use this quick action via a comment (Typing `/assign_reviewer @bcarranza-archive` or similar) will yield an error: ``` Could not apply assign_reviewer command. Failed to find users for '@GROUP_NAME'. ``` ### Steps to reproduce <!-- Describe how one can reproduce the issue - this is very important. Please use an ordered list. --> 1. Create a project where a group `GROUP_NAME` is a member (I've been testing with the group having the **Developer** role.) 1. Populate the project such that you can create a new merge request 1. Compose a new merge request with a string like `/assign_reviewer @GROUP_NAME` in the **Description** 1. Click **Create merge request** 1. Observe that the MR is created and the list of Reviewers remains empty 1. In a comment to the MR, add the `/assign_reviewer @GROUP_NAME` string and click **Comment** 1. Observe _Applying multiple commands_ 1. Observe a light blue dialog with `Could not apply assign_reviewer command. Failed to find users for '@GROUP_NAME '.` 1. Observe that the list of Reviewers remains empty The group we target is a member of the project that the MR is being created in. Watch both failure modes in [this recording on Loom](https://www.loom.com/share/e076059217154eaab1dccb6c66c8c51a). ### Example Project <!-- If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report. If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version. --> I have been testing this in the [assign_reviewer-quick-action-group ](https://gitlab.com/bcarranza/assign_reviewer-quick-action-group) project which is **Public**. I applied `/assign_reviewer @bcarranza-archive` and observed the behavior reported above in [the MRs in that example project](https://gitlab.com/bcarranza/assign_reviewer-quick-action-group/-/merge_requests). ### What is the current *bug* behavior? <!-- Describe what actually happens. --> The group/group members are not set as reviewers for the MR. Sometimes the failure is silent. Sometimes the `Could not apply assign_reviewer command. Failed to find users for '@GROUP_NAME'.` error message is observed. ### What is the expected *correct* behavior? <!-- Describe what you should see instead. --> The list of reviewers should be updated properly with the members of the group targeted by the `/assign_reviewer` quick action. **Note**: The [docs for this quick action](https://docs.gitlab.com/ee/user/project/quick_actions.html#issues-merge-requests-and-epics) do not explicitly say that a group can be used with this quick action. However, this has worked previously for the customer who originally reported this. GitLab team member with access to Zendesk can [learn more in the ticket](https://gitlab.zendesk.com/agent/tickets/267426). :ticket: ### Relevant logs and/or screenshots <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise. --> ### Output of checks <!-- If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com --> **This bug happens on GitLab.com.** #### Results of GitLab environment info <!-- Input any relevant GitLab environment information if needed. --> <details> <summary>Expand for output related to GitLab environment info</summary> <pre> (For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`) </pre> </details> #### Results of GitLab application Check <!-- Input any relevant GitLab application check information if needed. --> <details> <summary>Expand for output related to the GitLab application check</summary> <pre> (For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:check SANITIZE=true`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`) (we will only investigate if the tests are passing) </pre> </details> ### Possible fixes <!-- If you can, link to the line of code that might be responsible for the problem. --> I am not sure of the line of code in particular but I would take a look at: - https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/quick_actions/merge_request_actions.rb
issue