Skip to content

fix: replace the retired Groq model and stop retrying dead providers - #8

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

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

Conversation

@riteshbonthalakoti

@riteshbonthalakoti riteshbonthalakoti commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

What

Production logs (after #5/#6 deployed, thanks to the new failure logging) show why audits still come back mostly empty:

Provider Error Cause
groq-1, groq-2 404 meta-llama/llama-4-scout-17b-16e-instruct does not exist Groq shut the model down on 2026-07-17 (per its deprecations page); both Groq slots failed on every call
openrouter-inkling 403 "only available on agentic harnesses" a model I added from the catalog by modality that is not usable via chat completions
openrouter-gemma, -gemma-31b 429 free-tier rate limit
openrouter-nemotron output is not valid audit JSON reasoning model; cause not yet known

Changes:

  • Groq now uses qwen/qwen3.8-27b (Groq's vision model per its vision docs, preview, JSON mode supported, max 3 images/request) with response_format: json_object.
  • Removed openrouter-inkling.
  • Provider clients are built only after the key check (the SDK throws on an empty key).
  • maxRetries: 0 and a 30s timeout on every client. The SDK's default of 2 retries re-hit a rate-limited free tier and slowed every failure.
  • Provider health: after a failure that will not fix itself within seconds (404/401/403 for 30 min, 400 for 10 min, 429 for Retry-After or 30s, unusable output for 60s), the provider is skipped, so later dimensions stop paying for it. If everything is cooling down, it still tries instead of failing without a call.
  • Unusable-output errors now include finish_reason and a 160-char snippet so the next log shows whether nemotron is being cut off, answering in prose, or putting everything in reasoning.
  • max_tokens 1800 -> 3000 for reasoning models; the audit loop stops starting new dimensions after 85s so it ends with a done event instead of hitting the 120s limit (the last live audit took 1m57s for 3 dimensions).

Why

Live audit of stripe.com after #5/#6: dimension 1 was a real roast (via gemma), dimensions 2 and 3 failed on every provider, total 117s.

Type

  • Bug fix

Checklist

  • npx tsc --noEmit and npx eslint lib/ai pass
  • 16 checks with fake providers/errors: retired model and inkling gone, clients have no auto-retry and a timeout, cooldown per status (incl. Retry-After and its cap), a dimension after a failure skips dead providers, all-cooling-down still tries, cooldown expiry
  • Not verified against the real Groq API (no key in the sandbox): qwen/qwen3.8-27b is taken from Groq's docs, and the docs do not say whether it emits reasoning by default or how to hide it. parseDimensionJson strips <think> blocks, but if Groq returns it differently the new log line will show it
  • 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)
  • Merge conflict expected with test: add Vitest suite covering AI fallback, rate limiter, audit scoring, admin auth #1 in lib/ai/providers.ts (it contains an earlier version of the key-filter fix); this version supersedes it

Sources: Groq deprecations, Groq vision

Production logs showed groq-1/groq-2 returning 404 on every call because Groq
shut down llama-4-scout on 2026-07-17; its vision model is now
qwen/qwen3.8-27b (JSON mode supported). Also drops thinkingmachines/inkling
(403 'only available on agentic harnesses'), filters on the API key before
building clients, disables the SDK's default 2 auto-retries (they hammer a
rate-limited free tier) and adds a 30s timeout. A provider that fails with a
retired model, no access, bad request, rate limit or unusable output is skipped
for a while (honouring Retry-After), so later dimensions stop paying for it.
Unusable-output errors now carry finish_reason and a snippet so the log shows
whether the model was cut off or answered in prose. Providers that document
JSON mode get response_format json_object, max_tokens goes to 3000 for
reasoning models, and the loop stops starting new dimensions after 85s so an
audit finishes with a done event instead of hitting the 120s limit.
@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:36am 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 marked this pull request as ready for review November 3, 2026 09:37
@riteshbonthalakoti
riteshbonthalakoti merged commit 73022d0 into main Nov 3, 2026
5 of 6 checks passed

This branch had an error being deployed

1 failed deployment
Preview — 47b8b283 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