the shared issue pre-fetch reads one unpaginated page, silently capping both bands at 100 issues
Id: TD-PPagop-26082908 · Status: open · Filed: 2026-08-29
Noticed while reviewing PR #923 (agent-ops#875, D15 as revised #869), which
moved the tech-debt band’s store from the in-repo register to
pw::type:tech-debt-labelled issues.
Both issue-backed gatherers ask GitHub for a single page:
scripts/gather-issues.sh—repos/<slug>/issues?state=open&per_page=100scripts/gather-tech-debt.sh—repos/<slug>/issues?labels=pw::type:tech-debt&state=open&per_page=100
Neither passes --paginate, so a repository with more than 100 qualifying
open issues contributes only the first page. The issues endpoint defaults to
sort=created&direction=desc, so that page is the newest 100: everything
older is invisible to the Co-Ordinator, and invisible silently — the array
that reaches it is a well-formed, complete-looking candidate set, and
degrade never fires because nothing failed.
For the issues band this is a long-standing, tolerated ceiling. For
tech-debt it arrived with #875: the register-backed gatherer this replaced
read the whole tech-debt/ tree in one tarball and capped nothing. It also
lands on the wrong end of that band’s own priority rule — tech_debt is
ordered by issue number ascending (keep_order_tech_debt,
lib/coordinator-input.sh), i.e. oldest first, which is exactly what
truncation removes. agent-ops carries 77 status: open register items today,
all of which agent-ops#880 migrates into this label, so the margin to 100 is
one review cycle’s worth of filings, not years.
Why it was not fixed in #923
Section titled “Why it was not fixed in #923”The cap now lives in the walk both gatherers share (lib/issue-prefetch.sh
was introduced by that PR precisely to stop the two drifting apart), so a
correct fix is a change to both, and gh api --paginate on a list endpoint
emits one JSON array per page rather than one array overall. Both scripts
feed the raw payload straight into a single-document jq filter and then
sort_by(.number), so naively adding --paginate would yield one sorted
array per page — a set that is complete but no longer globally ordered, and
whose type == "array" guard no longer means what it says. The slurp has to
be done deliberately (--slurp, or --jq streaming into jq -s 'add') and
both call sites’ guards adjusted with it.
Suggested fix
Section titled “Suggested fix”Paginate the listing read in one place — lib/issue-prefetch.sh is the
natural home now that it exists — returning a single, globally sorted array to
both callers, with the type == "array" and degrade guards moved with it so
a partial page walk still fails safe rather than quietly returning a short
set. Cover it with a stub-gh test that serves two pages and asserts an
entry from the second one survives into the output, for each gatherer.
Requirements 3j and 3t (docs/IMPLEMENTATION-PIPELINE-SPEC.md) and the
scripts’ own header comments describe these arrays as the repository’s open
issues without qualification; whichever way this is settled, they should say
what the bound actually is.
Migrated to https://github.com/Poetic-Poems/agent-ops/issues/1029.