Make Duo Chat goal mode start the Developer flow

What does this MR do and why?

Goal mode used to be cosmetic. Typing /goal showed a token, changed the placeholder, and removed the /goal text, but the message was then sent as an ordinary chat turn. Nothing actually ran a goal.

This MR makes goal mode real. Sending a prompt in goal mode starts the Developer foundational flow in its goal configuration. Duo chat only enables the /goal functionality if the Developer foundational flow is also enabled at a group and/or instance level.

A few design decisions worth noting:

  • Goal is a configuration of the existing Developer foundational flow (developer/v1), not a flow of its own. The turn names a mode so the backend picks that configuration, and the flow's identity stays developer/v1, which is what billing and enablement key off.
  • Availability is one question asked in one place: a shared getGoalFlow lookup collapses the feature flag, project, flow configuration, and user permission into a single yes/no. The slash command and the + menu row are gated by the same answer, and the query is cache-first so the two callers cost one request.
  • Commands and actions are now separate concepts. A slash command is a trigger; START_GOAL is the effect. Typing /goal and clicking the + menu row both run that one action, so the two entry points can't drift apart.
  • The prompt object now carries which flow goal mode runs, instead of a plain on/off boolean, so the send path has what it needs.

What is not included in this MR?

This MR doesn't implement a UI to identify that a user message starts a goal or that a session is a goal session in the sessions pill or the session widget:

image.png

This depends on two MRs to actually run goals:

References

Epic: gitlab-org#23107

Screenshots or screen recordings

From slash command From prompt actions menu

How to set up and validate locally

  1. Enable the flag: Feature.enable(:duo_chat_goal_command)
  2. Enable the Developer flow for the project.
  3. Type /goal in Duo Chat, or pick Goal from the + menu. Either way the goal token appears and the /goal text is removed.
  4. Send a goal. Confirm the session runs the Developer flow in its goal configuration rather than answering as chat.
  5. Turn the Developer flow off for the project and confirm /goal and the Goal row both disappear.

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 Enrique Alcántara

Merge request reports

Loading
Loading