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:

  1. POSTs to a new onboarding/improve_ci controller action (gated behind the duo_agent_onboarding feature flag, consistent with the existing onboarding page).
  2. Guards against duplicate runs using a Rails cache entry and an exclusive lease (same pattern as the Project Context Init Flow in !229847 (merged)).
  3. Resolves a goal prompt via Ai::Catalog::GoalTemplates for a new :improve_ci event type, instructing the agent to review the CI configuration and open a draft MR with suggested improvements.
  4. Dispatches the workflow through Ai::Catalog::Flows::ExecuteService using the CI improvement foundational flow — no AIGW changes required.
  5. 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.yml existence on the default branch (push result to gon) before rendering the button, mirroring the AGENTS.md existence check.
  • Reuse the exclusive lease + Rails cache guard to prevent duplicate workflow dispatches.
  • Gate everything behind the existing duo_agent_onboarding feature flag.

References

Edited by 🤖 GitLab Bot 🤖