[GH-ISSUE #2664] [Issue]: Inherited embed() always uses OpenAI-style Bearer auth → Anthropic/Google embedding sources fail silently #1314

Closed
opened 2026-10-21 05:31:26 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Jun 20, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2664

Originally assigned to: @SpicyMarinara on GitHub.

Summary

The inherited default embed() always uses OpenAI-style Bearer auth and an /embeddings path/body, so using an Anthropic or Google connection as the embedding source (e.g. for memory recall) sends an auth scheme/endpoint those providers don't accept, failing silently and degrading retrieval.

Expected behavior

Embedding requests should use the auth scheme and endpoint appropriate to the connection's provider, or fail with a clear "this provider doesn't support embeddings via this path" error.

Actual behavior

BaseLLMProvider.embed() hardcodes Authorization: Bearer <key> and POSTs to <baseUrl>/embeddings with an OpenAI-style body. AnthropicProvider and GoogleProvider don't override it, and their auth is x-api-key / x-goog-api-key (Google can also use a query-param key) with different embeddings paths/bodies. When such a connection is the embedding source, the request goes out with the wrong scheme/path, returns 401/404, is caught, logged as warn, and returns null — silently degrading recall.

How it breaks the pipeline

Code trace (staging @ b826f8f4):

  • Default embed: packages/server/src/services/llm/base-provider.ts:626–643 — hardcoded Authorization: Bearer ${this.apiKey} + POST ${this.baseUrl}/embeddings.
  • AnthropicProvider / GoogleProvider do not override embed(); their auth headers differ (anthropic.provider.ts:280/:437 x-api-key; google.provider.ts:140/:407/:567 x-goog-api-key).
  • resolveMemoryRecallEmbeddingSource (packages/server/src/services/memory/memory-recall-embedding.ts) builds the provider via createLLMProvider and calls provider.embed() with no provider gating; failures are caught → warn → null.

Steps to reproduce

  1. Configure memory recall to embed using a Google or Anthropic connection (no separate OpenAI-compatible embedding connection).
  2. Trigger memory recall / embedding generation.
  3. Observe: the embed request hits {baseUrl}/embeddings with a Bearer header; Google/Anthropic reject it (401/404); recall silently returns nothing (only a server warn).

Suggested fix

Override embed() in providers whose auth/endpoint differ, or guard the default embed() to run only for OpenAI-compatible provider kinds and otherwise throw a clear "embeddings not supported via this provider/path" error so the misconfiguration is visible to the user.

Environment

  • Marinara Engine version: 2.0.0 (staging @ b826f8f4)
  • Install type: source
  • OS + version: All (code-level defect, platform-independent)
  • Browser or app shell: All

Additional context

Identified via systematic source review on staging (refs @ b826f8f4). Low severity (affects only non-OpenAI embedding sources) but fails silently, so retrieval quality degrades with no user-visible cause. Filed alongside related pipeline issues.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @kolacheee on GitHub (Jun 20, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2664 Originally assigned to: @SpicyMarinara on GitHub. ## Summary The inherited default `embed()` always uses OpenAI-style Bearer auth and an `/embeddings` path/body, so using an Anthropic or Google connection as the embedding source (e.g. for memory recall) sends an auth scheme/endpoint those providers don't accept, failing silently and degrading retrieval. ## Expected behavior Embedding requests should use the auth scheme and endpoint appropriate to the connection's provider, or fail with a clear "this provider doesn't support embeddings via this path" error. ## Actual behavior `BaseLLMProvider.embed()` hardcodes `Authorization: Bearer <key>` and POSTs to `<baseUrl>/embeddings` with an OpenAI-style body. `AnthropicProvider` and `GoogleProvider` don't override it, and their auth is `x-api-key` / `x-goog-api-key` (Google can also use a query-param key) with different embeddings paths/bodies. When such a connection is the embedding source, the request goes out with the wrong scheme/path, returns 401/404, is caught, logged as `warn`, and returns `null` — silently degrading recall. ## How it breaks the pipeline Code trace (staging @ `b826f8f4`): - Default embed: `packages/server/src/services/llm/base-provider.ts:626–643` — hardcoded `Authorization: Bearer ${this.apiKey}` + `POST ${this.baseUrl}/embeddings`. - `AnthropicProvider` / `GoogleProvider` do not override `embed()`; their auth headers differ (`anthropic.provider.ts:280`/`:437` `x-api-key`; `google.provider.ts:140`/`:407`/`:567` `x-goog-api-key`). - `resolveMemoryRecallEmbeddingSource` (`packages/server/src/services/memory/memory-recall-embedding.ts`) builds the provider via `createLLMProvider` and calls `provider.embed()` with no provider gating; failures are caught → `warn` → `null`. ## Steps to reproduce 1. Configure memory recall to embed using a Google or Anthropic connection (no separate OpenAI-compatible embedding connection). 2. Trigger memory recall / embedding generation. 3. Observe: the embed request hits `{baseUrl}/embeddings` with a `Bearer` header; Google/Anthropic reject it (401/404); recall silently returns nothing (only a server `warn`). ## Suggested fix Override `embed()` in providers whose auth/endpoint differ, or guard the default `embed()` to run only for OpenAI-compatible provider kinds and otherwise throw a clear "embeddings not supported via this provider/path" error so the misconfiguration is visible to the user. ## Environment - Marinara Engine version: 2.0.0 (staging @ `b826f8f4`) - Install type: source - OS + version: All (code-level defect, platform-independent) - Browser or app shell: All ## Additional context Identified via systematic source review on staging (refs @ `b826f8f4`). Low severity (affects only non-OpenAI embedding sources) but fails silently, so retrieval quality degrades with no user-visible cause. Filed alongside related pipeline issues. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@SpicyMarinara commented on GitHub (Jun 20, 2026):

Implemented on branch codex/spicymarinara-assigned-issues: Anthropic and Gemini providers now reject inherited OpenAI-style embedding calls with a clear unsupported-provider error. Final validation will run after the full assigned sweep per maintainer request.

<!-- gh-comment-id:4760051982 --> @SpicyMarinara commented on GitHub (Jun 20, 2026): Implemented on branch codex/spicymarinara-assigned-issues: Anthropic and Gemini providers now reject inherited OpenAI-style embedding calls with a clear unsupported-provider error. Final validation will run after the full assigned sweep per maintainer request.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1314
No description provided.