Skip to content

Use a single unit primitive for Duo Code Review

Context

In #463922 (comment 2095822136), it was identified that users must have access to two unit primitives in order to use Duo Code Review:

  • review_merge_request: to trigger Duo Code Review to review an MR and post review comments
  • summarize_review: for Duo Code Review itself to call the Summarize MR feature and post a final comment on the MR when it's done reviewing

Problems

  • Users must have access to both unit primitives to guarantee that the Duo Code Review feature works as expected, thereby coupling the delivery/packaging of both features. I.e. any add-on that contains one of these features must contain the other.
    • Note: this is not currently causing any real issues since (1) Duo Code Review is only available internally and (2) both features are part of the same add-on (Duo Enterprise).
  • Tracking data (e.g. MAU) is based on unit primitives and will be incorrect for the standalone Summarize MR review feature.

Proposal

Use a single unit primitive (review_merge_request) for all actions related to Duo Code Review, see #463922 (comment 2091479849)

I think what we can do is to change the unit_primitive we use in https://gitlab.com/gitlab-org/gitlab/-/blob/6692b48741bd529e7390dd0c7d9c5ed21642161c/ee/lib/gitlab/llm/anthropic/completions/review_merge_request.rb#L69 to review_merge_request as well. This way, all AI gateway requests in Duo Code Review will still be under the review_merge_request unit primitive.

Edited by François Rosé