Skip to content

fix: retry OpenAI streaming rate limits - #461

Open
Ben Younes (ousamabenyounes) wants to merge 1 commit into
langchain-ai:mainfrom
ousamabenyounes:fix/issue-431
Open

fix: retry OpenAI streaming rate limits#461
Ben Younes (ousamabenyounes) wants to merge 1 commit into
langchain-ai:mainfrom
ousamabenyounes:fix/issue-431

Conversation

@ousamabenyounes

@ousamabenyounes Ben Younes (ousamabenyounes) commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a retrying fetch wrapper for ChatOpenAI-backed providers so retryable HTTP responses from the OpenAI SDK transport are retried even on streaming runs
  • keep one retry budget for OpenAI-backed transports by disabling the outer LangChain retry layer where the fetch wrapper owns retryable HTTP and transport failures
  • preserve existing custom fetch transports for ChatGPT OAuth and Vertex MaaS by wrapping them instead of replacing them
  • document that OpenAI/OpenAI-compatible streaming HTTP responses are covered by provider retry attempts

Fixes #431

Test verification (RED → GREEN)

RED on origin/main with the new regression test only:

FAIL  test/openai-provider-retry-fetch.test.ts > createModel OpenAI provider retry fetch > retries provider rate-limit responses through the OpenAI SDK fetch
AssertionError: expected undefined to be type of 'function'

Expected: "function"
Received: "undefined"

GREEN on this branch:

pnpm vitest run test/openai-provider-retry-fetch.test.ts
Test Files  1 passed (1)
Tests  3 passed (3)

Additional validation on this branch:

./run-ci.sh
install: pnpm install --frozen-lockfile
format: pnpm run format:check
lint: pnpm run lint:check
typecheck: pnpm run typecheck
build: pnpm run build
cli-smoke: OPENWIKI_DEV=1 node dist/cli.js code --dry-run --init
test: pnpm test
Test Files  54 passed (54)
Tests  662 passed (662)

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.

[Bug]: Rate limits impede initializing the wiki

1 participant