Add linking between workflows and merge requests

What does this MR do and why?

Adds linking between workflows and merge requests:

  1. Creates a link between workflows and the Merge Request that they were created from (link_type: source)
  2. Creates a link between Merge Requests that are created by workflows (link_type: created)

References

#600655 (closed)

#600723 (closed)

How to set up and validate locally

  1. Go to a Merge Request in your GDK
  2. Ask developer to create a new merge requests, e.g. @duo-developer-gitlab-duo - Create a new MR that adds a placeholder todo.txt
  3. In your rails console, check that the links were created:
[1] pry(main)> workflow = Ai::DuoWorkflows::Workflow.last

[2] pry(main)> workflow.linked_merge_requests
...
=> [#<MergeRequest id:1936 gitlab-duo/ai-assist!399>, #<MergeRequest id:2314 gitlab-duo/ai-assist!437>]

[3] pry(main)> workflow.merge_request_links
...
=> [#<Ai::DuoWorkflows::WorkflowMergeRequest:0x000000013dbb1028
  id: 1,
  workflow_id: 4551,
  merge_request_id: 1936,
  project_id: 22,
  namespace_id: nil,
  created_at: "2026-06-26 19:53:28.847059000 +0000",
  updated_at: "2026-06-26 19:53:28.847059000 +0000",
  link_type: "source">,
 #<Ai::DuoWorkflows::WorkflowMergeRequest:0x000000013899bcc0
  id: 2,
  workflow_id: 4551,
  merge_request_id: 2314,
  project_id: 22,
  namespace_id: nil,
  created_at: "2026-06-26 19:55:19.094976000 +0000",
  updated_at: "2026-06-26 19:55:19.094976000 +0000",
  link_type: "created">]
  1. Confirm the links above match the links in your GDK
  2. Confirm the source MR is where you added the comment, and the created MR is the one created by developer.

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 Roman Eisner

Merge request reports

Loading
Loading