Summary
The Workers-AI summary feature starves itself out of its shared daily budget. summarizeAgentBundleWithAi and rewriteSignalBundleWithAi (src/services/ai-summaries.ts) resolve AI_DAILY_NEURON_BUDGET with a 10000 default and a 1_000_000 ceiling, but the two sibling features that draw on the same daily counter use a 10_000_000 default and 10_000_000 ceiling.
Area
MCP
Expected behavior
All three Workers-AI features sum into one shared daily total via sumAiEstimatedNeuronsSince(env, utcDayStartIso()) and gate on estimatedNeurons > remainingBudget. ai-review.ts and ai-slop.ts resolve the shared budget consistently:
// src/services/ai-review.ts:577-578 and src/services/ai-slop.ts:196-197
const rawNeuronBudget = Number(env.AI_DAILY_NEURON_BUDGET);
const budget = clampNumber(env.AI_DAILY_NEURON_BUDGET && Number.isFinite(rawNeuronBudget) ? rawNeuronBudget : 10_000_000, 0, 10_000_000);
This exact fix shipped for ai-slop as merged PR #1369 ("resolve the shared neuron budget like the AI review path (10M)"). ai-summaries.ts was never updated to match.
Actual behavior
Both summary sites use:
const budget = clampNumber(Number(env.AI_DAILY_NEURON_BUDGET || 10000), 0, 1_000_000);
Against the shared counter this means:
- Default unset: ai-review/ai-slop allow 10,000,000 but summaries allow only 10,000. Once shared daily usage crosses 10k neurons (a handful of AI reviews),
summarizeAgentBundleWithAi and rewriteSignalBundleWithAi return quota_exceeded for the rest of the UTC day even though ~9.99M of the real budget remains.
- Ceiling: an operator who sets the intended shared
AI_DAILY_NEURON_BUDGET=10000000 has summaries clamp it to 1_000_000 — 90% of the configured budget unusable for summaries.
summarizeAgentBundleWithAi backs real agent runs (agent-orchestrator.ts) and rewriteSignalBundleWithAi backs the public PR-intelligence comment, so both silently degrade to deterministic fallback text for the rest of the day, inconsistent with the two sibling features that keep running.
Reproduction
With AI_DAILY_NEURON_BUDGET unset and ~2,000,000 neurons already recorded on the shared daily counter (e.g. from AI reviews), summarizeAgentBundleWithAi(env, bundle, "private") returns quota_exceeded, whereas ai-review/ai-slop still run (10M default).
Validation
Fix mirrors the merged #1369 resolution (default 10M, finite-check, clamp to 10M) at both summary sites. Covered by test/unit/ai-summaries.test.ts with regression tests pinning the high default, the raised ceiling, and the invalid-to-default fallback for both the summarize and rewrite paths (each fails before the fix). Full local npm run test:ci green.
Summary
The Workers-AI summary feature starves itself out of its shared daily budget.
summarizeAgentBundleWithAiandrewriteSignalBundleWithAi(src/services/ai-summaries.ts) resolveAI_DAILY_NEURON_BUDGETwith a10000default and a1_000_000ceiling, but the two sibling features that draw on the same daily counter use a10_000_000default and10_000_000ceiling.Area
MCP
Expected behavior
All three Workers-AI features sum into one shared daily total via
sumAiEstimatedNeuronsSince(env, utcDayStartIso())and gate onestimatedNeurons > remainingBudget.ai-review.tsandai-slop.tsresolve the shared budget consistently:This exact fix shipped for ai-slop as merged PR #1369 ("resolve the shared neuron budget like the AI review path (10M)").
ai-summaries.tswas never updated to match.Actual behavior
Both summary sites use:
Against the shared counter this means:
summarizeAgentBundleWithAiandrewriteSignalBundleWithAireturnquota_exceededfor the rest of the UTC day even though ~9.99M of the real budget remains.AI_DAILY_NEURON_BUDGET=10000000has summaries clamp it to1_000_000— 90% of the configured budget unusable for summaries.summarizeAgentBundleWithAibacks real agent runs (agent-orchestrator.ts) andrewriteSignalBundleWithAibacks the public PR-intelligence comment, so both silently degrade to deterministic fallback text for the rest of the day, inconsistent with the two sibling features that keep running.Reproduction
With
AI_DAILY_NEURON_BUDGETunset and ~2,000,000 neurons already recorded on the shared daily counter (e.g. from AI reviews),summarizeAgentBundleWithAi(env, bundle, "private")returnsquota_exceeded, whereasai-review/ai-slopstill run (10M default).Validation
Fix mirrors the merged #1369 resolution (default 10M, finite-check, clamp to 10M) at both summary sites. Covered by
test/unit/ai-summaries.test.tswith regression tests pinning the high default, the raised ceiling, and the invalid-to-default fallback for both the summarize and rewrite paths (each fails before the fix). Full localnpm run test:cigreen.