Skip to content

fix(ai-slop): resolve the shared neuron budget like the AI review path (10M) - #1369

Merged
JSONbored merged 1 commit into
mainfrom
fix/ai-slop-neuron-budget
Jun 25, 2026
Merged

fix(ai-slop): resolve the shared neuron budget like the AI review path (10M)#1369
JSONbored merged 1 commit into
mainfrom
fix/ai-slop-neuron-budget

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Adversarial-audit finding (high, 3/3 verifiers). runGittensoryAiSlopAdvisory reads the same shared AI_DAILY_NEURON_BUDGET as the review path but computed clampNumber(Number(env.AI_DAILY_NEURON_BUDGET || 10000), 0, 1_000_000) — a 10k default + a 1M ceiling. ai-review.ts was deliberately fixed to default 10M / clamp 10M (a prod incident — the old 10k default "silently starves every dual-AI review into quota_exceeded"); ai-slop never got that fix. Both features sum into one usage counter (sumAiEstimatedNeuronsSince), so review spend over 1M silently disabled slop AI for the rest of the day under a larger configured budget.

Changes

  • Resolve the budget identically to ai-review.ts: default 10,000,000, clamp to 10,000,000.

Validation

  • npm run test:ci exit 0 (4408 tests); npm audit clean; changed line + branches covered
  • New tests: with a 2M configured budget + 1.5M prior spend slop is not quota_exceeded (old 1M ceiling would block it); with the budget unset + 2M prior spend slop still runs (old 10k default would block it)

…h (default 10M, clamp 10M)

runGittensoryAiSlopAdvisory read the SAME shared AI_DAILY_NEURON_BUDGET as the review path but computed
`clampNumber(Number(env.AI_DAILY_NEURON_BUDGET || 10000), 0, 1_000_000)` — a 10k default + a 1M ceiling.
ai-review.ts was deliberately fixed to default 10M / clamp 10M (a prod incident: the old 10k default
"silently starves every dual-AI review into quota_exceeded"), but ai-slop kept the old misconfig. Since
both features sum into ONE usage counter (sumAiEstimatedNeuronsSince), slop AI was starved well under the
real shared budget. Resolve it identically to ai-review.
@dosubot dosubot Bot added the size:XS label Jun 25, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.36%. Comparing base (0da8de6) to head (b631d91).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1369   +/-   ##
=======================================
  Coverage   95.36%   95.36%           
=======================================
  Files         191      191           
  Lines       20696    20697    +1     
  Branches     7479     7479           
=======================================
+ Hits        19736    19738    +2     
  Misses        378      378           
+ Partials      582      581    -1     
Files with missing lines Coverage Δ
src/services/ai-slop.ts 90.54% <100.00%> (+1.49%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit 5d1734d into main Jun 25, 2026
18 checks passed
@JSONbored
JSONbored deleted the fix/ai-slop-neuron-budget branch June 25, 2026 13:43
JSONbored added a commit that referenced this pull request Jun 28, 2026
… review path (10M) (#1455)

summarizeAgentBundleWithAi and rewriteSignalBundleWithAi resolved AI_DAILY_NEURON_BUDGET with a 10k default and a 1M ceiling, while ai-review.ts and ai-slop.ts (#1369) resolve the SAME shared daily counter to a 10M default and 10M ceiling. Because all three Workers-AI features sum into one sumAiEstimatedNeuronsSince total, summaries were starved into quota_exceeded once shared usage crossed 10k neurons — a tiny fraction of the real budget — and a configured budget was capped at 1M. Mirror the sibling resolution (default 10M, finite-check, clamp to 10M) at both sites and add regression tests pinning the high default, the raised ceiling, and the invalid-to-default fallback for both the summarize and rewrite paths.

Co-authored-by: ghost <49853598+JSONbored@users.noreply.github.com>
Co-authored-by: galuis116 <galuis116@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant