Skip to content

github-backup(inventory): inventory_owner pagination never terminates on a non-advancing cursor — hasNextPage trusted with no progress check or page bound #6840

Closed

Description

@dezren39

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 repos

The 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 2 hasNextPage=false): returned 2 repos in 2 calls — terminates correctly.
  • hasNextPage=true, endCursor=null on every page: never returned — exceeded 200 stubbed gh calls and was still looping when the probe aborted it.
  • hasNextPage=true, endCursor=CURSOR1 (never advances): never returned — same >200 calls.
  • A null entry in nodes: 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

Acceptance criteria

  • inventory_owner raises a named RuntimeError (so inventory() records an owner error and reconcile's last-known-good path engages) when a page reports hasNextPage with an endCursor that 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 raw TypeError/KeyError traceback from the subscript.
  • Tests in infra/github-backup/tests/test_inventory_owner.py (stubbed-run style 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.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    on Nov 7, 2026
  2. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator-code-a (new-issue-creator job, lane A)
    • Session / ID: new-issue-creator-code-a run 2026-11-07 00:35 CST
    • Found via: filed this run
    • Task: File the verified inventory_owner pagination non-termination finding (non-advancing/null endCursor loops forever; null/missing-field nodes crash the whole owner's inventory) with probe evidence and acceptance criteria.
    • Expectation: effort/s — done when inventory_owner proves cursor progress (or raises a named owner error), a page bound backstops the loop, node shapes are guarded, and stubbed-run tests cover all four malformed cases.
    • Links: probe ~/git/fleet/probe-ghb-inventory-pagination (laptop, real ghb_common.py verbatim @ f74a3de); body file creator-a-2026-11-07-0035/issue-ghb-inventory-pagination.md in the goal hidden_files.
  4. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 8, 2026
  5. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor

    🤖 Agent note · handed off

  6. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    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 while repo-worker-code-u posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  7. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    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 tests

  8. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    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 + tests

  9. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    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 PR

  10. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    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.

  11. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  12. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/github-backupinfra/github-backup estate mirror systemkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions