fix(openai-adapters): convert requestOptions.timeout from seconds to milliseconds#12563
Open
chatman-media wants to merge 1 commit into
Open
fix(openai-adapters): convert requestOptions.timeout from seconds to milliseconds#12563chatman-media wants to merge 1 commit into
chatman-media wants to merge 1 commit into
Conversation
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
c671741 to
c9bbec2
Compare
…milliseconds requestOptions.timeout is specified in seconds across Continue (see getAgentOptions in @continuedev/fetch, which does `(requestOptions?.timeout ?? TIMEOUT) * 1000`, commented "measured in ms"), but the OpenAI adapter passed it straight to the OpenAI SDK constructor, which expects milliseconds. A user setting `timeout: 300` therefore got a 300ms timeout instead of 300s, causing immediate "Connection error" failures (common with local models). Multiply by 1000 to convert. Closes continuedev#12450
c9bbec2 to
c57f33a
Compare
Author
|
I have read the CLA Document and I hereby sign the CLA. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #12450.
requestOptions.timeoutis specified in seconds throughout Continue —getAgentOptionsin@continuedev/fetchdoes(requestOptions?.timeout ?? TIMEOUT) * 1000; // measured in ms. Butpackages/openai-adapters/src/apis/OpenAI.tspassed the value straight to the OpenAI SDK constructor, which expects milliseconds.So a user setting
timeout: 300(intending 5 minutes) got a 300 ms timeout — ~2000× too short — causing immediate "Connection error" failures, especially with local models that need time to load and process prompts. This matches the reports referenced in #11818 / #11954.Fix: multiply by 1000 to convert seconds → ms, consistent with
getAgentOptions. Whentimeoutis unset,undefinedis passed so the OpenAI SDK keeps its own default (600000 ms).🤖 Generated with Claude Code
Summary by cubic
Fixes the OpenAI adapter timeout by converting
requestOptions.timeoutfrom seconds to milliseconds before passing it to the SDK. Prevents premature connection errors (300s no longer becomes 300ms); 0/undefined are treated as unset so the SDK default applies.timeoutSecondsToMsutility with unit tests and used it when setting the SDKtimeout.Written for commit c57f33a. Summary will update on new commits.