Skip to content

fix(ollama): skip local checks for hosted web search - #129833

Merged
steipete merged 3 commits into
mainfrom
codex/qa-ollama-hosted-search-prerequisites-20260826
Aug 26, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/qa-ollama-hosted-search-prerequisites-20260826

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Direct hosted Ollama Web Search uses the configured Ollama Cloud endpoint and an API key; it does not require a local Ollama daemon or ollama signin. Existing setup incorrectly probed local daemon/sign-in prerequisites even when both the model-provider endpoint and plugin-specific endpoint selected hosted search.

Route the existing prerequisite owner by the actual resolved endpoint. Hosted endpoints check their configured or environment API key and show actionable credential guidance when it is missing; local endpoints retain their existing daemon and sign-in warnings. Hosted HTTP 401 errors now explain the API-key requirement instead of suggesting local sign-in. The FAQ and dedicated Ollama-search guide now provide explicitly separate local and hosted setup paths.

Full branch production: +22/-22 (net 0). Tests: +96/-2.

Verification

  • Independently inspected Ollama's official Web Search API documentation and authentication documentation. They document POST https://ollama.com/api/web_search, bearer API-key authentication through OLLAMA_API_KEY, and local ollama signin as a separate local-installation authentication path.

  • Confirmed the actual hosted endpoint's authentication boundary with a credential-free, empty-body request that cannot execute a search:

    env -u OLLAMA_API_KEY -u GITHUB_TOKEN -u GH_TOKEN -u HOMEBREW_GITHUB_API_TOKEN \
      curl --disable --silent --show-error --max-time 15 \
      --header 'Authorization:' --header 'Content-Type: application/json' \
      --data '{}' --write-out '\nhttp_status=%{http_code}\n' \
      https://ollama.com/api/web_search

    Actual result: {"error":"Unauthorized"} and http_status=401. No credential, local Ollama service, account, search query, or authenticated request was used. This is live negative authentication-boundary proof, not a claim of authenticated live-search success.

  • Captured three authentic failing registered-provider/runtime cases before repairing the complete owner: hosted model-provider endpoint with no key, hosted plugin-specific override with no key, and hosted 401 authentication guidance.

  • Verified configured literal credentials, configured environment-marker credentials, ambient OLLAMA_API_KEY, endpoint precedence, unchanged local daemon/sign-in diagnostics, and both hosted selection paths.

  • Ran five actual Ollama provider, transport, interactive-setup, and noninteractive-setup suites: 187 tests passed; reran the complete changed provider suite after the documentation fix: 31 tests passed.

  • Ran targeted type-aware lint, formatting, git diff --check, documentation glossary validation, and pnpm docs:check-config-examples (774 documentation files scanned; 1,194 configuration examples validated).

  • Fresh integrated whole-branch independent P1 review passed with no accepted/actionable findings after all three commits.

  • Addresses both latest ClawSweeper rank-up moves: explicit local/hosted setup documentation and direct hosted authentication-boundary confirmation with official upstream contract evidence.

Risk

Low: one canonical plugin-owned setup decision, no new configuration, no authentication mechanism changes, no persistent state, no change to legitimate hosted or local search requests, and unchanged production line count.

@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 P2 Normal backlog priority with limited blast radius. 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: found issues before merge. Reviewed August 26, 2026, 3:15 AM ET / 07:15 UTC.

ClawSweeper review

What this changes

This PR skips local Ollama daemon/sign-in checks for hosted web search, adds hosted API-key guidance, and documents separate local and hosted setup paths.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open: the hosted classifier treats any HTTPS URL with hostname ollama.com as the canonical cloud API, including non-default ports, changing existing setup diagnostics and 401 guidance for those configurations.

Priority: P2
Reviewed head: 9c6aead90ce2c0c5e6a22bd3f9fe2676307406da

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has useful focused coverage and upstream-boundary evidence, but the endpoint predicate needs narrowing before it is merge-ready.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: This maintainer-labeled PR is outside the external-contributor proof gate; its body also records a credential-free hosted 401 observation, though that is not after-fix end-to-end proof.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-labeled PR is outside the external-contributor proof gate; its body also records a credential-free hosted 401 observation, though that is not after-fix end-to-end proof.
Evidence reviewed 6 items Hosted classification is broader than the canonical origin: The changed predicate accepts every HTTPS URL whose hostname is ollama.com; it does not reject a non-default port, while the plugin’s embedding path compares protocol, host, port, and path against the canonical cloud base URL.
Changed behavior follows that predicate: The setup path skips local checks and the runtime changes 401 remediation whenever the predicate returns true.
Documentation defines the supported hosted endpoint narrowly: The new guide specifies https://ollama.com and states that it is the resolved hosted endpoint for direct web search.
Findings 1 actionable finding [P2] Restrict hosted matching to the canonical Cloud origin
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/ollama/src/web-search-provider.test.ts

Result: FAIL (failed) — step 1 run node scripts/run-vitest.mjs extensions/ollama/src/web-search-provider.test.ts: previous terminal command was still running after 30 seconds: "node scripts/run-vitest.mjs extensions/ollama/src/web-search-provider.test.ts"

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

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129833-EUec9G/target

 ✓  extension-providers  extensions/ollama/src/web-search-provider.test.ts (31 tests) 11530ms
     ✓ uses the configured Ollama host and enables the plugin in config  8976ms
     ✓ uses only the hosted endpoint for Ollama Cloud base URLs  368ms

 Test Files  1 passed (1)
      Tests  31 passed (31)
   Start at  07:16:14
   Duration  14.02s (transform 9.06s, setup 1.11s, import 1.22s, tests 11.53s, environment 0ms)

[test] passed 1 Vitest shard in 20.48s

Assertions:

  • FAIL expect_output: ollama web search provider

How this fits together

The bundled Ollama Web Search plugin resolves a plugin-specific or model-provider endpoint before setup and request execution. That endpoint determines whether OpenClaw checks a local daemon/sign-in or sends requests to Ollama Cloud with API-key guidance.

flowchart LR
  A[Web search selection] --> B[Ollama plugin]
  B --> C[Resolve endpoint]
  C --> D{Canonical cloud origin?}
  D -->|Yes| E[API-key setup and request]
  D -->|No| F[Local daemon and sign-in checks]
  E --> G[Search result or guidance]
  F --> G
Loading

Before merge

  • Restrict hosted matching to the canonical Cloud origin (P2) - This hostname-only test also accepts URLs such as https://ollama.com:8443. Those are distinct configured origins but now skip the local setup checks and receive Cloud API-key 401 guidance. Match the normalized canonical Cloud origin instead, and cover the non-default-port case.
  • Resolve merge risk (P1) - A configuration such as https://ollama.com:8443 now bypasses local setup diagnostics and receives Cloud API-key remediation even though it is a distinct origin from the documented hosted endpoint.
  • Complete next step (P2) - This maintainer-labeled PR needs the focused endpoint-classification correction and then exact-head CI; no autonomous repair lane is proposed.

Findings

  • [P2] Restrict hosted matching to the canonical Cloud origin — extensions/ollama/src/web-search-provider.runtime.ts:66-69
Agent review details

Security

None.

PR surface

Source 0, Tests +94, Docs +13. Total +107 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 22 22 0
Tests 1 96 2 +94
Docs 2 18 5 +13
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 136 29 +107

Review metrics

Metric Value Why it matters
Production versus test delta runtime +22/-22; tests +96/-2; docs +18/-5 The bug fix is production-net-neutral, with the added test volume focused on endpoint selection and setup guidance.

Merge-risk options

Maintainer options:

  1. Narrow hosted-origin matching (recommended)
    Compare the normalized endpoint with the canonical Cloud origin and cover a non-default port before merging.
  2. Accept broader hostname semantics
    Keep hostname-only matching only if maintainers explicitly intend every HTTPS service on ollama.com to use Cloud API-key setup guidance.

Technical review

Best possible solution:

Classify hosted web search only when the resolved endpoint is the canonical Ollama Cloud origin after the supported /v1 normalization, and add a regression case for a non-default-port URL.

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

Yes, from the current PR head: configure a non-default-port HTTPS ollama.com endpoint and the changed hostname-only predicate selects hosted behavior. This was not executed because the review checkout is read-only.

Is this the best way to solve the issue?

No: routing by the resolved endpoint is the right owner boundary, but hostname-only matching is broader than the documented canonical Cloud origin and the plugin’s sibling origin comparison.

Full review comments:

  • [P2] Restrict hosted matching to the canonical Cloud origin — extensions/ollama/src/web-search-provider.runtime.ts:66-69
    This hostname-only test also accepts URLs such as https://ollama.com:8443. Those are distinct configured origins but now skip the local setup checks and receive Cloud API-key 401 guidance. Match the normalized canonical Cloud origin instead, and cover the non-default-port case.
    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 8c203185d7ed.

Labels

Label justifications:

  • P2: The patch can misclassify a bounded set of existing provider endpoint configurations and give them the wrong setup path.
  • merge-risk: 🚨 compatibility: Endpoint classification changes the setup diagnostics shown to configurations that use a noncanonical ollama.com origin.
  • merge-risk: 🚨 auth-provider: The classification controls whether 401 errors advise local sign-in or Cloud API-key configuration.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-labeled PR is outside the external-contributor proof gate; its body also records a credential-free hosted 401 observation, though that is not after-fix end-to-end proof.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-head blame attributes the hosted classifier, setup branch, and accompanying tests to this commit; older merged-history ownership could not be recovered from the grafted checkout. (role: introduced the checked-out endpoint-specific implementation; confidence: low; commits: 9c6aead90ce2; files: extensions/ollama/src/web-search-provider.runtime.ts, extensions/ollama/src/web-search-provider.test.ts)

Rank-up moves

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

  • Match only the normalized canonical Cloud origin and add a regression for https://ollama.com:8443.

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 (3 earlier review cycles)
  • reviewed 2026-08-26T03:45:54.835Z sha 65282fe :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T04:11:22.146Z sha 65282fe :: needs changes before merge. :: [P1] Keep hosted setup actionable without an API key
  • reviewed 2026-08-26T06:44:28.475Z sha 6bd531e :: found issues before merge. :: [P2] Split local and hosted setup instructions

@clawsweeper clawsweeper Bot added 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S and removed size: XS labels Aug 26, 2026
@steipete
steipete merged commit 0dfd87e into main Aug 26, 2026
136 checks passed
@steipete
steipete deleted the codex/qa-ollama-hosted-search-prerequisites-20260826 branch August 26, 2026 07:37
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
* fix(ollama): skip local checks for hosted web search

* fix(ollama): explain hosted search API key requirements

* docs(ollama): separate hosted and local search setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: ollama maintainer Maintainer-authored PR 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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.

1 participant