Skip to content

fix(ollama-cloud): capability-gate reasoning_effort + real disable semantics (salvage #51482) - #65723

Merged
teknium1 merged 1 commit into
mainfrom
fix/ollama-cloud-reasoning-gating
Jul 16, 2026
Merged

fix(ollama-cloud): capability-gate reasoning_effort + real disable semantics (salvage #51482)#65723
teknium1 merged 1 commit into
mainfrom
fix/ollama-cloud-reasoning-gating

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Ollama Cloud reasoning is now capability-gated, has a working off switch, and never sends values the API rejects.

Salvage of the follow-up half of #51482 by @kshitijk4poor (the base commit by @s010mn already landed on main as 221cd6024; this picks the remaining correctness fixes, authorship preserved).

Changes

  • plugins/model-providers/ollama-cloud/__init__.py (@kshitijk4poor):
    • Capability gatereasoning_effort only sent to models whose native /api/show capabilities include thinking; non-thinking models (gemma3, qwen3-coder) get nothing
    • Disable actually disables — Ollama Cloud defaults thinking ON and ignores extra_body.thinking:{disabled}; the only real off switch is top-level reasoning_effort:"none", now emitted on enabled:false
    • Unknown efforts omitted — API hard-400s on unrecognized values (accepted: low/medium/high/max/none); minimal and unknowns now omitted instead of forwarded verbatim
  • run_agent.py + hermes_cli/models.py (@kshitijk4poor): cached per-(model, base_url) capability probe (ollama_model_supports_thinking), mirrors the LM Studio pattern — no live HTTP in the per-request path
  • Conflict resolution vs current main: kept main's ultra in the max-clamp tuple (from feat(reasoning): add max and ultra effort levels #62650) alongside the PR's gating/disable/omit fixes

Validation

input before after
non-thinking model + any effort reasoning_effort sent anyway omitted
enabled: false field omitted → thinking stayed ON reasoning_effort: "none"
ultra forwarded verbatim → HTTP 400 clamped to max
unknown value forwarded verbatim → HTTP 400 omitted

Targeted: test_ollama_cloud_profile.py (24), test_run_agent.py + test_models.py (515) — all pass. E2E via real plugin discovery: gate-off/clamp/disable/omit all verified.

Closes #51482. Contributor's original fixes were live-verified against ollama.com per the PR body.

Infographic

ollama-cloud-reasoning-gating

… semantics

Three follow-up fixes to the salvaged reasoning_effort support, all verified
live against ollama.com /v1/chat/completions + /api/show on deepseek-v4-pro,
gemma3, and qwen3-coder:

1. Capability-gate on /api/show 'thinking'. The original ignored the
   supports_reasoning flag and emitted reasoning_effort for every model. Now
   gated: only models whose native /api/show capabilities list contains
   'thinking' (deepseek-v4 yes; gemma3 / qwen3-coder no) get reasoning_effort.
   Mirrors the LM Studio pattern — capability resolved once per (model,
   base_url) in run_agent._supports_reasoning_extra_body via a cached probe
   (hermes_cli.models.ollama_model_supports_thinking), threaded into the
   profile hook as supports_reasoning. No live HTTP in the per-request path.

2. Disable actually disables. Ollama Cloud defaults to thinking ON and IGNORES
   the extra_body.thinking:{type:disabled} shape (verified: still returned
   reasoning). The only working off switch is top-level reasoning_effort:'none'.
   The salvaged code returned ({}, {}) for enabled:false / effort:none, leaving
   thinking ON. Now emits {'reasoning_effort': 'none'}.

3. Omit unrecognized effort. The original forwarded any unknown string verbatim
   including 'minimal' (a real Hermes effort level). Ollama Cloud rejects
   unrecognized values with a hard HTTP 400 (accepted set: low/medium/high/
   max/none), so forwarding 'minimal' would break the request. Now omitted.

Core touches (run_agent.py, hermes_cli/models.py) add the capability probe;
the plugin profile only consumes the resolved flag. 24/24 profile tests green;
194 provider/transport tests unaffected.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/plugins Plugin system and bundled plugins provider/ollama Ollama / local models labels Jul 16, 2026
@teknium1
teknium1 merged commit 5d9a72b into main Jul 16, 2026
33 checks passed
@teknium1
teknium1 deleted the fix/ollama-cloud-reasoning-gating branch July 16, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have provider/ollama Ollama / local models type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants