feat(miner-governor): self-reputation throttle from own outcome history - #4969
feat(miner-governor): self-reputation throttle from own outcome history#4969davion-knight wants to merge 1 commit into
Conversation
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
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4969 +/- ##
=======================================
Coverage 94.26% 94.26%
=======================================
Files 448 449 +1
Lines 38900 38931 +31
Branches 14172 14185 +13
=======================================
+ Hits 36669 36700 +31
Misses 1574 1574
Partials 657 657
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-11 06:32:55 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 5 non-blocking
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.
|
|
Gittensory is closing this pull request on the maintainer's behalf (conflicts with the base branch — resolve and open a fresh PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Adds the pure calculator the Governor consults before an
open_pr/file_issueaction (#2346) — the self-reputation half of the miner-governor wave.What this adds
selfReputationThrottle(history, thresholds)inpackages/gittensory-engine/src/governor/reputation-throttle.ts(mirrors the siblinggovernor/rate-limit.tscalculator style — pure, deterministic, heavily input-normalized):decided= merged+closed+rejected,unfavorable= human-closed/gate-rejected) — local-only, never shared/cross-fleet data.cadenceFactorin[minCadenceFactor, 1]: a clean ratio runs at full cadence; as the unfavorable ratio rises fromthrottleAtRatiotofloorAtRatiothe factor interpolates linearly down to the floor; a recovering ratio measurably restores cadence — never a hard permanent ban.minSampleSizedecided outcomes, so a brand-new miner or new repo is never falsely throttled (documented + tested).resolveSelfReputationThresholds(partial)merges a.gittensory-miner.ymloverride 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 triggeringunfavorableRatio.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
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