Skip to content

fix: audits abort when a provider times out (regression from #8) - #9

Merged
riteshbonthalakoti merged 2 commits into
mainfrom
claude/fix-provider-timeouts
Nov 3, 2026
Merged

riteshbonthalakoti merged 2 commits into
mainfrom
claude/fix-provider-timeouts

Conversation

@riteshbonthalakoti

@riteshbonthalakoti riteshbonthalakoti commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

What

Regression fix for something I introduced in #8. After #8 deployed, a live audit of vercel.com returned "Something broke on our side" after 52s. The log has a single [analyze] failed: Error: Request timed out and no per-provider line.

Cause: APIConnectionTimeoutError and APIConnectionError extend APIError with status: undefined, so isRetryableError returned false for them ("fail fast"), and one slow provider aborted the whole audit instead of falling through. It was latent until #8 added a 30s client timeout; the SDK default is 10 minutes. The Groq call (first in the chain) timed out, most likely because qwen/qwen3.8-27b was thinking by default.

Changes:

  • Timeouts and connection errors are retryable and put the provider on a 60s cooldown.
  • Groq requests set reasoning_effort: "none" (instruct mode, no thinking) and reasoning_format: "hidden". Per Groq's reasoning docs, reasoning_format must be hidden or parsed with JSON mode (raw, the default, returns a 400), and none is supported by Qwen 3.8 27B. Providers can carry extra request fields; only Groq sets them.
  • A non-retryable failure now logs which provider it came from.

Type

  • Bug fix

Checklist

  • npx tsc --noEmit and npx eslint lib/ai pass
  • 11 checks with the network faked: timeout/connection errors are retryable with a 60s cooldown; the Groq request body has model qwen/qwen3.8-27b, reasoning_effort: none, reasoning_format: hidden, response_format: json_object, max_tokens: 3000; when Groq fails with a network error the audit completes through OpenRouter; OpenRouter requests carry none of the Groq-only fields
  • Not verified against the real Groq API (no key in the sandbox). If Groq rejects the new fields it returns a 400, the code falls through to OpenRouter and the log shows the message
  • npm run build not run here (sandbox lacks Stripe/Resend env vars; see test: add Vitest suite covering AI fallback, rate limiter, audit scoring, admin auth #1)

APIConnectionTimeoutError/APIConnectionError extend APIError with status
undefined, so isRetryableError returned false and a single slow provider
aborted the whole audit. This surfaced once the client got a 30s timeout.
Timeouts now fall through to the next provider and put the slow one on a 60s
cooldown. A non-retryable failure now logs which provider it came from.
Per Groq's reasoning docs, reasoning_effort 'none' selects instruct mode (no
thinking) and reasoning_format must be 'hidden' or 'parsed' with JSON mode
('raw', the default, returns a 400). Providers can now carry extra request
fields; only Groq sets them.
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
roastlab Error Error Nov 3, 2026 9:43am UTC

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@riteshbonthalakoti
riteshbonthalakoti merged commit 794f44a into main Nov 3, 2026
4 of 6 checks passed

This branch had an error being deployed

1 failed deployment
Preview — 2f94cdbd Deployed Nov 3, 2026 by vercel[bot]
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.

2 participants