Add troubleshoot command to move RCA to Chat
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
- Setup Duo locally (see the docs from the AI team)
- Turn on the Feature flag on in the rails console, by running:
rails c
thenFeature.enable(:root_cause_analysis_duo)
- 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.
- 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"
}
- Observe in your Duo chat window that the answer is there.
Edited by Allison Browne