Skip to content

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

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

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

Conversation

@lzyyzznl

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 extensions: ollama size: XS proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 17, 2026
Live-discovered Ollama models report thinking capabilities via /api/show
but the thinking profile resolver only used the catalog-provided `reasoning`
flag, which is undefined for runtime-discovered models not in the configured
catalog. This caused /think to show only "default, off" even for models
that support thinking.

Fix: fall back to the model name heuristic when reasoning is undefined,
matching the logic in buildOllamaModelDefinition.
@lzyyzznl
lzyyzznl force-pushed the fix/issue-93835-ollama-think-menu branch from 1c02159 to b052220 Compare June 17, 2026 01:33
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Jun 17, 2026
@clawsweeper

clawsweeper Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 16, 2026, 9:59 PM ET / 01:59 UTC.

Summary
Review failed before ClawSweeper could summarize the requested change.

PR surface: Source +3. Total +3 across 2 files.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Review metrics: none identified.

Merge readiness
Not assessed.
Failure reason: invalid structured output.

This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict.
Keep any merge decision on the normal maintainer review path until ClawSweeper can complete a fresh review.

Risk before merge

  • [P1] No close action taken because the review did not complete.

Maintainer options:

  1. Decide the mitigation before merge
    Retry the Codex review after fixing the execution failure.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • Review did not complete, so no work-lane recommendation was made.
Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

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

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

AGENTS.md: unclear because the file could not be read completely.

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

Evidence reviewed

PR surface:

Source +3. Total +3 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 5 2 +3
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 5 2 +3

What I checked:

  • failure reason: invalid structured output.
  • codex failure detail: Codex review failed for this PR with exit 0 and wrote invalid JSON or schema-invalid output to /home/runner/work/clawsweeper/clawsweeper/artifacts/event/codex/93844.json: decision.rootCauseCluster.currentItemRelationship fixed_by_candidate requires a canonical PR.
  • codex stderr: No stderr captured.
  • codex stdout: 06d186a0c51f"],"files":["src/auto-reply/thinking.ts"],"confidence":"medium"}],"risks":["Merging this as-is could close the linked bug while leaving the reported glm-5.2:cloud Telegram /think menu on the off-only profile.","The PR body supplies build/unit-test output but no real Telegram/Ollama proof of the after-fix menu behavior."],"bestSolution":"Derive the /think menu options from runtime catalog or capability-derived reasoning metadata for the selected Ollama model, while keeping explicit catalog reasoning:false authoritative.","triagePriority":"P2","impactLabels":[],"mergeRiskLabels":[],"mergeRiskOptions":[],"reviewMetrics":[],"labelJustifications":[{"label":"P2","reason":"This is a normal-priority user-visible Ollama/Telegram bugfix with limited blast radius, but the proposed patch currently misses the reported model."}],"itemCategory":"bug","reproductionStatus":"so.

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)
How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@lzyyzznl

Copy link
Copy Markdown
Contributor Author

Migrated to Pandah97/openclaw fork - see replacement PR

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

Labels

agents Agent runtime and tooling extensions: ollama proof: supplied External PR includes structured after-fix real behavior proof. size: XS

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

1 participant