fix: fetch newest cross-references for solver lookup so popular issues find the merged PR - #1018
Merged
anderdc merged 3 commits intoMay 9, 2026
Merged
Conversation
…s find the merged PR _PR_TIMELINE_QUERY used `timelineItems(... first: 50)`, returning the OLDEST 50 cross-references on the issue. On any issue that accumulated >50 mentions before the solver PR (long-lived issues bountied later, contested bounties with many miner PRs + review discussion, downstream trackers, bot pings), the solver PR's cross-ref event sits past position 50 and is dropped. The merged-PR + closing-numbers filter then returns [], find_solver_from_cross_references returns (None, None), and the validator votes vote_cancel_issue — refunding the bounty and zeroing the miner who actually did the work. Switch to `last: 50` to fetch the newest cross-references, matching the pattern already used elsewhere in this file (RENAMED_TITLE_EVENT last: 1, LABELED_EVENT last: 5). The downstream merged-PR filter and earliest-merged_at sort are unchanged.
6 tasks
anderdc
approved these changes
May 9, 2026
alpurkan17
pushed a commit
to alpurkan17/gittensor
that referenced
this pull request
May 10, 2026
…s find the merged PR (entrius#1018) Co-authored-by: Ander <61125407+anderdc@users.noreply.github.com>
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.
Summary
_PR_TIMELINE_QUERYin gittensor/utils/github_api_tools.py:412 requestedtimelineItems(itemTypes: [CROSS_REFERENCED_EVENT], first: 50)— the oldest 50 cross-references on the issue. On any issue that accumulated more than 50 cross-references before the solver PR was opened, the solver's cross-ref event sat past position 50 and got dropped. The merged-PR + closing-numbers filter at github_api_tools.py:1005 then returned[],find_solver_from_cross_referencesreturned(None, None), and the validator at issue_competitions/forward.py:115 castvote_cancel_issue— refunding the bounty and zeroing the miner who actually did the work.Switch to
last: 50so the query returns the newest 50 cross-references, matching the pattern already used elsewhere in the same file (RENAMED_TITLE_EVENT, last: 1at line 108;LABELED_EVENT, last: 5at line 130). Downstream filtering and the earliest-merged_attiebreaker are unchanged.Why this triggers in the wild
Cross-references aren't just miner PRs — every
#Nmention from any issue, PR, or comment counts: bot pings (Dependabot, CI), review-discussion comments, "see also" mentions from downstream trackers. 50 fills faster than it sounds.Realistic trigger cases:
Scope
merged_atASC sort still picks the earliest closing PR among matches. No behavior change on the happy path.solved_by_prfrom das-github-mirror) was unaffected; only the legacy timeline-based path was vulnerable. Issue-competitions runs against ALL active on-chain issues regardless ofmirror_enabled, so this fix applies broadly.Related
_PR_TIMELINE_QUERYtruncatesclosingIssuesReferencesto 20 nodes for solver lookup #885 —closingIssuesReferences(first: 20)at line 426. Different field, different trigger (a single PR closing >20 issues vs. a single issue accumulating >50 cross-refs).last:pattern fix forLABELED_EVENT.Residual nuance (not in this PR)
last: 50still loses if an issue accumulates >50 cross-refs after the solver merges (heavy post-merge discussion, regressions filed later that mention#N). Smaller blast radius than the current "old issue with prior history" case. Full correctness needsendCursorpagination — can extend this PR or follow up if preferred.Test plan
pytest tests/utils/test_github_api_tools.py -k "cross_references or solver"vote_solutioninstead ofvote_cancel_issueFixes #1017