fix(embeddings): pass explicit XDG-aware cache_folder to SentenceTransformer - #132
Merged
Conversation
…sformer embedding_engine._ensure_model() loaded SentenceTransformer without a cache_folder, relying entirely on huggingface_hub's own HF_HOME/default resolution. The reranker was hardened against the analogous /tmp class of incident in bb1c581 (reranker_cache_dir(), XDG-aware via shared.platform.cache_dir()); embeddings had no equivalent. Mirrors the reranker's pattern exactly: same shared cache_dir() base, laid out under huggingface/hub to match the directory sentence-transformers/huggingface_hub already write models--org--name snapshots into by default. Precedence: if the user has already set HF_HOME or SENTENCE_TRANSFORMERS_HOME, cache_folder is left as None so their choice is not silently overridden — an explicit cache_folder kwarg outranks both env vars inside sentence-transformers. Fixes #124 Co-Authored-By: Claude <noreply@anthropic.com>
pull Bot
pushed a commit
to asleekgeek/Cortex
that referenced
this pull request
Jul 15, 2026
Cuts 13 commits ahead of v4.14.1: core→infrastructure layer-violation cleanup via reverse-DI ports-and-adapters (cdeust#135), check_setup MCP tool + /preflight command (cdeust#115, cdeust#119, cdeust#133), XDG-aware embedding cache_folder (cdeust#132), project settings catalogue + headless CI regimes (cdeust#131), devcontainer with prewarmed models (cdeust#129), optional OTLP telemetry (cdeust#128), stale docs/ module-count fixes (cdeust#130, cdeust#121), CLAUDE.md refactor (cdeust#125), Windows postInstall dispatch fix (cdeust#117). No retrieval-path code touched. Pre-tag guard on the exact release tree (git_sha 018c76d, isolated ephemeral pgvector container via benchmarks/reproduce.sh --no-ablation): LongMemEval MRR 0.9166/R@10 0.9820 (matches v4.14.1, no regression); LoCoMo 3-run mean MRR 0.8009/R@10 0.9146 (vs v4.14.1's 3-run mean 0.7984/0.9142, an improvement within noise); BEAM MRR 0.5437/R@10 0.7139 (within v4.14.1's established intra-day variance band). All 4 gated floors PASS (tolerance 0.005) — unlike v4.14.1 where LoCoMo MRR failed the absolute floor on its 3-run mean, 4.14.2's mean clears it by -0.0041. Evidence: benchmarks/results/repro/20260715-v4.14.2-pretag/. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Fixes #124.
embedding_engine.py::_ensure_modelpasse désormais uncache_folderexplicite XDG-aware (viashared.platform.cache_dir()), en miroir du durcissement du reranker (bb1c581) — les embeddings ne dépendent plus entièrement de la résolution par défaut de huggingface_hub, et ne peuvent plus atterrir en /tmp (classe d'incident FlashRank).Précédence documentée : si l'utilisateur a posé HF_HOME ou SENTENCE_TRANSFORMERS_HOME, on défère à la bibliothèque (ne pas écraser un choix légitime) ; sinon cache_dir()/huggingface/hub. 6 tests ajoutés (défaut pas /tmp, XDG honoré, précédence HF_HOME/ST_HOME, kwarg réellement passé au constructeur). Suite embeddings+reranker verte (71 passed).
🤖 Generated with Claude Code