Loading
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:
- Keep the earlier pages in component state rather than merging them with
fetchMore, because every 10 second poll of the newest page would overwrite merged pages in the cache - Keep the paging logic in the page component for now, next to the query that drives it. Moving the merge rules into
utils/at flag cleanup is tracked in [Feature flag] Rollout of `dap_session_load_mor... (#636541) • Allison Villa • 19.7 • On track
References
- Related to https://gitlab.com/gitlab-org/gitlab/-/work_items/635073+s
- Stacked on Fetch only the newest session messages on the s... (!265566 - merged) • Allison Villa • 19.6
- Depends on the
messagesconnection added in Paginate the Duo session chat log and cap duoMe... (!264039 - merged) • Roman Eisner • 19.6 - Feature flag rollout: [Feature flag] Rollout of `dap_session_load_mor... (#636541) • Allison Villa • 19.7 • On track
Screenshots or screen recordings
| Full page | Side Panel | Video |
|---|---|---|
![]() |
![]() |
How to set up and validate locally
- Enable the
dap_session_load_more_messagesfeature flag. - 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. - Go to AI > Sessions and open the session (
/<project full path>/-/automate/agent-sessions/<session id>). - 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.
- Open the browser's Network tab and filter by
graphql. - Select Load earlier messages. Up to 100 earlier messages appear above the ones already shown, and one
graphqlrequest is sent withgetAgentFlowMessagesas itsoperationNameand abeforecursor in its variables. - Keep selecting Load earlier messages until the button disappears. The session goal shows as the first message, with the "Created session" item above it.
- 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.
- Disable the
dap_session_load_more_messagesfeature flag. - 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

