Skip to content

fix(signals): dedupe reward-risk next-actions before capping - #464

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
galuis116:fix/reward-risk-dedupe-before-cap
Jun 8, 2026
Merged

fix(signals): dedupe reward-risk next-actions before capping#464
JSONbored merged 1 commit into
JSONbored:mainfrom
galuis116:fix/reward-risk-dedupe-before-cap

Conversation

@galuis116

Copy link
Copy Markdown
Contributor

Closes #463.

buildRepoRewardRisk (line 274) and buildContributorRewardRiskStrategy (line 372) applied .slice(0, N) inside new Set(...), truncating the flattened next-actions before deduping. When the first N entries contain duplicates — common in the cross-repo aggregate, since nextActionsFor(kind) returns the same string for a given action kind regardless of repo — the deduped result collapses below the cap and distinct lower-priority steps (e.g. file_issue_discovery, maintainer_lane) are silently dropped.

Change

Move the cap outside the Set so the list is deduped first, then capped — matching the rest of the codebase, including the identical flatMap-nextActions pattern in src/services/decision-pack.ts:619 and the dedupe-then-slice convention in queue/processors.ts, agent-orchestrator.ts, local-branch.ts, etc.

-const nextActions = [...new Set(actions.flatMap((a) => a.nextActions).slice(0, 8))];
+const nextActions = [...new Set(actions.flatMap((a) => a.nextActions))].slice(0, 8);
-const nextActions = [...new Set(topActions.flatMap((a) => a.nextActions).slice(0, 10))];
+const nextActions = [...new Set(topActions.flatMap((a) => a.nextActions))].slice(0, 10);

Verification

  • Pure behavior-preserving reorder; both lines stay exercised by the existing buildRepoRewardRisk / buildContributorRewardRiskStrategy tests in signals-v2.test.ts. Full unit suite green (1254 passed). The observable regression only surfaces with many same-kind repos, which the current fixtures don't construct.

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).
@galuis116
galuis116 requested a review from JSONbored as a code owner June 7, 2026 11:10
@dosubot dosubot Bot added the size:XS label Jun 7, 2026
@github-actions github-actions Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 7, 2026
@ghost

ghost commented Jun 7, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #464 is no longer open. No action.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@galuis116 this is ready.

A few notes:

  • Dedupe now happens before the cap, so duplicate early entries no longer crowd out distinct next actions.
  • The change matches the existing convention used elsewhere in the codebase.
  • No code changes requested.

@dosubot dosubot Bot added the lgtm label Jun 8, 2026
@JSONbored
JSONbored merged commit 4bfefcc into JSONbored:main Jun 8, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

Reward-risk next-actions are truncated *before* deduplication, dropping distinct steps

2 participants