GLQL work item pagination returns empty results on "load more"

Problem

When using GLQL to fetch work items with pagination (using the "load more" button), the pagination is broken:

  1. First load returns no results
  2. Second load returns the entire list, duplicating the first set of items

Reproduction

The issue occurs with the following GLQL query:

display: table
title: Fresh S1 & S2 Bugs
description: All overdue for Pipeline Execution
fields: title, assignee, epic, labels("frontend", "backend") AS "FE/BE", milestone, weight, labels("workflow::*") AS "Workflow Stage"
limit: 3
query: project = "gitlab-org/gitlab" AND type = issue AND state = opened AND label = ~"group::pipeline execution" AND label != ~"SLO::Near Miss" AND label != ~"SLO::Missed" AND label = ~"type::bug" AND label in (~"severity::1", ~"severity::2") 
sort: milestone asc

When paginating with the cursor WzE3Njc5MTY4MDAwMDAsMTc3MzE4MTUxXQ, the GraphQL request returns:

{
  "data": {
    "project": {
      "workItems": {
        "nodes": [],
        "pageInfo": {
          "startCursor": null,
          "endCursor": null,
          "hasNextPage": false,
          "hasPreviousPage": true
        },
        "count": 0
      }
    }
  }
}

The response shows zero results despite hasPreviousPage: true, indicating the pagination state is inconsistent.

Root Cause

This is a bug with pagination on the Elasticsearch side. As a workaround, passing ?useES=false in the query params resolves the issue.

verify-stage#619

Edited by 🤖 GitLab Bot 🤖