Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions gittensor/validator/issue_discovery/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,19 @@ async def run_issue_discovery(
try:
current_response = await asyncio.to_thread(client.get_miner_issues, evaluation.github_id)
except MirrorRequestError as e:
bt.logging.warning(f'├─ UID {uid}: open-issue count fetch failed ({e}) — skipped this miner')
_restore_issue_discovery_from_cache(evaluation, evaluation_cache)
fetch_errors += 1
continue

open_counts = _count_open_issues(current_response.issues, enabled_names)
# Soft-fail: the open-count call is supplementary to the scoring
# payload already fetched above. Discarding fresh solved-issue
# evidence because of a transient open-count failure penalises
# miners for mirror flakiness. Fall back to last cycle's per-repo
# open counts when available; otherwise zero. Scoring proceeds.
open_counts = _open_counts_from_cache(evaluation, evaluation_cache, enabled_names)
bt.logging.warning(
f'├─ UID {uid}: open-issue count fetch failed ({e}) — '
f'using cached open counts ({sum(open_counts.values())} total); '
f'scoring proceeds with fresh lookback data'
)
else:
open_counts = _count_open_issues(current_response.issues, enabled_names)
filtered = [i for i in response.issues if i.repo_full_name in enabled_names and _should_include_issue(i)]
if not filtered:
_clear_issue_discovery_fields(evaluation)
Expand Down Expand Up @@ -362,6 +369,28 @@ def _count_open_issues(issues: List[MirrorIssue], enabled_names: Set[str]) -> Di
return counts


def _open_counts_from_cache(
evaluation: MinerEvaluation,
evaluation_cache: Optional[MinerEvaluationCache],
enabled_names: Set[str],
) -> Dict[str, int]:
"""Recover per-repo open-issue counts from the prior cycle's cached
evaluation. Used as the soft-fail fallback when the open-count fetch
fails but the scoring fetch succeeded, so fresh solved-issue evidence
isn't discarded. Returns {} when no cache row is available — scoring
then runs with zero open counts rather than dropping the miner."""
if evaluation_cache is None:
return {}
cached = evaluation_cache.get(evaluation.uid, evaluation.hotkey, evaluation.github_id or '')
if cached is None:
return {}
counts: Dict[str, int] = {}
for repo_name, repo_eval in cached.repo_evaluations.items():
if repo_name in enabled_names and repo_eval.total_open_issues:
counts[repo_name] = repo_eval.total_open_issues
return counts


def _build_solving_pr_cache(
miner_evaluations: Dict[int, MinerEvaluation],
) -> Dict[Tuple[str, int], CachedSolvingPR]:
Expand Down