[codex] fix(ollama): honor request option overrides#12022
[codex] fix(ollama): honor request option overrides#12022yzlu0917 wants to merge 1 commit intocontinuedev:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ac093b5d9
ℹ️ 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".
| stream: options.stream, | ||
| // format: options.format, // Not currently in base completion options | ||
| }; | ||
| if (options.tools?.length && ollamaMessages.at(-1)?.role === "user") { |
There was a problem hiding this comment.
Reinstate Ollama tool-support guard before attaching tools
The new condition now always adds chatOptions.tools for user turns, but the prior templateSupportsTools !== false safeguard was removed. That means models whose /api/show template does not include .Tools will still receive tool definitions and can reject the request, causing tool-enabled chats to fail instead of degrading gracefully. This regression is user-visible whenever Ollama is configured with a model lacking tool-template support.
Useful? React with 👍 / 👎.
Summary
requestOptions.keepAliveandrequestOptions.options/api/generateand/api/chatbodies for both autocomplete and chat requestsWhy
Continue already supports Ollama-specific runtime controls like
keep_alive,num_gpu, andnum_thread, but the practical config path users were relying on (requestOptions.options) was not actually making it through YAML parsing or into the Ollama request body. As a result, Continue could silently drop model residency and hardware-allocation settings, causing Ollama to reload models with default parameters and evict other preloaded models.This change makes those request overrides survive config parsing and flow all the way into Ollama chat and generate requests.
Validation
npm test -- --runInBand llm/llms/Ollama.test.tsincorenpm test -- --runInBand src/schemas/models.test.tsinpackages/config-yamlnpm run buildinpackages/config-yamlnpm run buildinpackages/config-typesgit diff --checknpm run tsc:checkincoreand only hit the existing unrelatedOPENROUTER_HEADERSexport mismatch inllm/llms/OpenRouter.tsCloses #10378
Summary by cubic
Honors Ollama request option overrides from config by parsing
requestOptions.keepAliveandrequestOptions.optionsand merging them into/api/generateand/api/chat. Prevents dropped model residency and hardware settings, and keeps completion options as the source of truth when provided.keepAliveandoptionsinrequestOptionsincore,packages/config-yaml, andpackages/config-types.keepAlive,numGpu,numThreads) overriding request-level defaults.Written for commit 6ac093b. Summary will update on new commits.