Skip to content

fix: only call ensureOllamaReady() when using Ollama embedding provider#8

Closed
pineapplestrikesback wants to merge 1 commit intogiancarloerra:mainfrom
pineapplestrikesback:fix/conditional-ollama-ready
Closed

fix: only call ensureOllamaReady() when using Ollama embedding provider#8
pineapplestrikesback wants to merge 1 commit intogiancarloerra:mainfrom
pineapplestrikesback:fix/conditional-ollama-ready

Conversation

@pineapplestrikesback
Copy link
Contributor

Summary

  • Fixes codebase_search failing for OpenAI and Google embedding users
  • ensureOllamaReady() was called unconditionally on every search, regardless of EMBEDDING_PROVIDER
  • Now only called when embeddingProvider === "ollama"; otherwise initializes the configured provider via getEmbeddingProvider()

Fixes #7

Test plan

  • Verify codebase_search works with EMBEDDING_PROVIDER=openai without Ollama installed
  • Verify codebase_search still works with EMBEDDING_PROVIDER=ollama (no regression)
  • Verify no Ollama Docker container is created when using OpenAI/Google providers

The codebase_search handler unconditionally called ensureOllamaReady()
regardless of the configured EMBEDDING_PROVIDER. This caused search to
fail for OpenAI and Google embedding users because:

- OLLAMA_MODE=auto/docker: creates an Ollama Docker container and tries
  to pull the configured model (e.g. text-embedding-3-large) from Ollama's
  registry, which fails since it's an OpenAI model
- OLLAMA_MODE=external: tries to reach localhost:11434, fails with
  "Ollama is not reachable"

Now ensureOllamaReady() is only called when embeddingProvider === "ollama".
For other providers, getEmbeddingProvider() is called to ensure the
provider singleton is initialized.

Fixes giancarloerra#7
giancarloerra pushed a commit that referenced this pull request Mar 17, 2026
ensureOllamaReady() was called unconditionally on every search and context
operation, causing failures for OpenAI and Google embedding users. Now only
called when embeddingProvider is ollama; otherwise the configured provider
is initialized via getEmbeddingProvider().

Fixes #7

Co-authored-by: pineapplestrikesback <pineapplestrikesback@users.noreply.github.com>
@giancarloerra
Copy link
Owner

Merged via squash to main with additional changes:

  • Extended the ensureOllamaReady guard to context-tools.ts — codebase_context_index and codebase_context_search had the same unconditional call
  • Added unit tests for query-tools.ts (3 tests) and context-tools.ts (5 tests), verifying ensureOllamaReady is only called for the Ollama provider

Issue #7 is auto-closed via the commit message.

Thank you for the contribution pineapplestrikesback, well spotted, and much appreciated!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ensureOllamaReady() called unconditionally in codebase_search, breaks OpenAI/Google embedding providers

2 participants