Skip to content

fix: make the edenai embedder selectable and honoured by serve - #1820

Merged
RaghavChamadiya merged 3 commits into
repowise-dev:mainfrom
MVS-source:fix/edenai-embedder-picker
Aug 21, 2026
Merged

RaghavChamadiya merged 3 commits into
repowise-dev:mainfrom
MVS-source:fix/edenai-embedder-picker

Conversation

@MVS-source

Copy link
Copy Markdown
Contributor

Summary

  • Makes the edenai embedder selectable: adds it to the --embedder click.Choice and its help, to both interactive embedder prompts, and to the env detection that supplies the advanced-mode default.
  • Fixes the HTTP server falling through to the keyless mock on REPOWISE_EMBEDDER=edenai, which made the server report healthy while semantic search ran on vectors that cannot match the index.
  • Adds tests for the flag, both prompts, the detection precedence, and the server resolution, and fills the edenai gap in the existing resolve_embedder parametrize.

Related Issues

Fixes #1815

Follow-up to #705, which added the embedder and the docs but left four older lists behind. My omission, so this closes it out.

Test Plan

  • Tests pass (pytest)
  • Lint passes (ruff check .)
  • Web build passes (npm run build) (if frontend changes)

No frontend change, so the web build is untouched.

What I ran:

  • pytest tests/unit/cli/test_edenai_reachability.py tests/unit/server/test_app_embedder_backends.py gives 13 passed, and tests/unit/cli/test_shared_helpers.py 25 passed with the two new parametrize cases.

  • pytest tests/unit/cli tests/unit/server for regressions, since the change touches prompt construction that other UI tests drive. This branch gives 6 failed, 4500 passed. I then ran the same command on main at 9c16233 with nothing of mine applied, and it gives 9 failed, 4482 passed, so this branch fails strictly fewer tests than the base and every failure on it also fails without the change. They are all in test_update_e2e.py, test_update_persist_reliability.py, and test_watch_cmd.py, none of which this diff touches, and the set varies between runs, which is what flaky looks like.

    One of them I can now explain, and it corrects something I said on feat: add Eden AI as a first-class LLM provider and embedder #705. The two test_watch_cmd::TestSingleRepoTrigger failures are OSError: [Errno 28] inotify watch limit reached on my machine, not anything in your code. Sorry for the earlier noise on that.

  • ruff check . clean across the repo. For formatting I checked against ruff 0.6.9, the version your .pre-commit-config.yaml pins, rather than the 0.15.6 the venv resolves under >=0.6,<1. Every line this PR adds is already formatted. Two of the files carry one pre-existing line each that 0.6.9 would rewrap, in mode_selection.py and command.py, both untouched here and both already like that on main, so I ran format --diff rather than format --write and left them alone.

Both failures reproduce before the change and pass after:

--embedder edenai      REFUSE -> ACCEPTE
REPOWISE_EMBEDDER=edenai -> KeylessEmbedder -> EdenAIEmbedder

Checklist

  • My code follows the project's code style
  • I have added tests for new functionality
  • All existing tests still pass
  • I have updated documentation if needed

Docs needed no change here: CLI_REFERENCE.md and CONFIG.md already list edenai, which is what made this a bug rather than a feature.

Notes on two judgement calls

_resolve_embedder_from_env in mode_selection.py reads EDENAI_API_KEY last, immediately before the mock, mirroring the shared resolver in cli/providers/embedders.py. Same reasoning you gave on #705: an unrelated key in the environment must not outrank a backend the user was already resolving to. There is a parametrized test pinning that, so it cannot drift back.

For server/app.py I added a branch next to the others rather than routing through get_embedder. Your #324 moved the MCP server onto the shared registry, and _build_embedder is the last hardcoded copy, so converging it would fix this class of bug for every registered embedder instead of one. I did not do it here because it changes behaviour for the four existing backends and this PR should stay small, but say the word and I will send that separately.

I left the numbered embedder menu in serve_cmd.py alone for the same reason, details in the issue.

I do work at Eden AI.

docs/reference/CLI_REFERENCE.md documents --embedder edenai and the
embedder is in the registry, but the flag's click.Choice and the two
interactive prompts were left on the older five-backend list, so the
flag was rejected and neither prompt offered the option.

_resolve_embedder_from_env in mode_selection.py is a third copy of the
detection chain and did not read EDENAI_API_KEY, so a machine whose only
key is that one defaulted to the mock and semantic search ran on vectors
that cannot match the index. It is read last, before the mock, mirroring
the shared resolver in cli/providers/embedders.py: an unrelated key in
the environment must not outrank a backend the user was already
resolving to.

The --provider help string also omitted edenai. That option has no
Choice, so the provider worked, it was just undocumented in --help.
docs/reference/CONFIG.md lists edenai among the accepted values, but
_build_embedder resolved backends through a hardcoded chain that stopped
at openrouter, so the value fell through to KeylessEmbedder with only a
warning. The server then reported healthy while semantic search ran on
vectors that cannot match the index, the same failure as repowise-dev#306.

repowise-dev#324 fixed this class of bug for the MCP server by going through the
shared registry, and _resolve_embedder there is correct today. This
chain is the remaining hardcoded copy; converging it on get_embedder
would fix every registered embedder at once, but that changes behaviour
for the four existing backends, so this keeps the change small.
@repowise-bot

repowise-bot Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ Health of changed files: 2.0 → 2.4 (+0.4)
⚠️ Change risk: moderate, riskier than 42% of this repo's commits.

📋 At a glance
5 hotspots touched · 1 new finding introduced · 4 co-change pairs left out · 4 files with recent fix history.

Files & modules (2)
  • packages (4 files)
    • .../server/app.py
    • .../init_cmd/command.py
    • .../ui/mode_selection.py
    • .../commands/reindex_cmd.py
  • tests (1 file)
    • .../cli/test_shared_helpers.py

✅ Health gate: passed

📌 Before you merge

  • Run .../cli/test_editor_setup.py, .../cli/test_health_rescore_gate.py, .../cli/test_workspace_deterministic.py, .../cli/test_embedder_resolution.py (+7 more): they import the changed files
  • .../init_cmd/workspace.py changed together with .../init_cmd/command.py in 22 past commits and isn't in this PR
  • .../cli/helpers.py changed together with .../init_cmd/command.py in 14 past commits and isn't in this PR
  • .../update_cmd/command.py changed together with .../init_cmd/command.py in 11 past commits and isn't in this PR
  • ...and 1 more co-change partner not in this PR
  • Docs that usually track this code: docs/reference/CLI_REFERENCE.md
🔎 More signals (3)

🗺️ Change map

flowchart LR
  subgraph PR ["Changed in this PR (4 with dependents)"]
    f_packages_cli_src_repowise_cli_commands_init_cmd_command_py[".../init_cmd/command.py 🔥"]:::changed
    f_packages_cli_src_repowise_cli_commands_reindex_cmd_py[".../commands/reindex_cmd.py 🔥"]:::changed
    f_packages_cli_src_repowise_cli_ui_mode_selection_py[".../ui/mode_selection.py 🔥"]:::changed
    f_packages_server_src_repowise_server_app_py[".../server/app.py 🔥"]:::changed
  end
  f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py[".../doctor_cmd/repo_checks.py"]
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py
  f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py[".../generate_cmd/command.py"]
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py
  f_packages_cli_src_repowise_cli_commands_hook_cmd_py[".../commands/hook_cmd.py"]
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_hook_cmd_py
  f_packages_cli_src_repowise_cli_commands_init_cmd___init___py[".../init_cmd/__init__.py"]
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_init_cmd___init___py
  f_packages_cli_src_repowise_cli_commands_reindex_cmd_py --> f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py
  f_packages_cli_src_repowise_cli_commands_reindex_cmd_py --> f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py
  f_packages_cli_src_repowise_cli_upgrade_py[".../cli/upgrade.py"]
  f_packages_cli_src_repowise_cli_commands_reindex_cmd_py --> f_packages_cli_src_repowise_cli_upgrade_py
  f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py[".../init_cmd/generation.py"]
  f_packages_cli_src_repowise_cli_ui_mode_selection_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py
  f_packages_cli_src_repowise_cli_commands_init_cmd_reporting_py[".../init_cmd/reporting.py"]
  f_packages_cli_src_repowise_cli_ui_mode_selection_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_reporting_py
  f_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py[".../init_cmd/workspace.py"]
  f_packages_cli_src_repowise_cli_ui_mode_selection_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py
  f_packages_cli_src_repowise_cli_commands_update_cmd_command_py[".../update_cmd/command.py"]
  f_packages_cli_src_repowise_cli_ui_mode_selection_py --> f_packages_cli_src_repowise_cli_commands_update_cmd_command_py
  f_packages_cli_src_repowise_cli_helpers_py[".../cli/helpers.py"]
  f_packages_server_src_repowise_server_app_py --> f_packages_cli_src_repowise_cli_helpers_py
  f_packages_cli_src_repowise_cli_main_py[".../cli/main.py"]
  f_packages_server_src_repowise_server_app_py --> f_packages_cli_src_repowise_cli_main_py
  f_packages_core_src_repowise_core_pipeline_orchestrator_py[".../pipeline/orchestrator.py"]
  f_packages_server_src_repowise_server_app_py --> f_packages_core_src_repowise_core_pipeline_orchestrator_py
  more(["+4 more dependents"])
  PR --> more
  w_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py(["⚠️ .../init_cmd/workspace.py changed together 22×, not in PR"]):::warn
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py -.- w_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py
  w_packages_cli_src_repowise_cli_helpers_py(["⚠️ .../cli/helpers.py changed together 14×, not in PR"]):::warn
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py -.- w_packages_cli_src_repowise_cli_helpers_py
  t_tests_unit_cli_test_editor_setup_py(["✅ .../cli/test_editor_setup.py"]):::guard
  t_tests_unit_cli_test_editor_setup_py -.-> f_packages_cli_src_repowise_cli_commands_init_cmd_command_py
  t_tests_unit_cli_test_embedder_resolution_py(["✅ .../cli/test_embedder_resolution.py"]):::guard
  t_tests_unit_cli_test_embedder_resolution_py -.-> f_packages_cli_src_repowise_cli_commands_reindex_cmd_py
  t_tests_unit_cli_test_file_page_volume_prompt_py(["✅ .../cli/test_file_page_volume_prompt.py"]):::guard
  t_tests_unit_cli_test_file_page_volume_prompt_py -.-> f_packages_cli_src_repowise_cli_ui_mode_selection_py
  classDef changed fill:#dbeafe,stroke:#1d4ed8,color:#1e3a5f
  classDef warn fill:#fef3c7,stroke:#b45309,color:#78350f
  classDef guard fill:#dcfce7,stroke:#15803d,color:#14532d
Loading

Solid arrows: code that imports the changed files (16 direct dependents, from the last indexed snapshot). Dashed: history/tests.

🔥 Hotspots touched (5)

  • .../server/app.py: 20 commits/90d, 6 dependents · primary owner: Raghav Chamadiya (81%)
  • .../init_cmd/command.py: 53 commits/90d, 7 dependents · primary owner: Raghav Chamadiya (92%)
  • .../ui/mode_selection.py: 17 commits/90d, 12 dependents · primary owner: Swati Ahuja (52%)
2 more
  • .../cli/test_shared_helpers.py: 4 commits/90d, 0 dependents · primary owner: Swati Ahuja (68%)
  • .../commands/reindex_cmd.py: 11 commits/90d, 6 dependents · primary owner: Raghav Chamadiya (57%)

🔗 Hidden coupling (1 file)

  • .../init_cmd/command.py co-changes with these files (not in this PR):
    • .../init_cmd/workspace.py (22×, 🔴 strong)
    • .../cli/helpers.py (14×, 🟡 notable)
    • .../update_cmd/command.py (11×, 🟡 notable)
    • .../init_cmd/generation.py (10×, 🟡 notable)

👀 Suggested reviewers @RaghavChamadiya


📊 See the full report for this PR
Your repo map with this PR's blast radius lit up, every caller of the contracts it changes, and health before and after. No sign-in. · ⭐ Star Repowise · 📥 Install bot · Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot · Updated 2026-08-21 13:51 UTC (since the last push: health 2.4 to 2.4, 1 more file)

The reindex flag carries its own click.Choice and was left on the same
older list, so `repowise reindex --embedder edenai` was rejected while
CLI_REFERENCE.md documents it alongside the init flag.

Spotted by @sloemo01 while working the same issue in repowise-dev#1819, which found
this one where my own sweep of the choice lists had missed it.
@MVS-source

Copy link
Copy Markdown
Contributor Author

Update: this raced with #1819 by @sloemo01, opened one second apart on the same issue. Context in #1815.

Their PR caught reindex_cmd.py, which has its own click.Choice and which my sweep of the choice lists had missed, so reindex --embedder edenai was rejected as well while CLI_REFERENCE.md documents it. Added here in 6e6fa42 with the credit in the commit message, plus a test that both flags accept it and both still reject an unknown backend.

I re-swept afterwards to be sure nothing else is left: grep -rn "click.Choice" across packages/*/src now returns three embedder choices, all three carrying edenai, and reindex was the only literal list still on the old set.

Happy to close this in favour of #1819 if that is easier for you, no strong feelings. The three spots that would then still need doing are listed in a comment over there.

@RaghavChamadiya RaghavChamadiya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @MVS-source. Filing the bug against your own merge before anyone noticed, and saying plainly that #705 was your omission, is the part worth naming here. That is a harder thing to do than the fix.

I checked the two judgement calls rather than taking the description for them.

The _resolve_embedder_from_env ordering is right. It mirrors the shared resolver at cli/providers/embedders.py:74-84 exactly, gemini then openai then openrouter then ollama then edenai then mock, so EDENAI_API_KEY only decides when nothing else has. That matters more than usual given you work at Eden AI, and putting your own backend last in the precedence chain is the correct answer rather than the convenient one. The parametrized test pinning it means it cannot quietly drift later either.

The default model is also right: amazon/amazon.titan-embed-text-v2:0 matches EdenAIEmbedder.__init__, not the value the registry docstring claims.

On the four symptoms in #1815, this covers all four. The two that make it worth taking before a release rather than after are the ones that are quiet:

_prompt_index_only_search is a second prompt that is easy to miss when you are reading for the obvious one, and _resolve_embedder_from_env is the one where nothing errors at all. A machine whose only key is EDENAI_API_KEY gets the mock, the server logs healthy, and semantic search runs on vectors that cannot match the index. That is the same shape as #1678, which shipped a fix for this morning, and it is not a failure anyone diagnoses from the outside.

Two follow-ups, neither for this PR.

Yes to converging _build_embedder on get_embedder, and you are right that it is the last hardcoded copy after #324 moved the MCP server across. Send it separately after the release, since it changes behaviour for four existing backends and that wants its own diff and its own week.

registry.py:9 says edenai defaults to openai/text-embedding-3-small, which is wrong against the class default your PR correctly uses. Pre-existing, unrelated to this change, worth a line whenever you are next in that file.

The flaky test_watch_cmd runs are an inotify limit on your machine and not something you needed to apologise for. Running the same command on main to show your branch fails strictly fewer tests than the base was the right way to settle it, and more rigour than most people bring to a "tests are flaky" claim.

Crediting @sloemo01 in the reindex commit for the one your own sweep missed was a good call.

@RaghavChamadiya
RaghavChamadiya merged commit 0364ff6 into repowise-dev:main Aug 21, 2026
9 checks passed
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] The edenai embedder is documented but cannot be selected

2 participants