Skip to content

feat(miner-governor): self-reputation throttle from own outcome history - #4983

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
davion-knight:feat-self-reputation-throttle
Jul 11, 2026
Merged

feat(miner-governor): self-reputation throttle from own outcome history#4983
JSONbored merged 1 commit into
JSONbored:mainfrom
davion-knight:feat-self-reputation-throttle

Conversation

@davion-knight

Copy link
Copy Markdown
Contributor

Adds the pure calculator the Governor consults before an open_pr/file_issue action (#2346) — the self-reputation half of the miner-governor wave. (Resubmit of #4969, which was auto-closed on a base-branch barrel conflict; rebased clean onto current main — the code is unchanged.)

What this adds

selfReputationThrottle(history, thresholds) in packages/gittensory-engine/src/governor/reputation-throttle.ts (mirrors the sibling governor/rate-limit.ts calculator style — pure, deterministic, heavily input-normalized):

  • Reads the miner's own recent terminal outcomes on one repo (decided = merged+closed+rejected, unfavorable = human-closed/gate-rejected) — local-only, never shared/cross-fleet data.
  • Returns a cadenceFactor in [minCadenceFactor, 1]: a clean ratio runs at full cadence; as the unfavorable ratio rises from throttleAtRatio to floorAtRatio the factor interpolates linearly down to the floor; a recovering ratio measurably restores cadence — never a hard permanent ban.
  • Fails OPEN below minSampleSize decided outcomes, so a brand-new miner or new repo is never falsely throttled (documented + tested).
  • resolveSelfReputationThresholds(partial) merges a .gittensory-miner.yml override over conservative defaults, normalizing every field (clamps ratios, floors the sample size, keeps the throttle band well-formed).
  • selfReputationThrottleLedgerEvent(...) shapes a decision as a governor-ledger event recording the triggering unfavorableRatio.

Pure/deterministic — no IO, Date, or randomness (the engine's contract). The enforcement wiring into the Governor chokepoint is the separate companion issue; this is the scored calculator + tests.

Validation

  • New suite test/unit/reputation-throttle.test.ts (12 tests): clean track record → full cadence, degrading ratio → measurable throttle, at/above floor → pinned to floor, insufficient history → fail-open, recovering ratio restores cadence, unfavorable clamped to decided, malformed/non-finite thresholds normalized, and both ledger-event branches. 100% branch coverage (24/24) verified locally (v8).
  • npm run engine-parity:drift-check → ok. Typechecks clean; prettier-clean.

Closes #2346

Add the pure calculator the Governor consults before an open_pr/file_issue action (JSONbored#2346):
selfReputationThrottle reads the miner's OWN recent terminal outcomes on a repo (merged vs.
human-closed/gate-rejected) and degrades that repo's submission cadence as the unfavorable
ratio rises past a configured threshold — a linear cadence factor from 1 down to a floor, so a
recovering ratio restores cadence (never a hard permanent ban). Fails OPEN below a minimum
sample size so a new miner/new repo is never falsely throttled; local-only history, no shared
data. Ships with conservative defaults + a resolve helper for .gittensory-miner.yml overrides
and a governor-ledger event builder that records the triggering ratio.

Closes JSONbored#2346
@davion-knight
davion-knight requested a review from JSONbored as a code owner July 11, 2026 06:48
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.30%. Comparing base (8eef9bd) to head (c207831).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4983   +/-   ##
=======================================
  Coverage   94.30%   94.30%           
=======================================
  Files         453      454    +1     
  Lines       38993    39024   +31     
  Branches    14217    14230   +13     
=======================================
+ Hits        36772    36803   +31     
  Misses       1572     1572           
  Partials      649      649           
Flag Coverage Δ
shard-1 46.91% <3.22%> (-0.04%) ⬇️
shard-2 33.24% <3.22%> (+0.01%) ⬆️
shard-3 31.34% <3.22%> (-0.14%) ⬇️
shard-4 33.07% <3.22%> (-0.01%) ⬇️
shard-5 33.61% <3.22%> (+0.17%) ⬆️
shard-6 45.17% <100.00%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...tensory-engine/src/governor/reputation-throttle.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. labels Jul 11, 2026
@loopover-orb

loopover-orb Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-11 06:54:05 UTC

3 files · no blockers · readiness 100/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • AI review already in progress for this PR head: Another Gittensory pass is already running the AI review for this exact PR head. This pass is skipping to avoid a duplicate LLM call.

Review summary
AI review is already running for this PR head in another Gittensory pass. Gittensory is holding this PR for manual review until that pass completes.

Nits — 1 non-blocking
  • AI review already in progress for this PR head — The gate is held for a human reviewer rather than passed automatically; it re-evaluates once the in-flight review completes or on the next update.
Signal Result Evidence
Code review ✅ No blockers No AI review summary
Linked issue ✅ Linked #2346
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 118 registered-repo PR(s), 81 merged, 2 issue(s).
Contributor context ✅ Confirmed Gittensor contributor davion-knight; Gittensor profile; 118 PR(s), 2 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence.
Review context
  • Author: davion-knight
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 118 PR(s), 2 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 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.

  • Re-run Gittensory review

@JSONbored
JSONbored merged commit 7bbf529 into JSONbored:main Jul 11, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(miner-governor): self-reputation throttle from own outcome history

2 participants