Draft: Fix: Allow sessions page to show instead of 404
What does this MR do and why?
When an instance had Duo availability Off by default, but a project had Duo enabled - the Automate > Sessions page at the project level would display a 404. The goal was to have it display the Sessions when the project has Duo and Flows enabled (which it does now).
When working on this, I discovered the side panel sessions always linked to Sessions even if the project level was disabled (which led to a 404 link when the page was hidden on the project level for Automate > Sessions). To fix this, I went ahead and added a filter to return only user sessions if the project had Flows enabled.
References
GitLab Issue: #574467
Screen recordings
| Before | After |
|---|---|
| Screen_Recording_2025-12-11_at_10.48.14_AM | Screen_Recording_2025-12-11_at_10.18.34_AM |
How to set up and validate locally
For DAP/General Setup
- General DAP: https://docs.gitlab.com/development/duo_agent_platform/
- Assigning Duo to a group: https://docs.gitlab.com/development/ai_features/#run-gitlabduosetup-script
- Make sure you are in
SaaSmode withexport GITLAB_SIMULATE_SAAS=1set in yourenv.runitfile in your local gdk. - Turn on the following feature flags:
duo_workflow,duo_workflow_in_ci,ai_flow_triggers.
To Test in Agent Sessions page
- Navigate to a project with that has AI features enabled.
- In the left side panel, you will see
Automatewith a tanuki icon. SelectSessionsfrom the dropdown. - Test settings (see below for test cases)
To Test in new UI Side Panel
- To test this locally, make sure you have the following FFs enabled:
paneled_view,global_topbar,tailwind_container_queriesAfter you can toggleNew UIon in user's setting under the user's profile dropdown - Open the side panel and open Sessions.
- Test settings(see below for test cases)
Adding Sessions
- A: If you see no Sessions, you can trigger one that displays a Pipeline/Job by going to an Issue within your Duo enabled project and clicking the
Generate MR with Duobutton. It should trigger a new session that you can open up. - B: You can also run the following query
bundle exec rake "gitlab:duo_workflow:populate[50,20,1,<<YOUR_TEST_GROUP_PATH_HERE>>]"to create new agent sessions. Refresh the page. Make sure the group you are testing in has Duo assigned (see DAP setup above).
Test Settings (The Actual Testing)
- Start in SM mode (set
GITLAB_SIMULATE_SAAS=0in your env.runit and restart your gdk). - Go to the Duo settings on the Admin/instance level: Admin > GitLab Duo > Change configuration.
- Make sure GitLab Duo availability is
Off by default, click Save at the bottom. - Go to a Group Project that has Duo enabled and Sessions (if you need to add Sessions see above section for steps).
- If you do not see any sessions in Automate > Sessions, go to your project settings and turn on Duo: Settings > General > GitLab Duo. Make sure Allow flow execution is also enabled to see the Sessions for the Project.
- Go to Automate > Sessions, validate page is in navigation and page does not generate a 404.
- ALSO, go to the Side Panel view for Sessions and validate the project sessions display. The Side Panel will only display Sessions where the project has sessions enabled.
- Select a Session from the Side Panel list and go to the Details view. Click the Session ID link and validate the page does not render a 404.
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.
Related to #574467