Skip to content

Fix DuoChat quick actions loading and streaming

Frédéric Caplette requested to merge fc-ai-poc-quick-actions into master

What does this MR do and why?

Fix DuoChat quick actions not triggering a loading and not streaming back.

When we executed DuoChat quick actions, no loading state was triggered. This commit adds a util function that decrease complexity and fixes the loading state. Additionally, the resourceID needed to be updated to use the new commands resourceID when executing commands and only clear the commands once the streaming was done.

Additionally, we want consumer of DuoChat to not execute a graphql mutation on their own, but rather call this util to update a reactive global state, and then let DuoChat execute on it which will greatly reduce code duplication and should help future feature be implemented faster and with less bugs.

Another big advantage is that implementer of the utils do not need to test graphql mutations, just the util method.

Note: There were no specs for the new RCA work. I could have added some, but it seems to me that this is a choice while the feature is still in development so I wanted to avoid merge conflicts and also to keep this MR extremely focused.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

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

RCA

Before After
Screen Recording 2024-07-18 at 4.27.14 PM.mov Screen_Recording_2024-07-19_at_11.46.58_AM

Ai Genie (Explain code)

Before After
Screen Recording 2024-07-19 at 12.01.08 PM.mov Screen_Recording_2024-07-19_at_11.45.10_AM

Summarize comments

How to set up and validate locally

  1. Make sure you have AI features enabled to test this change https://docs.gitlab.com/ee/development/ai_features/index.html
  2. Make sure you enable AI for your group
  3. Go to Build => Pipeline editor of a project within the group with AI features
  4. Add a simply configuration. it can be a single job which script: exit 1 to ensure that it fails
  5. Make sure you have working runners for this project by going to Settings => Ci/CD
  6. In the runners section, follow the instructions to setup a runner. I recommend using the shell executor for simplicity
  7. Turn on all FF for the RCA: ai_build_failure_cause, root_cause_analysis_duo
  8. Notice the "troubleshoot" button at the top of the job log (the job MUST have run and failed)
  9. Click on it
  10. Notice DuoChat opens and there is a loading chat bubble (Duo is typing)
  11. Notice the answer comes back streaming
  12. Go to a file in the repo
  13. Highlight text
  14. Select the explain code icon
  15. Notice the loading appears
Edited by Frédéric Caplette

Merge request reports

Loading