Enrich Duo Developer goal templates with trigger context

What does this MR do and why?

Enriches the GoalTemplates::Developer templates (in ee/app/models/ai/catalog/goal_templates/developer.rb) with two important pieces of context that were previously missing:

  1. Who triggered the flow — each template now includes a %{triggered_by_username} interpolation so the agent knows who to address and @mention in its response.
  2. Notification instructions — each template now instructs the agent to @mention the triggering user when it completes the task, so users are notified when the agent finishes (sessions can take 3–15 minutes).

Changes

ee/app/models/ai/catalog/goal_templates/developer.rb

  • Added %{triggered_by_username} interpolation to all four templates (MENTION_TEMPLATE, ASSIGN_MERGE_REQUEST_REVIEW_TEMPLATE, ASSIGN_MERGE_REQUEST_TEMPLATE, ASSIGN_ISSUE_TEMPLATE)
  • Updated resolve to extract and pass triggered_by_username from params

ee/app/services/ee/notes/post_process_service.rb

  • Passes triggered_by_username: note.author.username to RunService#execute for mention triggers

ee/app/services/ee/issuable_base_service.rb

  • Passes triggered_by_username: current_user.username to RunService#execute for assign/assign_reviewer triggers

References

Screenshots or screen recordings

N/A — backend-only change to goal template strings.

Before After
Agent does not know who triggered the flow; cannot reliably @mention or assign the user Agent is told who triggered the flow and instructed to notify them when done

How to set up and validate locally

  1. Set up a Duo Developer flow with a foundational flow reference of developer/v1

  2. Mention the service account in an issue note

  3. Check the session logs: Observe that the generated goal now includes the note author's username and notification instructions

    image.png

    It should mention you in the respond comment now:

    image.png

  4. Assign the service account to an issue or MR

  5. Check the session logs: Observe that the generated goal now includes the assigning user's username and notification instructions

    image.png

    It should mention you in a comment on the issue and assign you to the MR

    image.png

    image.png

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 Thomas Schmidt

Merge request reports

Loading