Skip to content

fix(engine): reward-risk scores a repo's open-PR gate off the contributor's global PR count, not that repo's own #8865

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

Context

packages/loopover-engine/src/reward-risk.ts's buildRepoRewardRisk (line 290) computes currentOpenPrCount = nonNegative(args.outcomeHistory.totals.openPullRequests) using the contributor-wide total across all repos, while the very next line (291) correctly prefers the repo-specific count for issues: repoOutcome?.openIssues ?? args.outcomeHistory.totals.openIssues. buildActions (line 623) separately uses the correct repo-scoped args.repoOutcome?.openPullRequests ?? 0. Net effect: a contributor active across many repos gets every single repo's open-PR gate/cleanup penalty inflated by their portfolio-wide PR count, while the action-offering logic in the same report uses the correct number -- producing self-contradictory reports.

Requirements

Change line 290 to prefer the repo-scoped count first: nonNegative(repoOutcome?.openPullRequests ?? args.outcomeHistory.totals.openPullRequests), matching the pattern already used one line below it for issues and in buildActions.

Deliverables

  • buildRepoRewardRisk's currentOpenPrCount prefers repoOutcome?.openPullRequests before falling back to the portfolio-wide total
  • A regression test with a contributor active across two repos, asserting each repo's reward-risk report uses that repo's own open-PR count, not the combined total

All of the above Deliverables are required in the same PR unless the deliverable text itself states otherwise.

Test Coverage Requirements

packages/loopover-engine/** -- 99%+ patch coverage, branch-counted, on both the repo-scoped and fallback paths.

Expected Outcome

A contributor's reward-risk report for one repo reflects that repo's own open-PR count, consistent with how the same report already treats open issues and offered actions.

Links & Resources

  • packages/loopover-engine/src/reward-risk.ts:290,291,623

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions