Skip to content

feat: add gitt miner status command#353

Open
eureka0928 wants to merge 2 commits intoentrius:testfrom
eureka0928:feat/miner-status
Open

feat: add gitt miner status command#353
eureka0928 wants to merge 2 commits intoentrius:testfrom
eureka0928:feat/miner-status

Conversation

@eureka0928
Copy link
Copy Markdown
Contributor

@eureka0928 eureka0928 commented Apr 9, 2026

Summary

Fixes #354

Adds gitt miner status — a lightweight CLI command that lets miners check their eligibility gate progress and PR overview without running a full validator scoring pipeline.

What it does:

  • Validates the miner's GitHub PAT (single API call)
  • Resolves wallet/hotkey UID on the Bittensor network
  • Fetches PRs across all incentivized repositories using the same GraphQL pipeline as validators (load_miners_prs)
  • Calculates credibility locally using calculate_credibility() (pure math — merged/(merged+closed-mulligan))
  • Displays eligibility status: merged PR count vs threshold, credibility vs minimum

What it does NOT do:

  • No token scoring / tree-sitter / file content fetching — that's validator-side only
  • Shows LIKELY ELIGIBLE with a caveat since the token_score >= 5 threshold can't be verified without the full pipeline (the threshold is very low, so false positives are rare)

Usage

# Basic status check
gitt miner status --wallet alice --hotkey default

# Detailed per-PR breakdown
gitt miner status --wallet alice --hotkey default --detail

# JSON output for scripting
gitt miner status --network test --json-output

Example Output

PAT valid — @alice

Miner Status
UID: 42  |  GitHub: @alice  |  Network: wss://test.finney.opentensor.ai

Eligibility Gate
  Merged PRs:    7/5  pass
  Credibility:   0.88/0.75  pass  (7M/1C, 1 mulligan)
  Status:        LIKELY ELIGIBLE
  Note: Final eligibility depends on token scoring by validators

Lookback Window (35 days)
  Merged: 7  |  Open: 2  |  Closed: 2
  Unique repos: 4
  Open PR threshold: 10 base (increases with token score)

Design Decisions

  • Reuses existing infrastructure: imports _error, _load_config_value, _resolve_endpoint from post.py — no duplication
  • Lazy imports: bittensor, MinerEvaluation, load_miners_prs, calculate_credibility are imported inside the function body to keep gitt --help fast
  • PAT cleared after use: miner_eval.github_pat = None after fetching (line 112)
  • _StatusContext class: consolidates output parameters with derived properties to keep _output_rich / _output_json signatures clean
  • Follows existing CLI patterns: same option style as post/check, Rich status spinners, --json-output flag

Related Issues

Fixes #354

Type of Change

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

Testing

  • Tests added/updated

  • Manually tested

  • All imports verified against current codebase (calculate_credibility, load_miners_prs, load_master_repo_weights, get_github_user, MinerEvaluation)

  • All PullRequest / MinerEvaluation attributes used exist on the dataclasses

  • ruff check — all checks passed

  • ruff format — all files formatted

  • Module loads cleanly: from gittensor.cli.miner_commands.status import miner_status

Checklist

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

@eureka0928
Copy link
Copy Markdown
Contributor Author

Hi @anderdc I put this PR as we discussed on the Discord
Thank you for your review

Shows eligibility gate progress and PR overview using miner's PAT.
Fetches PRs via GitHub GraphQL, calculates credibility locally.
Supports --detail for per-PR breakdown and --json-output for scripting.
@anderdc
Copy link
Copy Markdown
Collaborator

anderdc commented Apr 9, 2026

why is this even necessary if someone can look at the UI? not sure I see the actual advantage/argument for including this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add gitt miner status command

2 participants