drop the reasoning effort when an Ollama agent model cannot think - #6130
Merged
Conversation
Ollama rejects the whole request — `"<model>" does not support thinking` — rather than ignoring a reasoning field a model has no answer for, both on native /api/chat (`think: true`) and through the OpenAI-compatible `reasoning_effort` that OpenCode's `agent.*.reasoningEffort` becomes. So an agent dispatched at `effort: medium` onto a non-reasoning local model died on its first turn with exit 1 and no output: a pr-reviewer Stage 2 run pinned to gemma3:27b (capabilities ["completion","vision"]) failed three times that way and blocked its task. Resolve the model's thinking capability once per spawn, on the provider every spawn path shares, so the two carriers of the level — the `--effort` argv and OpenCode's config block — drop it together. A failed /api/show probe or an empty capability list means *unknown*, not *unsupported*, and leaves the level alone; a provider pointed at a remote daemon is never probed, since ollamaManager only inspects the local one. Mirrors modelRejectsThinking in codeReview.js, which already solves this for the local reviewer's own calls.
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.
Summary
effort: mediumonto a non-reasoning Ollama model died on its first turn withError: "gemma3:27b" does not support thinking, exit 1, no output. Apr-reviewerStage 2 run hit this three times and blocked its task.think: trueon/api/chat) and through the OpenAI-compatiblereasoning_effortthat OpenCode'sagent.*.reasoningEffortbecomes.dropUnsupportedOllamaThinking()inserver/services/ollamaAgentContext.jsresolves the model's capability once per spawn, on the provider every spawn path shares (TUI / runner / direct), so the two carriers of the level — the--effortargv and OpenCode's config block — drop it together./api/showprobe or an empty capability list leaves the level alone, and a provider pointed at a remote daemon is never probed (ollamaManageronly inspects the local one). MirrorsmodelRejectsThinkingincodeReview.js, which already solves this for the local reviewer's own HTTP calls.Test plan
server/services/ollamaAgentContext.test.js— 8 new cases: drops effort and athinking: trueoverride for a capability-less model, keeps them for a thinking-capable one, keeps them onnull/[]capabilities, and never probes at all for a no-thinking run, a non-Ollama provider, or a remote daemon.reasoning_effortandthink: trueboth return"gemma3:27b" does not support thinking; the same requests without them return 200.npx vitest run(server workspace): 38675 passed. One unrelatedservices/sprites/atlas.test.jstimeout under full-suite load; passes in isolation.