Adds agents service using SystemNoteService to track agent activity in work item timelines
What does this MR do and why?
This MR addresses #570291.
It implements system notes to track GitLab Duo agent activity on work items timelines.
Problem
Users have no visibility into when and how GitLab Duo agents interact with their work items, making it difficult to understand agent activities and troubleshoot workflow executions.
Solution
We're creating automatic system notes in work item timelines when agents start, complete or fail sessions. This provides transparency and audit trails for all agent interactions in work items.
Scope
This implementation focuses on the issue_to_merge_request flow use case as a first iteration but is set up in a reusable way for other workflow types, i.e. software_development, convert_to_gitlab_ci, etc.
When a GitLab Duo agent performs activities related to a work item, users will see that an Agent is working on the work-item in the work items timeline.
Implementation
-
System note creation at three workflow lifecycle points:
- Session started (when workflow begins)
- Session completed (on successful completion)
- Session failed (on cancellation or error)
-
Updated
SystemNoteServiceto support agent session tracking -
New
AgentsServicefor creating agent-specific system notes
How to set up and validate locally
Prequisites
- An active Ultimate license.
- Duo Enterprise subscription configured:
bundle exec 'rake gitlab:duo:setup[duo_enterprise]' -
Remote Flowsconfigured locally. Follow these steps to set up and configure.
Once the correct license and Remote Flows have been set up locally, follow the validation steps below.
Validation Steps
-
Navigate to an issue in the UI: for example
http://gdk.test:3000/gitlab-duo/test/-/issuesand select any of the issue -
Test agent started note:
- Click
Generate MR with Duobutton to trigger theissue_to_merge_requestworkflow - Verify a system note appears in the Issue timeline: "started Duo Developer session ID triggered by Issue to MR"
- Click
-
Test agent completed note:
- Wait for the workflow from step 2 to complete successfully
- Verify a system note appears in the Issue timeline: "Duo Developer completed session ID"
-
Test agent failed note:
- Trigger another
issue_to_merge_requestworkflow by clicking theGenerate MR with Duobutton - Navigate to the workflow job and cancel it manually
- Return to the issue and verify a system note appears: "Duo Developer session ID failed (dropped)"
- Trigger another
Expected Results
- All three system notes should appear in the issue timeline with:
- Clickable links to the agent session details
- Appropriate trigger source or failure reason
- Correct timestamps
Screenshots
1. System note creation in a top level project
2. System note creation in a nested project
3. System note creation in a deeply nested project
Acceptance Criteria
-
Agent session activities appear in work item timelines -
Session IDs are included for traceability -
Trigger sources are captured and displayed -
Integration works with existing timeline/activity feed UI -
Performance impact is minimal -
Tests cover the new functionality
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
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.


