Repository navigation
fix(startup): accept the ONNX backend in the dependency check (#1930) - #1932
Merged
Merged
Conversation
…oo#1930) check_critical_dependencies() only knew torch + sentence-transformers, so every start of a [sqlite] install (onnxruntime + tokenizers, no torch) printed [MISSING] and timeout warnings, doubled the init timeout, and pointed at `python install.py`, which pip, uv tool and uvx installs do not ship. Either backend now satisfies the check, and only an install with neither is reported. The hint is `pip install "mcp-memory-service[sqlite]"`. is_first_run() also scans ~/.cache/mcp_memory/onnx_models, so a cached ONNX model no longer counts as a first run.
… tokenizer ONNXEmbeddingModel creates the model directory before downloading, so a directory name alone does not mean the model is there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
The startup dependency check passes when either embedding backend is usable, onnxruntime + tokenizers or torch + sentence-transformers, and warns only when neither is. The install hint is now
pip install "mcp-memory-service[sqlite]", andis_first_run()also looks in the ONNX model cache.Why
Fixes #1930.
check_critical_dependencies()probed onlytorchandsentence_transformers, so every start of a[sqlite]install printed[MISSING] Missing dependencies detected: torch, sentence-transformers,get_recommended_timeout()doubled the base timeout, and the hint waspython install.py, which pip,uv toolanduvxinstalls don't have.check_onnx_installed()probes onnxruntime + tokenizers, next to the existing torch / sentence-transformers helpers. If ONNX is there, torch isn't imported at all.onnxruntime + tokenizers (or torch + sentence-transformers). The other critical packages (sqlite-vec,mcp, ...) are checked as before.suggest_installation_command()returns the[sqlite]command; the Windows branch returned the same string as the other one, so it's gone.is_first_run(): the issue suggested checking the ONNX cache. Without it a[sqlite]user with a cached model is still a "first run" on every start, so the timeout keeps doubling. It now also scans~/.cache/mcp_memory/onnx_models(Hub exports keeptokenizer.jsonin<model>/) and.../all-MiniLM-L6-v2(the bundled model unpacks intoonnx/). The existing name indicator'miniml'never matches "MiniLM", which is why the default model's folder is listed itself.How it was verified
The tests don't depend on what the venv has installed. They put fake
onnxruntime/tokenizers/torch/sentence_transformersmodules (orNone, which makes the import fail) intosys.modules, so the real helpers andcheck_critical_dependencies()run. Covered: ONNX only, torch only, neither, torch without sentence-transformers, therun_dependency_check()output, the hint, the timeout (not doubled with either backend, still doubled with none), andis_first_run()with the default model cached, a Hub model cached, and an empty model directory (still a first run, sinceONNXEmbeddingModelcreates the directory before downloading).By hand, in a fresh venv with
pip install -e ".[sqlite]"(onnxruntime 1.31.1, no torch), after lettingONNXEmbeddingModeldownload its model, withLM_STUDIO=1so the 5s cap doesn't hide the number:pre_pr_check.sh(Windows): the quality gate was skipped (no LLM backend). The test suite step is red only because oftests/ci/test_auto_assign_claim.py, which fails the same 20 tests onmain. Handler coverage and import validation failed on the cp1252 console encoding and pass withPYTHONUTF8=1.Changelog fragment
changelog.d/1930.fixed.mdNotes for the reviewer
is_first_run()was already well above the complexity budget. This change only adds two paths to its list, no branches. I didn't refactor it here to keep the PR on Startup dependency check reports torch/sentence-transformers as missing on the ONNX install #1930.Agent Disclosure
I used Claude Code to help with this change, and I went through the diff, the tests and the description myself before opening this.


Confidence Score: 5/5
The PR appears safe to merge.Summary
The PR accepts either ONNX or PyTorch dependencies and replaces the installation hint with
pip install "mcp-memory-service[sqlite]".Reviews (2) · Last reviewed commit: "fix(startup): count an ONNX model as cac..." · Reviewed by Greptile