GeezerVison is showing github.com — fix(github-backup): paginate queue polling (#3476) by dezren39 · Pull Request #3484 · developing-today/code
Conversation
dezren39
commented
Nov 1, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
GET /queue?cursor=… -> one KV page + cursor/list_complete
↓
drain_queue follows all pages -> existing fetch/ack policy
- Worker forwards the optional cursor and exposes KV pagination metadata.
- Drainer collects every page before applying the existing ack policy; incomplete or repeated cursors fail closed.
- Add Worker route coverage and the 500 retained failures + later healthy event regression. Failed events remain unacked.
Fixes #3476
Evidence
Merge Danger
Door: two-way
Blast Radius: narrow
The change affects only the authenticated queue polling response and its drainer. Existing event acknowledgement policy and the 500-item per-page limit are preserved.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by CodeRabbit
-
Improvements
- Queue retrieval now supports pagination, allowing large queues to be processed across multiple pages.
- Queue acknowledgements are sent in batches, including when processing large numbers of events.
-
Bug Fixes
- Added safeguards for incomplete or invalid pagination responses to prevent unreliable queue processing.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-11-04T07:24:31.565927Z |
ae02486 |
New commits |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Caution
Review failed
The pull request is closed.
Walkthrough
-
The Worker now exposes queue pagination metadata. The drainer follows pages before applying its acknowledgement policy and sends acknowledgements in batches of up to 500 IDs. Tests cover pagination, retained failed events, acknowledgement batches, and unauthenticated requests.
Changes: Queue pagination and draining
| Layer / File(s) |
Summary |
Worker queue pagination infra/github-backup/worker/src/index.js, infra/github-backup/worker/test/index.test.mjs |
The /queue endpoint passes an optional cursor to KV listing and returns events with a cursor and list_complete status. Tests check pagination responses and that unauthenticated requests do not call KV list. |
Drainer pagination and acknowledgment batches infra/github-backup/bin/drain_queue.py, infra/github-backup/tests/test_drain_queue.py |
The drainer follows pages and validates event data and pagination cursors. It acknowledges IDs in batches of 500. Tests check that a healthy event after 500 failing events is processed and that 1,200 events produce three acknowledgement requests. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)
sequenceDiagram
participant Drainer as drain_queue.py
participant Worker as GET /queue
participant KV as GHB_EVENTS
Drainer->>Worker: Request queue page with cursor
Worker->>KV: List events with prefix, limit, and cursor
KV-->>Worker: Return events and pagination metadata
Worker-->>Drainer: Return events, cursor, and list_complete
Drainer->>Worker: Request another page when listing is incomplete
Drainer->>Worker: Acknowledge IDs in batches of up to 500
Loading
Merge Risk: Minimal · up to ae024
-
The pagination and bounded acknowledgment changes have no established blocking defect. Comparing exact acknowledged IDs would strengthen the batching regression test.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21a4e83fa4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+87
to
+89
|
|
events.extend(page_events)
|
|
|
if page.get("list_complete", True):
|
|
|
return events
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Batch acknowledgements after collecting multiple queue pages
When a backlog contains more than 1,000 ackable events, collecting every page makes main() send all their IDs in a single /queue/ack request. That Worker handler performs one awaited KV delete per ID, but Cloudflare limits each invocation to 1,000 KV operations, so the request fails after partially deleting the batch and the drainer exits with an error. Previously, the 500-event polling limit kept acknowledgements below this ceiling. Split acknowledgements into bounded requests so multi-page backlogs can drain successfully.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed: acknowledgements are now sent through ack_events(), which batches ids at ACK_BATCH_SIZE = 500 per /queue/ack request — well under the Worker's 1,000-KV-operation invocation limit — so multi-page backlogs drain completely instead of failing mid-batch. Regression test in test_drain_queue.py case 15: 1,200 ackable events produce 3 bounded ack requests with every event acked (63/63 checks pass).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
🤖 Agent note · parked (task 8248, lane code-e)
Parking task 8248: the Codex gate blocks merge of PR #3484 — one undispositioned P2 finding, reverified fresh 2026-11-04 (no replies on the thread):
- drain_queue.py (comment 4435215151) — batch acknowledgements after collecting multiple queue pages: when a backlog contains more than 1,000 ackable events, acks must be batched within KV limits.
Resume condition: fix that finding on PR #3484 (or reply-disposition it with reasoning), then merge when the PR is mergeable and all findings are dispositioned.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
# Conflicts:
# infra/github-backup/bin/drain_queue.py
# infra/github-backup/tests/test_drain_queue.py
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|