Personality Report route calls Groq without the 15-second AbortSignal used by the sibling AI Insights route

Aperta
#4,054 3 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Aditya060806 ci sta già lavorando.

Dal 3/12/2026.

  • #4065 di @Aditya060806 — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

status:assigned

Describe the bug

On /dashboard/personality the AI branch calls Groq through groqChatCompletion without a request-level deadline. When Groq gets slow the serverless worker holds the user's request open until the Vercel function timeout fires, so the loading spinner stays stuck instead of falling back to the rule-based report. The sibling /api/ai-insights route already guards the same helper with a 15-second AbortSignal.timeout, so this is a one-sided gap.

To Reproduce

  1. Sign in with GitHub and open /dashboard/personality (hitting ?refresh=true is the surest way to drive the Groq branch).
  2. Picture a slow Groq response: the first candidate model taking 30 to 45 seconds before the SDK gives up on it, or the Groq edge pausing before any bytes come back. No infra is needed to see the shape of the problem, it is visible in the code.
  3. Watch the route: there is no AbortSignal on the groqChatCompletion call, so nothing on the server side cuts the request short. The worker waits for Groq, the user waits for the worker, and on Vercel the function keeps running until the platform timeout hits.
  4. Compare the same stall against /api/ai-insights. That route times out at 15 seconds and the rule-based fallback goes out to the client.

Expected behavior

A stalled Groq call on /api/personality aborts at 15 seconds and the route returns the rule-based personality report, matching the sibling /api/ai-insights behavior. The user should never sit on the spinner for the full Vercel function timeout.

Environment

  • Next.js 16 (App Router)
  • Node runtime (>=22.12 per package.json engines)
  • Groq LLM API (https://api.groq.com/openai/v1/chat/completions)
  • Vercel deploy target (devtrack.live)

Are you able to fix this?

Yes, happy to open a PR mirroring the sibling route's signal.

Additional context

The asymmetry sits between two callsites of the same helper:

  • src/app/api/personality/route.ts:259 calls groqChatCompletion({...}) with no second argument.
  • src/app/api/ai-insights/route.ts:247-250 calls the same helper with { signal: AbortSignal.timeout(15_000) }.

src/lib/groq.ts:36-46 already threads init.signal through to fetch, so the helper itself does not need any changes. The fix is a one-argument addition on the personality route plus a vitest case in test/personality-route.test.ts to lock the new behavior in.

Lingua principale
TypeScript
Stelle
246
Fork
436
Merge medio
9h 33m
PR unite (30g)
213

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Priyanshu-byte-coder/devtrack

Tutte le issue di Priyanshu-byte-coder/devtrack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.