Ask GitLab Duo for short, chat-style answers in Slack

What does this MR do and why?

GitLab Duo in Slack writes answers like documents: thousands of characters with headings, horizontal rules and long lists of options. In a chat thread that's hard to read, and answers over Slack's 12,000-character limit get cut off (see !258898 (merged)).

This MR asks Duo to write for a chat thread. The Slack instructions at the start of the goal now ask for:

  • Short answers: under about 2,000 characters.
  • The answer first, then at most a few short bullet points.
  • No headings or horizontal rules. Slack shows headings as plain text, so a mention inside a heading appears as raw <@U…> instead of a mention.
  • Offering more detail instead of writing it all out.

It also adds the mention rules from the slack_assistant/1.0.0 flow prompt: use the Slack ID form <@U…> in the reply, and a GitLab @username in issues and comments.

Both Slack flows now get these instructions. Before, only the developer/v1 flow got a Slack preamble. The slack_assistant/v1 flow behind slack_duo_api_flow relied only on its flow prompt, which has no length guidance.

The instructions are part of the goal, not the flow definition, so we can change them without releasing a new flow version.

There will be a follow-up on slack_assistant/1.0.0 to remove the instructions from there as soon as this lands.

References

How to set up and validate locally

You need a local Slack app connected to GDK, with Duo enabled for your user. See Duo in Slack. Turn the slack_duo_api_flow feature flag on to test the new flow, and off to test developer/v1.

  1. Check out this branch and restart Rails and Sidekiq: gdk restart rails-web rails-background-jobs.

  2. In a channel with the app, ask a normal question, for example:

    @gitlab what are the 3 most recently updated open issues in <group>/<project>, and which should I look at first?

  3. Check that the answer is short, starts with the recommendation, and has no headings.

  4. Open the session in GitLab and check that the first message starts with "You were mentioned in a Slack conversation."

  5. Optional: send the same message on master to compare. Expect a longer answer with headings.

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
Loading