GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — github-backup(drain): queue_events pagination has no page/event bound — a Worker page stream with fresh cursors and list_complete=false loops forever, accumulating events and never acking · Issue #6572 · developing-today/code

github-backup(drain): queue_events pagination has no page/event bound — a Worker page stream with fresh cursors and list_complete=false loops forever, accumulating events and never acking #6572

New issue
Copy link
New issue
Copy link
Closed
#6702
Closed
github-backup(drain): queue_events pagination has no page/event bound — a Worker page stream with fresh cursors and list_complete=false loops forever, accumulating events and never acking#6572
#6702
Copy link
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 jobsource/design-architectFiled by the repo design architect jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Description

@dezren39
dezren39
opened on Nov 6, 2026
Issue body actions

Problem

queue_events() in infra/github-backup/bin/drain_queue.py:95-122 follows Worker queue pages in an unbounded while True loop. It guards two stuck shapes — a missing/empty cursor (:114-115) and a repeated cursor (:116-118) — but a page stream that always returns list_complete: false with a fresh, never-repeated cursor loops forever:

  • every iteration performs another worker_req HTTP request (60 s timeout each, :73) and events.extend(page_events) (:109), so the accumulated event list grows without bound in memory;
  • queue_events never returns, so main() never reaches the ack policy, the state.json write, or exit — no event is acked, no failure is logged, and the run never surfaces an error;
  • the drainer runs as a Type=oneshot systemd service on a 5-minute timer (infra/github-backup/systemd/github-backup-drain.service / .timer, no TimeoutStartSec in the unit), so one stuck drain wedges the webhook freshness layer until something external kills it.

The Worker side (infra/github-backup/worker/src/index.js:60-82) passes Cloudflare KV's list.cursor / list_complete straight through, so the cursor stream is an external system's output, not something the drainer controls. A KV listing that keeps producing incomplete pages with advancing cursors — e.g. during a large backlog drain (the queue has held ~5.9k events, #5496) while new webhook events keep being written — is exactly the shape with no exit.

Evidence (verified this run, laptop @ origin/main 26f51c3)

Probe ~/git/fleet/probe-ghb-drain-pages/probe.py imports the real drain_queue module and stubs only worker_req:

  • Control, 2 pages then list_complete: true → returns 2 events in 2 calls. ✅
  • Repeated cursor → RuntimeError: Worker queue pagination cursor repeated. ✅ (existing guard)
  • Missing cursor with list_complete: false → RuntimeError: Worker queue response is incomplete but has no cursor. ✅ (existing guard)
  • Defect: every page returns list_complete: false with a novel cursor (cursor-1, cursor-2, …) and one event → the loop was still running at 5,000 fetched pages / 5,000 accumulated events when the probe stopped it externally with its own sentinel exception. queue_events raised no error of its own and never returned.

Sibling oracles in this repo guard the same failure mode by progress, and one sibling already had the missing-cursor half of this bug filed: ghb_common.inventory_owner (#6532, null endCursor re-fetching page 1 forever), and pkgs/cold-store-reaper/cold_store.py s3_list_objects / list_backups, whose docstrings call out "would loop forever, appending duplicates" and raise on missing/repeated continuation tokens. The drain loop is missing the remaining half: a bound.

Why it matters

The drainer is the freshness layer of the github-backup system (webhook events → mirror fetches, every 5 minutes). A single stuck page stream silently freezes it: mirrors stop reflecting pushes, events pile up in the Worker queue un-acked, and nothing logs or exits non-zero, so systemd shows a running/failed unit rather than the chronic-failure alarms the rest of this system was built to raise (#3219/#3300 pattern). Unbounded in-memory accumulation is a second, slower failure on top.

Acceptance criteria

  • queue_events terminates with a loud error (non-zero drain exit, naming the pagination bound that was hit) when a Worker page stream exceeds a bounded budget — e.g. a maximum page count and/or a maximum total accumulated events; the exact bound is triage's call, but it must be comfortably above the largest legitimate backlog (the queue has held ~5.9k events; pages are 500 events).
  • No event from an aborted poll is acked (the existing fail-closed-before-ack property is preserved).
  • Regression tests in infra/github-backup/tests/test_drain_queue.py style: novel-cursor-never-complete stream raises after the bounded number of pages; the existing two-page, repeated-cursor, and missing-cursor cases still pass.
  • The legitimate multi-page drain (healthy events beyond 500 retained failures, existing test 14) still completes.

Distinct from #6532 (inventory_owner GraphQL cursor in ghb_common.py) and #3240 (non-atomic state files): this is the drainer's Worker-KV pagination loop in drain_queue.py.

Activity

Next
  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    source/creatorFiled by the new-issue-creator job
    on Nov 6, 2026
  2. developing-today commented on Nov 6, 2026

    @developing-today
    developing-todayBot
    on Nov 6, 2026 – with developing.today
    Contributor
    More actions

    CODE-1998

  3. dezren39
    added
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued queue task
    app/github-backupinfra/github-backup estate mirror system
    on Nov 6, 2026
  4. dezren39 commented on Nov 6, 2026

    @dezren39
    dezren39
    on Nov 6, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: new-issue-creator-code-a cron run, 2026-11-06 10:35 CST
    • Found via: filed this run
    • Task: Filed issue github-backup(drain): queue_events pagination has no page/event bound — a Worker page stream with fresh cursors and list_complete=false loops forever, accumulating events and never acking #6572 — drain_queue.queue_events pagination has no page/event bound; a Worker page stream with fresh cursors and list_complete=false loops forever, accumulating events in memory and never reaching the ack policy. Verified on the laptop @ origin/main 26f51c3 with probe ~/git/fleet/probe-ghb-drain-pages (real drain_queue module, stubbed worker_req): 2-page control returns, repeat/missing-cursor guards raise, novel-cursor stream still looping at 5,000 pages when stopped externally.
    • Expectation: effort s; done = triage verdict, then a bounded-pagination fix with regression tests per the issue's acceptance criteria.
    • Links: issue github-backup(drain): queue_events pagination has no page/event bound — a Worker page stream with fresh cursors and list_complete=false loops forever, accumulating events and never acking #6572; queue packet to be enqueued this run (repo-health-code-pilot, triage)
  5. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 6, 2026
  6. dezren39 commented on Nov 6, 2026

    @dezren39
    dezren39
    on Nov 6, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), lane code-r
    • Session / ID: task 11233
    • Found via: queue claim
    • Task: triage issue github-backup(drain): queue_events pagination has no page/event bound — a Worker page stream with fresh cursors and list_complete=false loops forever, accumulating events and never acking #6572 — verify the drain_queue queue_events pagination claim at current main, reproduce or refute, and route (fix task / close with evidence)
    • Expectation: effort s; done = verdict comment on issue github-backup(drain): queue_events pagination has no page/event bound — a Worker page stream with fresh cursors and list_complete=false loops forever, accumulating events and never acking #6572 with file:line evidence at current main and a routed follow-up if confirmed
    • Links: issue github-backup(drain): queue_events pagination has no page/event bound — a Worker page stream with fresh cursors and list_complete=false loops forever, accumulating events and never acking #6572
  7. 14 remaining items

  8. dezren39
    added
    work/assignedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    on Nov 7, 2026
  9. dezren39 commented on Nov 7, 2026

    @dezren39
    dezren39
    on Nov 7, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), lane code-p
    • Session / ID: repo-queue-worker-shift-p cron run 2026-11-06 20:17 CST — FALLBACK MODE (queue backend down, HTTP 503 PGRST002; fallback claim marker is the claim of record for issue github-backup(drain): queue_events pagination has no page/event bound — a Worker page stream with fresh cursors and list_complete=false loops forever, accumulating events and never acking #6572, no broker task id exists this shift)
    • Found via: queue fallback scan (queue/queued label, scan order)
    • Task: implement the fix for issue github-backup(drain): queue_events pagination has no page/event bound — a Worker page stream with fresh cursors and list_complete=false loops forever, accumulating events and never acking #6572 — bound queue_events() pagination in infra/github-backup/bin/drain_queue.py with named page/event bounds + regression tests. Triage already CONFIRMED (lane code-r, task 11233); this issue is Phase 2 of design Design: complete, bounded, or say so — one pagination contract for the repo's paged reads #6622 and independent of Phase 1 in code, bound value is the fixer's call as a named constant
    • Expectation: effort s–m; done = fix on a branch + PR, targeted tests passing on the laptop, merged if verified
    • Links: claim marker comment above
  10. dezren39 commented on Nov 7, 2026

    @dezren39
    dezren39
    on Nov 7, 2026
    MemberAuthor
    More actions

    Heartbeat: implementation_complete + targeted_tests_passed — branch queue/6572-drain-pagination-bound in laptop worktree ~/git/fleet/6572: MAX_QUEUE_PAGES=100 / MAX_QUEUE_EVENTS=50_000 named bounds in queue_events(), errors name the bound hit, fail-closed before ack preserved. test_drain_queue.py: 89/89 checks pass on the laptop (7 new scenario-17 checks: novel-cursor stream raises exactly at the bound, huge-page stream trips the event bound, completion exactly at the bound returns). Independent probe of the filing run's defect shape: raised after exactly 100 pages. Next: commit, PR, Codex/CI check, merge if clean.

  11. dezren39
    added a commit that references this issue on Nov 7, 2026

    fix(github-backup/drain): bound queue_events pagination (#6572)

    0fbe899
  12. developing-today
    added
    status:in-review
    on Nov 7, 2026
  13. dezren39
    closed this as completedin #6702on Nov 7, 2026
  14. dezren39
    added a commit that references this issue on Nov 7, 2026

    Merge pull request #6702 from developing-today/queue/6572-drain-pagin…

    2aa4143
  15. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 7, 2026
  16. dezren39 commented on Nov 7, 2026

    @dezren39
    dezren39
    on Nov 7, 2026
    MemberAuthor
    More actions

    Released by repo-worker-code-p (fallback mode): issue #6572 fixed and merged via PR #6702 (#6702, merge 2aa4143) — queue_events() pagination now bounded by MAX_QUEUE_PAGES=100 / MAX_QUEUE_EVENTS=50_000 with bound-naming RuntimeErrors, fail-closed before ack. Verified: test_drain_queue.py 89/89 on the laptop (7 new scenario-17 checks), independent defect-shape probe raised at exactly 100 pages, Codex review on PR #6702 completed with no findings, fix confirmed present on main. Issue auto-closed by the PR's Fixes line.

  17. dezren39 commented on Nov 7, 2026

    @dezren39
    dezren39
    on Nov 7, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane code-p
    • Session / ID: repo-queue-worker-shift-p cron run 2026-11-06 20:17 CST — FALLBACK MODE (queue backend down, code#6619; fallback markers are the claim of record, no broker task id this shift)
    • Found via: queue fallback scan (queue/queued label, scan order)
    • Task: issue github-backup(drain): queue_events pagination has no page/event bound — a Worker page stream with fresh cursors and list_complete=false loops forever, accumulating events and never acking #6572 complete — fix implemented on branch queue/6572-drain-pagination-bound, PR fix(github-backup/drain): bound queue_events pagination (#6572) #6702 merged (2aa4143), issue auto-closed; design Design: complete, bounded, or say so — one pagination contract for the repo's paged reads #6622 Phase 2 obligation for the drain loop discharged
    • Expectation: nothing further; labels stripped to the terminal state
    • Links: PR fix(github-backup/drain): bound queue_events pagination (#6572) #6702
  18. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 7, 2026
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 jobsource/design-architectFiled by the repo design architect 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

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.