Skip to content

fix: convert requestOptions.timeout to milliseconds for OpenAI SDK#12451

Open
ScrewTSW wants to merge 1 commit into
continuedev:mainfrom
ScrewTSW:12450-fix-timeout-unit-conversion
Open

fix: convert requestOptions.timeout to milliseconds for OpenAI SDK#12451
ScrewTSW wants to merge 1 commit into
continuedev:mainfrom
ScrewTSW:12450-fix-timeout-unit-conversion

Conversation

@ScrewTSW
Copy link
Copy Markdown

@ScrewTSW ScrewTSW commented May 21, 2026

Description

requestOptions.timeout is configured in seconds by users, but the OpenAI JS SDK constructor expects milliseconds. The value was passed through without conversion, so timeout: 300 (5 minutes) became a 300ms timeout.

One-line fix: multiply by 1000 before passing to the SDK.

Fixes #12450
Likely root cause for many reports in #11818

Checklist

  • I've read the contributing guide
  • I've updated docs if needed
  • I've updated tests if needed

Tests

Tested with local llama.cpp models behind an orchestrator (timeout: 300 in config). Before: immediate "Connection error". After: requests complete normally with model load + prompt eval taking 30-60s.


Summary by cubic

Convert requestOptions.timeout (seconds) to milliseconds before passing to the openai client. Fixes unintended sub-second timeouts and restores expected behavior for long-running requests.

  • Bug Fixes
    • Multiply requestOptions.timeout by 1000 in the OpenAIApi constructor so timeout: 300 becomes 300000 ms, not 300 ms.

Written for commit 4a456a4. Summary will update on new commits. Review in cubic

…OpenAI SDK

The OpenAI JS SDK expects timeout in milliseconds, but users configure
requestOptions.timeout in seconds. Passing the value directly results in
sub-second timeouts (e.g. timeout: 300 becomes 300ms instead of 5 minutes),
causing "Connection error" for any model that takes more than a fraction
of a second to respond.

Fixes continuedev#12450
@ScrewTSW ScrewTSW requested a review from a team as a code owner May 21, 2026 02:22
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label May 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@ScrewTSW
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

OpenAI adapter passes timeout to SDK without unit conversion (seconds vs milliseconds)

1 participant