feat(miners): add cursor pagination to windowed POST pulls/issues endpoints#191
Merged
Merged
Conversation
…points The per-repo windowed POST /miners/:id/pulls and /issues endpoints ran unbounded: every matched PR/issue executes the inlined labels and linked-issues subqueries, so a high-volume author's request exceeds the validator's 30s read timeout and the miner is skipped onto a stale cached evaluation. Mirror the cursor pagination from the GET paths (#126) onto the windowed variants: optional cursor/limit query params, keyset on (created_at, lower(repo_full_name), number), and a next_cursor in the response. Default (no cursor/limit) responses stay unbounded, so callers that have not adopted pagination are unaffected.
entrius
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
The per-repo windowed
POST /api/v1/miners/:id/pullsand/issuesendpoints run unbounded: every matched PR/issue executes the inlinedlabels+linked_issuessubqueries, so a high-volume author's request exceeds the validator's 30s read timeout. The validator then catches the error, falls the miner back to a stale cached evaluation, and the miner's new PRs/issues never get ingested.Observed live:
POST /miners/156195510/pulls(kiannidev, 621 PRs) reliably read-times-out at 30s × 3 attempts; same for the other two highest-volume miners (UIDs 29, 212). The mirror has the data — it's purely query latency on the unbounded windowed read.What
Mirror the cursor pagination already shipped for the GET paths (#126) onto the windowed POST variants:
getPullRequestsByRepo/getIssuesByRepoaccept an optionalpaginationarg: keyset on(created_at, LOWER(repo_full_name), number), deterministic matchingORDER BY,LIMIT, and anext_cursorin the response.POST /pullsand/issuesaccept optional?cursor=/?limit=query params (body stays thesince_by_repomap), routed through the existingparsePaginationQuery.Compatibility
Default responses (no
cursor/limit) stay unbounded and unchanged, so validators that have not yet adopted paging are unaffected. The companion gittensor change (validator followsnext_cursor) ships only after this deploys.Verify
format:check,lint, andnest buildall pass.