feat(miner-governor): self-reputation throttle from own outcome history - #4983
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 #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
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:54:05 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 1 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.
|
Adds the pure calculator the Governor consults before an
open_pr/file_issueaction (#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)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