Skip to content

fix: expose ollama thinking profile before activation#77617

Merged
obviyus merged 2 commits intoopenclaw:mainfrom
yfge:fix/issue-77612
May 5, 2026
Merged

fix: expose ollama thinking profile before activation#77617
obviyus merged 2 commits intoopenclaw:mainfrom
yfge:fix/issue-77612

Conversation

@yfge
Copy link
Copy Markdown
Contributor

@yfge yfge commented May 5, 2026

Summary

  • expose Ollama's reasoning-capable thinking profile from the lightweight provider-policy artifact
  • keep /think max available for reasoning-capable Ollama models before the full Ollama plugin runtime activates
  • add regression coverage for the public artifact path

Changes

  • add resolveThinkingProfile() to extensions/ollama/provider-policy-api.ts
  • reuse that resolver from the full Ollama runtime registration
  • return off/low/medium/high/max for reasoning-capable Ollama models and off otherwise
  • document the fix in CHANGELOG.md

Real behavior proof

  • Behavior or issue addressed: ollama/deepseek-v4-pro:cloud rejected /think max before the Ollama plugin runtime activated.
  • Real environment tested: local OpenClaw build from this PR worktree (openclaw 2026.5.4, head ecde0494faae975180bcda243f80472b810a0f18) with built runtime artifacts generated by pnpm openclaw models --help.
  • Exact steps or command run after this patch:
    node --input-type=module <<'EOF_RUN'
    const thinking = await import('./dist/thinking-DtIsL--U.js');
    const catalog = [{ provider: 'ollama', id: 'deepseek-v4-pro:cloud', reasoning: true }];
    console.log(`levels=${thinking.t('ollama', 'deepseek-v4-pro:cloud', '|', catalog)}`);
    console.log(`maxSupported=${thinking.n({ provider: 'ollama', model: 'deepseek-v4-pro:cloud', level: 'max', catalog })}`);
    EOF_RUN
  • Evidence after fix: Terminal capture from the built OpenClaw runtime:
    levels=off|low|medium|high|max
    maxSupported=true
    
  • Observed result after fix: the startup-safe provider-policy path now advertises max for reasoning-capable Ollama Cloud models before full plugin activation, so the /think max validation path no longer falls back to the base off|minimal|low|medium|high profile.
  • What was not tested: live Fedora/Ollama Cloud chat round trip.

Testing

  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/ollama/index.ts extensions/ollama/provider-policy-api.ts extensions/ollama/provider-policy-api.test.ts
  • pnpm test extensions/ollama/provider-policy-api.test.ts extensions/ollama/index.test.ts
  • Testbox pnpm check:changed

Fixes #77612

@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 5, 2026

Codex review: needs maintainer review before merge.

Summary
The PR adds an Ollama resolveThinkingProfile export to the provider-policy artifact, regression coverage, and a changelog entry for #77612.

Reproducibility: yes. by source inspection. Current main's fallback path can ask the provider-policy artifact before runtime activation, but Ollama's artifact currently lacks the profile while the runtime hook exposes max for reasoning models.

Next step before merge
No ClawSweeper repair job is needed because this open PR already contains the narrow code, test, and changelog change; the remaining action is normal review and CI.

Security
Cleared: The diff only adds typed provider-policy data, a unit test, and changelog text; it does not touch dependency, workflow, install, secret, or code-execution surfaces.

Review details

Best possible solution:

Land this PR after normal CI or changed-gate validation, keeping the lightweight policy artifact aligned with the full Ollama runtime hook.

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

Yes, by source inspection. Current main's fallback path can ask the provider-policy artifact before runtime activation, but Ollama's artifact currently lacks the profile while the runtime hook exposes max for reasoning models.

Is this the best way to solve the issue?

Yes. Adding the Ollama-owned static profile to extensions/ollama/provider-policy-api.ts is the narrowest maintainable fix and does not require a new core seam or config option.

What I checked:

Likely related people:

  • vincentkoc: Current blame for the Ollama provider-policy artifact, provider-thinking fallback, and runtime Ollama thinking profile points to Vincent Koc's provider fast-path work; earlier Ollama commits also cover native thinking fallback behavior. (role: recent maintainer and Ollama/provider-policy owner; confidence: high; commits: d253392ea2a3, d6d04f361e1c; files: extensions/ollama/provider-policy-api.ts, src/plugins/provider-thinking.ts, extensions/ollama/index.ts)
  • Bruce MacDonald: Recent Ollama thinking work changed how OpenClaw sends native think options when thinking is off, adjacent to the same provider-owned thinking behavior. (role: adjacent Ollama thinking maintainer; confidence: medium; commits: 773c57b41882; files: extensions/ollama/src/stream.ts, src/agents/pi-embedded-runner/extra-params.ts)

Remaining risk / open question:

  • I did not independently run the PR branch tests in this read-only review; merge should still be gated by normal CI or changed-gate proof.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 58c4f9e190bc.

@byungskers

This comment was marked as low quality.

@yfge yfge force-pushed the fix/issue-77612 branch from da9e98a to b255a8d Compare May 5, 2026 02:49
@yfge
Copy link
Copy Markdown
Contributor Author

yfge commented May 5, 2026

Rebased this branch onto current origin/main and resolved the CHANGELOG.md conflict. The code diff remains limited to the Ollama provider-policy artifact/test plus changelog.

Validation after rebase:

  • pnpm test extensions/ollama/provider-policy-api.test.ts
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/ollama/provider-policy-api.ts extensions/ollama/provider-policy-api.test.ts
  • pnpm tsgo:extensions && pnpm tsgo:test:extensions

Note: the first typecheck attempt exposed missing local deps (web-tree-sitter); I ran pnpm install and then the extension prod/test typechecks passed.

@obviyus obviyus force-pushed the fix/issue-77612 branch from b255a8d to 2e787e6 Compare May 5, 2026 07:00
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 5, 2026
@obviyus obviyus self-assigned this May 5, 2026
@obviyus obviyus force-pushed the fix/issue-77612 branch from 2e787e6 to ecde049 Compare May 5, 2026 07:07
@obviyus obviyus removed the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 5, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 5, 2026
Copy link
Copy Markdown
Contributor

@obviyus obviyus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the Ollama startup-lazy thinking regression: the lightweight Ollama provider-policy artifact now exposes the reasoning-capable profile, so ollama/deepseek-v4-pro:cloud advertises max before the full plugin runtime activates.

Maintainer follow-up rebased onto current main, reused the lightweight resolver from the full Ollama runtime registration, moved the changelog entry to the active Fixes block, and refreshed the PR body's real-behavior proof.

Validation: pnpm test extensions/ollama/provider-policy-api.test.ts extensions/ollama/index.test.ts, targeted oxfmt, Testbox pnpm check:changed, and GitHub Real behavior proof passed. No open review threads remained.

@obviyus obviyus merged commit 5e9258d into openclaw:main May 5, 2026
98 of 107 checks passed
@obviyus
Copy link
Copy Markdown
Contributor

obviyus commented May 5, 2026

Landed on main.

Thanks @yfge.

vincentkoc added a commit to VintageAyu/openclaw that referenced this pull request May 5, 2026
…ainer-hardening

* origin/main: (843 commits)
  docs(changelog): relocate openclaw#77046 and openclaw#77280 entries from 2026.5.3 to Unreleased (openclaw#77728)
  docs: reorder unreleased changelog
  fix: expose ollama thinking profile before activation (openclaw#77617) (thanks @yfge)
  fix: expose ollama thinking profile before activation
  test(gateway): preserve dispatch timers in waiter
  test(gateway): keep startup context timer live
  docs: document cache-friendly activity helper
  ci: install ffmpeg for Mantis media previews
  fix: avoid impossible device token rotation advice (openclaw#77688) (thanks @Conan-Scott)
  docs(changelog): note doctor device pairing advice fix
  fix(doctor): avoid impossible device token rotation advice
  ci: use Crabbox media previews for Mantis
  docs: filter maintainer-owned triage noise
  test: cover GitHub activity helper
  fix(session-file-repair): drop null-role message entries instead of preserving them (openclaw#77288)
  fix: prune orphan session artifacts
  perf: reduce GitHub activity cache misses
  fix: cache session list model resolution (openclaw#77650) (thanks @ragesaq)
  ci: embed Mantis desktop previews
  fix(replay-history): drop trailing stream-error placeholder before provider send (openclaw#77287)
  ...

# Conflicts:
#	CHANGELOG.md
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ollama/deepseek-v4-pro:cloud does not allow "max" in v2026.5.3-1

3 participants