fix: use os.homedir() instead of process.env.HOME for HuggingFace cache dir#1078
Merged
Merged
Conversation
On Windows, HOME env is often unset, causing cache to be written to './undefined/'. Using os.homedir() ensures cross-platform compatibility while preserving HF_HOME priority. Fixes abhigyanpatwari#1068
|
@chouzz is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
CI Report✅ All checks passed Pipeline Status
Test Results
✅ All 7242 tests passed 97 test(s) skipped — expand for details
Code CoverageTests
📋 View full run · Generated by CI |
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.
Summary
On Windows,
HOMEenvironment variable is not set by default. When runninggitnexus analyze --embeddings, the cache directory resolves toundefined/.cache/huggingface/becauseprocess.env.HOMEreturnsundefined, which gets stringified into the path.This pollutes the working tree with an
undefined/directory containing ~86 MB of model files, risks accidental commits, and prevents cache sharing between repos.Changes
process.env.HOMEwithos.homedir()which correctly resolves the user home directory on Windows, macOS, and Linuxpath.join()for cross-platform path construction instead of template literalsgitnexus/src/core/embeddings/embedder.tsandgitnexus/src/mcp/core/embedder.tsTest
os.homedir()returns the correct home directoryHF_HOMEenvironment variable priority is preservedFixes #1068