Skip to content

fix(cache): expire stale evaluation fallbacks#1307

Open
JSONbored wants to merge 1 commit into
entrius:testfrom
JSONbored:codex/cache-freshness-policy
Open

fix(cache): expire stale evaluation fallbacks#1307
JSONbored wants to merge 1 commit into
entrius:testfrom
JSONbored:codex/cache-freshness-policy

Conversation

@JSONbored
Copy link
Copy Markdown

Summary

  • Add a bounded freshness policy for miner evaluation cache fallback.
  • Track issue-discovery cache freshness separately from the PR-side cache entry.
  • Prevent expired issue-discovery aggregates from being restored through either direct issue fallback or PR cache fallback.

What changed

  • Added EVALUATION_CACHE_MAX_AGE_SECONDS with a six-hour fallback window.
  • Added freshness checks to MinerEvaluationCache.get() and a dedicated get_issue_discovery() accessor.
  • Preserved issue-discovery fields across OSS stores only while their own refresh timestamp is fresh.
  • Added cache unit tests and issue-discovery regression coverage for expired fallback behavior.

Why

Cache fallback is useful for short-lived upstream failures, but old evaluation data should not remain reward-active indefinitely. The PR-side and issue-discovery cache fields refresh at different points in the validator round, so both need explicit freshness handling.

Validation

  • uv run pytest tests/validator/test_miner_evaluation_cache.py tests/validator/issue_discovery/test_scan.py tests/validator/test_github_identity_fallback.py tests/validator/oss_contributions/mirror/test_routing.py tests/validator/oss_contributions/mirror/test_classes_integration.py -q
  • uv run ruff check gittensor/classes.py gittensor/constants.py gittensor/validator/issue_discovery/scan.py tests/validator/test_miner_evaluation_cache.py tests/validator/issue_discovery/test_scan.py
  • uv run ruff format --check gittensor/classes.py gittensor/constants.py gittensor/validator/issue_discovery/scan.py tests/validator/test_miner_evaluation_cache.py tests/validator/issue_discovery/test_scan.py
  • uv run pyright gittensor/classes.py gittensor/constants.py gittensor/validator/issue_discovery/scan.py tests/validator/test_miner_evaluation_cache.py tests/validator/issue_discovery/test_scan.py
  • git diff --check
  • Codex Security source-to-sink review: transient PR fetch failures and mirror issue fetch failures now require fresh matching cache state; expired issue fields are stripped from PR fallback results.
  • CodeRabbit CLI review: blocked by free-tier rate limit after authentication; no CodeRabbit findings were available for this PR.

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 19, 2026
@JSONbored JSONbored marked this pull request as ready for review May 19, 2026 01:19
@JSONbored JSONbored marked this pull request as draft May 19, 2026 01:26
@JSONbored JSONbored marked this pull request as ready for review May 19, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant