Add Slack feedback buttons for Duo agent responses
What does this MR do and why?
Relates to: #603660 (closed)
Adds thumbs up/down feedback buttons to Duo agent responses delivered in Slack, and records clicks as internal AI usage events. This implements steps 1 and 2 of the issue's sequencing (post buttons, handle clicks and tracking). The thumbs-down reason modal (step 3) is a follow-up.
Buttons appear on successful results only. Clicks are tracked as ai_duo_messaging_feedback_submitted and dual-written to the ai_usage_events Postgres and ClickHouse tables, flowing into the AI Impact dashboards. This mirrors the ai_duo_agentic_chat_feedback_submitted pattern.
Feedback data semantics: last-write-wins
Slack's feedback_buttons element is a toggle. Slack sends an interaction payload on every state change, with no deselection signal and no current-state field. One event is recorded per toggle, so a single user can produce multiple events for the same workflow, and a retracted feedback is invisible.
Since ai_usage_events is append-only, feedback is modelled as mutable state with last-write-wins semantics: the effective feedback for a user and workflow is the latest event. Consumers must not treat raw event counts as feedback counts (use argMax in ClickHouse or DISTINCT ON ... ORDER BY timestamp DESC in Postgres). This is documented in the event definition.
No new feature flag: the buttons ride along with the existing slack_duo_agent-gated flow, since they only render on messages that flow can produce.
How to set up and validate locally
-
Set up the GDK Slack app integration and the Duo Slack agent flow (
slack_duo_agentfeature flag enabled, GitLab for Slack app installed, chat name linked). -
Mention the Duo bot in a Slack channel and wait for the run to complete.
-
Verify the delivered result message carries Helpful / Not helpful feedback buttons.
-
Click one and verify an
ai_usage_eventsrow is written:Ai::UsageEvent.where(event: 'ai_duo_messaging_feedback_submitted').lastwith
extrascontainingfeedback,workflow_id, andsurface: slack. -
Verify a click from a Slack user without a linked GitLab account records nothing.
| Screenshot |
|---|
![]() |
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.
