mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
* fix(github): pin work-item list ordering to updated-desc so cursor pagination reaches every page The Tasks page paginates work items with an updatedAt cursor (updated:<oldest-item), but the underlying gh calls never pinned a sort: 'gh issue list' defaults to created-desc and '--search' defaults to best-match. Items created long ago but updated recently therefore never appeared on any page — page 0 (created order) skipped them and every later page excluded them via the cursor — so the pager advertised pages the fetch chain could never reach, clicks on them clamped to the last real page, and cross-page ordering was scrambled. Append sort:updated-desc to every list/search invocation so the fetch order matches the cursor field on the first and all subsequent pages. Verified against a live 588-issue repo: the cursor chain previously died around page 5; it now traverses 585/588 unique issues (the remainder is the pre-existing strict '<' boundary edge for items sharing the cursor's exact timestamp). Fixes #8649 * fix(github): make work-item cursor pagination lossless at updatedAt boundaries Builds on the sort-pin fix: switch the pagination cursor from strict 'updated:<' to inclusive 'updated:<=' so items sharing the boundary row's exact updatedAt are no longer skipped between pages (the residual 3/588 edge in #8649). The inclusive bound re-fetches the boundary rows, so dedupe them by repoId+id (a bare item.id like 'issue:9' collides across repos). Extract the page accumulation out of the 12k-line TaskPage component into a pure, unit-tested helper (accumulateWorkItemPages) that dedupes and backfills: it accumulates fresh rows across fetches and emits uniform pageSize pages, so deduped pages never shrink below the size totalPages (count / effectivePageSize) assumes — which would otherwise strand the tail items and break the no-count degraded pager. Also hoist the updated-desc ordering into a named WORK_ITEM_LIST_SORT_QUALIFIER constant so the cursor's ordering contract has one home. Tradeoff: when per-repo fetch size equals pageSize, the boundary dedupe costs one extra fetch per page; acceptable for interactive pagination and bounded by the gh rate-limit guard. Persisting the cursor/buffer across calls is a possible follow-up. --------- Co-authored-by: OrcaWin <alpha-eng@stably.ai>