Run risk classification without a checkout behind a feature flag

What does this MR do and why?

The Risk Assessment flow clones the full repository on every new merge request, even though flow version 2.0.0 reads all its files through the API. The previous MR moved the flow to 2.0.0 behind the duo_mr_risk_classification_no_checkout feature flag. This MR removes the clone.

Now all projects use 2.0.0. The feature flag no longer selects the flow version. It selects only whether the flow needs a checkout. For projects with the flag, the flow runs with coding_environment: none. A flow with none runs on Workhorse and not in a CI job, so no runner, image or clone is necessary. Projects without the flag keep the CI job and the clone.

A flow could only declare one coding environment for all projects before, so this adds a per-project hook. A caller that does not know the project always gets the clone.

Risk Assessment is the first flow started by a merge request event to run on Workhorse. Until now, only Slack and MCP sessions used Workhorse.

This is the second of two steps:

  1. Use 2.0.0, still with a clone: !268120 (merged)
  2. This MR: skip the clone.

References

Screenshots or screen recordings

Not applicable. There is no UI change.

How to set up and validate locally

  1. In GDK, check out the AI Gateway branch with flow version 2.0.0 and restart DWS.
  2. In a Rails console, enable the Risk Assessment flow for gitlab-duo/test:
    project = Project.find_by_full_path('gitlab-duo/test')
    Feature.enable(:duo_mr_risk_classification, project)
  3. Create a merge request in gitlab-duo/test. Make sure that DWS loads risk_classification 2.0.0 and that the session runs in a CI job that clones the repository.
  4. Enable the new flag:
    Feature.enable(:duo_mr_risk_classification_no_checkout, project)
  5. Create a merge request that changes a migration or an authorization-related file. Make sure that:
    • The session has no CI job. log/sidekiq.log shows Ai::Messaging::ServerSideTurnWorker for the session, and the Workhorse log shows the request to /api/v4/ai/duo_workflows/workflows/<id>/execute.
    • The merge request widget shows the risk assessment, and the session ends as finished.

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.

Edited by Wanderson Policarpo

Merge request reports

Loading
Loading