DAP Onboarding: GitLab CI Improvements Flow
Summary
As part of the DAP Project Onboarding Page, add a GitLab CI Improvements section that uses the CI improvement foundational flow to analyze the project's .gitlab-ci.yml and surface actionable improvement suggestions.
Behavior
When a user visits the Automate > Onboarding page, a "Improve CI setup" card/button is shown if the project has a .gitlab-ci.yml on the default branch. Clicking it:
- POSTs to a new
onboarding/improve_cicontroller action (gated behind theduo_agent_onboardingfeature flag, consistent with the existing onboarding page). - Guards against duplicate runs using a Rails cache entry and an exclusive lease (same pattern as the Project Context Init Flow in !229847 (merged)).
- Resolves a goal prompt via
Ai::Catalog::GoalTemplatesfor a new:improve_cievent type, instructing the agent to review the CI configuration and open a draft MR with suggested improvements. - Dispatches the workflow through
Ai::Catalog::Flows::ExecuteServiceusing the CI improvement foundational flow — no AIGW changes required. - Returns a workflow/session ID so the frontend can link the user to the agent session to track progress.
If no .gitlab-ci.yml exists, the card is hidden or shows a disabled state with a tooltip explaining why.
Implementation Notes
- Follow the same controller/frontend pattern established in !229847 (merged) for the Project Context Init Flow.
- Check for
.gitlab-ci.ymlexistence on the default branch (push result togon) before rendering the button, mirroring theAGENTS.mdexistence check. - Reuse the exclusive lease + Rails cache guard to prevent duplicate workflow dispatches.
- Gate everything behind the existing
duo_agent_onboardingfeature flag.
References
- Parent epic: DAP Project Onboarding Page &21086
- Context Init Flow implementation reference: !229847 (merged)
Edited by 🤖 GitLab Bot 🤖