Skip to content

Add troubleshoot command to move RCA to Chat

Allison Browne requested to merge ab-add-troubleshoot-command into master

What does this MR do and why?

This adds Root cause Analysis as a slash command into Duo chat. When the Troubleshoot button is clicked we will open a duo chat window with the '/rca' slash command typed for the user, then the root cause analysis will appear.

Validate locally

  1. Setup Duo locally (see the docs from the AI team)
  2. Turn on the Feature flag on Feature.enable(:root_cause_analysis_duo)
  3. Consider replacing:
def perform_for(message, options = {})
  perform_async(serialize_message(message), options)
end

with:

def perform_for(message, options = {})
  perform_inline(serialize_message(message), options)
end

Then you don't have to worry about any issues with rails background jobs. Rails background Jobs can sometimes need restarting if code changes were made or branches switched. 4. Run a graphql request query:

mutation chat(
  $question: String!
  $resourceId: AiModelID!
  $agentVersionId: AiAgentVersionID
  $clientSubscriptionId: String
  $currentFileContext: AiCurrentFileInput
) {
  aiAction(
    input: {
      chat: {
        resourceId: $resourceId
        content: $question
        agentVersionId: $agentVersionId
        currentFile: $currentFileContext
      }
      clientSubscriptionId: $clientSubscriptionId
    }
  ) {
    requestId
    errors
  }
}

Query Variables (replace with your job or subscription id):

{
  "question": "/rca",
  "resourceId": "gid://gitlab/Ci::Build/352",
  "clientSubscriptionId": "6278d2fc-9b37-46d5-99d7-a99bb9d5b811" 
}
  1. Observe in your Duo chat window that the answer is there.
Edited by Allison Browne

Merge request reports