Skip to content

fix: report PAT check as inconclusive on transient GitHub /user failures#1123

Closed
statxc wants to merge 1 commit into
entrius:testfrom
statxc:fix/pat-check-transient
Closed

fix: report PAT check as inconclusive on transient GitHub /user failures#1123
statxc wants to merge 1 commit into
entrius:testfrom
statxc:fix/pat-check-transient

Conversation

@statxc
Copy link
Copy Markdown
Contributor

@statxc statxc commented May 9, 2026

Summary

When the GitHub /user endpoint is temporarily unreachable, handle_pat_check was reporting stored PATs as invalid (pat_valid = False), which surfaces in gitt miner check as a hard "PAT invalid" message. That can push miners to rotate a token that's actually fine — the validator just couldn't reach GitHub.

This PR keeps the existing failure path for permanent errors and adds a third state for transient failures: pat_valid = None (inconclusive) with a short "please retry in a few minutes" message. The check handler now uses validate_github_credentials_result() so the transient_failure flag introduced in #932 isn't dropped.

The broadcast handler is intentionally not changed — it already rejects the PAT and short-circuits the same way before and after, so swapping the rejection string there isn't worth the extra surface area.

Related Issues

Closes #1106

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Testing

  • Tests added/updated
  • Manually tested

Added test_transient_identity_lookup_reports_inconclusive — patches get_github_identity to return TRANSIENT_FAILURE end-to-end and asserts pat_valid is None, the inconclusive message, and that the GraphQL test query is not called (proves the early return).

Updated test_valid_pat and test_stored_but_invalid_pat to patch the new symbol (validate_github_credentials_result); behavior assertions are unchanged.

Local run:

uv run pytest tests/validator/test_pat_handler.py -v   # 22 passed
uv run pytest tests/                                   # 1450 passed
uv run ruff check  gittensor/validator/pat_handler.py tests/validator/test_pat_handler.py
uv run ruff format --check gittensor/validator/pat_handler.py tests/validator/test_pat_handler.py
uv run pyright   gittensor/validator/pat_handler.py tests/validator/test_pat_handler.py

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 9, 2026
@statxc statxc force-pushed the fix/pat-check-transient branch from 8160645 to fbe7417 Compare May 9, 2026 00:43
@xiao-xiao-mao
Copy link
Copy Markdown

xiao-xiao-mao Bot commented May 9, 2026

duplicate of #1107.

@xiao-xiao-mao xiao-xiao-mao Bot closed this May 9, 2026
@statxc
Copy link
Copy Markdown
Contributor Author

statxc commented May 9, 2026

@anderdc Hi, could you please take look at this PR carefully?
It handles same issue 1107 but it’s not actually the same change. I think this one is more solid. Could you please reopen it? thanks

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.

[Bug] pat_handler treats transient GitHub /user failures as invalid PATs in validator-side broadcast/check handlers

1 participant