Skip to content

fix(ollama): cloud models vanish from discovery when inspection returns nothing - #130240

Merged
steipete merged 1 commit into
openclaw:mainfrom
Yigtwxx:fix/ollama-list-capabilities-provenance
Aug 26, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
Yigtwxx:fix/ollama-list-capabilities-provenance

Conversation

@Yigtwxx

@Yigtwxx Yigtwxx commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Related: #130000

What Problem This Solves

Fixes an issue where operators running Ollama with cloud models would lose those models from provider discovery and from onboarding whenever the daemon answered /api/show without describing the model — the same degraded-inspection case #130000 set out to improve. The models disappear from the provider catalog entirely, so no cloud model can be selected until inspection starts working again.

Why This Change Was Made

#130000 made the /api/tags row fill in what an inspection could not report. That is correct for a local row, which the daemon derives from the model itself, but a remote row is built differently upstream: buildModelListSummary only calls readModelListGGUF when the manifest carries neither RemoteHost nor RemoteModel, and completion is appended inside that read (server/model_list_cache.go). thinking is likewise appended only when a template layer is present. A remote row therefore advertises whatever its manifest config declares and stays silent about the rest — but discovery reads that silence as a denial:

  • enrichOllamaCompletionModels excludes any row that carries capabilities without completion, which is every remote row.
  • buildOllamaModelDefinition treats a present list as a full account, so the name heuristic behind reasoning and the optimistic supportsTools default stop being reachable for those rows.

This change records where a capability list came from (mergeOllamaModelShowInfo now marks list-sourced capabilities) and reads a remote row's advertised list as authoritative for what it asserts and unknown for what it omits — the same rule this module already applies to contextWindow. Once /api/show answers with capabilities, the list is settled again and every existing rule applies unchanged.

Non-goal: local rows keep today's behavior exactly. A local list entry is derived from the model's own GGUF and template, so its omissions are meaningful and stay authoritative — including a local reasoning model whose list omits thinking.

User Impact

Cloud Ollama models stay discoverable, keep tool support, and keep their reasoning flag when the daemon cannot inspect them, instead of vanishing from the catalog. Local model metadata, embedding-model exclusion, and the context and tool precedence introduced by #130000 are unchanged.

Evidence

Runtime probe, no mocking: a real loopback HTTP server stands in for the daemon, serving the /api/tags rows below and answering /api/show with 200 {} (the degraded case). buildOllamaProvider runs against it unmodified; the same probe ran against three checkouts of the two changed files.

/api/tags row before #130000 (296227fdf^) main (a2d54319bc3) this branch
glm-5.1:cloud, remote_host set, ["vision"] discovered, tools true dropped discovered, tools true
deepseek-r1:671b-cloud, remote_host set, ["tools"] discovered, reasoning true dropped discovered, reasoning true
llama3.1:8b, ["completion","tools"] ctx 128000 ctx 131072 ctx 131072
deepseek-r1:8b, ["completion","tools"] reasoning true reasoning false reasoning false
nomic-embed-text, ["embedding"] discovered excluded excluded

The last two rows are the control arms: this branch reproduces main exactly for local rows, so the difference the first two rows show is the remote-row rule and not the harness.

Six focused cases were added. Five of them fail against main's provider-models.ts and setup-model-selection.ts with the tests unchanged; the sixth (a local ["embedding"] row must stay excluded) passes on both arms and is there to prove the completion filter was not loosened.

extensions/ollama: 28 files, 723 tests passed
check:assertion-safety  OK (4248 files)
check:max-lines-ratchet OK
oxlint / oxfmt          clean

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 2:25 PM ET / 18:25 UTC.

ClawSweeper review

What this changes

The PR keeps remotely hosted Ollama models selectable in discovery and interactive setup when /api/show omits capabilities by distinguishing incomplete remote list metadata from authoritative inspection results.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal merge review: the owner-local fix and focused regression coverage address the reported remote-row failure, with no actionable patch defect found. The upstream Ollama source links cited by the maintainer could not be independently fetched in this review environment, so the external contract remains the only residual verification gap.

Priority: P1
Reviewed head: ed2fc421b29945660191a175a57dbdfd40004cc1

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The PR has strong owner-boundary behavior evidence and focused regression coverage, with external-contract verification remaining the only review-environment gap.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body and maintainer follow-up provide after-fix loopback HTTP-server evidence through the production provider transport, with observed recovery for incomplete remote metadata.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body and maintainer follow-up provide after-fix loopback HTTP-server evidence through the production provider transport, with observed recovery for incomplete remote metadata.
Evidence reviewed 6 items Current-main failure path: Current main excludes a model with a present capability list that lacks completion, so an incomplete remote list row is removed before provider discovery can expose it.
Owner-boundary repair: The PR records incomplete remote list provenance, preserves explicit inspection arrays, excludes embeddings, and leaves strict paired-node discovery requiring explicit completion.
Caller and sibling coverage: Provider discovery, interactive setup, and paired-node discovery share the metadata owner; node discovery passes requireCompletionCapability: true, retaining its strict boundary.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/ollama/src/provider-models.test.ts extensions/ollama/src/setup-model-selection.test.ts

Result: PASS (completed)

[test] starting test/vitest/vitest.extension-providers.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130240-5mVBh4/target

 ✓  extension-providers  extensions/ollama/src/provider-models.test.ts (53 tests) 244ms
 ✓  extension-providers  extensions/ollama/src/setup-model-selection.test.ts (13 tests) 6959ms
     ✓ selects the smallest explicitly non-thinking model during interactive setup  6808ms

 Test Files  2 passed (2)
      Tests  66 passed (66)
   Start at  18:26:43
   Duration  12.63s (transform 13.59s, setup 2.74s, import 8.24s, tests 7.20s, environment 0ms)

[test] passed 1 Vitest shard in 19.45s
[test] starting test/vitest/vitest.extension-providers.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130240-5mVBh4/target

 ✓  extension-providers  extensions/ollama/src/provider-models.test.ts (53 tests) 254ms
 ✓  extension-providers  extensions/ollama/src/setup-model-selection.test.ts (13 tests) 2975ms
     ✓ selects the smallest explicitly non-thinking model during interactive setup  2831ms

 Test Files  2 passed (2)
      Tests  66 passed (66)
   Start at  18:27:03
   Duration  6.09s (transform 4.95s, setup 1.38s, import 4.50s, tests 3.23s, environment 0ms)

[test] passed 1 Vitest shard in 12.70s

Assertions:

  • PASS expect_output: Tests

How this fits together

The Ollama plugin combines /api/tags rows with optional /api/show inspection before building the provider catalog and setup configuration. Those derived model definitions determine which models users can select and whether tools, vision, and reasoning are advertised.

flowchart LR
  A[Ollama model list] --> B[Metadata normalization]
  C[Model inspection] --> B
  B --> D[Capability precedence]
  D --> E[Provider discovery]
  D --> F[Setup wizard]
  E --> G[Selectable model catalog]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - This changes the compatibility interpretation of an existing Ollama capability list: incomplete remote rows gain only unknown defaults, while explicit /api/show arrays and embedding exclusions must remain authoritative.
  • Complete next step (P2) - This open PR already owns the concrete repair; the remaining action is normal exact-head CI and maintainer merge review.
Agent review details

Security

None.

PR surface

Source +18, Tests +170. Total +188 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 41 23 +18
Tests 2 173 3 +170
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 214 26 +188

Review metrics

Metric Value Why it matters
Production versus regression coverage production +41/-23 (net +18); tests +173/-3 (net +170) The production growth adds remote-row provenance and normalization in one owner file; the focused tests cover provider, setup, and strict-node behavior.

Stored data model

Persistent data-model change detected: vector/embedding metadata: extensions/ollama/src/provider-models.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Retain the owner-boundary interpretation (recommended)
    Merge after exact-head CI if maintainers accept the documented Ollama contract that remote list omissions are unknown while explicit inspection results remain authoritative.

Technical review

Best possible solution:

Merge only after exact-head CI completes, retaining this single provider-local normalization path and its local-versus-remote, explicit-empty, embedding, and strict-node regression coverage.

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

Yes: current main’s completion filter excludes a remote row with an incomplete capability list, and the PR supplies focused fail-first cases plus a real loopback server through the provider transport.

Is this the best way to solve the issue?

Yes, subject to the cited upstream contract: normalizing the remote-versus-local distinction in the shared metadata owner fixes both discovery and setup without relaxing paired-node completion requirements.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The regression can remove remotely hosted Ollama models from both provider discovery and interactive setup when inspection is incomplete.
  • merge-risk: 🚨 compatibility: Merging changes the meaning of existing daemon capability omissions for remote models, so local and explicit-inspection behavior must remain preserved.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body and maintainer follow-up provide after-fix loopback HTTP-server evidence through the production provider transport, with observed recovery for incomplete remote metadata.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and maintainer follow-up provide after-fix loopback HTTP-server evidence through the production provider transport, with observed recovery for incomplete remote metadata.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the current rewrite and the immediately preceding merged metadata fallback repair in this owner module. (role: recent area contributor; confidence: high; commits: ed2fc421b299, 3e9edd96928c; files: extensions/ollama/src/provider-models.ts, extensions/ollama/src/provider-models.test.ts)
  • Vito Cappello: Recent Ollama cloud capability and context work is recorded in the same metadata owner history. (role: adjacent feature contributor; confidence: medium; commits: 4fdfb8b1bf69; files: extensions/ollama/src/provider-models.ts)
  • Vincent Koc: Recent refactors in the same Ollama provider and node-discovery surfaces establish the strict local-node boundary exercised by this PR. (role: adjacent owner-boundary contributor; confidence: medium; commits: 04c8d418e67a, 011691f734e1; files: extensions/ollama/src/node-inference.ts, extensions/ollama/src/provider-models.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let exact-head CI complete before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-26T17:35:56.161Z sha 4a4924de1f2dc2de5ec48d8632a13fe2db54ffa8 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the fix/ollama-list-capabilities-provenance branch from 4a4924d to ed2fc42 Compare August 26, 2026 18:20
@steipete

Copy link
Copy Markdown
Contributor

Maintainer follow-up: I rewrote the existing contributor branch into the canonical Ollama metadata owner while preserving @Yigtwxx's authorship through the commit Co-authored-by trailer.

The upstream contract is stricter than the original patch assumed: Ollama considers a model remote when either remote_host or remote_model is present (remote manifest predicate); remote rows skip the local GGUF inspection that infers completion (list producer, GGUF capability inference). Both remote identifiers are part of the upstream list response (response contract).

Before the production change, five focused regressions failed against current main: remote_host, remote_model alone, the existing explicit cloud suffix, a real isolated loopback HTTP-server request using the actual guarded provider transport, and interactive setup preserving reasoning. Explicit empty inspection results and local/remote embedding exclusion remained passing controls.

The repaired branch:

  • Keeps incomplete remote model advertisements discoverable for all three supported remote representations.
  • Preserves authoritative /api/show capability arrays, including [], positive advertised vision/tool support, and the existing tool/reasoning defaults only where upstream omissions leave them unknown.
  • Keeps embedding-only models excluded and preserves strict paired-node completion requirements.
  • Repairs both provider discovery and interactive setup inside the shared metadata owner; no setup production code, auth, configuration, persistence, or public protocol changes are needed.

Validation on commit ed2fc421b29945660191a175a57dbdfd40004cc1:

node scripts/run-vitest.mjs extensions/ollama
Test Files  28 passed (28)
Tests       727 passed (727)

OPENCLAW_OXLINT_SKIP_PREPARE=1 node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.extensions.json extensions/ollama/src/provider-models.ts extensions/ollama/src/provider-models.test.ts extensions/ollama/src/setup-model-selection.test.ts
PASS

pnpm exec oxfmt --check extensions/ollama/src/provider-models.ts extensions/ollama/src/provider-models.test.ts extensions/ollama/src/setup-model-selection.test.ts
PASS

Independent whole-change P1 review: no accepted/actionable findings

Production: +41/-23 (net +18), one owner file, down from the original net +52 across two production files. The remaining growth records the upstream remote_model field and one truthful list-provenance fact, normalizes incomplete remote capabilities at their owner, and preserves strict completion/embedding boundaries. Tests: +173/-3 (net +170) across two existing suites.

This uses a real isolated loopback HTTP server, not an authenticated live Ollama daemon; no user service or credentials were accessed.

@Yigtwxx

Yigtwxx commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for taking this over. The remote_model arm is a real gap in my original patch — I only covered remote_host and the cloud-suffixed name — and folding the repair into the single metadata owner is clearly the better shape.

I re-ran my loopback probe against your commit ed2fc421b29 with current main (adb3fb2967c) as the control arm. Same harness as the PR description: a real HTTP server on loopback serves /api/tags and answers /api/show with 200 {} (the degraded case), and enrichOllamaCompletionModels runs against it unmodified.

/api/tags row main adb3fb2967c ed2fc421b29
glm-5.1:cloud, remote_host set, ["vision"] dropped kept, caps ["vision","tools"]
kimi-k3-remote, remote_model set, ["vision"] dropped kept, caps ["vision","tools"]
deepseek-r1:671b-cloud, no remote field, ["tools"] dropped kept, caps ["tools","thinking"]
llama3.1:8b, ["completion","tools"] kept, caps unchanged kept, caps unchanged
nomic-embed-text, ["embedding"] excluded excluded
nomic-embed-remote, remote_host set, ["embedding"] excluded excluded

The local row is the control: it reproduces main byte-for-byte, so the difference in the first three rows is the remote-row rule and not the harness. The embedding rows are only meaningful on the right-hand arm — the remote one now takes the remote path and is still excluded, so the completion/embedding boundary did not loosen.

I also checked the single-owner claim from the other side: setup-model-selection.ts reaches the repair purely through mergeOllamaModelShowInfo (inspectOllamaModelsForSetup), and buildOllamaModelsConfig reads the normalized capabilities back out, which is why no setup production change is needed.

One disclosure about my environment: this machine runs Node 22.20, whose embedded SQLite trips OpenClaw's WAL-reset guard during module import, so the probe ran under a local shim that fakes only the sqlite_version() string. Everything else is the real implementation, and no Ollama daemon or credentials were involved.

Housekeeping, your call: the PR description still describes the original two-file shape and does not mention remote_model. I can rewrite it to match your commit if you want the squash body accurate, or leave it untouched so nothing re-triggers the checks.

@steipete

Copy link
Copy Markdown
Contributor

Maintainer review complete on ed2fc421b29945660191a175a57dbdfd40004cc1. Required CI run and its openclaw/ci-gate passed, satisfying the latest review's rank-up move.

I personally checked the upstream remote-manifest predicate, list producer, and wire response. Remote rows bypass local GGUF completion inference, and either remote identifier is sufficient. This resolves the external-contract verification gap reported by the review environment. Explicit inspection arrays, embedding exclusions, and strict paired-node completion requirements remain covered and unchanged.

The automated stored-data warning is not applicable: these are transient discovery response fixtures; the diff changes no database, persisted embedding metadata, schema, or migration. The remaining production growth (net +18, down from the original +52) represents the actual upstream field and one shared provenance/normalization owner, with no duplicate setup policy.

This repairs the incomplete remote-row regression introduced by our earlier #130000 metadata change. Thanks @Yigtwxx for identifying it; your credit is retained in the rewritten commit. The 727-test owner/sibling pass and independent clean P1 review stand; the HTTP proof uses an isolated loopback server, not an authenticated cloud account.

@steipete
steipete merged commit a21de1a into openclaw:main Aug 26, 2026
100 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

steipete added a commit that referenced this pull request Aug 26, 2026
…130459)

Share remote identity across discovery, node inference, and Local-only setup.
Keep affirmative embedding-only models out of inferred chat capabilities,
guided selection, and failed-download fallback while preserving advertised
metadata and existing unknown-capability chat fallback behavior.

Follow up on #130240 with reproduced regressions, 742 Ollama tests, isolated
real-daemon before/after proof, and source-blind public CLI validation.

Co-authored-by: Yigtwxx <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…penclaw#130459)

Share remote identity across discovery, node inference, and Local-only setup.
Keep affirmative embedding-only models out of inferred chat capabilities,
guided selection, and failed-download fallback while preserving advertised
metadata and existing unknown-capability chat fallback behavior.

Follow up on openclaw#130240 with reproduced regressions, 742 Ollama tests, isolated
real-daemon before/after proof, and source-blind public CLI validation.

Co-authored-by: Yigtwxx <[email protected]>
@Yigtwxx
Yigtwxx deleted the fix/ollama-list-capabilities-provenance branch September 1, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: ollama merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants