From 73f0e0200dc859a839d9a375bdbd355f8e727d78 Mon Sep 17 00:00:00 2001 From: galuis116 Date: Sun, 7 Jun 2026 04:08:16 -0700 Subject: [PATCH] fix(signals): dedupe reward-risk next-actions before capping buildRepoRewardRisk and buildContributorRewardRiskStrategy sliced the flattened next-actions to N before deduping (slice inside new Set), so duplicate early entries (e.g. same action kind across repos yields the same nextActionsFor string) collapsed the result below the cap and dropped distinct lower-priority steps. Move the cap outside the Set to dedupe first, matching the rest of the codebase (e.g. decision-pack.ts). --- src/signals/reward-risk.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/signals/reward-risk.ts b/src/signals/reward-risk.ts index 9c17cf8b57..4798dbaf65 100644 --- a/src/signals/reward-risk.ts +++ b/src/signals/reward-risk.ts @@ -271,7 +271,7 @@ export function buildRepoRewardRisk(args: { queueHealth, collisionsHighRiskCount: collisions.summary.highRiskCount, }); - const nextActions = [...new Set(actions.flatMap((action) => action.nextActions).slice(0, 8))]; + const nextActions = [...new Set(actions.flatMap((action) => action.nextActions))].slice(0, 8); return { login: args.login, @@ -369,7 +369,7 @@ export function buildContributorRewardRiskStrategy(args: { .filter((analysis) => analysis.actionImpact.cleanupNeeded > 0 || analysis.currentPreview.scoreEstimate.estimatedMergedScore !== analysis.afterCleanupPreview.scoreEstimate.estimatedMergedScore) .slice(0, 8) .map((analysis) => `${analysis.repoFullName}: ${analysis.actionImpact.explanation} Score preview ${analysis.actionImpact.estimatedScoreDelta}; openPrMultiplier ${analysis.actionImpact.openPrMultiplierDelta}.`); - const nextActions = [...new Set(topActions.flatMap((action) => action.nextActions).slice(0, 10))]; + const nextActions = [...new Set(topActions.flatMap((action) => action.nextActions))].slice(0, 10); return { login: args.login, generatedAt: nowIso(),