Add a Load earlier messages button to session details

What does this MR do and why?

Add a "Load earlier messages" button to the session details page, so users can read messages older than the newest 100. Stacked on !265566 (merged), which fetches only the newest 100 messages.

Currently, the page loads every message in the session when it opens and on every 10 second poll, so long sessions return their whole history each time - see https://gitlab.com/gitlab-org/gitlab/-/work_items/635073+s

  • Show a "Load earlier messages" button above the messages while older messages aren't on the page. Each click loads the previous 100.
  • Show an error and keep the button when earlier messages fail to load

Other decisions I've made:

References

Screenshots or screen recordings

Full page Side Panel Video
Screenshot_2026-10-30_at_2.15.55_PM Screenshot_2026-10-30_at_2.16.05_PM

How to set up and validate locally

  1. Enable the dap_session_load_more_messages feature flag.
  2. Start a session that results in more than 100 messages. This prompt worked for me, as an example (but you'll need at least 60 work items/MRs in that project). If you validated Fetch only the newest session messages on the s... (!265566 - merged) • Allison Villa • 19.6, the session you used there works too:
    Using duo developer and starting a workflow session, go through the merge requests in this project one at a time, oldest first. For each one, look it up on its own with a separate tool call, then after each tool call, reply with a single line: its ID and title. Do not batch several merge requests into one call, skip any, or summarize groups. When you run out of merge requests, continue the same way with the issues. Stop after 110 lookups in total.
  3. Go to AI > Sessions and open the session (/<project full path>/-/automate/agent-sessions/<session id>).
  4. Once the session has more than 100 messages, reload the page. Only the newest 100 messages show, with a Load earlier messages button above them. The "Created session" item is not shown.
  5. Open the browser's Network tab and filter by graphql.
  6. Select Load earlier messages. Up to 100 earlier messages appear above the ones already shown, and one graphql request is sent with getAgentFlowMessages as its operationName and a before cursor in its variables.
  7. Keep selecting Load earlier messages until the button disappears. The session goal shows as the first message, with the "Created session" item above it.
  8. If the session is still running, keep the page open until the next poll, about 10 seconds. New messages appear at the bottom, and the earlier messages you loaded stay on the page.
  9. Disable the dap_session_load_more_messages feature flag.
  10. Reload the page. Every message in the session shows again, starting with the session goal, and there's no Load earlier messages button.
Edited by Allison Villa

Merge request reports

Loading
Loading