Store the created filter on Risk and Reviewers flow triggers
What does this MR do and why?
The Risk Classification ("Risk Assessment" in the UI) and Recommend Reviewers flows have a precondition in code: action eq created. Their triggers are stored with an empty filter. So the "Run when" field in the triggers UI is empty, and a customer cannot see when the flow runs.
This MR provisions new triggers for both flows with the filter action in [created]. Existing triggers still use precondition, so runtime behavior does not change (P AND P = P). The triggers UI now shows "Run when = Created".
This MR also fixes a spec that validates the default_trigger_filter of every flow. The spec now asks the trigger model to validate the filter, because a different allow list checks merge request actions.
This is the first of 3 stacked MRs. Each MR must be deployed before the next one merges.
References
- Work item: #632698 (closed)
- Parent work item: #630716
- Discussion: https://gitlab.com/gitlab-org/gitlab/-/work_items/630382#note_3886911147
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
- In a Rails console, enable the feature flag:
Feature.enable(:duo_mr_risk_classification). Risk Classification is behind this flag and needs Ultimate. - Go to the
gitlab-duogroup, then Settings > General. Expand GitLab Duo features. - Under Flow execution, turn on Risk Assessment and Recommend Reviewers. Select Save changes.
- If they were already on, turn them off and save. Then turn them on again and save. This provisions the triggers again with the new code. Wait a moment for the triggers to be created.
- Go to http://gdk.test:3000/gitlab-duo/test/-/automate/triggers.
- Open the trigger for each flow. Confirm that "Run when" shows Created.
- Create a merge request in
gitlab-duo/test. Go to Automate > Sessions. Confirm that sessions start for both flows.
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.

