Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 10, 2026, 12:42 AM ET / 04:42 UTC (Revision 13). ClawSweeper reviewWhat this changesMoves Local AI model downloads into the shared Hugging Face cache, adds verified reuse and legacy migration, and retains downloaded weights after later setup failures. Merge readiness⛔ Blocked before merge - 17 items remain Keep open: the merged replacement layers deliberately leave normal cache downloads and active model selection unfinished. The original branch still has compatibility and filesystem-safety defects, while the maintainer explicitly retained this PR as the parent tracking item. Priority: P2 Review scores
Verification
How this fits togetherLocal AI setup acquires pinned model files and records their location in an installation manifest. The Windows runtime reads that manifest to launch llama-server, so cache migration affects both setup recovery and existing installations. flowchart TD
A[Pinned model catalog] --> C[Model acquisition]
B[Existing cache files] --> C
C --> D[Size and digest verification]
D --> E[Shared model cache]
F[Legacy installation] --> G[Manifest migration]
E --> G
G --> H[Local inference runtime]
Decision needed
Why: The merged migration contract deliberately defers activation and downgrade gating; choosing when persisted installations switch requires rollout intent. Before merge
Findings
Agent review detailsSecurityNeeds attention: Shared-cache verification and mutation are not bound to stable file identities; no unrelated supply-chain change was found. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Complete layer 3 using main's verified-handle and migration owners, preserving legacy runtime loading until an explicitly approved, upgrade-tested cache activation succeeds. Do we have a high-confidence way to reproduce the issue? Yes, the branch defects have concrete source paths: load a schema-3 manifest directly, migrate with a corrupt or symlink destination, or resume a hard-linked partial. These were not executed in this read-only review. Is this the best way to solve the issue? No, the original migration and cache-mutation implementation should not be carried forward unchanged; main now provides safer reusable owners and an explicit staged migration contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3ce56b8902d5. LabelsLabel justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
5672c46 to
3426209
Compare
Move LocalAI Inference model downloads from an app-private folder (%LOCALAPPDATA%\OpenClawTray\LocalAI\models\<org>\<repo>\<sha>\<file>) to the standard Hugging Face hub cache layout (models--<org>--<repo>\snapshots\<revision>\<file>, rooted at HF_HUB_CACHE/HF_HOME/the default ~/.cache/huggingface/hub). This lets a model already downloaded by huggingface-cli, llama.cpp's --hf-repo, or another OpenClaw install be recognized and reused instead of re-downloaded, and vice versa. - Add HuggingFaceHubCache (OpenClaw.Shared) to resolve the cache root and compute/validate snapshot paths, with narrower reparse-point checks appropriate for a directory shared with other tools (only the target and its parent, not the whole tree). - Extract the common Windows path-safety primitives (segment safety, device-name rejection, descendant/equality checks) into a new WindowsPathSafety utility in OpenClaw.Shared so LocalAiPathPolicy and HuggingFaceHubCache share one implementation instead of duplicating it. - Wire HuggingFaceModelInstaller, LocalAiInstallReconciler, and LocalAiManifest to the new cache; remove the now-unused LocalAiPathPolicy.TryGetModelPaths/ModelsDirectory. - Bump the install manifest schema to v4: ModelPath is now an absolute path into the hub cache rather than relative to the LocalAI root. Existing installs will reinstall on upgrade. - Side effect: uninstalling/reinstalling OpenClaw no longer deletes the downloaded model, since it never lived under the deleted LocalAI root. - Update affected test fixtures to use an isolated per-test HF_HUB_CACHE (via the existing EnvironmentScope/EnvironmentVariableCollection pattern) and add HuggingFaceHubCacheTests covering cache-root precedence and path validation. Co-Authored-By: Claude Sonnet 5 <[email protected]>
3426209 to
0a1edfd
Compare
Reconciler_MigratesLegacyCudaPrefixedUuidSelector still called the old 3-arg CreateManifest after the schema-v4 switch to absolute hub-cache ModelPaths. Pass the per-test HF_HUB_CACHE cacheRoot and scope the environment so the manifest resolves and the CS7036 build error goes away.
Model acquisition only looked for the pinned revision's snapshot path. Standard hub-cache tools (huggingface_hub, hf CLI, llama.cpp) store content in the content-addressed blobs store or under another revision's snapshot, so identical verified bytes were invisible and OpenClaw re-downloaded multi-GB models. Discovery now enumerates the blob named by the pinned SHA-256 plus same-named snapshot entries across all revisions of the repository. Each candidate must pass the existing snapshot-read validation and the pinned size and SHA-256 check; verified content is hardlinked into the pinned snapshot path so manifests keep their canonical form and rollback removes only the link, never the pre-existing blob. Validation: build.ps1; Shared.Tests 3925 passed; Tray.Tests 2833 passed; SetupEngine.Tests 1037 passed. Real-cache proof: the pinned 35B blob (22,663,387,424 bytes) and sibling-revision snapshot are now discovered.
…able Follow-up fixes from reviewing the hub-cache migration. Source: - Record the hub cache root in the manifest (schema 4) and validate the model path against it. Validity no longer depends on the ambient HF_HUB_CACHE/HF_HOME of whichever process loads the manifest. - Migrate schema-3 manifests in place, relocating the already-downloaded weights into the hub cache. Existing installs previously hit a terminal "run uninstall" and re-downloaded tens of gigabytes of identical bytes. - Mark a reused hard link as created this run so rollback removes the link, and resolve a symlink candidate to its blob before linking so the pinned snapshot never becomes a reparse point. - Create the snapshot directory lazily and remove it when empty, so a failed install leaves no bogus revision in this shared cache. - Unlink a huggingface_hub pointer whose blob fails verification instead of refusing forever and stranding setup on a bad blob. - Hash a resumable partial before sending the request, and report verification progress under its own phase: hashing multi-gigabyte weights was silent and read as a hang. Tests: - Replace five symlink tests that silently returned (and reported as passed) on machines without Developer Mode with a [SymbolicLinkFact] gate that skips, or fails loudly under OPENCLAW_REQUIRE_SYMLINK_TESTS. - Isolate LocalAiPortLifecycleTests from the developer's real Hugging Face cache and serialize its environment mutation with a collection. - Cover reuse end to end: a second install of the same revision performs no HTTP, and a new revision of already-downloaded content is linked rather than downloaded again. Also cover rollback of a reused link, empty-directory cleanup, verification progress, and both schema-3 migration outcomes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Legacy Windows-node context cleanup now checks the registered WSL distributions before querying the prior distro. This makes a rerun idempotent after OpenClawGateway-Dev has already been removed instead of failing the uninstall. Missing-distro diagnostics are also recognized across stdout and stderr.
AcquireLocalAiModelStep.RollbackAsync only ever runs after the model was already downloaded and digest-verified (the step never sets LocalAiModelInstall on its own failure), so it only fires when a later, unrelated step fails (e.g. GPU/inference verification). It was unconditionally deleting the multi-gigabyte verified .gguf in that case, forcing a full re-download on the next setup attempt even though the file was fine. Stop deleting the model on rollback; still clear the context handoff and clean up stray .partial files. The verified file stays in the shared HF hub cache so the next run's reuse-by-digest check in HuggingFaceModelInstaller.InstallAsync picks it back up instead of re-downloading. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
@clawsweeper provided proof, review again. |
|
@clawsweeper edited the description and provided proof |
|
@clawsweeper review again. I provided proof |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper what is missing? |
…wnload # Conflicts: # src/OpenClaw.SetupEngine/WindowsNodeBootstrapContextStep.cs # tests/OpenClaw.SetupEngine.Tests/SetupStepsTests.cs
|
@clawsweeper review again |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Adds validated standard Hugging Face cache paths and handle-bound verified reads as layer 1 of the #1288 replacement train.
Layer 2 of #1288 after #1385: add explicit, handle-bound migration of verified legacy Local AI model weights into the standard Hugging Face cache while preserving the active legacy model path. Layer 3 owns downloads and active selection.`n`nCo-authored-by: Copilot App <[email protected]>`nCopilot-Session: e7ffdfcb-cd94-420d-9f35-b268846a60fc
@larroy, thank you for driving #1288 (feat(local-ai): store downloaded models in the standard HF hub cache). Your PR established the product direction and much of the implementation surface we are now finishing. We split the landing into #1385 (feat(shared): add safe Hugging Face cache primitives), #1388 (feat(local-ai): add verified legacy model cache migration), and a final installer/runtime wiring layer because we wanted to preserve schema-3 installs, keep We do not want the replacement train to erase your contribution. The final layer is still in progress. We would like to coordinate it with you rather than simply closing this PR underneath you. If you would prefer, we can help reshape this branch to the remaining layer-3 delta, or land the final maintainer PR with explicit attribution to this PR and your work. We will not close #1288 until the complete replacement exists and we have made the relationship and credit clear. |
|
Superseded by #1397 (feat(local-ai): safely use the standard Hugging Face hub cache), which preserves and credits Pedro Larroy's original work while completing the compatibility, verified migration, rollback, uninstall, recovery, cross-volume, and cache-ownership safety contracts. Thank you @larroy for the original #1288 (feat(local-ai): store downloaded models in the standard HF hub cache) direction and implementation foundation. |
Completes layer 3 of #1288 with verified standard-cache acquisition, explicit schema rollout, safe runtime identity binding, recovery, rollback, and uninstall behavior. Preserves and credits Pedro Larroy (@larroy) for the original direction and implementation. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 3d314994-f5c9-4f11-8ce3-06e750fb27b3
Summary
Moves LocalAI Inference model downloads from an app-private folder (
%LOCALAPPDATA%\OpenClawTray\LocalAI\models\<org>\<repo>\<sha>\<file>) to the standard Hugging Face hub cache layout (models--<org>--<repo>\snapshots\<revision>\<file>, rooted atHF_HUB_CACHE/HF_HOME/the default~/.cache/huggingface/hub).This lets a model already downloaded by
huggingface-cli, llama.cpp's--hf-repo, or another OpenClaw install be recognized and reused instead of re-downloaded, and vice versa.Changes
HuggingFaceHubCache(OpenClaw.Shared) to resolve the cache root and compute/validate snapshot paths, with narrower reparse-point checks appropriate for a directory shared with other tools (only the target and its parent, not the whole tree — unlike the app-ownedLocalAIroot, which requires the whole tree to be reparse-point-free).WindowsPathSafetyutility inOpenClaw.SharedsoLocalAiPathPolicyandHuggingFaceHubCacheshare one implementation instead of duplicating it.HuggingFaceModelInstaller,LocalAiInstallReconciler, andLocalAiManifestto the new cache; remove the now-unusedLocalAiPathPolicy.TryGetModelPaths/ModelsDirectory.ModelPathis now an absolute path into the hub cache rather than relative to theLocalAIroot. Existing installs will reinstall on upgrade.LocalAIroot.blobs/storage + symlinks (realhuggingface_hubcache semantics). Files are written directly at their snapshot path — matches the visible folder shape other tools recognize, but skips cross-revision dedup. This avoids requiring Windows Developer Mode/admin for symlinks and avoids conflicting with the existing reparse-point-rejection security model.Testing
HuggingFaceHubCacheTestscovering cache-root resolution precedence (HF_HUB_CACHE>HUGGINGFACE_HUB_CACHE>HF_HOME> default) and snapshot/managed-path validation.LocalAiInstallRecoveryTests,LocalAiPortHandoffTests,LocalAiGatewayUninstallTests,LocalAiPortLifecycleTests) to use an isolated per-testHF_HUB_CACHEoverride (existingEnvironmentScope/EnvironmentVariableCollectionpattern) so tests stay hermetic.OpenClaw.Shared.Tests,OpenClaw.Connection.Tests,OpenClaw.Tray.Tests, andOpenClaw.SetupEngine.Testsall pass.Proof
Verified that redoing the install workflow doesn't redownload the model (just verifies it recalculating the checksum)
🤖 Generated with Claude Code