Skip to content

Provider resolution ignores memorySearch.provider config, routing to wrong Ollama instance #97055

Closed

Description

@Tabytha-Stryker

Summary

The builtin memory search provider resolution ignores the configured memorySearch.provider field and its associated provider's baseUrl, routing embedding requests to whichever Ollama instance resolves first on the network instead.

When memorySearch.provider is set to "ollama-cpu" with a custom baseUrl pointing at http://127.0.0.1:11434, gateway logs show it acknowledges the requested provider ((requested: ollama-cpu)) but connects to the wrong Ollama instance — often a remote inference box rather than the configured local endpoint.

Steps to Reproduce

  1. Configure two Ollama instances:

    • Local on localhost:11434 (OpenClaw host) with embedding model pulled but not loaded
    • Remote on a separate machine (e.g. 10.0.0.250:11434) with embedding model loaded and active
  2. Set provider config in openclaw.json:

{
  "models": {
    "providers": {
      "ollama-cpu": {
        "type": "ollama",
        "baseUrl": "http://127.0.0.1:11434"
      }
    }
  },
  "agents": {
    "defaults": {
      "memorySearch": {
        "provider": "ollama-cpu",
        "model": "qwen3-embedding:4b"
      }
    }
  }
}
  1. Enable session transcript indexing (experimental.sessionMemory: true, sources: ["memory", "sessions"])

  2. Observe gateway logs during embedding work:

Provider: ollama (requested: ollama-cpu)
Model: qwen3-embedding:4b
baseUrl: http://127.0.0.1:11434
  1. Monitor GPU activity on the remote inference box — embedding requests hit there despite baseUrl pointing at localhost

Expected Behavior

Embedding requests route to http://127.0.0.1:11434 (the configured ollama-cpu endpoint). The (requested: ollama-cpu) annotation in logs should match the actual provider used.

Actual Behavior

The provider is resolved as ollama (the primary/default provider) and requests go to whichever Ollama instance responds first on the network, ignoring the baseUrl override entirely. No errors or warnings are logged — the misrouted request succeeds silently.

Environment

  • OpenClaw: 2026.6.10
  • Backend: builtin memory engine (not QMD)
  • Memory provider: ollama-cpu → http://127.0.0.1:11434
  • Embedding model: qwen3-embedding:4b

Evidence

Gateway logs consistently show (requested: ollama-cpu) but the resolved provider is always ollama. Confirmed by observing GPU activity (nvtop) on the remote inference box during local memory indexing operations. The local Ollama instance has the embedding model pulled but idle — it never receives requests despite being the configured endpoint.

First identified June 12, 2026. Persisted through multiple gateway restarts and config changes.

Activity

  1. clawsweeper commented on Jun 26, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 26, 2026, 7:51 PM ET / 23:51 UTC.

    Summary
    Keep open: current main still drops the configured custom Ollama memory provider id before endpoint lookup, and the issue is already paired with an open candidate fix PR that should be reviewed rather than closing the issue early.

    Reproducibility: yes. Source inspection shows current main resolves a custom provider id to the Ollama memory adapter, then drops or overwrites that id before resolveConfiguredProvider can use its configured baseUrl.

    Root-cause cluster
    Relationship: canonical
    Canonical: #97055
    Summary: This issue is the currently open canonical report for the remaining custom Ollama memory provider endpoint-loss bug; the open linked PR is the active candidate fix.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Next step
    No new repair lane: #97059 is already the open implementation candidate for this issue and should be reviewed, landed, or closed first.

    Review details

    Best possible solution:

    Review and land a focused fix that preserves the requested provider id through gateway memory-specific adapter creation and the Ollama memory adapter, with regression coverage and explicit cache identity upgrade handling.

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

    Yes. Source inspection shows current main resolves a custom provider id to the Ollama memory adapter, then drops or overwrites that id before resolveConfiguredProvider can use its configured baseUrl.

    Is this the best way to solve the issue?

    Yes for the issue direction: the narrow maintainable fix is to pass the existing provider id through the gateway memory-specific path and stop the Ollama adapter from hardcoding the base provider. The open linked PR should be reviewed and landed or replaced before closing this issue.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The linked fix path touches Ollama memory index identity; maintainers still need merge-quality handling of the one-time rebuild or alias/migration tradeoff before the issue can close.
    • I did not run a live two-Ollama setup in this read-only review, so the reproduction is source-level plus reporter logs and linked PR proof rather than a fresh live endpoint run.

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

    Label changes

    Label changes:

    • add clawsweeper:linked-pr-open: Current issue advisory state selects this label.
    • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.
    • remove clawsweeper:fix-shape-clear: Current issue advisory state no longer selects this label.
    • remove clawsweeper:queueable-fix: Current issue advisory state no longer selects this label.

    Label justifications:

    • P2: This is a documented custom Ollama memory provider-routing bug with limited provider-specific blast radius.
    • impact:auth-provider: The issue affects provider selection plus endpoint, header, and auth resolution for custom Ollama memory embedding providers.
    Evidence reviewed

    What I checked:

    Likely related people:

    • steipete: Authored the custom memory embedding provider id support and the provider-plugin memory embedding refactor that define this routing boundary. (role: feature-history owner; confidence: high; commits: a0a0ab4d9e2a, 77e6e4cf87f7; files: docs/reference/memory-config.md, src/agents/memory-search.ts, src/plugins/memory-embedding-provider-runtime.ts)
    • dutifulbob: Added the OpenAI-compatible embedding provider and gateway embeddings endpoint surfaces that share the configured-provider routing invariant. (role: adjacent owner; confidence: medium; commits: 4d89e00c5093; files: src/gateway/embeddings-http.ts, src/plugins/openai-compatible-embedding-provider.ts, extensions/memory-core/src/memory/embeddings.ts)
    • mushuiyu886: Recently changed Ollama memory embedding output-dimensionality behavior in the same adapter and test surface. (role: recent adjacent contributor; confidence: medium; commits: 1fc4342a0297; files: extensions/ollama/src/memory-embedding-adapter.ts, extensions/ollama/src/embedding-provider.ts, extensions/ollama/src/embedding-provider.test.ts)
    • harjothkhara: Authored the open PR that uses closing syntax for this issue and targets the same gateway/Ollama provider-id propagation bug. (role: candidate fix author; confidence: medium; commits: 02ddd3dd63e0; files: src/gateway/embeddings-http.ts, extensions/ollama/src/memory-embedding-adapter.ts, extensions/ollama/src/embedding-provider.test.ts)
    • maweibin: Authored the older closed unmerged PR with focused real HTTP proof for the same two-layer provider-id propagation root cause. (role: prior candidate fix contributor; confidence: medium; commits: f1142e5f0922; files: src/gateway/embeddings-http.ts, extensions/ollama/src/memory-embedding-adapter.ts, extensions/ollama/src/embedding-provider.test.ts)
    How this review workflow works
    • 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.
  2. added
    P2Normal backlog priority with limited blast radius.
    impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.
    no-staleExclude from stale automation
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    and removed
    no-staleExclude from stale automation
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    on Jun 26, 2026
  3. steipete commented on Jul 21, 2026

    @steipete
    Contributor

    Fixed on main.

    The provider-id routing portion landed earlier in fa5f24b021e and b085184d085. PR #97059 now closes the residual cache-identity gap: custom/explicit Ollama endpoints receive distinct provider keys, custom header identity is hashed without retaining raw values, and the implicit default Ollama route keeps its shipped key.

    Landed commit: 9405f2c

    Proof: 29 focused tests, complete core/extension changed gates, clean final AutoReview, and exact-head openclaw/ci-gate plus 79 hosted checks green.

  4. locked as resolved and limited conversation to collaborators on Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions