fix(thinking): disable thinking for unsupported Ollama models - #1376
Merged
Merged
Conversation
Fixes Twigpine#1371 - Adds central `shouldUseThinkingForModel` gate that checks the actual route and model descriptor. - Disables thinking parameters for the Ollama route when the model is unknown or unsupported. - Updates API requests to evaluate the actual retry model against the capability gate instead of the initial request model. - Adds targeted tests for Ollama logic and shim payloads.
jatmn
requested changes
May 26, 2026
jatmn
left a comment
Collaborator
There was a problem hiding this comment.
Findings
- [P2] Replace the Ollama shim test with coverage for the actual thinking gate
src/services/api/openaiShim.test.ts:4955
This test asserts that the OpenAI-compatible request body does not containthinking, but the shim already only writesbody.thinkingfor routes whosethinkingRequestFormatisdeepseek-compatible; Ollama does not set that option. That means this new test can pass even if theclaude.tsthinking gate regresses and still constructs Anthropic-side thinking params forllama3.1:8b, so it does not protect the #1371 failure path. Please move the regression coverage to the boundary that changed here, such asqueryModel/the params passed intocreateOpenAIShimClient, or directly covershouldUseThinkingForModelwith the Ollama route so the test fails without the new gate.
Contributor
Author
|
Addressed the requested test change in
Verification:
I also sanity-checked the regression shape by temporarily removing the model capability check from |
jatmn
approved these changes
May 26, 2026
jatmn
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the update. I rechecked the previously discussed paths and do not see any remaining actionable issues from my side.
jatmn
requested review from
Vasanthdev2004,
anandh8x,
auriti,
gnanam1990 and
techbrewboss
May 26, 2026 18:53
kevincodex1
approved these changes
May 26, 2026
discopops
pushed a commit
to discopops/openclaude
that referenced
this pull request
May 28, 2026
…ne#1376) * fix(thinking): disable thinking for unsupported Ollama models Fixes Twigpine#1371 - Adds central `shouldUseThinkingForModel` gate that checks the actual route and model descriptor. - Disables thinking parameters for the Ollama route when the model is unknown or unsupported. - Updates API requests to evaluate the actual retry model against the capability gate instead of the initial request model. - Adds targeted tests for Ollama logic and shim payloads. * test(thinking): cover Ollama thinking gate
Gravirei
added a commit
to Gravirei/openclaude
that referenced
this pull request
May 28, 2026
- fix(autocompact): retry circuit breaker after cooldown (Twigpine#1375) - fix(provider): require API key input when adding OpenGateway (Twigpine#1384) - fix(provider): allow remote Ollama without OPENAI_API_KEY (Twigpine#952) - fix(codex-stream): recover tool args delivered only via done events (Twigpine#1262) - fix: route MiniMax compacting through Anthropic-compatible API (Twigpine#1154) - fix(thinking): disable thinking for unsupported Ollama models (Twigpine#1376) - feat(agents): set active session agent from agents menu (Twigpine#1349) - fix(repl): show permission prompts while draft input is present (Twigpine#1393) - fix(model): include profile models in descriptor picker (Twigpine#1361) - Improve warning notice formatting (Twigpine#1415) - fix(codex): allow credential storage fallback (Twigpine#1347) - fix(attribution): make git attribution opt-in by default (Twigpine#1335) - fix(agent): allow custom model overrides (Twigpine#1337) - feat(query): robust multi-lingual and structural continuation nudge (Twigpine#1280) - fix(watchers): debounce skills and settings reload bursts (Twigpine#1370) - feat: configure API retry backoff (Twigpine#370) (Twigpine#1095) - chore(main): release 0.15.0 (Twigpine#1325) - ci: retrigger CodeQL after action download outage (Twigpine#1374) - Fix launcher heap setup for long sessions (Twigpine#1242)
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.
Fixes #1371
Overview
This pull request addresses the
invalid_request_error: "llama3.1:8b" does not support thinkingAPI failure encountered when using Ollama models that lack reasoning capabilities.By centralizing the thinking gate and evaluating it against the model actually used for the request attempt, OpenClaude avoids constructing Anthropic-side thinking parameters for unsupported Ollama routes, including retry and fallback paths.
Changes
shouldUseThinkingForModelto consistently combine app-level thinking settings, the global thinking disable flag, and model capability support.falsefor thinking support.retryContext.modelinstead of the stale base request model.claude.tsstarts constructing unsupported thinking params again.Verification
bun test src/utils/thinking.test.ts src/services/api/openaiShim.test.tsgit diff --check