fix(miner): drop discovery-index candidates whose repo bans AI contributions (#9680) - #9907
fix(miner): drop discovery-index candidates whose repo bans AI contributions (#9680)#9907kai392 wants to merge 1 commit into
Conversation
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-29 21:35:09 UTC
Review summary Nits — 3 non-blocking
CI checks failing
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. |
…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. Two named cases: one 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. Closes JSONbored#9680 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (87.50%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #9907 +/- ##
==========================================
+ Coverage 79.29% 79.37% +0.08%
==========================================
Files 281 283 +2
Lines 58566 58868 +302
Branches 6785 6898 +113
==========================================
+ Hits 46440 46728 +288
- Misses 11843 11844 +1
- Partials 283 296 +13
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
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: candidate.aiPolicyAllowed !== 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, 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.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 (matchingnormalizeDiscoveryIndexCandidate's default).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_querytelemetry call reports the number dropped.No change to the local fan-out path, the ranker,
portfolio-discovery.ts, orRawCandidateIssue's declared type.Tests
Two named cases in
test/unit/miner-discover-cli.test.ts:aiPolicyAllowed: false+ onetrue→ only the allowed one reaches the ranked/enqueued output, anddroppedAiBanned: 1is reported (fails against the current code).aiPolicyAllowedentirely is still kept (proves the filter didn't become a fail-closed drop of every index candidate).Together they cover all three arms of
aiPolicyAllowed !== false(dropped / kept / field-absent) plus the telemetry count. The shared-module testminer-discovery-index-client.test.ts(which asserts the exact telemetry payload) still passes.Closes #9680