fix(miner): drop discovery-index candidates whose repo bans AI contributions (#9680) - #9908
Conversation
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-29 21:46:38 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9908 +/- ##
===========================================
- Coverage 91.76% 79.37% -12.39%
===========================================
Files 921 283 -638
Lines 113207 58868 -54339
Branches 27255 8718 -18537
===========================================
- Hits 103886 46729 -57157
- Misses 8034 11844 +3810
+ Partials 1287 295 -992
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…butions (JSONbored#9680) `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 JSONbored#9680 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What
supplementWithDiscoveryIndexfolded hosted discovery-index candidates into the local fan-out with dedupe as the only filter. The index client deliberately preserves a repo's AI-contribution ban (normalizeDiscoveryIndexCandidatewritesaiPolicyAllowed !== false), but nothing downstream re-checks it — and theas RawCandidateIssuecast (whoseaiPolicyAllowedis declared as the literaltrue) laundered afalsestraight through. So an index-served candidate flagged "this repo bans automated contributions" was ranked and enqueued into the miner's own portfolio backlog. The local path enforces the ban hard (fetchTargetIssues:if (!verdict.allowed) return []); the index path did not.How
discover-cli.ts: filter outaiPolicyAllowed === falsecandidates before the dedupe filter / cast, mirroringfetchTargetIssues's own drop. The predicate is!== false, so a candidate that omits the field entirely is still kept.discovery-index-client.ts:recordDiscoveryTelemetrynow accepts an optionaldroppedAiBannedcount, spread conditionally into the log payload so every existing caller keeps its exact{ event, outcome }shape; thediscover_querycall reports the number dropped.Tests
aiPolicyAllowed: false+ onetrue→ only the allowed one reaches ranked/enqueued output, anddroppedAiBanned: 1is reported (fails against current code).aiPolicyAllowedis still kept (not a fail-closed drop).recordDiscoveryTelemetrycase (both opt-ins enabled, count supplied) asserting the payload carries the count — so both arms of the conditional spread are covered.The shared-module test that asserts the exact
{ event, outcome }telemetry payload still passes.Closes #9680