fix(fetch): route dynamic model-list fetches through request options#12999
fix(fetch): route dynamic model-list fetches through request options#12999devYRPauli wants to merge 2 commits into
Conversation
The Ollama, OpenRouter, Anthropic, and Gemini model-list fetchers in fetchModels.ts called the global fetch() directly, bypassing the user's requestOptions (proxy, custom CA / verifySsl, custom headers). Behind an SSL-intercepting corporate proxy the Add Model dropdown failed to load these lists even though normal chat requests (which use fetchwithRequestOptions) succeeded. Thread requestOptions through the four fetchers and pass config.requestOptions from the models/fetch handler, mirroring the ContinueServerClient fix in continuedev#12993. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Yash Raj Pandey <yashpn62@gmail.com>
fetchwithRequestOptions().json() returns unknown (global fetch returned any), so annotate the parsed data as any to preserve the prior behavior, and run prettier on the file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
💡 Codex Reviewcontinue/docs-site/app/[[...slug]]/page.tsx Lines 69 to 71 in a7bce9f For legacy redirects from continue/core/llm/fetchModels.ts Lines 247 to 251 in a7bce9f When a provider falls through to continue/extensions/vscode/src/commands.ts Lines 712 to 714 in a7bce9f After removing the core ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Problem
The dynamic model-list fetchers in
core/llm/fetchModels.ts(Ollama, OpenRouter, Anthropic, Gemini) call the globalfetch()directly. They never go throughfetchwithRequestOptions, so they ignore the user'srequestOptions(proxy, custom CA /verifySsl, custom headers).Behind an SSL-intercepting corporate proxy, or with a custom CA configured, the "Add model" dropdown fails to load these provider model lists even though normal chat requests succeed - because chat already routes through
fetchwithRequestOptionswhile these fetchers do not.Fix
Thread
requestOptionsthrough the four fetchers and usefetchwithRequestOptionsinstead of the rawfetch(). Themodels/fetchhandler incore.tsnow loads the config and passesconfig.requestOptionsdown.This mirrors the earlier
ContinueServerClientfix in #12993, which deliberately leftfetchModels.tsuntouched.Notes
requestOptionsconfigured; it stays a no-op for them.fetchwithRequestOptions(url, init, requestOptions)call pattern already used elsewhere incore.ts.