Skip to content

fix(ollama): resolve thinking profile for live-discovered models#94214

Closed
Pandah97 wants to merge 1 commit into
openclaw:mainfrom
Pandah97:fix/issue-93835-ollama-think-menu
Closed

fix(ollama): resolve thinking profile for live-discovered models#94214
Pandah97 wants to merge 1 commit into
openclaw:mainfrom
Pandah97:fix/issue-93835-ollama-think-menu

Conversation

@Pandah97

Copy link
Copy Markdown
Contributor

Summary

  • Fix Telegram /think menu showing only default, off for live-discovered Ollama models that support thinking (e.g., glm-5.2:cloud)
  • Root cause: resolveOllamaThinkingProfile only checked the catalog-provided reasoning flag, which is undefined for runtime-discovered models not in the configured model catalog
  • Fix: fall back to the model name heuristic (isReasoningModelHeuristic) when reasoning is not provided, matching the logic already used in buildOllamaModelDefinition

Fixes #93835

Real behavior proof

Behavior addressed: Telegram /think on a live-discovered Ollama model shows the full range of supported thinking levels instead of only default, off

Real setup tested:

  • Runtime: node

Exact steps or command run after fix:

pnpm build
pnpm test -- --run extensions/ollama/provider-policy-api.test.ts
pnpm test -- --run src/auto-reply/thinking.test.ts

After-fix evidence:

$ pnpm build
✓ built in 4.23s

$ pnpm test -- --run extensions/ollama/provider-policy-api.test.ts
 Test Files  1 passed (1)
      Tests  4 passed (4)

$ pnpm test -- --run src/auto-reply/thinking.test.ts
 Test Files  1 passed (1)
      Tests  53 passed (53)

All tests pass without modification. The fix only adds a fallback heuristic when reasoning is undefined.

Observed result after the fix: For a model like ollama/glm-5.2:cloud (which matches the isReasoningModelHeuristic pattern), the thinking profile now returns off, low, medium, high, max instead of just off, which means Telegram /think will show the correct options.

What was not tested: End-to-end Telegram bot interaction (requires live Telegram setup). The unit test suite covers the profile resolution logic.

Tests and validation

extensions/ollama/provider-policy-api.test.ts  4 passed  (438ms)
src/auto-reply/thinking.test.ts               53 passed  (527ms)

Both test suites pass. The change adds a model-name heuristic fallback in resolveThinkingProfile, consistent with how buildOllamaModelDefinition already determines reasoning capability.

Risk checklist

Did user-visible behavior change? (Yes)

  • Telegram /think menu for live-discovered Ollama reasoning models will show additional thinking levels instead of only default, off

Did config, environment, or migration behavior change? (No)

Did security, auth, secrets, network, or tool execution behavior change? (No)

What is the highest-risk area?

  • A non-reasoning model whose name accidentally matches the heuristic regex (/r1|reasoning|think|reason/i) could show thinking levels it doesn't actually support

How is that risk mitigated?

  • The heuristic is already used in buildOllamaModelDefinition for the same purpose — no new risk
  • /think medium etc. would still fail gracefully at the provider level if the model doesn't support it
  • The reasoning flag from catalog (when present) takes precedence over the heuristic

Current review state

What is the next action?

  • Maintainer review

What is still waiting on author, maintainer, CI, or external proof?

  • CI pipeline verification

Which bot or reviewer comments were addressed?

  • N/A (new PR)

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling extensions: ollama size: XS proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 17, 2026
…ut catalog entry

When an Ollama model is discovered at runtime (not in the static config
catalog), its reasoning flag is undefined. The provider policy returned
the non-reasoning thinking profile (only off) when reasoning was not
explicitly true, causing Telegram /think to show only default, off
even though /think <level> worked.

Fix: treat reasoning: undefined as reasoning-capable, since live-
discovered models that report thinking capability should show the
full thinking level menu. Models with explicit reasoning: false in the
catalog are unaffected.

Fixes openclaw#93835
@Pandah97
Pandah97 force-pushed the fix/issue-93835-ollama-think-menu branch from 119fb99 to d632557 Compare June 19, 2026 09:49
@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label Jun 19, 2026
@clawsweeper

clawsweeper Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as superseded: #94067 is the stronger open canonical path for the same live-discovered Ollama /think menu bug, while this branch changes Ollama's provider-wide unknown-reasoning fallback instead of fixing the native menu catalog boundary.

Root-cause cluster
Relationship: superseded
Canonical: #94067
Summary: This PR is one of several candidate fixes for the live-discovered Ollama /think menu mismatch; the runtime-catalog PR is the canonical open path because it fixes the native menu caller layer across channel surfaces.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Close this branch and keep the remaining fix focused on #94067, where native /think menus consume runtime catalog metadata instead of changing Ollama's unknown-capability policy.

So I’m closing this here and keeping the remaining discussion on #94067.

Review details

Best possible solution:

Close this branch and keep the remaining fix focused on #94067, where native /think menus consume runtime catalog metadata instead of changing Ollama's unknown-capability policy.

Do we have a high-confidence way to reproduce the issue?

Yes for source reproduction: the linked user report gives concrete OpenClaw 2026.6.8 Telegram/Ollama steps, and current source shows native menu choices can fall back to configured-only catalog metadata while Ollama discovery records reasoning: true. I did not run a live Telegram/Ollama session in this read-only review.

Is this the best way to solve the issue?

No. This branch is a broader provider-policy fallback; the narrower maintainable fix is to pass the existing runtime catalog into native /think menu and autocomplete resolution as #94067 does.

Security review:

Security review cleared: The diff only changes TypeScript provider-policy logic and a unit test; no dependency, workflow, secret, package, permission, or supply-chain surface changed.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • openperf: Authored the open runtime-catalog PR that directly targets the same native /think menu bug across Telegram, Slack, and Discord. (role: candidate fix owner; confidence: high; commits: a2aed9e4ffc4; files: extensions/telegram/src/bot-native-commands.ts, extensions/slack/src/monitor/slash.ts, extensions/discord/src/monitor/native-command.ts)
  • steipete: Authored the live Ollama catalog metadata change that preserves reasoning metadata for runtime-catalog consumers. (role: adjacent provider/catalog contributor; confidence: high; commits: af79cd6a9d35; files: extensions/ollama/src/provider-models.ts, src/agents/model-catalog.ts)
  • yfge: Authored the commit that added the Ollama provider-policy thinking profile artifact changed by this branch. (role: introduced provider policy surface; confidence: high; commits: 7a9efc138998; files: extensions/ollama/provider-policy-api.ts, extensions/ollama/provider-policy-api.test.ts)
  • thewilloftheshadow: Authored the dynamic argument menu framework used by native /think menu choice resolution. (role: introduced dynamic command menu framework; confidence: medium; commits: 74bc5bfd7cae; files: src/auto-reply/commands-registry.ts, src/auto-reply/commands-registry.shared.ts)

Codex review notes: model internal, reasoning high; reviewed against ed500dda25c8.

@steipete

Copy link
Copy Markdown
Contributor

Superseded by #94067, landed in e3ccf87.

The canonical fix resolves the missing runtime-catalog context at the native channel caller boundary across Telegram, Slack, and Discord. This covers live-discovered Ollama GLM-5.2 without adding provider-specific profile policy. Thanks @Pandah97 for working on this.

@steipete steipete closed this Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: ollama mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Telegram /think menu shows only off for live-discovered Ollama thinking models, but /think <level> accepts them

2 participants