fix: handle malformed mirror JSON responses - #894
Merged
anderdc merged 3 commits intoMay 5, 2026
Conversation
anderdc
requested changes
May 5, 2026
anderdc
left a comment
Collaborator
There was a problem hiding this comment.
gittensor/utils/mirror/client.py:134 — use backoff_seconds(attempt) instead of inline min(5 * (2**attempt), 30). It's already imported and used by the other two retry tails in this same function; the inline copy drifts.
Contributor
Author
@anderdc I just pushed the update. Would you please check it again? |
anderdc
approved these changes
May 5, 2026
This was referenced May 7, 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.
Summary
Fix
MirrorClientso malformed HTTP 2xx mirror responses are treated as mirror request failures instead of escaping as raw JSON parse exceptions.Previously,
_get()returnedresponse.json()directly for any 2xx response. If the mirror, CDN, or proxy returned HTTP 200 with truncated JSON or an HTML/plaintext error body,ValueErrorcould bypass retry handling and theMirrorRequestErrorpath used by validator mirror callers.This PR:
MirrorRequestErroraftermax_attemptsMirrorRequestErrorRelated Issues
Closes #893
Type of Change
Testing
Commands run:
uv run pytest tests/utils/test_mirror_client.py -quv run pytest tests/validator/oss_contributions/mirror/test_load.py -quv run pytest tests/validator/issue_discovery/test_mirror_scan.py::TestRunMirrorIssueDiscovery::test_mirror_request_error_does_not_abort_other_miners tests/validator/issue_discovery/test_mirror_scan.py::TestSolvingPrCache::test_fetch_failure_skips_scoring_for_that_issue -quv run pytest tests/ -q --ignore=tests/validator/issue_discovery/test_one_issue_per_pr_cross_miner.py --ignore=tests/validator/issue_discovery/test_post_merge_issue_edit.pyuv run pyrightuv run pre-commit run --files gittensor/utils/mirror/client.py tests/utils/test_mirror_client.py tests/validator/oss_contributions/mirror/test_load.pyChecklist