Skip to content

fix(ai-gateway): extend generation polling timeout - #4818

Merged
chrarnoldus merged 2 commits into
mainfrom
increase-fetchgeneration-timeout
Jul 28, 2026
Merged

fix(ai-gateway): extend generation polling timeout#4818
chrarnoldus merged 2 commits into
mainfrom
increase-fetchgeneration-timeout

Conversation

@chrarnoldus

@chrarnoldus chrarnoldus commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • configure fetchGeneration to use the existing backoff helper with a five-minute maximum retry budget
  • start retries at five-second intervals so generation polling remains gentle; the existing exponential backoff yields roughly nine attempts over about four minutes
  • raise every transcription route alias that can reach generation usage processing to maxDuration = 1800
  • add focused coverage for the generation backoff options and route duration exports

Verification

  • pnpm --filter web exec jest --runInBand src/lib/ai-gateway/providers/upstream-request.generation.test.ts src/app/api/openrouter/audio/transcriptions/route.test.ts (6 tests passed)
  • pnpm --filter web typecheck
  • pnpm --filter web lint

@chrarnoldus chrarnoldus self-assigned this Jul 28, 2026
@kilo-code-bot

kilo-code-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The follow-up commit narrows the generation-polling change to a minimal fetchWithBackoff tuning (baseDelayMs/maxDelayMs), reverting the earlier attemptTimeoutMs/AbortSignal/maxBackoffDelayMs additions back to main's existing implementation, with tests updated to match; no new bugs, security issues, or logic errors were found in the changed lines.

Files Reviewed (2 changed files in this update)
  • apps/web/src/lib/ai-gateway/providers/upstream-request.ts
  • apps/web/src/lib/ai-gateway/providers/upstream-request.generation.test.ts
Previous Review Summary (commit 5ed4868)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 5ed4868)

Status: No Issues Found | Recommendation: Merge

Executive Summary

Reviewed the generation-polling timeout/backoff rework and route maxDuration bumps with high confidence and found no security, correctness, or logic bugs in the changed lines.

Files Reviewed (9 files)
  • apps/web/src/app/api/gateway/audio/transcriptions/route.ts
  • apps/web/src/app/api/gateway/v1/audio/transcriptions/route.ts
  • apps/web/src/app/api/openrouter/audio/transcriptions/route.test.ts
  • apps/web/src/app/api/openrouter/audio/transcriptions/route.ts
  • apps/web/src/app/api/openrouter/v1/audio/transcriptions/route.ts
  • apps/web/src/lib/ai-gateway/providers/upstream-request.generation.test.ts
  • apps/web/src/lib/ai-gateway/providers/upstream-request.ts
  • apps/web/src/lib/fetchWithBackoff.test.ts
  • apps/web/src/lib/fetchWithBackoff.ts

Reviewed by claude-sonnet-5 · Input: 60 · Output: 16K · Cached: 2.6M

Review guidance: REVIEW.md from base branch main

@chrarnoldus
chrarnoldus merged commit ea0f08f into main Jul 28, 2026
15 checks passed
@chrarnoldus
chrarnoldus deleted the increase-fetchgeneration-timeout branch July 28, 2026 15:03
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