Repository navigation
Closed
Labels
app/github-backupinfra/github-backup estate mirror systeminfra/github-backup estate mirror systemkind/bugSomething isn't working (prefixed form of the classic bug label)Something isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)Ordinary priority (the default)source/creatorFiled by the new-issue-creator jobFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted testsQueue packet kind: bounded fix with reproduction and targeted tests
Description
github-backup(inventory): inventory_owner pagination never terminates on a non-advancing cursor — hasNextPage is trusted with no progress check, page bound, or node-shape guard
Evidence
infra/github-backup/bin/ghb_common.py, inventory_owner (verified on laptop at origin/main f74a3dea13):
# ghb_common.py:71
while True:
...
# ghb_common.py:126-127
if conn["pageInfo"]["hasNextPage"]:
after = conn["pageInfo"]["endCursor"]
else:
return reposThe loop's only exit is hasNextPage becoming false. The cursor is never checked for progress: if a page reports hasNextPage: true with endCursor: null, the next iteration re-requests the first page (after=None); if endCursor repeats the cursor just used, the same page is re-fetched forever. There is no page cap. Each iteration is a real gh api graphql call and appends the same repos to the result list again, so the loop also grows memory unboundedly.
Node handling in the same loop is unguarded (ghb_common.py:113): n["nameWithOwner"] is subscripted directly, so a null node or a node missing the field raises mid-loop.
Verified this run (probe on the laptop, real ghb_common.py verbatim, run stubbed with canned GraphQL pages; probe dir ~/git/fleet/probe-ghb-inventory-pagination)
- Control (page 1
hasNextPage=true, endCursor=CURSOR1, page 2hasNextPage=false): returned 2 repos in 2 calls — terminates correctly. hasNextPage=true, endCursor=nullon every page: never returned — exceeded 200 stubbedghcalls and was still looping when the probe aborted it.hasNextPage=true, endCursor=CURSOR1(never advances): never returned — same >200 calls.- A
nullentry innodes:TypeError: 'NoneType' object is not subscriptable— the whole owner's inventory raises. - A node missing
nameWithOwner:KeyError: 'nameWithOwner'— same whole-owner failure.
Why it matters
- The only caller is the weekly reconcile sweep (
reconcile.py:79→inventory(cfg["owners"]),github-backup-reconcile.service,Type=oneshot, no timeout set in the unit). A non-advancing cursor wedges that sweep forever: plan.json is never rewritten, no error is recorded, and the run issues one GraphQL request per iteration indefinitely (API quota burn). - The failure mode bypasses the system's own safety net: reconcile's last-known-good retention (github-backup(inventory): a null repositoryOwner is silently read as 'this owner has no repos' — reconcile drops the owner's mirrors from plan.json and MANIFEST.json and exits 0 #3229,
reconcile.py:87+) engages only wheninventory()records an owner error (a raised exception). A hang raises nothing, so the protection never engages and nothing alerts. - The node-shape crashes are the milder sibling: one malformed node fails the entire owner's inventory (caught per-owner by
inventory(), so the owner falls back to last-known-good and never refreshes while the shape persists), instead of the bad node being named and skipped under the github-backup(fetch): a valid-JSON but wrong-shape plan/state entry crashes the whole daily fetch — one poison entry in plan.json or state.json wedges every repo, every day #6637 poison-entry discipline the rest of this system already follows.
Acceptance criteria
inventory_ownerraises a namedRuntimeError(soinventory()records an owner error and reconcile's last-known-good path engages) when a page reportshasNextPagewith anendCursorthat is null/empty or equal to the cursor used for that page — i.e. pagination must prove progress on every iteration.- A hard page bound (generous, e.g. well above the largest owner's real page count) backstops the loop even if cursor semantics change again.
- A null node, or a node without a string
nameWithOwner, is named and skipped (or fails the owner with a named shape error) — it must not surface as a rawTypeError/KeyErrortraceback from the subscript. - Tests in
infra/github-backup/tests/test_inventory_owner.py(stubbed-runstyle already used there): null-cursor page, stuck-cursor page, null node, and missing-field node cases, plus the existing terminating two-page control still passing. - The existing inventory tests and the github-backup test workflow stay green.
Metadata
Metadata
Assignees
Labels
app/github-backupinfra/github-backup estate mirror systeminfra/github-backup estate mirror systemkind/bugSomething isn't working (prefixed form of the classic bug label)Something isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)Ordinary priority (the default)source/creatorFiled by the new-issue-creator jobFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted testsQueue packet kind: bounded fix with reproduction and targeted tests
Activity
developing-today commentedon Nov 7, 2026
CODE-2109
dezren39 commentedon Nov 7, 2026
🤖 Agent note · filed
~/git/fleet/probe-ghb-inventory-pagination(laptop, real ghb_common.py verbatim @ f74a3de); body filecreator-a-2026-11-07-0035/issue-ghb-inventory-pagination.mdin the goal hidden_files.developing-today commentedon Nov 8, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 9, 2026
Picked up by
repo-worker-code-u— working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live whilerepo-worker-code-uposts progress markers; after 30 minutes of silence any other worker may pick this up.)dezren39 commentedon Nov 9, 2026
Progress from
repo-worker-code-u: verified: issue open, no held labels, no superseding PR; implementing inventory_owner pagination progress check + page bound + node guard with testsdezren39 commentedon Nov 9, 2026
Progress from
repo-worker-code-u: reproduced: cursor-progress fix already on main via PR #6574 (36/36 existing tests pass); remaining defects reproduced on current main - null node TypeError, missing nameWithOwner KeyError, ever-advancing cursor unbounded; worktree ~/git/fleet/6840 branch queue/6840-6840-inventory-owner-pagination at 62fca51; implementing page bound + node guard + testsdezren39 commentedon Nov 9, 2026
Progress from
repo-worker-code-u: implementation_complete: MAX_INVENTORY_PAGES=1000 bound + malformed-node named skip in inventory_owner; targeted test 51/51, full github-backup suite 12/12 files pass on laptop; committing and opening PRfix(github-backup): bound inventory_owner pagination and skip malform…
dezren39 commentedon Nov 9, 2026
Released by
repo-worker-code-u(outcome: done). fixed_merged: PR #7934 #7934 squash-merged ac3320f, issue #6840 closed by merge. Remainder after PR #6574 (cursor-progress RuntimeError already on main): MAX_INVENTORY_PAGES=1000 hard page bound raising named RuntimeError, and malformed nodes (null / missing / non-string nameWithOwner) named on stderr and skipped per #6637. Tests: test_inventory_owner.py 51/51 (36 pre-existing + 15 new), full github-backup suite 12/12 files pass on laptop. CI: PR checks stayed QUEUED (fleet CI stall) — merged under standing merge authority on local suite evidence; Codex review failed on usage limits, zero findings posted. Bookkeeping: sweep.log + backlog-code.md lines at 2026-11-09T03:41Z.dezren39 commentedon Nov 9, 2026
🤖 Agent note · done
dezren39 commentedon Nov 9, 2026
Agent note - done (already_done). Agent: repo queue worker, lane code-o (repo-worker-code). Task: task 11057 for issue #6840 (small_fix, attempt 3/4). Fresh verification 2026-11-09T10:42Z: issue #6840 CLOSED (2026-11-09T03:38:31Z, status:done); the work landed via PR #7934, squash-merged 2026-11-09T03:38:30Z as ac3320f (fallback-lane code-u run; MAX_INVENTORY_PAGES=1000 bound, remainder after PR #6574). No work remains; completing task 11057 as already_done.