Skip to content

fix(ai-gateway): clarify interrupted stream errors - #4927

Merged
chrarnoldus merged 1 commit into
mainfrom
fix/clarify-stream-timeout-disconnect
Jul 31, 2026
Merged

fix(ai-gateway): clarify interrupted stream errors#4927
chrarnoldus merged 1 commit into
mainfrom
fix/clarify-stream-timeout-disconnect

Conversation

@chrarnoldus

Copy link
Copy Markdown
Contributor

Summary

  • clarify that a mid-stream ResponseAborted can indicate either a provider disconnect or a request timeout
  • preserve the existing upstream_disconnect error type and distinct TimeoutError handling
  • update exact JSON and SSE message assertions with and without a Vercel request id

Why

The previous message said the provider disconnected, but ResponseAborted only establishes that the response stream was interrupted. A timeout at the provider, intermediary, or request layer can surface through the same read-error path, so the injected client message should not claim a single cause.

Verification

  • pnpm --filter web exec jest --runInBand --forceExit src/lib/rewriteModelResponse.test.ts (72 tests passed)
  • pnpm exec oxfmt --list-different apps/web/src/lib/rewriteModelResponse.ts apps/web/src/lib/rewriteModelResponse.test.ts
  • git diff --check

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

kilo-code-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Message-only change to the ResponseAborted read-error text in the AI gateway response rewriter, with matching exact-string test updates; the upstream_disconnect error type, 503 status, request-id suffix behavior, and the separate TimeoutError path are all unchanged, so behavioral risk is minimal (high confidence).

Files Reviewed (2 files)
  • apps/web/src/lib/rewriteModelResponse.ts
  • apps/web/src/lib/rewriteModelResponse.test.ts
Verification Notes
  • Checked for other consumers of the old string (The upstream provider disconnected while sending the response.): no remaining references in the repo.
  • Confirmed apps/web/src/tests/openrouterApi.timeout.test.ts asserts different messages produced by upstream-request.ts and is unaffected.
  • Read-only mode: no tests were executed in this session; test results reported in the PR description were not independently reproduced.

Reviewed by claude-opus-5 · Input: 20 · Output: 3.4K · Cached: 430.5K

Review guidance: REVIEW.md from base branch main

@chrarnoldus
chrarnoldus merged commit 1dbd401 into main Jul 31, 2026
16 checks passed
@chrarnoldus
chrarnoldus deleted the fix/clarify-stream-timeout-disconnect branch July 31, 2026 13:57
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