Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: retain quota health when review batches are incomplete (#13291)

[._.]/ Adam Eivy66722ddea278
diff --git a/server/services/codeReview.js b/server/services/codeReview.js
index 81225b5369..745710703c 100644
--- a/server/services/codeReview.js
+++ b/server/services/codeReview.js
@@ -106,7 +106,8 @@ export async function reportReviewerFailure(reviewer, error, now = Date.now()) {
const isExplicitUnavailable = explicitReason === 'unavailable'
// Input limits are not provider health, quota, or configuration failures.
- if (['REVIEW_CONTEXT_CAPACITY', 'REVIEW_BUDGET_EXHAUSTED', 'REVIEW_INCOMPLETE', 'REVIEW_BATCH_FAILED'].includes(code)) return false
+ if (['REVIEW_CONTEXT_CAPACITY', 'REVIEW_BUDGET_EXHAUSTED', 'REVIEW_INCOMPLETE', 'REVIEW_BATCH_FAILED'].includes(code)
+ && !isQuota && !isConfigFault && !isExplicitUnavailable) return false
const isProvider = isProviderReviewer(reviewer)
diff --git a/server/services/codeReview.test.js b/server/services/codeReview.test.js
index f19765952e..ffaf043ba8 100644
--- a/server/services/codeReview.test.js
+++ b/server/services/codeReview.test.js
@@ -1010,6 +1010,14 @@ describe('codeReview helpers', () => {
expect(result.coverage.diffSha256).toMatch(/^[a-f0-9]{64}$/)
})
+ it('retains provider quota health reporting through an incomplete batch aggregate', async () => {
+ global.fetch = vi.fn().mockResolvedValue(mockTextResponse('quota exceeded', { ok: false, status: 429 }))
+ const result = await runLocalCodeReview({ backend: 'lmstudio', model: 'quota-model', diff: fileDiff('a.js', 100) })
+ expect(result).toMatchObject({ ok: false, code: 'REVIEW_BATCH_FAILED' })
+ expect(await reportReviewerFailure('provider:example', result)).toBe(true)
+ expect(mockedSettings.current.codeReview.reviewerHealth['provider:example']).toMatchObject({ reason: 'quota' })
+ })
+
it('identifies a single-file context refusal without treating it as provider health or a clean verdict', async () => {
global.fetch = vi.fn().mockResolvedValue(mockTextResponse('Prompt is too long /private/local/path', { ok: false, status: 400 }))
const result = await runLocalCodeReview({ ...batchOptions, diff: fileDiff('a.js') })