Skip to content

fix: support AGENTMEMORY_EMBEDDING_PROVIDER and xenova/transformers aliases#412

Open
AyushKar2005 wants to merge 1 commit into
rohitg00:mainfrom
AyushKar2005:fix/issue-395
Open

fix: support AGENTMEMORY_EMBEDDING_PROVIDER and xenova/transformers aliases#412
AyushKar2005 wants to merge 1 commit into
rohitg00:mainfrom
AyushKar2005:fix/issue-395

Conversation

@AyushKar2005
Copy link
Copy Markdown

@AyushKar2005 AyushKar2005 commented May 15, 2026

so i was looking at issue #395 and traced it down to detectEmbeddingProvider in config.ts. it was reading EMBEDDING_PROVIDER but the docs and startup logs all say to set AGENTMEMORY_EMBEDDING_PROVIDER — so the env var was just never being read.

also noticed that even if someone set it correctly to xenova or transformers, it would still fall through to null because the switch in index.ts only handles local. added an alias that maps both to local.

tested locally, embedding provider now correctly resolves instead of falling back to BM25-only mode.

Closes #395

Summary by CodeRabbit

  • Improvements
    • Added support for an additional environment variable override for embedding provider configuration, enabling more flexible deployment options.
    • Enhanced normalization of provider selection to ensure consistent behavior across different configuration settings.

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

@Adolfler is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

📝 Walkthrough

Walkthrough

The PR adds environment variable override support to embedding provider detection. detectEmbeddingProvider now checks AGENTMEMORY_EMBEDDING_PROVIDER first, falling back to EMBEDDING_PROVIDER, and normalizes xenova and transformers provider names to "local" before returning the resolved value.

Changes

Embedding Provider Configuration

Layer / File(s) Summary
Embedding provider detection with override support
src/config.ts
detectEmbeddingProvider prioritizes AGENTMEMORY_EMBEDDING_PROVIDER over EMBEDDING_PROVIDER and normalizes xenova/transformers to "local" before returning the provider value.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A small tweak, so fine and true,
Embedding names the rabbit knew—
Xenova, transformers, all the same,
Now "local" is their honored name.
One override to rule them all!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding support for AGENTMEMORY_EMBEDDING_PROVIDER override and handling xenova/transformers aliases.
Linked Issues check ✅ Passed The PR changes directly address both requirements from issue #395: reading AGENTMEMORY_EMBEDDING_PROVIDER instead of EMBEDDING_PROVIDER, and mapping xenova/transformers aliases to local provider.
Out of Scope Changes check ✅ Passed All changes in src/config.ts are directly related to fixing the embedding provider detection issue; no out-of-scope changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/config.ts (1)

185-191: ⚡ Quick win

Normalize and trim forced provider values before alias mapping.

Current matching only handles exact lowercase strings, so "Xenova" / " transformers " won’t resolve to "local".

Proposed fix
-const forced = source["AGENTMEMORY_EMBEDDING_PROVIDER"] || source["EMBEDDING_PROVIDER"];
+const forcedRaw =
+  source["AGENTMEMORY_EMBEDDING_PROVIDER"] ?? source["EMBEDDING_PROVIDER"];
+const forced = forcedRaw?.trim().toLowerCase();

 if (forced) {
-
   if (forced === "xenova" || forced === "transformers") return "local";
-  
+
   return forced;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/config.ts` around lines 185 - 191, The code reads the environment
override into the variable forced but compares it directly, so values like
"Xenova" or " transformers " don't match; normalize by trimming whitespace and
converting to lowercase (e.g., let normalized =
String(forced).trim().toLowerCase()) and use normalized for the alias checks in
the existing block that maps "xenova" or "transformers" to "local" and otherwise
returns the forced provider; ensure you still return the original
normalized/mapped value rather than the unnormalized input.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/config.ts`:
- Around line 185-191: The code reads the environment override into the variable
forced but compares it directly, so values like "Xenova" or " transformers "
don't match; normalize by trimming whitespace and converting to lowercase (e.g.,
let normalized = String(forced).trim().toLowerCase()) and use normalized for the
alias checks in the existing block that maps "xenova" or "transformers" to
"local" and otherwise returns the forced provider; ensure you still return the
original normalized/mapped value rather than the unnormalized input.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1da76421-a495-495d-be17-9e395f5832e1

📥 Commits

Reviewing files that changed from the base of the PR and between 7530339 and 1feb490.

📒 Files selected for processing (1)
  • src/config.ts

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.

Bug: Local embedding stuck at "none" (BM25-only) in v0.9.13 despite correct xenova config

2 participants