Skip to content

fix(fetch): route dynamic model-list fetches through request options#12999

Open
devYRPauli wants to merge 2 commits into
continuedev:mainfrom
devYRPauli:fix/fetch-models-request-options
Open

fix(fetch): route dynamic model-list fetches through request options#12999
devYRPauli wants to merge 2 commits into
continuedev:mainfrom
devYRPauli:fix/fetch-models-request-options

Conversation

@devYRPauli

Copy link
Copy Markdown

Problem

The dynamic model-list fetchers in core/llm/fetchModels.ts (Ollama, OpenRouter, Anthropic, Gemini) call the global fetch() directly. They never go through fetchwithRequestOptions, so they ignore the user's requestOptions (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 fetchwithRequestOptions while these fetchers do not.

Fix

Thread requestOptions through the four fetchers and use fetchwithRequestOptions instead of the raw fetch(). The models/fetch handler in core.ts now loads the config and passes config.requestOptions down.

This mirrors the earlier ContinueServerClient fix in #12993, which deliberately left fetchModels.ts untouched.

Notes

  • No behavior change for users without requestOptions configured; it stays a no-op for them.
  • The change follows the existing fetchwithRequestOptions(url, init, requestOptions) call pattern already used elsewhere in core.ts.

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>
@devYRPauli
devYRPauli requested a review from a team as a code owner July 19, 2026 01:32
@devYRPauli
devYRPauli requested review from sestinj and removed request for a team July 19, 2026 01:32
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 19, 2026
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>
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

const target = redirectTo.startsWith("http")
? redirectTo
: `/docs${redirectTo}`;

P2 Badge Preserve standalone docs paths when redirecting

For legacy redirects from docs/docs.json with internal destinations such as /cli/overview -> /cli/quickstart, this constructs /docs/cli/quickstart. The standalone docs app generates pages at /cli/quickstart and other code routes links through resolveHref to strip /docs, so redirected users land on an ungenerated/404 path in the static export. Route internal redirects through resolveHref or use redirectTo as-is.


const llm = llmFromProviderAndOptions(provider, {
apiKey,
apiBase: apiBase || defaultApiBase,
model: "",
});

P2 Badge Pass request options into listModels fallback

When a provider falls through to listModels (for example the OpenAI/Mistral refresh button in Add Model), this LLM is constructed without requestOptions, so BaseLLM.fetch has no proxy, custom CA, or custom headers. Users with requestOptions configured still fail on these model-list fetches even though models/fetch loaded config.requestOptions; thread the option into this fallback constructor too.


const isValid = core.invoke("mdm/setLicenseKey", {
licenseKey,
});

P2 Badge Restore enterprise license handling

After removing the core mdm/setLicenseKey listener, this command is still contributed and calls it. In the VS Code in-process messenger, invoke returns undefined when no listener is registered, so any entered enterprise key is treated as invalid; JetBrains' AddLicenseKey action still sends the same message too. Restore the handler or remove/disable the command.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

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

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant