You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(miner): drop discovery-index candidates whose repo bans AI contributions (#9680) (#9908)
`supplementWithDiscoveryIndex` folded hosted-index candidates into the
local fan-out with dedupe as the only filter. The index client deliberately
preserves a repo's AI-contribution ban (`aiPolicyAllowed !== false`), but
nothing downstream re-checks it -- the `as RawCandidateIssue` cast (the type
declares `aiPolicyAllowed: true`) laundered a `false` straight through, so an
AI-banned repo's issue was ranked and enqueued into the miner's own
portfolio backlog, where the loop would later claim and attempt it. The
local path enforces the ban hard (`fetchTargetIssues`: `if (!verdict.allowed)
return []`); the index path did not.
- discover-cli.ts: filter out `aiPolicyAllowed === false` candidates before
the dedupe/cast, using `!== false` so a candidate omitting the field is
still kept (matching normalizeDiscoveryIndexCandidate's own default).
- discovery-index-client.ts: `recordDiscoveryTelemetry` now carries an
optional `droppedAiBanned` count, spread conditionally so existing callers
keep their exact `{ event, outcome }` payload; the `discover_query` call
reports the number dropped.
Tests: an index candidate `aiPolicyAllowed:false` + one `true` -> only the
allowed one is ranked and `droppedAiBanned:1` is reported (fails against
current code); a candidate omitting the field is still kept; and a direct
recordDiscoveryTelemetry case (both opt-ins on) covering the payload with
the count present, so both arms of the conditional spread are covered.
Closes#9680
Co-authored-by: kai392 <chengjunkai4@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments