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