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
- Delivery fix for long answers: !258898 (merged)
- Slack thread where a long answer got lost (internal): https://gitlab.slack.com/archives/C0BP2BL7TSB/p1790782312200109?thread_ts=1790703760.919779&cid=C0BP2BL7TSB
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.
-
Check out this branch and restart Rails and Sidekiq:
gdk restart rails-web rails-background-jobs. -
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? -
Check that the answer is short, starts with the recommendation, and has no headings.
-
Open the session in GitLab and check that the first message starts with "You were mentioned in a Slack conversation."
-
Optional: send the same message on
masterto 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.