Skip to content

Remove extra LLM call for generating summary for Duo Code Review

Duo Code Review can show individual code review comments but display an error message, I have encountered some problems while I was reviewing. Please try again later., instead of a summary. This happens because DCR makes two separate LLM requests: first to generate comments, then a second request to generate the summary. When the summary request fails (Anthropic API errors, timeouts, rate limits), comments are already in the database, creating an inconsistent state.

Once Duo Code Review gets migrated to Duo Agent Platform, we could still have the same issue as we're still making two requests: one via agentic flow to generate comments and another one to generate the summary (on the monolith side) later in the process.

Solution: Instruct the LLM to add the summary in the <review></review> tag or, even better, in a separate tag: <summary></summary>. This would eliminate the need for a separate LLM call just to generate the summary of the posted comments.

Note: We would need to validate whether the comments generated are valid or not (matching line numbers and so on) and only then should we use the generated summary. Otherwise, the summary could be misleading.

Edited by 🤖 GitLab Bot 🤖