fix: don't cache fabricated zero when mirror scoring_data_stored=False - #968
Merged
anderdc merged 5 commits intoMay 8, 2026
Merged
Conversation
ai-mountain
force-pushed
the
fix/mirror-issue-discovery-cache-unavailable
branch
from
May 4, 2026 16:48
ef33390 to
3643e5e
Compare
Contributor
Author
|
@anderdc Could you please review this please? Thanks |
anderdc
approved these changes
May 8, 2026
Contributor
Author
|
@anderdc I've fixed CI test failures. |
anderdc
approved these changes
May 8, 2026
Contributor
Author
|
@anderdc Thanks. |
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
In
_resolve_solving_pr_score(gittensor/validator/issue_discovery/mirror_scan.py), a mirror response withscoring_data_stored=Falsewas treated as a successful fetch of an empty diff —mirror_files_to_legacy()returned no file changes,calculate_base_score_for_pr_files()returnedbase_score=0 / token_score=0, and that fabricated zero was committed to the cross-miner solving-PR cache. Sibling miners' lookups against the same(repo, pr_number)then served the cached zero with no in-cycle retry, even after the mirror finished its backfill mid-cycle.This PR adds an explicit guard immediately after the
MirrorRequestErrorbranch: whenfiles_response.scoring_data_stored is False, incrementcache_stats.fetch_failures, log a warning that mentions data unavailability (not "below threshold"), and returnNonewithout writing tocache. Parity with the existingMirrorRequestErrorhandling — same three actions, same callsite-visible semantics.Scope: only
gittensor/validator/issue_discovery/mirror_scan.pyand its sibling test file. No change tomirror/scoring.pyand no change to credibility/eligibility behaviorRelated Issues
Closes #836
Type of Change
Testing
tests/validator/issue_discovery/test_mirror_scan.py::TestCacheStats— 2 new cases:test_resolve_treats_unavailable_scoring_data_as_failure— single call: assertsresult is None,fetch_failures == 1, empty cache.test_unavailable_scoring_data_is_not_cached_across_sibling_lookups— the literal acceptance criterion from [Bug] Mirror issue-discovery caches a fabricated zero score when scoring_data_stored=False #836: two issues sharing one solving PR,scoring_data_stored=Falsereturned both times →misses == 2,fetch_failures == 2,cache == {},client.get_pr_files.call_count == 2.uv run pre-commit run --all-files).uv run pre-commit run --all-files --hook-stage pre-push).Checklist
oss_contributions/mirror/scoring.py).cachestays empty on availability failure, leaving the slot open for sibling miners' in-cycle retries.