Automatic Flow triggers for foundational flows
What does this MR do and why?
This code change adds automatic trigger creation for AI workflow definitions. When AI workflows are set up for projects, the system now automatically creates triggers that will activate these workflows based on specific events (like when someone is assigned to review code, gets assigned to an issue, or mentions the AI in comments). The workflow definitions are also expanded with two new AI workflows: a "developer" workflow that activates on assignments, and a "fix_pipeline" workflow that currently has no trigger.
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
-
In the rails console, seed foundational flows
Ai::Catalog::Flows::SeedFoundationalFlowsService.new(current_user: User.first, organization: ::Organizations::Organization.first).execute => #<ServiceResponse:0x0000000147d77038 @http_status=:ok, @message="Foundational flows seeded successfully", @payload={}, @reason=nil, @status=:success> -
In a Duo enabled group open the settings e.g. http://gdk.test:3000/groups/gitlab-duo/-/settings/gitlab_duo
-
Go to Gitlab Duo -> Click on "Change configuration" and scroll down to "Flow execution"
-
Select one or more flows and click on "Save changes"
-
You should have catalog_items, service_accounts and flow_triggers for the configured flows
-
If you pull from !215896 you can assign the respective service account for Duo developer flow and it should trigger the flow
-
Open any issue for the same project and assign the flow's service account to the issue. You should see a
developer/v1flow started -
It doesn't trigger the flow when you assign any service account apart from
developer/vflow. Please note that assignment would still work fine.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #583191