Skip to content

Fix storing messages for summarizing reviews

Nicolas Dular requested to merge nd/fix-chat-caching into master

What does this MR do and why?

Issue: #420870 (closed)

Fix storing messages for summarizing reviews

This should have been fixed with !127511 (merged) already.

We fixed this before by setting skip_cache: true by default in ExecuteMethodService. However, SummarizeSubmittedReviewService was not going through the ExecuteMethodService.

As we only want to store messages from the chat action, and to fix this for the future, the logic is now reversed and it's required to set cache_response: true explicitly.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Enable AI features https://docs.gitlab.com/ee/development/ai_features.html#test-ai-features-locally
  2. Feature.enable(:gitlab_duo, true)
  3. Perform a merge request review
  4. Refresh the browser and Open the GitLab Duo chat
    1. This is a necessity to test the feature, because right now, the chat listens on the AiCompletionResponseSubscription - and adds it to the chat, regardless of the action performed. This is another problem that needs to be tackled, also see #413600 (comment 1485444913)
  5. Before: You'd see the answer from the AI in the chat, Now: You no longer see the response because we don't store the message for the chat.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Nicolas Dular

Merge request reports