feat(review): miner-aware exemption and fleet-scale defaults for GLOBAL_CONTRIBUTOR_OPEN_ITEM_CAP - #4541
Conversation
…AL_CONTRIBUTOR_OPEN_ITEM_CAP The install-wide open-item cap was unset-by-default (no cap at all) and had no awareness of the confirmed_miner identity used elsewhere in the codebase for authorization. Both meant a legitimate miner fleet arriving at scale would either sail through with zero defense or get throttled identically to a farming attack, depending entirely on whether an operator had proactively opted in. - GLOBAL_CONTRIBUTOR_OPEN_ITEM_CAP now falls back to a real default (20) when unset or malformed, instead of silently disabling the defense. The literal string "off" is the explicit escape hatch back to no cap. - New GLOBAL_CONTRIBUTOR_OPEN_ITEM_CAP_MINER gives a CONFIRMED official Gittensor miner its own, higher default (50) instead of either "no cap" or the plain human default -- checked via the same getCachedOfficialMinerDetection path the rest of the codebase already trusts for this purpose. - Both the PR-path and issue-path install-wide checks defer the (cached but non-free) miner-identity lookup until at least one of the two resolvers is actually active, so an install that's fully opted out pays no extra cost. Fixes #4511
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4541 +/- ##
==========================================
- Coverage 94.04% 94.03% -0.02%
==========================================
Files 422 422
Lines 37600 37614 +14
Branches 13736 13741 +5
==========================================
+ Hits 35362 35371 +9
Misses 1583 1583
- Partials 655 660 +5
🚀 New features to boost your workflow:
|
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - fixes requiredReview updated: 2026-07-10 00:36:09 UTC
🛑 Suggested Action - Manual Review
Review summary Nits — 7 non-blocking
CI checks failing
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
GLOBAL_CONTRIBUTOR_OPEN_ITEM_CAPwas unset-by-default (no install-wide cap at all) and had zero awareness of theconfirmed_minerrole used elsewhere for authorization — so a legitimate miner fleet would either sail through with zero cross-repo defense, or get throttled identically to a farming attack, depending entirely on whether an operator had proactively opted in and pre-sized it."off"is the explicit escape hatch back to unconditional no-cap.GLOBAL_CONTRIBUTOR_OPEN_ITEM_CAP_MINERenv var gives a CONFIRMED official Gittensor miner (checked via the samegetCachedOfficialMinerDetectionpath the codebase already trusts for this) its own, higher default (50) instead of either extreme.runAgentMaintenancePlanAndExecute) and issue-path (maybeCloseIssueOverContributorCap) install-wide checks defer the miner-identity lookup (cached, but not free) until at least one of the two resolvers is actually active, so a fully-opted-out install pays no extra cost.Test plan
test/unit/global-contributor-cap.test.ts— rewrote the resolver tests for the new default-based behavior, added coverage for the miner resolver and the"off"escape hatch (100% stmt/branch/func/line coverage on the file)test/unit/queue.test.ts— updated two now-inaccurately-titled "off by default" integration tests (assertions still hold since the sample counts stay under the new default), added a new end-to-end test proving a confirmed miner gets the higher cap even where the human cap alone would already be exceedednpx tsc --noEmitclean (one pre-existing, unrelated error inminer-opportunity-ranker.test.tsfrom upstream drift, not touched by this PR)Fixes #4511