Draft: Draft: Refactor GitlabNote adapter to use system-note lifecycle (alternative to !235039)
What does this MR do and why?
This is an alternative approach to MR !235039 (closed) (!235039 (closed)) for side-by-side comparison. See the proposal comment at !235039 (comment 3395313223) for the full rationale and trade-offs.
Summary
Refactors Ai::Messaging::Adapters::GitlabNote to use a system-note lifecycle that mirrors the already-merged GitlabDuoNote adapter, replacing the editable progress-note UX (
Lifecycle change
| Phase | MR !235039 (closed) (progress note) | This MR (system note) |
|---|---|---|
on_request_received |
Creates a |
Validates project/noteable/note exist; returns ServiceResponse.success |
on_flow_started |
Edits progress note to |
Posts a duo_mention_started system note; stores started_note_id |
deliver_result |
Posts reply note | Destroys started system note, posts reply note |
deliver_error |
Posts reply note | Destroys started system note, posts error reply note |
Key changes
-
GitlabNoteadapter refactored to mirrorGitlabDuoNote's lifecycle:manages_system_notes? = truesuppresses defaultCreateWorkflowServicesystem noteson_flow_startedposts aduo_mention_startedsystem note viaIssuablesService, authored as the configured service accountdeliver_result/deliver_errordestroy the started system note before posting the reply
-
duo_mention_startedlifted fromMergeRequestsServicetoIssuablesServiceso it works for Issue, MR, AND WorkItem noteables (not just MR). The i18n key is renamed fromDuoCodeReview|toAi|since the message is no longer code-review specific. -
GitlabDuoNoteupdated to callIssuablesService#duo_mention_startedinstead ofMergeRequestsService#duo_mention_started(one-line change to which service it instantiates). -
WorkItem support:
GitlabNotesupports Issue, MR, AND WorkItem — a key feature vs.GitlabDuoNotewhich only supports Issue+MR.
Consolidation follow-up
GitlabNote and GitlabDuoNote remain separate classes in this MR. Consolidation (e.g., GitlabDuoNote < GitlabNote inheritance) is a deliberate follow-up so each step is easy to review.
References
- Alternative approach: !235039 (closed)
- Proposal comment with rationale: !235039 (comment 3395313223)
Screenshots or screen recordings
| Before (MR !235039 (closed)) | After (this MR) |
|---|---|
started mention session N system note appears, disappears when final reply arrives |
How to set up and validate locally
- Set up a service account and flow trigger for @mention flows (see MR !235039 (closed) for setup instructions)
- @mention the service account in an issue comment, MR discussion, or work item comment
- Observe: no progress note appears immediately (unlike !235039 (closed))
- When the flow starts: a system note
started mention session N and will let you know when it's finishedappears - When the flow completes: the system note disappears and the final reply note appears in the discussion
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.