fix(validator): cache issue-discovery state for zero-PR miners#1324
Open
dripsmvcp wants to merge 3 commits into
Open
fix(validator): cache issue-discovery state for zero-PR miners#1324dripsmvcp wants to merge 3 commits into
dripsmvcp wants to merge 3 commits into
Conversation
…us#1323) Always cache successful OSS-phase evaluations so issue-discovery-only miners get a cache anchor. The previous `total_prs > 0` gate left miners with no PRs (e.g. pure issue-discovery miners, or those whose PRs were all maintainer-filtered) unrecoverable on transient mirror failures, while PR+issue miners were protected — an asymmetry that disproportionately hurt entrius/allways (issue_discovery_share == 1.0). In the OSS-failure fallback, also require `cached_eval.total_prs > 0` before swapping the cached eval in, so an issue-only entry can never masquerade as authoritative PR state. Uses the existing total_prs derived property rather than a new flag; PR lists are already preserved in _build_cache_entry.
anderdc
requested changes
May 23, 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.
total_prs > 0gate left them unrecoverable on transient mirror failures.cached_eval.total_prs > 0guard in the OSS-failure fallback so an issue-only entry can never masquerade as authoritative PR state.Root Cause
Validator.store_or_use_cached_evaluationat neurons/validator.py:170-171 gated the cache write onminer_eval.total_prs > 0. Combined withMinerEvaluationCache.update_issue_discoverybeing a no-op when no entry exists (gittensor/classes.py:620-630), an issue-only miner (no PRs surviving load-time filtering) never got a cache entry. A laterMirrorRequestErrorduring issue discovery had nothing to restore, and the miner was scored zero — asymmetric with PR+issue miners. This disproportionately affectsentrius/allways(issue_discovery_share == 1.0), where PR rewards are skipped entirely and issue discovery is the sole earning surface.Fix
total_prs > 0gate atneurons/validator.py:170-171—store()runs for every successful OSS fetch, including zero-PR miners.cached_eval.total_prs > 0before swapping the cached eval in; an issue-only entry stays in the cache forupdate_issue_discovery/_restore_issue_discovery_from_cachebut is never used as PR fallback. Uses the existingtotal_prsderived property rather than a new flag — the PR lists are already preserved in_build_cache_entry, so no new state to keep in sync.update_issue_discoverydocstring to reflect the new invariant (entries now exist for zero-PR miners too).Test Plan
tests/validator/test_store_or_use_cached_evaluation.pyTestZeroPrCaching::test_zero_pr_miner_is_cached_after_successful_oss_fetchTestZeroPrCaching::test_update_issue_discovery_now_refreshes_zero_pr_entryTestOssFallbackGuard::test_oss_failure_does_not_restore_issue_only_entry_as_pr_stateTestOssFallbackGuard::test_oss_failure_still_restores_entry_with_pr_datatest_zero_pr_miner_is_cached_after_successful_oss_fetchfails ontestwithout the validator change (verified by stashing the fix and re-running).pytest tests/validator/test_store_or_use_cached_evaluation.py tests/validator/issue_discovery/test_scan.pyFixes #1323