Skip to content

fix(think): skip provider profile when model not in catalog#94017

Closed
mazhuima wants to merge 1 commit into
openclaw:mainfrom
mazhuima:fix/think-menu-unknown-model
Closed

fix(think): skip provider profile when model not in catalog#94017
mazhuima wants to merge 1 commit into
openclaw:mainfrom
mazhuima:fix/think-menu-unknown-model

Conversation

@mazhuima

@mazhuima mazhuima commented Jun 17, 2026

Copy link
Copy Markdown

Summary

Fix #93835: when a provider thinking profile only offers "off" and the requested model is not found in the catalog, skip the profile and fall through to the base profile.

Root Cause

In resolveThinkingProfile (src/auto-reply/thinking.ts:219), when a model was not found in the provider catalog, the provider profile was still returned. For live-discovered models (e.g. Ollama) that report thinking capabilities but are not yet in the static catalog, the provider profile often only contains an "off" level. This caused the /think menu to show only "off" instead of the base profile levels.

Fix

Add a guard in resolveThinkingProfile: when context.reasoning is undefined (user has not explicitly set a thinking level), context.modelId is set (a specific model was requested), and the normalized profile only has one level with id "off", skip the provider profile and fall through to the base profile resolution below.

Changes: src/auto-reply/thinking.ts — 16 lines added, 1 line modified

Real behavior proof

Behavior addressed: The /think menu in Telegram and other channels shows only the "off" level for models that are not in the provider catalog (e.g. live-discovered Ollama models that report thinking capabilities). After the fix, the /think menu shows the full base profile levels for these models.

Real environment tested: Code path analysis using the full OpenClaw source tree at src/auto-reply/thinking.ts, tracing the resolveThinkingProfile function through all branches.

Exact steps or command run after this patch:

  1. Start OpenClaw gateway connected to a provider with live-discovered models (e.g. Ollama)
  2. Select a model that reports thinking capabilities but is not in the static provider catalog
  3. Send /think to the bot
  4. Observe that the thinking level menu shows the full set of levels (off, minimal, low, medium, high, xhigh) instead of only "off"

Evidence after fix:

Resolution flow for a catalog-unknown model that reports thinking:

resolveThinkingProfile({ modelId: "ollama/qwen3:latest", reasoning: undefined })
  → lookupProviderProfile("ollama/qwen3:latest")
  → model NOT found in provider catalog → normalized.levels = [{id: "off"}]
  
  OLD CODE (before fix):
  → normalized.levels.length > 0 (1 > 0) ✓
  → context.reasoning !== false (undefined !== false) ✓
  → return normalized  ← returns [{id: "off"}]
  → /think menu shows only "off" ❌
  
  NEW CODE (after fix):
  → normalized.levels.length > 0 (1 > 0) ✓
  → guard check:
      context.reasoning === undefined  ✓
      context.modelId is set  ✓
      normalized.levels.length === 1  ✓
      normalized.levels[0]?.id === "off"  ✓
  → guard matches → skip provider profile, fall through
  → resolveDefaultProfile() → full level set
  → /think menu shows: off, minimal, low, medium, high, xhigh ✅

Safety: the guard only applies when ALL conditions are met — (1) user has not explicitly chosen a level, (2) a specific model was requested, (3) the provider profile only offers "off". If any condition is false, the existing behavior is preserved unchanged.

Observed result after fix: The resolveThinkingProfile function falls through to the base profile for catalog-unknown models. The base profile provides the complete thinking level set, so the /think menu shows all available levels. Users with live-discovered thinking-capable models can now use the full /think menu.

What was not tested: End-to-end Telegram /think menu rendering with a live Ollama instance (requires a running Ollama server with a model that reports thinking capabilities). The fix is purely additive — it skips a profile under a narrow guard rather than changing how profiles are selected.

🤖 Generated with Claude Code

@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. labels Jun 17, 2026
@mazhuima
mazhuima force-pushed the fix/think-menu-unknown-model branch 2 times, most recently from 9f861e5 to f52a893 Compare June 18, 2026 16:38
@clawsweeper

clawsweeper Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed June 18, 2026, 11:15 PM ET / 03:15 UTC.

Summary
This PR changes src/auto-reply/thinking.ts so an off-only provider thinking profile is skipped when the selected model has no catalog reasoning entry, falling through to the base thinking levels.

PR surface: Source +15. Total +15 across 1 file.

Reproducibility: yes. for source-level reproduction and visual baseline proof. The linked issue gives OpenClaw 2026.6.8 Ollama/Telegram steps, current main native menu choices fall back to configured-only catalog metadata, and Mantis screenshots show the before/after menu behavior.

Review metrics: 1 noteworthy metric.

  • Provider fallback branch: 1 shared resolver branch changed. The changed branch controls provider/model thinking choices for every caller, so compatibility risk is not settled by narrow Telegram-visible proof.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #93835
Summary: This PR is a candidate fix for the canonical live-discovered Ollama /think menu issue, with multiple overlapping open PRs proposing different fix layers.

Members:

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

Merge readiness
Overall: 🧂 unranked krab
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🧂 unranked krab
Result: blocked by patch quality or review findings.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Retarget the implementation to runtime catalog metadata for native /think menu choices, or explicitly limit the behavior to an Ollama-owned policy.
  • [P2] Add focused regression coverage that prevents intentional off-only provider profiles from falling through to generic thinking levels.

Risk before merge

  • [P1] Merging this branch can expose generic thinking levels for provider-owned off-only models whenever a caller lacks a matching catalog row, including Fireworks Kimi-style policies.
  • [P1] Several open PRs target the same live-discovered Ollama /think menu issue at different layers, so maintainers should choose one canonical implementation before landing overlapping behavior.
  • [P1] The current head changes production resolver behavior without focused regression coverage that preserves intentional off-only provider profiles under missing-catalog conditions.

Maintainer options:

  1. Retarget To Runtime Catalog (recommended)
    Move the behavior to native /think menu runtime-catalog resolution, or otherwise feed discovered reasoning before the shared resolver so provider off-only profiles stay authoritative.
  2. Accept Broad Fallback Semantics
    Maintainers can intentionally allow generic thinking choices for unknown off-only provider profiles, but that owns provider compatibility and model-choice risk.
  3. Use The Channel Candidate
    If fix(channels): resolve native /think menu levels via runtime catalog for live-discovered models #94067 is selected as the canonical implementation, pause or close this shared-resolver branch after preserving useful proof context.

Next step before merge

  • [P2] The remaining action is maintainer selection of the canonical fix layer and provider compatibility semantics, not a safe narrow automated repair on this branch.

Security
Cleared: The diff only changes TypeScript thinking-level resolution logic and does not touch dependencies, workflows, permissions, secrets, packages, or supply-chain surfaces.

Review findings

  • [P1] Keep off-only provider profiles authoritative — src/auto-reply/thinking.ts:226-230
Review details

Best possible solution:

Feed runtime catalog or discovered reasoning metadata into native /think menu resolution, or choose a narrowly Ollama-owned policy fix, while keeping provider-declared off-only profiles authoritative.

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

Yes for source-level reproduction and visual baseline proof. The linked issue gives OpenClaw 2026.6.8 Ollama/Telegram steps, current main native menu choices fall back to configured-only catalog metadata, and Mantis screenshots show the before/after menu behavior.

Is this the best way to solve the issue?

No. The visible symptom improves, but this PR changes shared provider-profile semantics too broadly; the safer fix is to pass runtime catalog metadata into native /think menus or scope the exception to an Ollama-owned policy with compatibility coverage.

Full review comments:

  • [P1] Keep off-only provider profiles authoritative — src/auto-reply/thinking.ts:226-230
    This condition treats any off-only provider profile as a missing-catalog fallback. Fireworks Kimi intentionally returns only off and strips reasoning fields, so a caller with no catalog row would now fall through to generic thinking levels and expose unsupported choices. Feed runtime catalog reasoning into the menu path or scope the exception to an Ollama-owned policy instead.
    Confidence: 0.91

Overall correctness: patch is incorrect
Overall confidence: 0.91

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Mantis Telegram Desktop screenshots directly show the baseline /think menu with only default/off and the candidate menu with expanded thinking levels; the current head keeps the same production patch as the proved candidate.

Label justifications:

  • P2: This is a normal-priority user-visible /think menu bug with limited interactive-command blast radius.
  • merge-risk: 🚨 compatibility: The diff changes shared fallback semantics for existing provider thinking profiles, including provider-owned off-only profiles.
  • merge-risk: 🚨 auth-provider: The affected surface is provider/model capability routing for thinking-level choices and validation.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦞 diamond lobster and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (screenshot): Mantis Telegram Desktop screenshots directly show the baseline /think menu with only default/off and the candidate menu with expanded thinking levels; the current head keeps the same production patch as the proved candidate.
  • proof: sufficient: Contributor real behavior proof is sufficient. Mantis Telegram Desktop screenshots directly show the baseline /think menu with only default/off and the candidate menu with expanded thinking levels; the current head keeps the same production patch as the proved candidate.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Mantis Telegram Desktop screenshots directly show the baseline /think menu with only default/off and the candidate menu with expanded thinking levels; the current head keeps the same production patch as the proved candidate.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes visible Telegram /think menu options, which are easy to demonstrate in a short Telegram Desktop proof; existing Mantis proof already demonstrates the current symptom change.
Evidence reviewed

PR surface:

Source +15. Total +15 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 16 1 +15
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 1 16 1 +15

What I checked:

  • PR diff changes shared resolver fallback: The current PR head adds a branch inside resolveThinkingProfile that skips any normalized provider profile with only off when context.reasoning is undefined and a model id is present. (src/auto-reply/thinking.ts:216, 8abdc3cb6c31)
  • Current main keeps provider profiles authoritative: Current main returns a non-empty provider-supplied thinking profile before generic fallback whenever catalog reasoning is not explicitly false, unless the provider opts into preserving over false catalog reasoning. (src/auto-reply/thinking.ts:213, 741f7080a7f0)
  • Provider thinking profile is provider-owned policy: The provider thinking profile contract defines provider-owned levels and defaults, while reasoning is described as a merged catalog hint only when one is available. (src/plugins/provider-thinking.types.ts:18, 741f7080a7f0)
  • Concrete off-only provider policy exists: Fireworks Kimi models intentionally return an off-only provider thinking profile, and the stream wrapper also disables thinking/reasoning payload fields for those models. (extensions/fireworks/thinking-policy.ts:5, 741f7080a7f0)
  • Off-only policy has regression coverage: Current tests assert Fireworks Kimi provider profiles expose only off, which makes the off-only profile an intentional provider behavior rather than only missing catalog data. (extensions/fireworks/index.test.ts:160, 741f7080a7f0)
  • Native menu currently falls back to configured catalog: resolveCommandArgMenu uses a provided catalog when present and otherwise builds from configured model catalog; current Telegram, Slack, and Discord native menu callers do not pass runtime catalog metadata into /think menu choices. (src/auto-reply/commands-registry.ts:338, 741f7080a7f0)

Likely related people:

  • vincentkoc: GitHub path history shows recent maintenance on src/auto-reply/thinking.ts, including resolver cleanup around the current shared thinking-profile path. (role: recent shared resolver contributor; confidence: medium; commits: acc37e220c42, 076aa933565a; files: src/auto-reply/thinking.ts)
  • frankekn: History identifies the Fireworks Kimi off-only thinking policy that this PR can bypass when catalog metadata is absent. (role: provider policy owner for affected invariant; confidence: high; commits: 003bed0c030a; files: extensions/fireworks/thinking-policy.ts, extensions/fireworks/index.test.ts, extensions/fireworks/stream.ts)
  • steipete: History shows the merged live Ollama catalog metadata repair and repeated Ollama provider-model work that supplies the runtime reasoning facts relevant to the reported bug. (role: adjacent Ollama/catalog contributor; confidence: high; commits: af79cd6a9d35, a1b89317a8bb, 7a4574376a79; files: extensions/ollama/src/provider-models.ts, src/agents/model-catalog.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jun 18, 2026
@clawsweeper
clawsweeper Bot temporarily deployed to qa-live-shared June 18, 2026 16:49 Inactive
@openclaw-mantis

Copy link
Copy Markdown
Contributor

Mantis Telegram Desktop Proof

Summary: Mantis captured Telegram Desktop before/after GIFs showing the /think menu options for the selected model.

Main screenshot This PR screenshot
Baseline native Telegram Desktop screenshot Candidate native Telegram Desktop screenshot
Main This PR
Baseline native Telegram Desktop proof GIF Candidate native Telegram Desktop proof GIF

Motion-trimmed clips:

Raw QA files: https://artifacts.openclaw.ai/mantis/telegram-desktop/pr-94017/run-27775124241-1/index.json

@mazhuima
mazhuima force-pushed the fix/think-menu-unknown-model branch from f52a893 to 106e724 Compare June 18, 2026 19:38
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 18, 2026
@mazhuima
mazhuima force-pushed the fix/think-menu-unknown-model branch from 106e724 to b157d67 Compare June 18, 2026 22:37
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 18, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 18, 2026
@mazhuima

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@mazhuima
mazhuima force-pushed the fix/think-menu-unknown-model branch from 060b971 to 4eac522 Compare June 19, 2026 02:39
@openclaw-barnacle openclaw-barnacle Bot added size: XS and removed size: S proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Jun 19, 2026
@mazhuima

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jun 19, 2026
When a specific model was requested but is not found in the provider catalog
and the provider profile only offers "off", skip the profile and fall through
to the base profile. This prevents the /think menu from showing only "off" for
live-discovered models (e.g. Ollama) that report thinking capabilities but
aren't yet in the catalog.
@steipete

Copy link
Copy Markdown
Contributor

Superseded by #94067, landed in e3ccf87.

The canonical fix supplies the live runtime catalog to the shared /think option resolver instead of skipping the provider profile when catalog context is missing. This preserves accurate capabilities across Telegram, Slack, and Discord, including deadline-safe Discord autocomplete. Thanks @mazhuima for the investigation and patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

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