Skip to content

fix(cluster): count only the disk space free now for a model copy or download - #1766

Merged
jonathan308 merged 4 commits into
devfrom
fix/cluster-disk-check-real-free-space
Nov 4, 2026
Merged

jonathan308 merged 4 commits into
devfrom
fix/cluster-disk-check-real-free-space

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

darkbloom cluster judged free disk by macOS's "important usage" capacity, which counts space macOS could purge (local snapshots, files iCloud keeps elsewhere) as free. On the owner's M3 Ultra that read 256.6 GB with 54.1 GB actually free, so the setup offered MiMo-V2.6-Flash's 172.9 GB download, which could not fit.

Every download or copy now needs the model's size free now on each Mac that receives it, plus the 2 GiB kept free. Purgeable space is said, never counted. A model without room is listed last, ending "not enough free disk", and choosing it explains why.

Linked issue

None filed: found by the pair-2 validation (gap 3), 2026-11-04.

Test plan

  • provider-swift/Tests/ClusterModelProvisioningChecks/run.sh provisioning
    • red on the test commit: 156 passed, 8 failed;
    • green: 164 passed, 0 failed.
  • provider-swift/Tests/ClusterOnboardingChecks/run.sh
    • red: 707 passed, 4 failed;
    • green: 711 passed, 0 failed.
  • swift build --target ProviderCore: complete.
  • make docs-check, make docs-impact-check BASE=origin/dev, make changelog-check, git diff --check.
  • Real Macs, in progress (0.10.8 candidate run on the owner's M3 Ultra + M5 Max). On 11-03 the M3 Ultra read 54.1 GB free against 256.6 GB important-usage. Where free space is short, the list must mark the model "not enough free disk" and refuse it with the purgeable sentence; where it fits, it must download as before. Results will be added here.

Components touched

  • provider-swift (Swift CLI)
  • docs

Protocol / interface changes

  • Yes. Two optional fields, both additive with synthesized Codable:

    • ClusterSetupReport.modelStorePurgeableBytes (the setup report each Mac sends the other);
    • ClusterOnboardingProvisionOffer.fitsOnDisk (the planned list a member may forward).

    Older builds ignore them and read their absence as unknown. modelStoreFreeBytes keeps its name and now carries the space free now. No coordinator or platform change.

Documentation impact

  • Canonical documentation updated:
    • docs/provider/two-mac-cluster.md (new "Free disk" section and the list row);
    • docs/architecture/inference.md (two-Mac cluster stages).

Changelog

  • changelog.d/cluster-disk-check-free-space.md; make changelog-check passes.

Notes for reviewers

  • Where the figures come from. One probe, ClusterModelStore.diskSpace(at:), feeds every disk decision: the download, the copy each way, the receiving Mac's cluster service and the setup wizard's Disk line. The duplicate probe in ClusterSetupLocalReader is gone.
  • Which figure counts. The free figure is volumeAvailableCapacity, else statfs (the fallback is unchanged).
  • Purgeable space (important usage minus free) appears in the message only when it alone would make room.
  • Clones from the product's store take no new blocks and stay unchecked.
  • Not changed: the single-Mac downloader (ModelDownloader.ensureAvailableCapacity) and Autopilot (AutopilotDiskGuard) still use important usage through their own code. That is a follow-up decision.
  • Validated: the plain-swiftc checks and the ProviderCore build. Not validated: a real Mac. No XCTest exercises these paths.

Before And After

Behavior

flowchart TD
  subgraph Before
    B1[darkbloom cluster: Choose a model] --> B2["Disk = important usage<br/>256.6 GB on the M3 Ultra"]
    B2 --> B3["List: MiMo · 172.9 GB · download"]
    B3 --> B4[Download / Cancel offered]
    B4 --> B5[Download starts on 54.1 GB actually free:<br/>fills the disk or fails part way]
  end
  subgraph After
    A1[darkbloom cluster: Choose a model] --> A2["Disk = free now 54.1 GB<br/>+ purgeable 202.5 GB, not counted"]
    A2 --> A3["List: MiMo · 172.9 GB · download · not enough free disk<br/>(after the models that fit)"]
    A3 --> A4["Chosen: Can't start … 54.1 GB free; needs 172.9 GB and 2.1 GB to spare.<br/>macOS could free up to 202.5 GB more …, but Darkbloom doesn't count on it."]
    A4 --> A5[Exit 1, nothing downloaded]
  end
Loading

Code

flowchart LR
  subgraph Before
    P1["ClusterModelStore.freeBytes(at:)<br/>important usage, else statfs"] --> L1[OnboardingLive: download / copy offers]
    P2["ClusterSetupLocalReader.freeBytes<br/>(duplicate)"] --> R1[report.modelStoreFreeBytes] --> L1
    L1 --> PL1["ClusterModelProvisioning.plan<br/>free < bytes + 2 GiB"]
    P1 --> RC1[ClusterModelReceiver.begin]
  end
  subgraph After
    P3["ClusterModelStore.diskSpace(at:)<br/>available capacity, else statfs"] --> D[ClusterDiskSpace<br/>freeBytes · purgeableBytes]
    D --> L2[OnboardingLive offers<br/>+ fitsOnDisk]
    D --> R2[report.modelStoreFreeBytes<br/>+ modelStorePurgeableBytes] --> L2
    L2 --> PL2["plan: holds(bytes, keeping: 2 GiB)<br/>diskShortWords + purgingWouldMakeRoom"]
    D --> RC2[ClusterModelReceiver.begin<br/>same rule and words]
    PL2 --> F[Flow list: last, 'not enough free disk']
  end
Loading

Refactor Pass

A dedicated refactor review (AGENTS.md "Required Refactor Pass") ran after the fix. It made one behavior-preserving commit, e1e8d5e813 refactor(cluster): share the disk rule mid-copy and word the refusal in one place:

  • One disk rule: the receiver's mid-copy check (ClusterModelReceiver.checkFreeDisk) now asks ClusterDiskSpace.holds with half the reserve, as begin and the plan do with the whole reserve. It no longer does its own sum. The figure, threshold and message are the same.
  • One function for the words: ClusterDiskSpace.purgeableNote returned a sentence. It is now the predicate purgingWouldMakeRoom, and ClusterModelProvisioning.diskShortWords holds the whole refusal. The text is byte-identical.

Reviewed and left as is:

  • Where ClusterDiskSpace lives: it stays in ClusterModelProvisioning.swift, beside its probe and the code that uses it. Three plain-swiftc runners list that file by name.
  • The flow and live hunks: kept minimal for the parallel branches.
  • Unchanged: the freeBytes: convenience initializer, the two optional wire fields, the statfs fallback, the list order and marker, and every message.

Rerun after the refactor:

  • provisioning checks: 164 passed, 0 failed;
  • onboarding checks: 711 passed, 0 failed;
  • swift build --target ProviderCore: complete;
  • make docs-check, make docs-impact-check BASE=origin/dev, make changelog-check and git diff --check: pass.

Not run: XCTest (none covers these paths), ClusterConsoleChecks (it fails to build on origin/dev for an unrelated reason) and a real Mac.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

jonathan308 and others added 4 commits November 3, 2026 16:43
The two-Mac setup offered MiMo-V2.6-Flash's 172.9 GB download on the owner's
M3 Ultra with 54.1 GB free: macOS's "important usage" capacity (256.6 GB)
counts purgeable space such as local snapshots as free.

The checks drive the copy-or-download plan, the receiver of a copy over the
cable, the statfs fallback and the real probe with macOS's three figures, and
the setup's model list with a choice that has no room on disk. They need one
seam: `ClusterDiskSpace` (free now, purgeable) from `ClusterModelStore.diskSpace`,
carried by `ClusterModelProvisioningMac.disk`, the receiver's `diskSpace`, the
setup report's `modelStorePurgeableBytes` and the offer's `fitsOnDisk`. The
seam keeps today's rule (important usage first, then statfs), so the checks
fail: provisioning 156 passed, 8 failed; onboarding 707 passed, 4 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…download

The setup offered MiMo-V2.6-Flash's 172.9 GB download on the owner's M3 Ultra
with 54.1 GB free. Its disk check read macOS's "important usage" capacity,
256.6 GB there, which counts what macOS could purge (local snapshots, files
iCloud keeps elsewhere) as free; the M5 Max read 551.4 GB with 161 GB free.

- `ClusterDiskSpace` takes the volume's available capacity (statfs's free
  blocks when that is not read, as before) as the free figure; the rest of the
  important-usage capacity is purgeable, said but never counted.
- The download, the copy to the other Mac, the copy from it and the receiving
  Mac's cluster service all refuse on the space free now plus the 2 GiB kept
  free. When the purgeable space would make room, the refusal says so:
  "this Mac has 54.1 GB free; the model needs 172.9 GB and 2.1 GB to spare.
  macOS could free up to 202.5 GB more (purgeable files such as local
  snapshots), but Darkbloom doesn't count on it."
- The model list puts a model a Mac has no room for after the ones that fit,
  its line ending "not enough free disk" (`ClusterOnboardingProvisionOffer
  .fitsOnDisk`); chosen anyway, it says why and downloads nothing.
- The setup wizard's "Disk" fact and its low-disk warning read the same figure.

Checks: provisioning 164 passed, 0 failed; onboarding 711 passed, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Free disk in the two-Mac guide: what a download or copy needs, what macOS
could purge (not counted), the list's "not enough free disk", the refusal's
words and what to do. The cluster stages explanation names the figures and the
code that reads them. One changelog fragment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in one place

- The receiver's mid-copy check (`checkFreeDisk`) asks `ClusterDiskSpace.holds`
  with half the reserve, as `begin` and the plan ask it with the whole reserve,
  instead of its own `free < remaining + keep`. Same free-now figure, same
  threshold; the sum is now overflow-safe like the others.
- `ClusterDiskSpace.purgeableNote`, which returned a sentence, becomes the
  predicate `purgingWouldMakeRoom`. `ClusterModelProvisioning.diskShortWords`
  now holds the whole refusal, so the disk value type keeps figures and rules
  and the words live in one function.

No message, figure, threshold or wire field changes.
Checks: provisioning 164 passed, 0 failed; onboarding 711 passed, 0 failed;
`swift build --target ProviderCore` complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonathan308
jonathan308 requested a review from davidtai November 4, 2026 00:52
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Error Error Nov 4, 2026 12:54am UTC
d-inference-console-ui-dev Error Error Nov 4, 2026 12:54am UTC
d-inference-landing Ready Ready Preview Nov 4, 2026 12:54am UTC
darkbloom-status Ready Ready Preview Nov 4, 2026 12:54am UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 4, 2026 12:54am UTC

Request Review

@jonathan308
jonathan308 merged commit 9a8f3d2 into dev Nov 4, 2026
24 of 26 checks passed
jonathan308 added a commit that referenced this pull request Nov 4, 2026
Brings #1763, #1765, #1764, #1770, #1772, #1767, #1768, #1769 and #1766 from dev. One conflict, in
docs/provider/two-mac-cluster.md (2 hunks): before "## Undo", #1774's "Stopping and starting again",
then #1770's "Pairing again"; Undo keeps #1770's opening, #1774's --service sentences, the Uninstall
link, and #1772's "## Uninstall" section as written. Resolution verified in a dry run (tree 4737f00).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/provider/two-mac-cluster.md
jonathan308 added a commit that referenced this pull request Nov 4, 2026
This branch and dev share three merge bases (#1770's c066551, #1767's 6a399dc and #1766's
e1e8d5e, each merged into dev separately), so GitHub's single-base check reports conflicts. git's
default merge resolves them through a virtual base with no conflict. Its tree equals the tree the
0.10.8 integration was built, tested and run on real Macs with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch had an error being deployed

2 failed and 3 active deployments
Preview – eigen-homepages-darkbloom — e1e8d5e8 Deployed Nov 4, 2026 by vercel[bot]
Preview – d-inference-landing — e1e8d5e8 Deployed Nov 4, 2026 by vercel[bot]
Preview – darkbloom-status — e1e8d5e8 Deployed Nov 4, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — e1e8d5e8 Deployed Nov 4, 2026 by vercel[bot]
Preview – d-inference — e1e8d5e8 Deployed Nov 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant