Show the source session of a restarted session in Linked Items

What does this MR do and why?

When a session is restarted, the backend links the new session to the one it was restarted from. This MR shows that link on the session details page.

  • Fetch the session's workflow links in the linked items query
  • Add the session a restarted session came from to the "Source" row of "Linked items", linking to it
  • Raise the get_agent_flow_linked_items.query.graphql complexity override in all_queries_spec.rb
Why raise the `get_agent_flow_linked_items.query.graphql` complexity override
  • workflowLinks raised the query's static score from 264 to 320, so the override goes from 265 to 321, the smallest value that passes (score < limit).
  • At runtime it scores about 190, under the 250 limit for signed-in users. The static check ignores first, so it overcounts.
  • Trimming fields doesn't get it under the limit (308 with only linkedWorkflow { id }), and get_agent_flow.query.graphql has no room for the connection either.
  • The alternative was a separate query, which means another request on every page load, or every 10 seconds if it polls, all counting against per-user rate limits. Keeping it in the existing query adds no requests.

References

Screenshots or screen recordings

First session, that was retried Session created after retry
Screenshot_2026-11-03_at_1.54.22_PM Screenshot_2026-11-03_at_1.54.34_PM

How to set up and validate locally

  1. Have GitLab Duo set up in your GDK, with a Duo-enabled project.
  2. Have GitLab Runner working.
  3. Enable the dap_session_restarts feature flag.
  4. Start a flow in your Duo-enabled project.
  5. On the session details page, select Cancel session, then Cancel session in the confirmation dialog. The session status changes to Stopped.
  6. Select Retry session. You land on a new session with a new ID.
  7. In Linked items, check that the Source row shows a badge with the original session's title and ID.
  8. Select the badge. Check that it opens the original session.
Edited by Allison Villa

Merge request reports

Loading
Loading