Conversation
There was a problem hiding this comment.
Pull request overview
Adds a safeguard to detect Git LFS pointer files left behind after Hugging Face model downloads (clone or resume) and surfaces a dedicated status code when this occurs.
Changes:
- Introduces a new
StatusCodefor LFS download failures. - Adds status message mapping for the new status code.
- Extends
HfDownloader::downloadModel()to scan for LFS pointer files after clone/resume and fail fast if any are found.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/status.hpp |
Adds a new status code for LFS download failure. |
src/status.cpp |
Adds a human-readable message for the new status code. |
src/pull_module/libgit2.cpp |
Detects remaining LFS pointer files after clone/resume and returns the new failure status. |
Co-authored-by: Adrian Tobiszewski <adrian.tobiszewski@intel.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| /** | ||
| * Builds the side-marker path used to track interrupted LFS operations. | ||
| * The marker lives next to the repository directory as <repo>.lfswip. | ||
| * | ||
| * @param repositoryPath Absolute path to the model repository directory. | ||
| * @return Filesystem path to the .lfswip marker associated with repositoryPath. | ||
| * @note Pure path computation; does not access filesystem or network. | ||
| */ |
There was a problem hiding this comment.
Do we really need so much comments for those short functions? I would skip them, naming convention is good so they are self-explanatory I think, and it just bloats the code.
| * @return -1 if cancellation requested (aborts transfer), 0 otherwise. | ||
| * @note Connects to internet during clone operations; works on the clone/fetch domain. | ||
| */ | ||
| int cloneTransferProgressCb(const git_indexer_progress* stats, void* payload) { |
There was a problem hiding this comment.
Since we don't do a lot in those callbacks maybe name those (
checkIfCancelCloneTransferProgressCallback or sth like that?
| (void)str; | ||
| (void)len; | ||
| (void)payload; | ||
| if (libgit2::isCloneCancellationRequestedFromServer()) { |
There was a problem hiding this comment.
This is used in several places. Use macro to shorten the code?
#define STOP_IF_OVMS_CANCELLED or sth like that?
| } | ||
|
|
||
| /** | ||
| * Callback for sideband progress messages during git operations (clone, fetch). |
There was a problem hiding this comment.
Here comments again - we don't even use those methods for anythin usefull, so this comments only bloats the code.
| * @note Works on specific git repository location; reads and deletes lfs_error.txt. | ||
| * @note Part of the git LFS domain: detects LFS download failures recorded by patched libgit2. | ||
| */ | ||
| bool hasLfsErrorFileAndLogContent(const std::string& repositoryRootPath) { |
There was a problem hiding this comment.
| bool hasLfsErrorFileAndLogContent(const std::string& repositoryRootPath) { | |
| bool ifHasLfsErrorFileLogContentAndRemove(const std::string& repositoryRootPath) { |
or sth like that?
It not only checks but removes as well.
| std::cout << " Resuming " << p.string() << "...\n"; | ||
| std::string path = p.string(); | ||
| resumeLfsDownloadForFile(repoGuard.get(), path.c_str()); | ||
| Status resumeExistingRepository(git_repository* repo, |
| } | ||
|
|
||
| auto status = IModelDownloader::checkIfOverwriteAndRemove(); | ||
| auto normalizeIndexStatus = normalizeIndexToHead(repo); |
There was a problem hiding this comment.
normalizeIndex->restoreGitIndex?
| // ResumeAfterShutdownRequestAndRerun | ||
| TEST_F(HfPull, ResumeShutdown) { |
There was a problem hiding this comment.
| // ResumeAfterShutdownRequestAndRerun | |
| TEST_F(HfPull, ResumeShutdown) { | |
| TEST_F(HfPull,ResumeAfterShutdownRequestAndRerun) { |
There was a problem hiding this comment.
We cannot have long names in unit tests for lib git 2 clone because on windows we have a path max that can be exceeded.
| EXPECT_EQ(preservedDigestBefore, preservedDigestAfter); | ||
| } | ||
|
|
||
| // PullAfterUserEditedTrackedFileDoesNotOverwriteIt |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
third_party/libgit2/lfs.patch:435
- The new
lfs_filter.cbeing introduced by this patch starts with a UTF-8 BOM and the license block lines are prefixed with+/instead of the usual*. The BOM (the invisible character before/*) can break compilation on some toolchains or cause lint/style checks to fail. Please remove the BOM and normalize the comment to a standard C block comment format.
+/*
+/ Copyright 2025 Intel Corporation
+/
+/ Licensed under the Apache License, Version 2.0 (the "License");
+/ you may not use this file except in compliance with the License.
…oolkit/model_server into fix_pull_all_dl_failed
🛠 Summary
CVS-CVS-184757
Libgit2 Lfs-filter.c patch changes:
Ovms Libgit2.cpp Changes:
🧪 Checklist
``