Duo Messaging: Slack adapter and AppMentionedService wiring
## Problem The messaging service core (orchestrator, adapter base, callback worker) provides the infrastructure to trigger agent flows from messaging services, but there is no concrete adapter for any platform yet. The existing `AppMentionedService` currently has a stub response when a user `@mentions` Duo in Slack — it does not trigger an actual agent flow. ## Proposal Implement the Slack adapter and wire it into the existing `AppMentionedService` entry point. ### `Adapters::Slack` A concrete adapter implementing the messaging lifecycle hooks via the Slack API: | Hook | Slack behavior | |------|----------------| | `deliver_result` | Posts the agent's response as a threaded reply (`chat.postMessage`) | | `deliver_error` | Posts an ephemeral error message to the user (`chat.postEphemeral`) | | `on_flow_started` | Adds :eyes: reaction to the mention message | | `on_flow_completed` | Removes :eyes:, adds :white_check_mark: reaction | | `on_flow_failed` | Removes :eyes:, adds :x: reaction + ephemeral error | Uses the existing `Slack::API` client and `SlackIntegration` model to authenticate via the installed bot token. ### `AppMentionedService` refactor Replace the current stub with a call to the messaging service: 1. Build the goal from the Slack thread context (participants + conversation) — this logic already exists as `build_thread_context`, renamed to `build_goal` 2. Build the `callback_context` hash (adapter, team_id, channel_id, thread_ts, message_ts, user_id) 3. Call `TriggerFlowService` with the goal and callback context 4. On success: call `adapter.on_flow_started` 5. On failure: call `adapter.on_flow_failed` ### Feature flag Gated behind the existing [`slack_duo_agent`](https://gitlab.com/gitlab-org/gitlab/-/work_items/592185) feature flag (per-user), which already gates the `AppMentionedService` entry point. No additional flags needed — disabling this flag kills the entire flow. ### Scope - `ee/app/services/ai/messaging/adapters/slack.rb` + spec - `app/services/integrations/slack_events/app_mentioned_service.rb` + spec (refactor) ### Reference - PoC implementation: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/231853 ## Related - Parent issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/590434 - ADR: https://gitlab.com/gitlab-com/content-sites/handbook/-/merge_requests/19020 - Feature flag: https://gitlab.com/gitlab-org/gitlab/-/work_items/592185 - Blocked by: https://gitlab.com/gitlab-org/gitlab/-/work_items/597570
task