fix(ollama): show all thinking levels in /think menu for dynamically-discovered models#93864
fix(ollama): show all thinking levels in /think menu for dynamically-discovered models#93864RichChen01 wants to merge 1 commit into
Conversation
…discovered models When an Ollama model with thinking capability is dynamically discovered (e.g. via local Ollama endpoint), it is not in the configured model catalog. The resolveThinkingProfile function was treating undefined reasoning as non-reasoning, returning only ['off'] levels — causing Telegram /think menu to show only 'default, off'. Fix: only return the restricted off-only profile when reasoning is explicitly false. When reasoning is undefined (dynamic model, unknown capabilities), return the full reasoning profile so all thinking levels are available in the menu. Co-Authored-By: Claude <[email protected]>
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as duplicate/superseded: this PR targets the right live-discovered Ollama Canonical path: Close this branch and keep review focused on the runtime-catalog native menu fix at #94067; keep the linked issue open until a canonical PR merges. So I’m closing this here and keeping the remaining discussion on #94067. Review detailsBest possible solution: Close this branch and keep review focused on the runtime-catalog native menu fix at #94067; keep the linked issue open until a canonical PR merges. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: the linked issue gives concrete v2026.6.8 Telegram/Ollama steps, and current main shows native Is this the best way to solve the issue? No. This PR is a plausible mitigation, but the best fix is to pass discovered runtime catalog metadata into native Security review: Security review cleared: Security review cleared: the diff only changes TypeScript provider-policy branching and does not touch dependencies, workflows, secrets, permissions, package resolution, or supply-chain surfaces. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against ab41a311cfdc. |
|
Superseded by #94067, landed in e3ccf87. The canonical fix passes the runtime model catalog into the shared |
Summary
Fixes #93835
When an Ollama model with thinking capability is dynamically discovered (e.g. via local Ollama endpoint
/api/tags), it is not in the configured model catalog. TheresolveThinkingProfilefunction inprovider-policy-api.tswas treatingundefinedreasoning as non-reasoning, returning only["off"]levels — causing the Telegram/thinkmenu to show only "default, off".Root Cause
Two issues combined:
provider-policy-api.ts:resolveThinkingProfile({ reasoning })usedreasoning ? A : B, treatingundefinedas falsy and returning the non-reasoning profile (off-only).Catalog mismatch: Dynamically-discovered models store their
reasoningfield indynamicModelCache, but the thinking system queriesbuildConfiguredModelCatalogwhich only includes configured models. So for dynamic models,reasoningisundefinedwhen resolving the thinking profile.Fix
Change
resolveThinkingProfileto only restrict to off-only whenreasoningis explicitlyfalse. When reasoning isundefined(dynamic model, unknown capabilities), return the full reasoning profile so all thinking levels (off,low,medium,high,max) appear in the/thinkmenu.Behavior mapping
truefalseundefinedundefinedReal behavior proof
Behavior or issue addressed: Telegram
/thinkmenu shows only "default, off" for dynamically-discovered Ollama models that have thinking capability and accept/think mediumetc.Real environment tested: Code path analysis on
openclaw/openclawmain branch (commit0c651fd082b), reviewed against the full call chain:Exact steps or command run after this patch: Code review of the diff and trace verification:
Evidence after fix: The fix changes the conditional from loose falsy check (
reasoning ?) to strict equality check (reasoning === false). This is the complete proof trace:Call chain trace:
Observed result after fix: For any dynamically-discovered Ollama model,
resolveThinkingProfilewill return the reasoning profile (with all levels: off, low, medium, high, max) instead of the non-reasoning profile (off only). The/thinkTelegram menu will display"default, off, low, medium, high, max"as options, matching the actual model capabilities reported byollama/api/show.What was not tested: This fix was not tested against a live Ollama instance + Telegram setup. The fix is based on static code path analysis. The dynamically-discovered models
reasoningflag is correctly set bybuildOllamaModelDefinition(which checkscapabilities.includes("thinking")), but this info lives indynamicModelCacheand is not propagated to the thinking systems catalog lookup — that mismatch is what this fix works around at the profile level. A more complete fix would also sync dynamic model metadata into the catalog, but that would require larger refactoring.Fixes #93835
🤖 Generated with Claude Code