fix: gate AI slop advisory to confirmed contributors - #727
Conversation
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
gittensory · advisory review Reviewed 3 changed file(s) — two independent AI reviewers. Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Worth double-checking
|
Completes the BYOK-only gating in this PR by closing the remaining cost vector: the AI slop advisory was still invoking FREE Workers AI for any PR author (the shared daily neuron budget), even though the AI review path (runAiReviewForAdvisory) already no-ops for unconfirmed authors. - runAiSlopForAdvisory now returns early when `!confirmedContributor` (matching the AI review path exactly): no AI spend — free OR BYOK — on a PR from an unconfirmed/untrusted author. The deterministic slop core still runs for everyone; only the paid AI layer is gated. Fail-closed: if the contributor can't be confirmed, no AI runs. - The BYOK key lookup no longer needs its own `&& confirmedContributor` guard (the early return already guarantees it). Adopts the full-gate approach from the sibling PR #727 (which also spotted this vector) while preserving this branch's BYOK integration (#728). Deliberately does NOT adopt #727's neuron-budget bump (1 -> 6): the AI review path estimates by LOGICAL free-call count, not worst-case retries, so a 6x reservation would be inconsistent and over-reserve, causing premature quota_exceeded.
|
Superseded by #737. Your full-gate insight (no AI spend at all for unconfirmed authors, matching One deliberate difference: I did not carry over the |
…free + BYOK) (#737) * fix: gate BYOK slop advisory by contributor * fix(slop): fully gate the AI slop advisory on confirmed contributor Completes the BYOK-only gating in this PR by closing the remaining cost vector: the AI slop advisory was still invoking FREE Workers AI for any PR author (the shared daily neuron budget), even though the AI review path (runAiReviewForAdvisory) already no-ops for unconfirmed authors. - runAiSlopForAdvisory now returns early when `!confirmedContributor` (matching the AI review path exactly): no AI spend — free OR BYOK — on a PR from an unconfirmed/untrusted author. The deterministic slop core still runs for everyone; only the paid AI layer is gated. Fail-closed: if the contributor can't be confirmed, no AI runs. - The BYOK key lookup no longer needs its own `&& confirmedContributor` guard (the early return already guarantees it). Adopts the full-gate approach from the sibling PR #727 (which also spotted this vector) while preserving this branch's BYOK integration (#728). Deliberately does NOT adopt #727's neuron-budget bump (1 -> 6): the AI review path estimates by LOGICAL free-call count, not worst-case retries, so a 6x reservation would be inconsistent and over-reserve, causing premature quota_exceeded.
Motivation
slopGateMode != offandslopAiAdvisorywas enabled, allowing untrusted PRs to consume shared Workers AI budget.Description
confirmedContributorcheck inrunAiSlopForAdvisoryand no-op when it is false or the advisory has noheadShaso unconfirmed PR authors cannot trigger the AI call (src/queue/processors.ts).confirmedContributorthrough to the slop advisory helper so the gating is enforced before any AI invocation (src/queue/processors.ts).SLOP_AI_MAX_MODEL_CALLS = 6and using it inestimateNeurons(src/services/ai-slop.ts).confirmedContributorparameter (test/unit/ai-slop.test.ts).Testing
npm run typecheckand it completed successfully.npx vitest run test/unit/ai-slop.test.tsand the suite passed (28 tests, all passed).Codex Task