Skip to content

feat(miner): wire real reputationHistory into the Governor's self-reputation throttle - #5685

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
lourincedaging0-commits:feat-governor-reputation-history
Jul 14, 2026
Merged

feat(miner): wire real reputationHistory into the Governor's self-reputation throttle#5685
JSONbored merged 1 commit into
JSONbored:mainfrom
lourincedaging0-commits:feat-governor-reputation-history

Conversation

@lourincedaging0-commits

Copy link
Copy Markdown
Contributor

Closes #5675.

Problem

buildAttemptGovernorContext always left governor.reputationHistory undefined, so the chokepoint's self-reputation throttle — already built + tested in gittensory-engine — never saw a real track record and was silently skipped on every attempt. Now that #5678 landed the recordOwnSubmission write path, the read/write sides can be wired.

Change

  • Write (loop-cli.js, disposition-poll path): on a resolved terminal PR outcome, update governor-state.js's reputation history — decided always increments, unfavorable only on a closed-without-merge (reusing rejection-state-machine.js's isRejectedPr, consistent with Check a miner's own prior-rejection history on a repo (rejectionSignaled's second documented trigger) #5655's own-rejection classification). Forge-scoped by apiBaseUrl like every other governor-state write.
  • Read (attempt-cli.jsattempt-input-builder.js): attempt-cli.js reads the per-repo loadReputationHistory and passes it into buildAttemptGovernorContext, which forwards it into the chokepoint context — the same optional-parameter-with-honest-fallback pattern convergenceInput uses (Track real per-issue attempt-history on the portfolio queue, feed the Governor's convergenceInput #5654). Omitted stays an honest absence (the throttle stage is skipped), never a fabricated clean history.
  • Out of scope: reputation-throttle.ts's calculator/thresholds are untouched (.d.ts updated to match the new signature).

Validation

  • buildAttemptGovernorContext forwards a real reputationHistory and omits the field entirely when the caller passes none (honest absence).
  • End-to-end regression: a real unfavorable streak ({decided:10, unfavorable:8}) threaded through buildAttemptGovernorContext produces a reputation_throttle denied chokepoint decision.
  • Write regression: a loop cycle whose PR resolves closed-without-merge records {decided:1, unfavorable:1}; the existing merged-outcome cycle covers the favorable (decided-only) branch.
  • Reputation write formula + store round-trip independently verified via node:test (node:sqlite); node --check clean.

…utation throttle

buildAttemptGovernorContext always left governor.reputationHistory undefined, so the chokepoint's
self-reputation throttle (already built + tested in the engine) never saw a real track record and
was silently skipped. Now that JSONbored#5678 landed the recordOwnSubmission write path, wire the real data:

- WRITE: on a resolved terminal PR outcome (loop-cli.js's disposition poll), update governor-state.js's
  reputation history -- decided always increments, unfavorable only on a closed-without-merge
  (rejection-state-machine.js's isRejectedPr, matching JSONbored#5655's own-rejection classification).
- READ: attempt-cli.js reads the per-repo loadReputationHistory and passes it into
  buildAttemptGovernorContext, which forwards it into the chokepoint context -- the same
  optional-parameter-with-honest-fallback pattern convergenceInput uses (JSONbored#5654). Omitted stays an
  honest absence (the throttle stage is skipped), never a fabricated clean history.

Out of scope: reputation-throttle.ts's calculator/thresholds are unchanged.

Closes JSONbored#5675
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.04%. Comparing base (66e927e) to head (0537863).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5685   +/-   ##
=======================================
  Coverage   95.04%   95.04%           
=======================================
  Files         576      576           
  Lines       45977    45981    +4     
  Branches    14724    14724           
=======================================
+ Hits        43699    43703    +4     
  Misses       1525     1525           
  Partials      753      753           
Flag Coverage Δ
shard-1 43.56% <0.00%> (-0.43%) ⬇️
shard-2 35.86% <60.00%> (+0.13%) ⬆️
shard-3 32.25% <0.00%> (-0.21%) ⬇️
shard-4 31.31% <0.00%> (-1.75%) ⬇️
shard-5 32.55% <0.00%> (+0.78%) ⬆️
shard-6 44.83% <40.00%> (+0.42%) ⬆️

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

Files with missing lines Coverage Δ
packages/gittensory-miner/lib/attempt-cli.js 97.71% <100.00%> (+0.02%) ⬆️
...ages/gittensory-miner/lib/attempt-input-builder.js 100.00% <ø> (ø)
packages/gittensory-miner/lib/loop-cli.js 96.65% <100.00%> (+0.03%) ⬆️
🚀 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 14, 2026
@loopover-orb

loopover-orb Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-14 05:23:17 UTC

6 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This wires the previously-stubbed governor.reputationHistory through both the write path (loop-cli.js updates decided/unfavorable counts on a resolved terminal PR outcome, using isRejectedPr for the unfavorable classification) and the read path (attempt-cli.js reads loadReputationHistory and threads it into buildAttemptGovernorContext, which now conditionally spreads it in rather than always including undefined). The change closes issue #5675 as claimed, follows the existing convergenceInput optional-parameter-with-honest-fallback pattern from #5654, and is well-tested end-to-end (a real unfavorable streak produces a denied reputation_throttle decision, and a closed-without-merge cycle records {decided:1, unfavorable:1}). The write is correctly forge-scoped by apiBaseUrl consistent with other governor-state writes, and reuses the existing isRejectedPr classifier rather than reimplementing rejection logic.

Nits — 4 non-blocking
  • packages/gittensory-miner/lib/loop-cli.js: the priorReputation read + saveReputationHistory write is not atomic — if two loop cycles for the same repo/apiBaseUrl race, one write could be lost; likely low-risk given the single-process loop model but worth a comment if intentional.
  • External brief flags attempt-cli.js and loop-cli.js as now exceeding the repo's 400-line file-length convention; consider extracting the reputation write block into governor-state.js as a helper (e.g. recordResolvedOutcome) if the file keeps growing.
  • Consider adding a helper in governor-state.js (e.g. `recordResolvedOutcome(repoFullName, isRejected, apiBaseUrl)`) to encapsulate the read-increment-write pattern in loop-cli.js:463-474, keeping loop-cli.js leaner and centralizing the reputation-update logic.
  • The comment block in attempt-input-builder.js referencing Wire real reputationHistory into the Governor's self-reputation throttle #5675 is thorough — consider a one-line JSDoc `@​see` or issue link convention for discoverability if the repo doesn't already have one.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #5675
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: 0 registered-repo PR(s), 0 merged, 0 issue(s).
Contributor context ❌ No public Gittensor match lourincedaging0-commits; not a blocker.
Gate result ✅ Passing No configured blocker found.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence.
Review context
  • Author: lourincedaging0-commits
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Contributor context: Public profile only; not a blocker.
  • 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.
[BETA] Chat with Gittensory

Ask Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @gittensory ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @gittensory chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @gittensory mention with a real question is routed to the closest matching read-only command automatically -- no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands

🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 14, 2026
@JSONbored
JSONbored merged commit be9af47 into JSONbored:main Jul 14, 2026
16 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. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire real reputationHistory into the Governor's self-reputation throttle

2 participants