Persist event source to source_type on duo workflow creation

What does this MR do and why?

Reconciles the source event property with the source_type database column on duo_workflows_workflows.

Previously, the source param (e.g. merge_request_code_conflict, fix_pipeline) was only forwarded to the agent_platform_session_created internal analytics event and was never persisted to the database. The source_type column existed but only held slack and mcp.

This MR:

  1. Extends the source_type enum in Ai::DuoWorkflows::Workflow to include all internal GitLab entry points from WORKFLOW_ACTIONS_SOURCE.
  2. Persists the source param into source_type at workflow creation time via a new source_type_attributes private method in CreateWorkflowService. Unknown or blank source values are silently ignored, preserving backward compatibility.

The source_type column already exists in the database (added in milestone 19.4 by AddSourceTypeAndSourceLinkToDuoWorkflowsWorkflows), so no migration is needed.

References

How to set up and validate locally

  1. Run a fix pipeline flow on a failed pipeline
  2. In the rails console, confirm source_type was saved:
pry(main)> Ai::DuoWorkflows::Workflow.last.source_type
...
=> "fix_pipeline"

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