Repository navigation
feat(cli): revision-aware mlx download model — detect upstream updates, sync changed files, --force - #104
Conversation
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01M6DA9gPNjKiV77T7UHGm5P
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01M6DA9gPNjKiV77T7UHGm5P
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01M6DA9gPNjKiV77T7UHGm5P
…s, sync changed files, --force Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01M6DA9gPNjKiV77T7UHGm5P
The completion marker is shared with the dashboard, which lists the repo recursively; the CLI lists non-recursively, so nested marker entries can never appear in the CLI's remote list. Treating that absence as "gone from upstream" deleted live files a CLI sync could never re-download. Nested entries are now never pruned, and buildMarkerFiles keeps nested previous entries on disk-presence alone so a CLI sync does not forget them. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01M6DA9gPNjKiV77T7UHGm5P
- The no-glob up-to-date short-circuit now also requires the local model shape (config + weights): a selection-only marker from a --glob run can no longer satisfy a full run (canShortCircuitFullRun). - Prune + marker write fold into finalizeSync(), invoked only from the three success paths — pruning before verification could destroy the only working copy on an upstream restructure. A verify sync also deletes the stale on-disk marker up front so an interrupted sync cannot masquerade as a complete install to other marker readers. - A marker from a different repo (slug collision on the default output dir) is nulled for prune and the marker union (sameRepoCompletion), with an honest message instead of 'Upstream revision changed'. - A --glob sync at a changed revision keeps the OLD marker revision (markerRevisionToClaim): stamping the new sha would launder unverified union files into a current marker and stop future full syncs. - writeCompletion uses a unique wx-opened temp name, cleaned on failure; prune rm failures warn instead of aborting a finished download. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01M6DA9gPNjKiV77T7UHGm5P
Update three dashboard comments that still said mlx download writes no marker, and note in the CLI docs that --force without --glob on a variant-partial GGUF dir downloads all variants and that the marker makes the directory dashboard-managed. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01M6DA9gPNjKiV77T7UHGm5P
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_b8cd14dc-6f3f-4214-8419-f9865db3500c) |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73874f4414
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_2ee60cf6-f101-4252-b333-6f9a4fa966d0) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09e34f7066
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_041cd57d-9f07-4034-9272-7f0798498218) |
…oad, mlx-node#106 Gemma4 tools/images/restart-cache Merge-forward of mirror/upstream (91f232b) into our patched main. Upstream delta since mlx-node#103: 91f232b feat(cli): revision-aware mlx download model (mlx-node#104) e6598c6 fix(agent): recover Gemma 4 tools, images, and restart cache (mlx-node#106) Conflict resolutions: - packages/agent (3 TS files): kept our genmlx-provider extension + our genmlx-only test, added upstream's mlx-local-image-input extension (order: mlx-provider, genmlx-provider, mlx-local-image-input, ...); took upstream's richer gemma4 FamilyTraits (reasoning + thinkingLevelMap). - crates/mlx-core auto-merged textually but broke the build: mlx-node#106 migrated the VLM image hash u64 -> engine::ImageCacheDigest, while our fork-only vlm_prepare_vision_continuation kept &[u64]. Migrated its signature to &[engine::ImageCacheDigest] (pure pass-through to vlm_prepare_vision_features; sole caller qwen3_5_moe already passes the digest type). Rebuild clean. - nested mlx-sys/mlx gitlink kept ours (b55ff6e6). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Problem
mlx download modelrefused to re-download once the output directory looked complete — the gate was local-only and revision-blind, so an updated HuggingFace repo could only be fetched viarm -rfof the whole checkpoint (all 26 GB of it, for gemma-4-26b-a4b-it).What this does
modelInfo, retried) and pins listing + per-file fetches to it — a push mid-download can no longer mix two revisions..mlx-download-complete.jsonmarker after every successful download — same filename/shape as the dashboard's (contract-tested againstpackages/dashboard/src/models.ts), so the dashboard stops classifying CLI installs as foreign dirs, and the cold-tier fingerprint takes its cheap manifest path on CLI-downloaded checkpoints.--force: per-file content verification (LFS sha256 / git-blob sha1, ported from the dashboard) — catches same-size re-uploads that a size check misses; only changed files are re-fetched. Marker-less dirs downloaded before this PR heal automatically, norm -rf.--forceflag: full re-verify against upstream; unchanged files still skip by hash.Review trail
Built via subagent-driven development (spec + plan committed in
docs/superpowers/specs/). Per-task reviews plus two independent final reviews (whole-branch reviewer + Codex adversarial). Four findings from the final reviews were confirmed against control flow and fixed in38d8cdc7: glob-marker short-circuit regression, prune-before-verify data-loss path, slug-collision prune across repos, and revision-laundering of unverified files in glob syncs — each pinned by a mutation-named test (revert-verified live).Tests
download-marker,download-sync, incl. dashboard contract tests); 62/62 download-suite tests green; full TS suite 2352 passed (5 pre-existingpackages/agentfailures from a stale local native addon, A/B-proven unrelated — they needyarn build:native).--force(proven by sha256 round-trip, not logs) → marker-less heal → glob-then-full run downloads weights instead of short-circuiting.🤖 Generated with Claude Code
https://claude.ai/code/session_01M6DA9gPNjKiV77T7UHGm5P
Note
Medium Risk
Changes model download correctness and can delete files during full sync prune; safeguards (marker-only prune, post-verify, repo mismatch refusal) are heavily tested but the flow is complex and touches large checkpoints.
Overview
mlx download modelis now revision-aware: it resolves the upstream commit, pins listing and fetches to that SHA, and writes.mlx-download-complete.json(same contract as the dashboard) so re-runs can sync instead of requiringrm -rf.Re-runs short-circuit only when the marker matches the current revision, the run is a full (non-glob) install, local shape is complete, and every recorded file exists. Otherwise a sync pass hash-verifies size-matched files (LFS sha256 / git blob sha1), re-downloads only what changed, and on full runs prunes files the old marker listed but the recursive remote tree no longer has—after downloads succeed, with path safety and repo-ownership guards.
--forceskips the up-to-date gate but still skips unchanged files by hash. Glob runs markscope: partial; offline revision resolution keeps the prior local-only behavior with a warning.New CLI modules
download-markeranddownload-synchold marker I/O and pure sync helpers;download-modelwires the flow. The dashboard gainsscopeon markers, treats partial markers as owned but not installed, and documents that current CLI installs are no longer “foreign.” Docs and a design spec describe behavior; extensive CLI contract and mutation-named tests cover edge cases (slug collision, glob short-circuit, prune ordering, revision under-claim on glob sync).Reviewed by Cursor Bugbot for commit 3121ce3. Bugbot is set up for automated code reviews on this repo. Configure here.