⚠️ 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
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
Context
packages/loopover-engine/src/reward-risk.ts'sbuildRepoRewardRisk(line 290) computescurrentOpenPrCount = 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-scopedargs.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 inbuildActions.Deliverables
buildRepoRewardRisk'scurrentOpenPrCountprefersrepoOutcome?.openPullRequestsbefore falling back to the portfolio-wide totalAll 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