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

To Test in Agent Sessions page

  1. Navigate to a project with that has AI features enabled.
  2. In the left side panel, you will see Automate with a tanuki icon. Select Sessions from the dropdown.
  3. Test settings (see below for test cases)

To Test in new UI Side Panel

  1. To test this locally, make sure you have the following FFs enabled: paneled_view, global_topbar, tailwind_container_queriesAfter you can toggle New UI on in user's setting under the user's profile dropdown
  2. Open the side panel and open Sessions.
  3. Test settings(see below for test cases)

Adding Sessions

  1. 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 Duo button. It should trigger a new session that you can open up.
  2. 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)

  1. Start in SM mode (set GITLAB_SIMULATE_SAAS=0 in your env.runit and restart your gdk).
  2. Go to the Duo settings on the Admin/instance level: Admin > GitLab Duo > Change configuration.
  3. Make sure GitLab Duo availability is Off by default, click Save at the bottom.
  4. Go to a Group Project that has Duo enabled and Sessions (if you need to add Sessions see above section for steps).
  5. 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.
  6. Go to Automate > Sessions, validate page is in navigation and page does not generate a 404.
  7. 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.
  8. 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

Edited by Lindsey Shelton

Merge request reports

Loading