Skip to content

fix(ollama): resolve web search secret refs - #104829

Merged
vincentkoc merged 9 commits into
openclaw:mainfrom
Leon-SK668:llagy007/ollama-web-search-secretref-20260712
Jul 31, 2026
Merged

vincentkoc merged 9 commits into
openclaw:mainfrom
Leon-SK668:llagy007/ollama-web-search-secretref-20260712

Conversation

@Leon-SK668

@Leon-SK668 Leon-SK668 commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Ollama web search did not resolve env-backed SecretRefs configured at models.providers.ollama.apiKey. Treating an explicitly configured but unavailable SecretRef as no configuration could also select an unrelated ambient OLLAMA_API_KEY and route the query to Ollama Cloud.

Why This Change Was Made

The Ollama runtime now delegates literal and env-backed SecretRef resolution to the existing shared resolveWebSearchProviderCredential(...) helper. The plugin separately preserves whether the configured input was a SecretRef, so a missing or unsupported ref fails before any request without expanding the Plugin SDK. Literal configured keys and the independent ambient cloud key remain separate, preserving the selected-host attempts plus authenticated cloud fallback used by mixed setups.

User Impact

Users can configure an env SecretRef for the Ollama provider key and have the resolved value sent on web-search requests. Missing or non-env SecretRefs fail before fetchWithSsrFGuard instead of silently using an unrelated ambient key. Existing marker-string fallback to OLLAMA_API_KEY and mixed configured-key/ambient-key cloud fallback remain covered.

Evidence

  • Current PR diff is limited to extensions/ollama/src/web-search-provider.ts and extensions/ollama/src/web-search-provider.test.ts; Plugin SDK, core credential helper, packages, and generated API baseline have zero diff.

  • The configured-ref path calls the shared resolver, uses the public coerceSecretRef(...) contract to retain explicit-ref state, and rejects an unavailable ref before request construction.

  • Focused tests cover resolved env refs, missing env refs with an ambient key present, unsupported non-env refs, mixed literal configured and ambient keys, and marker-string fallback.## Proof

  • Exact current candidate head: 28f39ca2886ab1a3a42481f233612546b67abfa0.

  • Secretless fork Actions run 29720026227 passed the exact-head public-provider runtime proof. The isolated runner unset repository, Actions runtime, package-registry, and OIDC tokens before candidate execution; anonymously fetched and checked out the full candidate SHA; installed the exact lockfile with pinned Node 24.15.0 and pnpm 11.2.2; and exercised the public createOllamaWebSearchProvider().createTool().execute() path.

  • The repo-supported mock-marked fetch transport retained fetch-guard URL/policy validation while redirecting dispatch to IPv4 loopback. No real provider credential or external provider endpoint was used. Redacted transcript:

case resolved-env-ref: requests=1 destination=ollama-cloud auth=resolved-secret-ref result-count=1
case unavailable-env-ref: requests=0 outcome=fail-closed-with-ambient-present
case non-env-ref: requests=0 outcome=fail-closed-with-ambient-present
case mixed-auth: requests=3 route=selected-host,selected-host,ollama-cloud auth=configured,configured,ambient result-count=1
candidate-head: 28f39ca2886ab1a3a42481f233612546b67abfa0
transport: repo-supported mock-marked fetch guard path redirected to IPv4 loopback
proof-result: PASS
  • Canonical current-head CI run 29714007989 passed on the same SHA, including openclaw/ci-gate, build artifacts, changed Node tests, production/test types, lint, extension package boundary, dependency guards, and security checks.
  • This closes the exact-head runtime-proof gap only. The owner-level compatibility decision remains unresolved: whether an unavailable explicit models.providers.ollama.apiKey SecretRef should fail closed when ambient OLLAMA_API_KEY exists. This evidence does not claim the PR is otherwise cleared.

Post-Rebase Proof Binding (2026-07-26)

The public Ollama provider runtime proof above ran on 28f39ca2886ab1a3a42481f233612546b67abfa0. It is bound to the rebased current head 06b415c1e26c0291cb3a85a13c9555490014f9c1 as follows:

  • old aggregate diff: 64c82812a5e52f4a03d2b89b8132c068a048a81b...28f39ca2886ab1a3a42481f233612546b67abfa0
  • current aggregate diff: 0951d0dd307d5008276714679c62459293d3b619...06b415c1e26c0291cb3a85a13c9555490014f9c1
  • both aggregate diffs have stable patch-id 26968e2110c378ea3d58b2578802ea6a33622ec6
  • both touch the same two files with the same totals: +172/-8
  • current-head CI run 30193421098 and Workflow Sanity run 30193421056 passed

No new runtime execution is claimed. The binding shows that the contributor patch exercised by the prior public-provider proof is unchanged after rebase, while current-head CI validates its integration with the frozen main base. The documented owner-level compatibility decision remains unresolved.

Exact-Head Public Tool Proof (2026-07-31)

Maintainer proof ran on exact published head
00bd1a123a6224e9c648ca73b2eb5b155711ae8c through the public
createOllamaWebSearchProvider().createTool().execute() surface. The
repo-supported mocked guarded-fetch boundary used redacted fake credentials
and recorded request routing without external provider traffic.

resolved-env-ref requests=1 auth=resolved-secret-ref result-count=1
unavailable-env-ref requests=0 outcome=fail-closed-with-ambient-present
non-env-ref requests=0 outcome=fail-closed-with-ambient-present
mixed-auth requests=3 route=selected-host,selected-host,ollama-cloud auth=configured,configured,ambient result-count=1

The focused proof passed as one Vitest test on July 31, 2026. It confirms the
approved compatibility decision: an unavailable explicit SecretRef fails
closed instead of using ambient OLLAMA_API_KEY, while a literal configured
selected-host key still preserves the independent ambient cloud fallback.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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 Jul 12, 2026
@clawsweeper

clawsweeper Bot commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 5:55 AM ET / 09:55 UTC.

ClawSweeper review

What this changes

The PR makes Ollama web search resolve configured environment SecretRefs, reject unavailable explicit SecretRefs before a request, and retain ambient OLLAMA_API_KEY fallback only when no explicit configured reference blocks it.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

This PR appears ready for normal maintainer merge review: the shared resolver now handles configured environment SecretRefs before Ollama selects its ambient credential, and the maintainer explicitly approved fail-closed precedence for unavailable explicit refs. The branch is currently reported mergeable but behind main, so refresh that integration state before landing. Likely related people: vincentkoc is the high-confidence routing contact for the credential-precedence decision and recent implementation work.

Priority: P2
Reviewed head: 94d25faa506e8b3c68f2194bd1783aa937f06b01

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-scoped provider fix with convincing runtime-path proof and explicit maintainer direction; only current-base refresh remains before landing.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body and maintainer follow-up provide an exact-head public tool-surface transcript for resolved, unavailable, unsupported, and mixed-routing cases, with redacted fake credentials and observed request counts.
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 an exact-head public tool-surface transcript for resolved, unavailable, unsupported, and mixed-routing cases, with redacted fake credentials and observed request counts.
Evidence reviewed 5 items Current PR behavior: The candidate changes the Ollama provider to call the shared web-search credential resolver, retains explicit SecretRef state with coerceSecretRef, and raises an error before guarded fetch when an explicit reference cannot resolve; the diff also preserves the separate ambient-key route for non-explicit configuration.
Shared resolver contract: The shared resolver now checks SecretRef syntax before treating configuration as a literal secret, so $NAME and ${NAME} resolve as environment references and an unavailable explicit reference does not fall through to ambient provider variables.
Focused regression coverage: The proposed tests cover resolved environment references, unavailable and unsupported explicit references with an ambient key present, and mixed configured/ambient routing; the PR discussion reports 32 focused tests and 23 public tool-surface cases passing on the refreshed head.
Findings None None.
Security None None.

How this fits together

Ollama’s web-search plugin takes provider configuration plus environment state, resolves credentials before guarded HTTP requests, and returns search results to the agent tool. The shared resolver distinguishes explicit SecretRefs from ambient provider keys so operator configuration remains authoritative.

flowchart LR
  Config[Ollama provider configuration] --> Resolve[Shared credential resolution]
  SecretRef[Environment SecretRef] --> Resolve
  Ambient[Ambient OLLAMA API key] --> Resolve
  Resolve --> Precedence[Explicit reference precedence]
  Precedence --> Guarded[Guarded web-search request]
  Guarded --> Results[Agent search results]
Loading

Before merge

  • Resolve merge risk (P1) - Existing setups that configured an unavailable explicit models.providers.ollama.apiKey SecretRef while relying on ambient OLLAMA_API_KEY will now fail before any request; that compatibility change is deliberate and explicitly approved.
  • Resolve merge risk (P1) - GitHub reports the PR as mergeable but behind current main; refresh the merge result and required checks against the current base before landing.
  • Complete next step (P2) - No repair lane is needed because there is no discrete patch defect; normal maintainer merge review should refresh the current-base result before landing.
Agent review details

Security

None.

PR surface

Source +31, Tests +185. Total +216 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 44 13 +31
Tests 2 186 1 +185
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 230 14 +216

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Refresh current-base integration, then merge (recommended)
    Rebase or merge current main, confirm the focused credential cases and required checks remain green, then land the approved fail-closed precedence.
  2. Accept the approved precedence change
    Merge with the documented understanding that unavailable explicit SecretRefs now block ambient-key fallback for affected existing configurations.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Refresh the branch against current main and rerun the focused Ollama credential tests plus required checks before merge.

Technical review

Best possible solution:

Land the narrow resolver-and-plugin fix after refreshing the merge result against current main, while preserving the approved rule that explicit configured SecretRefs are authoritative and fail closed when unavailable.

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

Yes in source form: configure models.providers.ollama.apiKey as an env SecretRef, run the public Ollama web-search tool, and compare the resolved, unavailable, unsupported, and mixed configured/ambient cases covered by the focused tests and attached runtime transcript.

Is this the best way to solve the issue?

Yes. Reusing the existing shared credential resolver while keeping Ollama-specific marker filtering and explicit-reference diagnostics in the owner plugin is narrower and safer than adding parallel Plugin SDK behavior.

AGENTS.md: unclear because the file could not be read completely.

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

Labels

Label justifications:

  • P2: This is a bounded provider-authentication behavior repair with a limited but real effect on Ollama web-search users.
  • merge-risk: 🚨 compatibility: The deliberate fail-closed rule changes upgrade behavior for users who have an unavailable explicit SecretRef and an ambient key.
  • merge-risk: 🚨 auth-provider: The patch changes credential precedence and resolution for Ollama provider web-search requests.
  • 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 an exact-head public tool-surface transcript for resolved, unavailable, unsupported, and mixed-routing cases, with redacted fake credentials and observed request counts.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and maintainer follow-up provide an exact-head public tool-surface transcript for resolved, unavailable, unsupported, and mixed-routing cases, with redacted fake credentials and observed request counts.

Evidence

What I checked:

  • Current PR behavior: The candidate changes the Ollama provider to call the shared web-search credential resolver, retains explicit SecretRef state with coerceSecretRef, and raises an error before guarded fetch when an explicit reference cannot resolve; the diff also preserves the separate ambient-key route for non-explicit configuration. (extensions/ollama/src/web-search-provider.ts, 94d25faa506e)
  • Shared resolver contract: The shared resolver now checks SecretRef syntax before treating configuration as a literal secret, so $NAME and ${NAME} resolve as environment references and an unavailable explicit reference does not fall through to ambient provider variables. (src/agents/tools/web-search-provider-credentials.ts, 94d25faa506e)
  • Focused regression coverage: The proposed tests cover resolved environment references, unavailable and unsupported explicit references with an ambient key present, and mixed configured/ambient routing; the PR discussion reports 32 focused tests and 23 public tool-surface cases passing on the refreshed head. (extensions/ollama/src/web-search-provider.test.ts, 94d25faa506e)
  • Maintainer product decision: A repository member explicitly chose fail-closed precedence: an unavailable explicit models.providers.ollama.apiKey SecretRef must not silently substitute ambient OLLAMA_API_KEY. (7636f48b42a9)
  • Exact-head proof and checks: The supplied PR context records exact-head public tool proof for the four credential-routing cases and successful current-head CI, including changed tests, types, lint, package-boundary checks, and security checks. (94d25faa506e)

Likely related people:

  • vincentkoc: A member documented the intended fail-closed compatibility rule and authored the env-shorthand resolver commit carried by this PR. (role: credential-precedence decision owner and recent area contributor; confidence: high; commits: 7636f48b42a9, 00bd1a123a62; files: src/agents/tools/web-search-provider-credentials.ts, extensions/ollama/src/web-search-provider.ts)

Rank-up moves

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

  • Refresh the branch or merge result against current main and confirm the focused credential cases remain green.

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 (22 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-16T02:09:47.762Z sha 7048ae448971bcb4c5c9305840197000c6301d0b :: needs maintainer review before merge. :: none
  • reviewed 2026-07-20T03:13:12.507Z sha 28f39ca2886ab1a3a42481f233612546b67abfa0 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-20T06:38:30.398Z sha 28f39ca2886ab1a3a42481f233612546b67abfa0 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-26T07:51:50.472Z sha 06b415c :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-26T09:03:49.686Z sha 06b415c :: needs maintainer review before merge. :: none
  • reviewed 2026-07-31T09:17:59.622Z sha 00bd1a1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-31T09:39:36.357Z sha 00bd1a1 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-31T09:50:06.957Z sha 94d25fa :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 12, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M and removed size: S labels Jul 12, 2026
@Leon-SK668

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Pushed exact head 049435911000f746de1c6b40bc1504c22b56877f to address the implementation-layer blocker from the prior review.

What changed:

  • Ollama web search now uses the shared resolveWebSearchProviderCredential policy instead of carrying a provider-local SecretRef state machine.
  • The shared helper now supports provider-owned normalization and an onUnavailableConfiguredRef callback so callers can keep fail-closed, provider-specific diagnostics without duplicating SecretRef resolution policy.
  • Ambient OLLAMA_API_KEY fallback is still used only when no configured credential is available; missing or non-env configured SecretRefs block before any request.

Exact-head runtime proof:

  • Ran a clean detached worktree at 049435911000f746de1c6b40bc1504c22b56877f.
  • Started a local loopback HTTP server and invoked runOllamaWebSearch through the real runtime path.
  • Configured env SecretRef case made one real POST /api/experimental/web_search request; the request carried the configured SecretRef credential as Authorization and returned one result.
  • Missing env SecretRef case had ambient OLLAMA_API_KEY set, but failed before request; server call count stayed unchanged.
  • Non-env SecretRef case also failed before request; server call count stayed unchanged.
  • The proof output was redacted to booleans and request path only; no secret value was printed.

Proof output:

{
  "head": "049435911000f746de1c6b40bc1504c22b56877f",
  "successCount": 1,
  "calls": [
    {
      "method": "POST",
      "url": "/api/experimental/web_search",
      "authorizationMatched": true,
      "bodyHasQuery": true
    }
  ],
  "missingRefBlockedBeforeRequest": true,
  "missingRefErrorMatched": true,
  "nonEnvRefBlockedBeforeRequest": true,
  "nonEnvRefErrorMatched": true
}

Local validation on this patch:

  • OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=.vitest-cache-ollama-credentials-2 node scripts/run-vitest.mjs extensions/ollama/src/web-search-provider.test.ts src/agents/tools/web-search-provider-credentials.test.ts -- --reporter=verbose -> passed, 27 tests.
  • node_modules/.bin/oxfmt --check extensions/ollama/src/web-search-provider.ts extensions/ollama/src/web-search-provider.test.ts src/agents/tools/web-search-provider-credentials.ts src/agents/tools/web-search-provider-credentials.test.ts src/plugin-sdk/provider-web-search.ts && git diff --check -> passed.
  • node scripts/run-oxlint.mjs extensions/ollama/src/web-search-provider.ts extensions/ollama/src/web-search-provider.test.ts src/agents/tools/web-search-provider-credentials.ts src/agents/tools/web-search-provider-credentials.test.ts src/plugin-sdk/provider-web-search.ts -> passed.
  • node --max-old-space-size=8192 scripts/plugin-sdk-surface-report.mjs --check -> passed.
  • node --max-old-space-size=8192 --import tsx scripts/generate-plugin-sdk-api-baseline.ts --check -> passed.
  • AUTOREVIEW_ENGINE=claude .agents/skills/autoreview/scripts/autoreview --mode local -> clean, no accepted/actionable findings.

@clawsweeper

clawsweeper Bot commented Jul 12, 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. 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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 12, 2026
@clawsweeper clawsweeper Bot added the rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. label Jul 16, 2026
@Leon-SK668
Leon-SK668 force-pushed the llagy007/ollama-web-search-secretref-20260712 branch from 7048ae4 to 28f39ca Compare July 20, 2026 03:08
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 20, 2026
@Leon-SK668

Copy link
Copy Markdown
Contributor Author

Exact-head proof binding after the force-push (no new loopback rerun is claimed):

The separate maintainer decision about fail-closed compatibility remains open; this comment binds the existing runtime proof and does not present CI as loopback proof.

@Leon-SK668

Copy link
Copy Markdown
Contributor Author

Exact-head runtime proof is now refreshed for 28f39ca2886ab1a3a42481f233612546b67abfa0:

  • Secretless fork Actions run: https://github.com/Leon-SK668/openclaw/actions/runs/29720026227/job/88280971028
  • The isolated runner anonymously fetched that full SHA, installed the exact lockfile with pinned Node 24.15.0 / pnpm 11.2.2, and executed the public createOllamaWebSearchProvider().createTool().execute() path.
  • The repo-supported mock-marked fetch transport retained fetch-guard URL/policy validation and redirected dispatch to IPv4 loopback; no repository token, Actions token, repository secret, or real credential was supplied.
  • PASS: resolved env SecretRef reached Ollama Cloud once with the resolved credential role and returned one result.
  • PASS: unavailable env SecretRef and unsupported non-env SecretRef each failed closed before any request, even with ambient OLLAMA_API_KEY present.
  • PASS: mixed configured/ambient auth made the two selected-host attempts with the configured role, then the Ollama Cloud fallback with the ambient role, and returned one result.

This closes the exact-head runtime-proof gap only. The owner-level compatibility decision remains unresolved: whether an unavailable explicit models.providers.ollama.apiKey SecretRef should fail closed when ambient OLLAMA_API_KEY exists. This evidence does not claim the PR is cleared.

Route configured models.providers.ollama.apiKey resolution through the
existing shared resolveWebSearchProviderCredential helper so env-backed
SecretRefs resolve for web search, and resolve the ambient OLLAMA_API_KEY
independently of the configured selected-host key so mixed setups still
reach the Ollama Cloud fallback after both selected-host attempts fail
(regression fixed at web-search-provider.ts:195).

Drop the two optional plugin-SDK resolver hooks (provider normalization
and unavailable-configured-ref callback) added earlier: the fix does not
depend on them, so the shared resolver and its generated plugin-SDK
baseline stay identical to main and no new plugin-SDK contract surface is
introduced. Ollama applies its own non-secret-marker filter locally on
the resolver output instead.

Add a mixed-credential regression test (configured host key plus a
distinct ambient OLLAMA_API_KEY reaching the cloud fallback) and drop the
tests for the removed fail-closed-throw behavior.
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer decision: adopt fail-closed credential precedence. An explicitly configured SecretRef is authoritative; if it is unavailable or unsupported, Ollama web search must fail before any request even when ambient OLLAMA_API_KEY exists. Silently substituting an ambient credential would make endpoint and credential selection depend on process state rather than the operator’s explicit config.

Ambient OLLAMA_API_KEY remains valid when no explicit SecretRef is configured. I am proceeding with a current-main refresh and final exact-head proof/autoreview before landing.

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 31, 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: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 31, 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: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@vincentkoc

Copy link
Copy Markdown
Member

Maintainer decision: explicit configured SecretRef credentials remain authoritative and fail closed when unavailable; OpenClaw must not silently fall back to an ambient Ollama key. The release-owned CHANGELOG edit has been removed, focused tests and fresh autoreview are clean, and the prepared head is now published.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 31, 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: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member

Exact-head public tool proof is now attached to the PR body for 00bd1a123a6224e9c648ca73b2eb5b155711ae8c. The four-case redacted transcript covers resolved env ref, unavailable env ref with ambient key, unsupported non-env ref, and mixed configured/ambient routing. The temporary proof file was removed and the prepared worktree remains clean.

@clawsweeper re-review

* origin/main: (1976 commits)
  fix(ollama): models advertise tools when /api/show fails (openclaw#109971)
  fix(ollama): use CJK-aware char estimate for usage fallback (openclaw#110073)
  fix(ollama): release failed setup response bodies before returning (openclaw#111802)
  feat(plugins): externalize Synthetic provider (openclaw#116720)
  fix(agents): unblock channel turns after restart recovery (openclaw#116728)
  fix(telegram): keep typing alive during active steered tasks (openclaw#116721)
  fix(gateway): admit standalone MCP app work (openclaw#116727)
  fix(googlechat): record canonical receipt thread (openclaw#116717)
  test(ui): cover the Talk relay start-stop race
  fix(ui): close superseded Talk allocations
  fix(agents): resume interrupted turns past progress commentary (openclaw#116725)
  fix(gateway): sign device proofs with challenge time (openclaw#116679)
  fix(testing): load relay smoke through UI Vite config
  test(testing): guard realtime relay smoke module path
  fix(testing): repair realtime relay live smoke import
  test: type session request parameters (openclaw#116713)
  fix: retain event invalidation for pagination
  docs: note queued session refresh fix
  fix: preserve queued session refresh options
  fix(exec): require approval for abbreviated inline eval flags [AI] (openclaw#116529)
  ...
@vincentkoc

Copy link
Copy Markdown
Member

Merged current main into the contributor branch at 94d25faa506e8b3c68f2194bd1783aa937f06b01; the aggregate PR delta remains the same four credential-routing files. Exact refreshed proof: 32 focused tests passed; the public createOllamaWebSearchProvider().createTool().execute() suite passed all 23 cases, including resolved env refs, unavailable env refs with ambient credentials present, unsupported non-env refs, and mixed configured/ambient routing; targeted format/lint and git diff --check passed; fresh branch autoreview is clean (0.91).

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 31, 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: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

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

Labels

agents Agent runtime and tooling extensions: ollama 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: 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