Resolve catalog item version for foundational flow sessions

What does this MR do and why?

!255478 (merged) linked new sessions to the flow's catalog item, but only for the CreateAndStartWorkflowService path (reviewer-assignment / auto code review). Every other creation path — the comment-mention trigger (Ai::DuoWorkflows::CodeReview::Mention::AssistantFlowHandler), POST /ai/duo_workflows/agent_workflows, and the aiDuoWorkflowCreate GraphQL mutation — still stored NULL in ai_catalog_item_version_id, so the session info view hides the flow link (see #628824 (comment 3852958956)).

When a caller does not supply a catalog item version, or supplies an explicit nil, CreateWorkflowService now looks up the foundational flow for the workflow definition and stores the id of its latest released catalog version. Callers that pass a real version, as a record or an id, keep it unchanged, and non-foundational or chat definitions still store nil.

References

Closes #628824 (closed)

Related: !255478 (merged)

How to set up and validate locally

  1. Go to an MR and comment: @GitLabDuo - What is this MR about?
  2. Check that the link to the flow exists in the session info pane
  3. Optional: Confirm the above fails on the master branch

Fullscreen_2026-09-21__12_22_PM

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