Repository navigation
Reliability audit fixes + release 0.3.1 - #3
Merged
Merged
Conversation
Alias creation: mkdir() and the stale-alias unlink() ran outside the OSError->RuntimeError conversion, so a PermissionError/FileExistsError escaped _sync_one and aborted the whole sync batch. Wrap both calls so each model reports an error result instead. Artifact order: a manifest that lists the projector before the model made per-artifact partial persistence serialize a projector-only record, whose primary_artifact lookup raised StopIteration and aborted the batch. The adapter now normalizes model layers first, partial persistence never serializes without a model artifact, and primary_artifact raises a clear ValueError if the invariant is ever violated. Bundle co-location: re-pulling one artifact of a vision bundle changed import_user_repo, but the unchanged artifact was still reused from the old digest-keyed directory, splitting the pair across LM Studio directories. Reuse now requires the prior target to live in the current destination directory, so both artifacts are re-imported together and vision confirmation checks the new location. Already-synced policy: a complete import that Ollama can no longer back now reports "skipped" for bundles too, matching text models, instead of a spurious stale error. same_file(): treat st_ino == 0 as unknowable identity. On filesystems without file ids (FAT/exFAT) every file on the volume compared equal, which could silently reuse a stale alias and import old weights.
Read state.json with utf-8-sig so an editor-added BOM no longer makes every record disappear and trigger a mass re-import. Write through a per-process temp file with fsync before the atomic replace, so concurrent writers cannot interleave into one temp file and a crash cannot leave a truncated state file behind.
status() no longer crashes when lms cannot be executed: with a broken CLI, projector bundles read as pending instead of the whole command failing for users with synced vision models. doctor gains two checks: a reversible hard-link probe of a real blob into each staging destination (catching restrictions such as Linux fs.protected_hardlinks that same-volume st_dev checks cannot see), and an lms ls --json inventory check that vision verification depends on. prune now also sweeps .studiolink-imports, where copy-mode temporary aliases live; anything found there survived a crash or cleanup failure and pinned blob space.
_version_tuple concatenated every digit run in a component, so 0.1.0rc1 compared as (0, 1, 11) - newer than any 0.1.x release. Only the leading numeric run counts now, so pre-releases never look newer than their release. The upgrade command pins the exact version it just reported, so the success message cannot describe a different release than the one pip installed.
The audit documents the verified failure modes behind this branch's fixes, including two merge blockers in the bundles branch (projector-first manifests and split vision bundles) found during review.
ensevengg
added a commit
that referenced
this pull request
Nov 16, 2026
PRs #2 and #3 landed on their stacked parent branches instead of main, so this branch was written without them. Merge them in and apply this branch's import guarantees to multi-artifact records: - verify, transactionally replace, recover, copy-reuse and reclaim each artifact; record a file identity per artifact - keep a previous import tracked when a re-pull fails partway; the retry adopts files the failed attempt already verified - keep imports whose Ollama blob was deleted synced only while their recorded identity is unchanged (symlinks and edited files are stale) - sweep every leftover in copy-mode staging, since copy mode removes its aliases after each locked import - apply manifest size checks to projector blobs Validation: 281 passed on Python 3.12 including 27 sandboxed real-lms cases; 254 passed, 27 skipped on 3.13 and 3.14; Ruff, formatting, Pyright and distribution builds pass. 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.
Summary
Third and final PR of the stack (contains #1 and #2). Applies the findings of the branch reliability audit (
docs/research/branch-reliability-audit.md), which identified real bugs in the earlier stack with reproduced probes — each fix below corresponds to an audit finding:primary_artifactraisingStopIterationpreviously aborted the whole batch).import_user_repodirectory, so a changed digest can't leave the model/projector pair split across two LM Studio directories.unlink()and stagingmkdir()failures are translated to per-model error results.statuscrash whenlmsis broken (P2) — inventory failure degrades to "pending" for projector bundles instead of taking the command down.utf-8-sigon load; a BOM previously discarded every sync record as corrupt.same_fileinode-0 guard (P2) — FAT/exFAT report inode 0, which made every same-size file compare "equal" and risked stale-alias reuse.sdl doctor— links an actual blob into both staging dirs, catching restrictions like Linuxfs.protected_hardlinksthat thest_devcheck can't see; adds anlms lsinventory check to doctor..studiolink-imports— copy-mode staging leftovers from crashes no longer pin blob space forever.sdl upgradefixes — pinsstudiolink=={latest}so the success message can't describe a different release than pip installed; version comparison uses leading digits so1rc1no longer parses as 11.Verification
Stack / merge order
stabilize-sync-lifecycle→mainsupport-artifact-bundles→stabilize-sync-lifecyclesupport-artifact-bundlesMerge in order; this PR supersedes the other two if merged last (it contains both).