fix(ollama): skip think for non-reasoning models#82445
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. Current main source can emit truthy top-level native Ollama Real behavior proof Next step before merge Security Review detailsBest possible solution: Land this narrow guard, or an equivalent one, after maintainer review and CI clearance while preserving top-level native Do we have a high-confidence way to reproduce the issue? Yes. Current main source can emit truthy top-level native Ollama Is this the best way to solve the issue? Yes. Suppressing only truthy What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against b9921e21b93d. |
|
Updated the PR body with real behavior proof and re-ran the proof check. Verification:
GitHub Remaining CI failures match current upstream |
786cc92 to
90a5166
Compare
|
Maintainer verification for head Behavior addressed: Ollama provider no longer forwards truthy native
|
90a5166 to
c91088f
Compare
|
Updated maintainer verification for head Behavior addressed: Ollama provider no longer forwards truthy native
|
c91088f to
ff73e14
Compare
|
Rebased again for latest Additional proof after rebase:
All passed locally. Changelog conflict was resolved by preserving both the latest Telegram entry from |
ff73e14 to
e042f0a
Compare
|
Maintainer update pushed after rebasing on current main. Behavior addressed: Ollama native chat no longer forwards truthy top-level
|
Summary
thinkvalues for models markedreasoning: falsethinkfor reasoning-capable/unknown modelsthink: falseso explicit thinking-off requests still workCloses #80332
Test Plan
node scripts/run-vitest.mjs extensions/ollama/src/stream-runtime.test.ts -- -t "non-reasoning"pnpm check:test-typesReal behavior proof
Behavior addressed: native Ollama chat requests for a non-reasoning model no longer include top-level or options-level
think, avoiding the error path triggered when such servers reject thinking for that model.Real environment tested: local OpenClaw Ollama stream runtime on this PR branch, Node 22.18.0, with a local Ollama-compatible HTTP server that returns
400 model does not support thinkingif eitherthinkfield is present.Exact steps or command run after this patch:
pnpm exec tsx .hermes-ollama-proof.tsThe temporary proof script started a local HTTP server, ran
createConfiguredOllamaCompatStreamWrapper+createOllamaStreamFnfor modelllama3.2:latestwithreasoning: falseand configuredparams.thinking: "medium", then consumed the resulting stream.Evidence after fix:
Observed result after fix: the request reached
/api/chatwithoutthink; the local Ollama-compatible server returned a successful NDJSON stream instead of the 400 rejection branch.What was not tested: a live Ollama daemon/model was not available in this cron environment (
ollamacommand was not installed), so the proof uses the real OpenClaw native Ollama request path against a local compatibility server rather than a downloaded Ollama model.Risk/Notes
main; the Ollama focused test and test typecheck passed locally.