Skip to content

fix(cluster): say Serving only once the pair is loaded, end with a clear outcome, and say why it isn't - #1764

Merged
jonathan308 merged 9 commits into
devfrom
fix/cluster-start-verifies-serving
Nov 4, 2026
Merged

jonathan308 merged 9 commits into
devfrom
fix/cluster-start-verifies-serving

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The universal bug: on every model, darkbloom cluster said a pair was serving and "Done" when nothing was loaded. The Start step loaded the model locally, tested it, then restarted both Macs in coordinator mode (which unloads the model and loads nothing until the coordinator forms the pair) and printed Done without checking. This PR makes the wizard say Serving only when the model is really loaded on both Macs and answered, and say why when it isn't.

The real evidence

  • End user, 2026-11-03 call (Dylan; 2x M3 Ultra and 2x M4 Max on 0.10.7). "It said MiMo was successful but it
    did not actually load anything and then the clustering TUI just ended on both saying it worked." The flow ends with
    "you can hit it again to manage", with no clear "it's running" signal, and "if it fails, it should say why". Team
    notes: show success or failure "VERY clearly"; a disclaimer and progress on step 4.
  • Production telemetry for his M4 pair. Its leader's App Attest re-enrollment was cut 0.7 s into Apple's
    attestation by the setup's own restart. Its key-generation safeguard then refused a new key for an hour. The
    coordinator logged cluster pair not eligible … rank 0 …: liveness:private_text for MiMo, Qwen 3.8 and Gemma
    (23:34:40, 23:43:40, 23:46:59Z) while both screens had said success.
  • The owner's second pair (M3 Ultra + M5 Max, 0.10.7). The wizard printed "✓ Serving Qwen 3.8 27B (tensor
    parallel)… (earning through Darkbloom)", "✓ Test response in 1.14 s", "Registered with the coordinator as a cluster
    member…", "Done." At 23:50:20Z neither Mac ran a darkbloom-cluster-worker. Neither Mac had a Darkbloom login, so
    the coordinator never paired them. The leader's part had ended exit 1 once on a memory_gate_refused from the
    follower.
  • The code defects behind the false success. An offered pair counted as tested (ready.offered != nil),
    register() threw away awaitReady's result, and the menu's Serve through Darkbloom printed the registered line
    as "✓ Serving" (an end user's session 2: he pressed p on the status screen and nothing loaded).

What changes

  • A pair registered with the coordinator is awaited, at most 15 minutes with live progress, until rank 0 reports its
    pair slot published: both ranks loaded and the warm-up request answered.
  • A Mac without a Darkbloom login is named before anything starts, with Log in, Serve locally only, or Cancel.
  • The setup ends with one unmistakable outcome block:
    • ✓ Serving <model> through Darkbloom on both Macs (<split>), with the API and test response under it;
    • ✓ Serving <model> on this Mac's local API only;
    • ✗ Not serving: <reason>. with the next step, then Retry / Change model / Serve locally only / Diagnostics. q
      exits 1 and never says Done.
  • Step 4 opens with "Loading takes a few minutes for a large model; both Macs show progress here." On a color
    terminal it shows one live row per Mac with its elapsed time. There is no bar: no load fraction is reported.
  • A Mac Apple hasn't verified is named with when Darkbloom retries by itself (from its local key-generation
    safeguard, read only) and "Don't restart either Mac until then".
  • The other Mac's window says where to look, and shows the same block from the status. The status line no longer
    calls a registered pair serving.

Linked issue

None filed (end-user call 2026-11-03 and the owner's own pairs).

Test plan

  • Validator fix fa3865e703: a busy pair's serving line is found. pairReport read only the last 16 KiB of
    rank.log for the latest Pair: line, which a part writes only when its state changes. On the production pair's
    real log, the last 16 KiB held about 9 minutes of per-request lines, so a busy, healthy pair would soon read "not
    serving". A new ClusterLogScan.lastLine reads backwards in 64 KiB chunks from the end to the first match,
    bounded at 8 MiB and never before the running part's start offset. The pair line and the local serving notice use
    it; the log format is unchanged. ClusterServiceLogScanTests: red, 4 tests / 7 issues (Pair: serving lost behind
    20 KiB and 1.2 MiB of request lines; the notice behind 300 KiB), then green. 31 tests in 5 suites pass;
    onboarding checks 808/0; docs and changelog gates pass.

  • CI fix 0e7eed36b9 (repo convention test ChildExitWaitConventionTests): OnboardingLive.login() waits for
    darkbloom login with ProcessExitObserver instead of Process.waitUntilExit(), as ClusterLocalNetworkAccess
    already does. Same behaviour, no timeout (the person approves the login in the browser). Sandboxed
    ChildExitWaitConvention|ClusterLeaderFailoverFinishTests|ClusterOnboardingPeerLabelTests: 22 tests in 3 suites
    pass; onboarding checks 808/0; docs and changelog gates pass.

  • provider-swift/Tests/ClusterOnboardingChecks/run.sh:

    • round 1: 30 failures on the old driver, then 765 passed, 0 failed;
    • round 2: 15 failures on the round-1 driver, then 796 passed, 0 failed;
    • round 3 (menu path): 5 failures on the refactor head, then 808 passed, 0 failed.
  • Sandboxed swift test --filter ClusterLeaderFailoverFinishTests (14 passed, incl. the new wire test);
    ClusterApprovalLifetimeTests|ClusterLocalServingTests (10 passed).

  • ClusterPlacementChecks/run-flow.sh (33), ClusterDiagnosticsChecks/run.sh (pass),
    GLMImageAdmissionChecks/run.sh (40), all sandboxed.

  • swift build --target ProviderCore (exit 0).

  • make docs-impact-check BASE=origin/dev, make docs-check, make changelog-check.

  • ClusterConsoleChecks: the runner doesn't build on origin/dev either (ClusterApprovalFallback missing from its
    source list). This PR changes no console source.

  • Real pairs, in progress. The 0.10.8 candidate (this branch merged with the other cluster fixes) is being
    installed on the owner's two pairs (M5 Ultra × M5 Ultra; M3 Ultra + M5 Max). Pass means:

    • an unlogged pair gets the login check;
    • logged in without App Attest gives ✗ with the retry time;
    • a loaded pair gets the ✓ block on the leader and in darkbloom cluster on the member;
    • a forced refusal never says Serving.

    Results will be added here.

Components touched

  • provider-swift (Swift CLI)
  • native runtime / MLX
  • landing (Next.js)
  • enclave (Swift)
  • CI / provider release
  • docs

Protocol / interface changes

  • Mac↔Mac only: ClusterServiceStatus (the pair's link control) gains optional loggedIn, child.pair, child.appAttest and child.appAttestRetryAt. Older builds omit or ignore them, and missing fields read as unknown (committed cross-build test). No coordinator protocol change.

Documentation impact

  • Canonical documentation updated: docs/provider/two-mac-cluster.md (Start step, outcome block, login check, status), docs/provider/troubleshooting.md, docs/architecture/inference.md (how the outcome is decided).

Changelog

  • Added changelog.d/cluster-start-says-serving-only-when-loaded.md and ran make changelog-check.

Notes for reviewers

  • Base of a stack. Two UX PRs follow on top of this one: re-pair / Start over / the member's next step (stacked on this branch), then the after-onboarding clarity work. They touch the same onboarding files in other functions.
  • No coordinator channel for refusal reasons exists today. The coordinator's cluster pair not eligible reason is only a log line, and GET /v1/me/cluster-pairs shows waiting: not_eligible without it. This PR uses each Mac's own signals (login, App Attest authorization and its retry time, memory, the part's progress). Reasons it can't see (for example serves_model or a reservation refusal) show progress until the 15-minute bound. A follow-up could carry the coordinator's reason to the Macs.
  • ClusterConsoleChecks doesn't build on origin/dev either (ClusterApprovalFallback is missing from its source list); this PR changes no console source.

Before And After

Behavior

flowchart TB
  subgraph Before
    B1[Start both Macs] --> B2{waitReady}
    B2 -->|both members registered| B3["✓ Serving … : Registered…"]:::bad
    B3 --> B4["counted as tested"]:::bad --> B5["Done. (texts bundled, command ends)"]:::bad
    B2 -->|local API ready| B6[test] --> B7[register] --> B8["_ = awaitReady"]:::bad --> B5
  end
  subgraph After
    A0{Both Macs logged in?} -->|no| A9["name the Macs: Log in / Serve locally only / Cancel"]:::warn
    A0 -->|yes| AN["'Loading takes a few minutes…' + one live row per Mac"]
    AN --> A1[Start both Macs] --> A2{waitForParts}
    A2 -->|registered| A3{rank 0: pair slot published?}
    A3 -->|yes| A4["── ✓ Serving … through Darkbloom on both Macs ──"]:::good --> A5[Done]:::good
    A3 -->|"no: login / Apple (retries at ~HH:MM) / memory / part ended"| A6["── ✗ Not serving: reason + next step ──"]:::warn
    A2 -->|local API ready| A7[test] --> A8[register once] -->|parts restart| A2
    A7 --> A4
    A6 --> A10["Retry · Change model · Serve locally only · Diagnostics"]:::warn
    A10 -->|q| A11["Not serving yet … exit 1"]:::warn
  end
  classDef bad fill:#fdd,stroke:#c00,color:#000
  classDef good fill:#dfd,stroke:#080,color:#000
  classDef warn fill:#ffd,stroke:#a80,color:#000
Loading

Code flow

flowchart LR
  subgraph Before
    c1[chooseAndServe] --> c2[awaitReady] --> c3[print summary] --> c4["register: _ = awaitReady"] --> c5[Done]
  end
  subgraph After
    d0[checkLogins] --> d1[chooseAndServe] --> d2[finishStart] --> d3[startOutcome]
    d3 --> d4["waitForParts / awaitPairServing<br/>ClusterOnboardingLoadRows → console.workingRows"]
    d4 --> d6[OnboardingLive.pairLook]
    d6 --> d7["ClusterServiceStatus.child.pair / appAttest / appAttestRetryAt / loggedIn"]
    d7 --> d8["rank.log 'Pair:' lines ← ProviderLoop.reportPair<br/>daemon state appAttest.key (read only)"]
    d3 --> d9["register → Bool"]
    d2 --> d10["console.result ✓/✗ block · notServing choices"]
  end
Loading

Refactor Pass

  • The pass: a dedicated refactor pass reviewed the whole branch and produced e3c15773ba
    (overnight/refactor-start-truth.md). It fixed six check runners this branch had broken, gave one source to the
    not-serving words and the status-line contract, and made one live-rows wait and one local-only rule. All 24
    transcripts stayed byte-identical; onboarding went 796 → 799.
  • Its two findings, fixed after it (c8f1892089 behavior, 30187cb405 test), reviewed against its invariants:
    • the menu's switch of scope now ends through the same outcome as the start;
    • the four new status fields have a committed cross-build test.

A dedicated refactor pass reviewed the whole branch. Its result is one signed, behavior-preserving commit,
e3c15773ba, with these changes:

  • Fixed a build break this branch caused: six plain-swiftc check runners compile ClusterOnboardingFlow.swift
    without the new ClusterOnboardingPairServing.swift (control, placement flow, diagnostics, installed session,
    console, GLM image admission). Each now lists the file. ClusterControlChecks went from failing to compile to
    229/0. CI runs only the onboarding runner, so CI did not catch it.
  • One source for the not-serving words: ClusterOnboardingNotServing.statusLine / reason(inStatusLine:)
    (the leader's status and the other Mac's ✗ block), title(reason:), and isMissingLogin (the remedy and the
    wait's 90 s hold).
  • One live-rows wait (waitWithRows) for the parts and the pair, and one local-only rule
    (ClusterOnboardingReady.servesLocallyOnly) for the outcome block and servesWords.
  • Tests:
    • The member's status fixtures come from the producers.
    • Screen budgets are constants with one comment: leader 25 lines and 125 words (shows 25 and 121); member 70 words
      (shows 64).
    • Three assertions were added; none were removed.
  • Docs and changelog: corrected the joined-line quote, "live rows", the hold's wording and the split's position;
    shortened the fragment.
  • Validation:
    • Onboarding checks 799/0, up from 796/0.
    • All 24 transcripts byte-identical.
    • swift build --target ProviderCore OK.
    • make docs-check, make docs-impact-check, make changelog-check OK.
    • ClusterServiceStatus wire compatibility verified with a harness built from the HEAD and origin/dev struct
      sources.
  • Its two follow-ups are fixed in this PR:
    • c8f1892089: the menu's "Serve through Darkbloom" (changeScope) now ends through the same outcome as the start.
      Every other path that prints "Serving", "✓" or "Done" was audited and routed the same way.
    • 30187cb405: a committed cross-build test for the four new status fields.

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

jonathan308 and others added 7 commits November 3, 2026 16:06
On 2026-11-03 the owner's M3 Ultra + M5 Max and an end user's 2x M4 Max
both printed "Serving" and "Done" while nothing was loaded: a pair offered
for pairing counted as tested, and register() discarded awaitReady's result.

The driver now waits for a pair offered for pairing to serve (operation
pairServing: rank 0's pair slot published, both ranks loaded, first request
answered) before it says Serving or Done; a start that does not serve, the
restart after the registration included, says why in one line and stays
open with Retry, Change model, Serve locally only and Diagnostics; q exits 1.
A Mac without a Darkbloom login is named before the Start step starts
anything, with darkbloom login or local-only serving offered.

Onboarding checks (a)-(d) fail first (30 failures on the driver as on
origin/dev) and pass after (765 passed, 0 failed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rank 0's coordinator-paired part writes its pair's progress to its log
(Pair: starting / serving (first request in N s) / stopped (<guidance>)),
from serveCommittedStart and the pair slot's publication and retirement.
Each cluster service publishes the latest line, the member's App Attest
authorization from the coordinator's trust status, and whether the Mac has
a Darkbloom login (ClusterServiceStatus.Child.pair, Child.appAttest,
loggedIn; all optional, nil from an older build).

OnboardingLive.pairServing waits up to 15 minutes for rank 0 to serve; a
missing login ends it at once, App Attest, memory or a stopped start after
90 s. The status line of a registered pair says Serving only while it
serves, else "<model> is not serving yet: <reason>." with what to do.
missingLogins and login back the login check before the Start step.

Docs: two-mac-cluster, troubleshooting, architecture/inference; changelog.

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

From the owner's call with an end user (2x M3 Ultra and 2x M4 Max on 0.10.7):
the setup "just ends", step 4 gave no sense of time, and a failure gave no
reason.

The Start step now opens with "Loading takes a few minutes for a large
model; both Macs show progress here." and, on a color terminal, the waits
draw one live row per Mac with the time since loading began (no bar or
percent: no load fraction is reported). The setup ends with its outcome as a
block between two rules: "✓ Serving <model> through Darkbloom on both Macs
(<split>)" or "✓ Serving <model> on this Mac's local API only", with the API
and test response under it, or "✗ Not serving: <reason>." with the next step
before the choices. The other Mac's window says where to look and shows the
same block from the cluster's status. A Mac Apple has not verified yet is
named with when Darkbloom retries by itself, and to restart neither Mac.

Onboarding checks (e)-(h) fail first (15 failures on the previous driver)
and pass after (796 passed, 0 failed).

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

Each Mac's cluster service now also passes the end of its member's local
App Attest key-generation safeguard (ClusterServiceStatus.Child
.appAttestRetryAt, read only from the daemon state's AppAttestKeyState
.generationBlockedUntil; nil when nothing blocks it or from an older build).
The not-verified reason names that time in local time ("… retries by itself
at about 00:34. Don't restart either Mac until then."), or "within minutes".
An end user's M4 pair was refused this way for an hour after the setup's own
restart cut its leader's attestation (production telemetry, 2026-11-03).

pairLook's progress carries one row per Mac (registering, registered,
loading its share once rank 0's part reports the committed start); the
status line keeps only the wait's first line.

Docs: two-mac-cluster (Start notice, live rows, outcome block, the reason's
time), troubleshooting, architecture/inference; changelog.

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

- The check runners that compile ClusterOnboardingFlow.swift (control,
  placement flow, diagnostics, installed session, console, GLM image
  admission) also compile ClusterOnboardingPairServing.swift: the driver
  uses its types, and those runners stopped compiling at 5a604f8.
- ClusterOnboardingNotServing owns the status line, its read-back on the
  other Mac and the outcome's title (statusLine, reason(inStatusLine:),
  title(reason:)), and isMissingLogin for the remedy and the wait's hold.
- One live-rows wait (waitWithRows) for the parts and for the pair; one
  local-only rule (ClusterOnboardingReady.servesLocallyOnly) for the
  outcome block and servesWords; missingLogins(peer:) shared by pairLook.
- Checks: the member's status fixtures come from the producers; the
  screen budgets are constants with one comment; the status-line
  contract is asserted. Every transcript is byte-identical.
- Docs and changelog: the joined line's quote, live rows, the hold's
  wording, the split's place; a shorter fragment.

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

The refactor pass found the universal false success on the menu path: "Serve
through Darkbloom" (and "Serve locally", and `darkbloom cluster local` on a
serving cluster) waited for the parts, then printed ready.summary. With a
cluster approval saved that is an offered ready, so the screen said "✓ Serving
<model> (<split>): Registered with the coordinator…" for a pair that was only
registered: an end user's session 2 (he pressed p on the status screen; it
said Serving and nothing loaded).

changeScope now ends through finishStart (registers: false), as the start
does: a registered pair is awaited until it serves, a pair on the leader's
API is tested, then the outcome block; otherwise ✗ with the reason and the
choices. The audit of the other paths:
- summary(model:) of an offered ready no longer starts with "Serving";
- the status screen says a Mac serving alone is still loading until its
  solo server answers (as the setup's wait already counted it);
- the menu's Test on a registered pair that doesn't serve names why.
awaitReady and offerDiagnostics had no caller left and are removed.

Onboarding check (i) fails first on the refactor head e3c1577 (5
failures: "✓ Serving …: Registered …", exit 0) and passes after: 808
passed, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Covers Child.pair, Child.appAttest, Child.appAttestRetryAt and loggedIn in
ClusterServiceStatus: a new-to-new round trip keeps all four, a status from
an older build (without them) decodes them as nil, and nil fields are left
out of the JSON, so an older build reads a newer status unchanged.

Ran sandboxed (no-darkbloom.sb, swift test --disable-sandbox --skip-build
--filter ClusterLeaderFailoverFinishTests): 14 tests passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonathan308
jonathan308 requested a review from davidtai November 4, 2026 00:41
@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 2:37am UTC
d-inference-console-ui-dev Error Error Nov 4, 2026 2:37am UTC
d-inference-landing Ready Ready Preview Nov 4, 2026 2:37am UTC
darkbloom-status Ready Ready Preview Nov 4, 2026 2:37am UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 4, 2026 2:37am UTC

Request Review

…ntion)

OnboardingLive.login() waited for `darkbloom login` with
Process.waitUntilExit(), which ChildExitWaitConventionTests refuses (CI run
41748650807, Provider Unit Tests shard 3). It now starts and waits for the
child through ProcessExitObserver, as the interactive sudo child in
ClusterLocalNetworkAccess does: no timeout, as before (the person approves
the login in the browser).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An independent validator found it, and the production pair's own rank.log
confirms it (0.10.7, 457 KB: its last 16 KiB held about nine minutes of
`darkbloom.distributed.request` lines). ClusterService.pairReport read only
the last 16 KiB of rank.log for the latest `Pair: ` line, which a part writes
once per change, so a busy pair that serves lost its `Pair: serving` line
within minutes and read as not serving. The status, the outcome block and
the scripted status read it. The local serving notice, written once per start,
had the same tail.

ClusterLogScan.lastLine reads backwards from the end in 64 KiB chunks, stops
at the first match, never reads before the part's start offset (a line an
earlier part wrote is never this part's; a log shorter than the offset was
replaced and is read from its start) and at most 8 MiB back. pairReport and
servingNotice use it; the service's own notice now reads only the running
part's lines (from its start offset), as the pair line already did. No
change to the log or to what writes it. lastError keeps its tail: the error
is the last thing a part writes before it ends.

ClusterServiceLogScanTests fail first (4 tests, 7 issues: the pair line
behind 20 KiB and 1.2 MiB of requests, the notice behind 300 KiB, the bound
and chunk edges) and pass after; onboarding checks stay 808/0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 added a commit that referenced this pull request Nov 4, 2026
Brings #1764's CI fix (0e7eed3: login() waits with ProcessExitObserver) and its validator fix
(fa3865e: the pair line is found behind any number of request lines) into the stacked re-pair branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 added a commit that referenced this pull request Nov 4, 2026
… pair line behind any number of request lines

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonathan308
jonathan308 merged commit c33bd98 into dev Nov 4, 2026
24 of 26 checks passed
jonathan308 added a commit that referenced this pull request Nov 4, 2026
…ale-pairing

cluster: Macs paired before get Pair again, Start over and plain next steps (stacked on #1764)
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
…-on-a-pair

fix(cluster): on a paired Mac, darkbloom start/stop/restart/status control the pair; plain cluster status --json (stacked on #1764)

This branch had an error being deployed

2 failed and 3 active deployments
Preview – d-inference-landing — fa3865e7 Deployed Nov 4, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — fa3865e7 Deployed Nov 4, 2026 by vercel[bot]
Preview – d-inference — fa3865e7 Deployed Nov 4, 2026 by vercel[bot]
Preview – darkbloom-status — fa3865e7 Deployed Nov 4, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — fa3865e7 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