Skip to content

fix(cluster): DevNet and production no longer share a pair on one Mac - #1846

Merged
jonathan308 merged 4 commits into
devfrom
fix/devnet-cluster-isolation
Nov 6, 2026
Merged

jonathan308 merged 4 commits into
devfrom
fix/devnet-cluster-isolation

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

On a Mac with both the production app (darkbloom) and the DevNet app (darkbloom-dev), the two shared every piece of cluster and pairing state. 0.10.9 ships this as a known limitation: the DevNet app can read production's pair state, restart production's cluster service, and darkbloom-dev cluster pair --forget can remove production's login job.

With this PR each build keeps its own cluster and pairing state. Production's paths, launchd label shape, lock names and cable ports are byte for byte what they were, and a test pins them. Only these stay shared, on purpose:

  • One GPU. Every build's native session takes one device lock all builds share, so only one app's pair runs on a Mac at a time. A DevNet pair can't start beside a production pair and push it out of memory. A pair that finds the GPU held waits: it is never counted as failing, and it starts by itself within seconds of the GPU freeing. A DevNet build also waits for production serving on that Mac in any version, including 0.10.9/0.10.10 which take no lock, and steps aside if production starts after it.
  • The models and the cable port setup.

Inventory: 10 kinds of state were shared. Compiled as a DevNet build, the original code resolved 12 of 12 checked paths, labels, locks and ports to production's (RED below). The independent review found two more: the GPU and model-copy staging (rows 11 and 12).

# State Before (both apps) After: production (unchanged) After: DevNet
1 Pairing store (pins, edge secrets, gate) ~/.darkbloom/cluster-pairing same ~/.darkbloom-dev/cluster-pairing
2 Setup record; service lock, pid, status, update request; logs; screens ~/.darkbloom/cluster-setup same ~/.darkbloom-dev/cluster-setup
3 Device lease and journal, link records, prefix-cache key, link-fix.sh ~/.darkbloom/cluster-device same ~/.darkbloom-dev/cluster-device
4 Saved cluster setups ~/.config/darkbloom/clusters same ~/.config/darkbloom-dev/clusters
5 Observability: incidents, pair telemetry, follower status, served speed, link/share probes, member profiles, device index ~/.darkbloom/cluster/ same ~/.darkbloom-dev/cluster/
6 Member heartbeat, supervisor state ~/.darkbloom/cluster-member-health.json, cluster-supervisor.json same in ~/.darkbloom-dev
7 Pair SSD prefix cache ~/Library/Caches/darkbloom/cluster-prefix-v1 same ~/Library/Caches/darkbloom-dev/cluster-prefix-v1
8 Cluster service login job, and which jobs cluster, cluster stop --service, pair --forget and uninstall list, replace or remove io.darkbloom.cluster-service.<12 hex>; every build took every such job as its own same label (…f19aa32ccffd for /Users/someone/.darkbloom/Darkbloom.app, pinned) io.darkbloom.cluster-service.dev.<12 hex>; each build touches only its own jobs
9 Per-user locks in the temporary directory darkbloom-cluster-{console,exchange,control}.lock same darkbloom-dev-cluster-…lock
10 Cable ports: link control, pairing, setup exchange, control lease, GLM calibration, native coordinator 47420, 47421, 47422, 47423, 47424, 52420 same 47430–47434, 52430
11 One native session on the GPU at a time by accident: both used production's native-device.lease its own lease, as before, plus the shared ~/Library/Application Support/io.darkbloom.cluster/native-device.lock its own lease plus the same shared lock, plus no start while a production serving process runs
12 Model-copy staging in the shared model store .darkbloom-incoming-<digest>; a copy short of disk reclaimed every one same name; reclaims only its own .darkbloom-incoming-dev-<digest>; reclaims only its own

Shared on purpose:

  • the models and the cluster model store;
  • the cable port setup (one cable, one macOS network setup);
  • the GPU lock (row 11);
  • the sweep of cluster processes whose parent is gone;
  • the range the pair's local API port comes from (8000, or the lowest free port up to 8020).

Before

flowchart LR
  P["darkbloom (production app)"]
  D["darkbloom-dev (DevNet app)"]
  subgraph Shared["One set of cluster state"]
    S1["~/.darkbloom/cluster-pairing, cluster-setup, cluster-device, cluster/"]
    S2["~/.config/darkbloom/clusters"]
    S3["LaunchAgents io.darkbloom.cluster-service.*: each build lists, replaces and removes all"]
    S4["cable ports 47420-47424 and 52420, temp-dir locks, prefix cache"]
  end
  P --> S1 & S2 & S3 & S4
  D --> S1 & S2 & S3 & S4
Loading

After

flowchart LR
  P["darkbloom (production app)"]
  D["darkbloom-dev (DevNet app)"]
  subgraph Prod["Production: unchanged"]
    P1["~/.darkbloom/cluster-*, ~/.config/darkbloom/clusters"]
    P2["io.darkbloom.cluster-service.HASH"]
    P3["ports 47420-47424 and 52420, darkbloom-cluster-*.lock"]
  end
  subgraph Dev["DevNet: its own"]
    D1["~/.darkbloom-dev/cluster-*, ~/.config/darkbloom-dev/clusters"]
    D2["io.darkbloom.cluster-service.dev.HASH"]
    D3["ports 47430-47434 and 52430, darkbloom-dev-cluster-*.lock"]
  end
  G["One GPU lock: ~/Library/Application Support/io.darkbloom.cluster/native-device.lock (one pair per Mac)"]
  M["Shared on purpose: models, cluster model store, cable port setup, orphan sweep"]
  P --> P1 & P2 & P3
  D --> D1 & D2 & D3
  P --> G
  D --> G
  P -.-> M
  D -.-> M
Loading

How

  • Paths. ClusterUserPaths carries the build and derives every cluster folder from BuildEnvironment.installDirectory / configDirectory. Its public init is for the running build only. ClusterPairingStore.default(home:environment:) (ProviderCore) replaces the library's home-only default. The library's observability defaults take an install folder.
  • Identity. Two fields in provider-swift/identity/provider-identity.json: clusterServiceLabelPrefix and clusterPortOffset (0 / 10 / 20).
  • Ports. ClusterCablePorts names every cable port of a build. A source test fails on any provider call that pairs, probes or listens with the library's production defaults.
  • Login jobs. ClusterServiceAgentPlan.isOwnAgent(fileName:program:environment:home:) decides whose a job is. A job of production's shape stays production's, unless its program is in another build's folder (an older DevNet app's job). ClusterServiceAgent.installedLabels/install/uninstall/status take an environment and touch only that build's jobs.
  • One GPU (review fix). ClusterMachineDeviceLock (DarkbloomClusterProcess) is an empty owner-only file in a folder no app or build owns (io.darkbloom.cluster, created 0700), flock only.
    • ClusterDeviceExclusion / ClusterDeviceLease take it after the build's own lease, so a second process of the same build is still refused by its lease, as before.
    • Every provider device scope passes ClusterUserPaths.machineDeviceLock: a pair's owner session (ClusterWorkerOwnerService.serveKeyed), member preparation, native member prepare, and the GLM calibration's three. A source test guards new call sites.
    • The other build's start is refused with a line that names the app holding the Mac, for example The production Darkbloom on this Mac holds this Mac's GPU for its pair (or a model check), and two pairs don't fit one Mac's memory: this pair starts by itself once production's stops. Production serves here: ask its owner before stopping it. A DevNet user or agent is never told to stop production; production blocked by DevNet is told darkbloom-dev cluster stop.
  • Waiting, not failing (re-review fix 1). Every refusal contains holds this Mac's GPU (ClusterMachineDeviceLock.isRefusal).
    • ClusterApprovalCheck.memberQuickEnds never counts such an end, so it can't add up to the 3 quick ends that set the pair aside as .failing (60 minutes on the leader's local API).
    • The cluster service doesn't start its part into a hold: each tick, ClusterMachineDeviceLock.heldByAnotherBuild probes the lock shared (released at once) and checks that this build's own lease is free. While held, the part waits (ClusterOtherAppHold), says so once, and the status's heldBack names the holder, so the leading Mac waits too.
    • On the first tick (1 s) after the hold ends, the part starts, with its backoff, quick ends and any .failing set-aside cleared (blockerCleared). A refused end (the other app won a race) seeds the same wait. This works the same in both directions.
    • A start that coincides with the other build's probe retries for up to 100 ms (ClusterDeviceExclusion.machineLockTries), so a probe never refuses it.
  • Rollout guard (re-review fix 2). Production 0.10.9/0.10.10 takes no lock, so a non-production build also treats production serving as a hold (ClusterMachineDeviceLock.productionServing).
    • It reads only the process table, never a lock or file of production's: an executable inside ~/.darkbloom/ that is darkbloom start … (single-Mac serving or a pair's part), darkbloom cluster link-follower, the worker owner or the native worker (ClusterOrphanReaper.role).
    • The DevNet build's device scope is refused with The production Darkbloom on this Mac holds this Mac's GPU: it is serving (process N) … (ClusterMachineDeviceLock.otherHolder, checked once the lock is held), and its service waits as above.
    • A running DevNet part steps aside when such a process appears, for example production's pair starting after DevNet's at login. It stops, isn't counted, and starts again once production stops serving there.
    • Production builds get no guard (otherHolder is nil): production wins by default, and from 0.10.11 the lock covers it.
  • Model copies (review fix). Staging is named per build (ClusterModelStore.stagingPrefix), and a copy short of disk reclaims only its own build's abandoned staging.
  • cluster link --remove (review fix). When the other app still holds the port in its link record (ClusterLinkRepair.otherInstallsUsingCable, read only), --remove names that app and asks at a terminal, even with --yes. Without a terminal, or with --json, it changes nothing.
  • Uninstall. Each app removes only its own pairing, setup and cluster service, as on a Mac with one app. It keeps the cable port setup while the other app is installed (Plan.cableKeptFor), so it asks for no password.
  • Cable undo records. These are per build. A port the other app set up is adopted with what that app's record says the setup changed (read only, ClusterLinkRepair.otherInstallsIsolationEntries, adoptionEntry), so the app uninstalled last can still undo it all.
  • Everything else follows the build: the locks, the pair prefix-cache root, the supervision files, the placement helper's default probes, the GLM frame-timing switch, and the cluster pair hint.

Migration: what a DevNet user sees once

  • After the update, darkbloom-dev cluster shows the Mac as not paired. Update the DevNet app on both Macs, then run darkbloom-dev cluster on both and pair again. Nothing is copied from production.
  • The DevNet app's old login job (production's label shape, program in ~/.darkbloom-dev) is recognised as DevNet's, and the new DevNet code replaces or removes it. Production never touches it.
  • If the DevNet app was the last to pair in the shared store before this update, production's darkbloom cluster says the Secure Enclave key changed and offers Pair again (the existing flow).
  • Production-only Macs: paths, labels, ports and locks are unchanged. The pair's first start creates the empty GPU lock file, which nothing else holds there. Each tick, the cluster service also checks whether another build holds that lock. The code that reads another build's files acts only when those files exist.
  • Macs that serve production and run DevNet: DevNet's pair waits for production whatever production's version, and steps aside when production starts serving. It is never told to stop production.

Validation

Head 350e24789a on dev 06eefcbcd9, Xcode 27.2, on a Mac that serves production. Builds ran at nice -n 19 with no debug info and no index store, under a watchdog that stops at 15 GiB free and pauses for M5U-QUIET. Every test run used a temporary HOME (CFFIXED_USER_HOME). No darkbloom command was run, and no port 8000 or 47420–47423 was bound.

Red first, for every finding:

Finding Red (before the fix) Green
Crossings (12) Original sources compiled as DevNet: 12/12 resolved to production's DevNet 15/15 own; production 14/14 byte for byte
Guided pairing on 47421 Port source check failed at ClusterOnboardingLive.swift:566 passes
Refactor pass M1: cable undo lost on uninstall ClusterLinkChecks: 1 of 2543 failed 2543/2543, plus a CI test (cableUndoSurvivesTheOtherBuildsUninstall)
Review: two pairs on one GPU ProcessChecks device-exclusion check: "A second build's device scope started beside the first build's" 11/11 groups, plus CI tests: devicesAreLockedAcrossBuilds (both builds' real paths and the refusal text) and everyDeviceScopeTakesTheMachineLock (6 call sites)
Review: one app's copy reclaims the other's ClusterModelProvisioningChecks (a CI runner): 3 of 169 failed 169/169
Review: link --remove with no warning ClusterPairCommandsTests: 4 issues passes
Re-review 1: a refusal counted toward the 60-minute fallback Real service loop (ClusterApprovalServiceStartTests), member refused by a held GPU lock: both refusals in 20 s counted (quick ends 2, the backoff growing), and the part never started. Part beside the other app's real lock: started on the held GPU. Unit: 3 refusals gave a count of 3. 4 refusals, 0 quick ends, approval still offered, started within the test's 5-second bound after the release. Held part: waits, said once, named in heldBack, starts within seconds. Count 0.
Re-review 2: no guard beside production 0.10.9/0.10.10 DevNet took the GPU beside production's real worker process (devnetRefusesBesideAnOlderProductionsWorker). DevNet's lock ignored production's published "pair serves here". A running DevNet part kept running when production started (service loop). ProcessChecks device exclusion: "A device scope started beside a build that takes no lock". Refused, naming production's process. Waits for production's status. The part stops, isn't counted, and restarts within 5 s of production stopping. Device exclusion 12/12 (13/13 with the next row).
Re-review follow-up: the waiting build's probe could refuse the other's start ProcessChecks device exclusion without the retry: refused 13/13, 3 reruns

Swift tests, both flavours (CPU only). The filter is the 32 suites the change reaches, plus the member/native-pair and GLM calibration suites the review fixes touch (39 patterns), plus SoloStepsStickTests and ClusterServicePartStartCacheTests for this round.

  • Production flavour (CI's): 570 tests. All pass except the same two timing tests in ClusterMemberServeLoopTests (2-second negotiation windows), which failed while other builds kept the Mac's load average at 25–31. On its own the suite passed 11/11 on three of five reruns (load 11–31); the other two failed only those timing tests. They take no device scope, and the same two also fail on unchanged dev.
  • DevNet flavour: ClusterInstallIsolationTests passes 17/17, the service-start suite passes with the three new service-loop tests, and so do the agent, uninstall, observability and planner suites. 50 tests fail: the same 50 as on acb63c5e8a.
    • Unchanged dev (06eefcb) built as DevNet, same filter: it fails the same 47 tests asked about, plus the same three others (the onboarding-command text test and the two timing tests), plus one more this PR fixes (diagnosticsReportCarriesTheObservabilitySection). So 51 fail on dev and 50 on the head, and no failure is new on the head.
    • The 47 pin production's names: CLI text darkbloom …, Darkbloom.app in the update fixtures, the darkbloom/kv3 and darkbloom/cluster-prefix-v1 roots. Plain swift test builds as DevNet on this branch (Package.swift defaults to dev); CI builds as production.

Check runners (plain swiftc), on the head:

  • Pass on 350e24789a (the runners that compile this round's files): ClusterInstalledSessionChecks (it caught a closure that wasn't @Sendable before the SwiftPM build did), ClusterPairingChecks, ClusterModelProvisioningChecks, libs ProcessChecks (device exclusion 13/13), RemoteChecks, SSHChecks, LinkWorkerChecks, LinkControlChecks, ObservabilityChecks, and the worker's QualificationChecks (80 tests).
  • Pass on acb63c5e8a: ClusterLinkChecks (2543/2543), SecurityChecks.
  • ClusterConfigurationChecks, ClusterConsoleChecks and ClusterDiagnosticsChecks fail with exactly the errors they already have on dev (see Limitations).
  • Earlier on 081f108031: ClusterOnboardingChecks (a CI runner) 1829/1829, plus Supervision, Pairing, Placement, Control and libs Placement, Observability, Prelude. The review fixes don't change their sources.

Other checks:

Not run: the full provider suite with GPU/MLX lanes (this Mac serves production), and a hardware pair with both apps installed.

Limitations

  • One pair per Mac; production wins.
    • A DevNet build waits whenever production serves on the Mac or says its pair serves there, and steps aside when production starts.
    • Production waits only for a DevNet pair or model check that already holds the lock (a race, or production's intent turning on later). A DevNet pair sees production's intent on its next tick (about a second) and stops. A DevNet model check runs to its end.
    • A production GLM model check run from the console while DevNet holds the lock is refused, not queued.
    • A DevNet build before this change still shares production's lease, as in 0.10.9.
    • The lock file stays after uninstall: an empty file in ~/Library/Application Support/io.darkbloom.cluster.
  • What DevNet reads of production: the process table, and production's published service-status.json, read only and never locked or written. Its fields (serving, pairRunning, servicePID) are the wire format since 0.10.9. A status older than two minutes doesn't count, so for up to two minutes after production's service stopped for good, DevNet still waits.
  • Not under the lock (pre-existing): single-Mac serving (darkbloom start/serve, and the cluster service's own solo part). Production's single-Mac serving holds a DevNet pair back through the process rule, but DevNet's single-Mac serving isn't held back by production's pair. The ClusterWorkerOwnerService.serve/serveConfigured overloads take no machine lock; no provider code calls them.
  • Member preparation holds the lock while it hashes the weights. So a DevNet start on a large model can hold production's pair back for minutes. Production now waits and isn't counted, and the DevNet part steps aside on its next tick once production says its pair serves.
  • The probe: a waiting service takes the lock shared for a few microseconds once a second. A start at that moment retries for up to 100 ms.
  • The cable port setup is one per Mac. cluster link --remove asks before taking a port another app still holds, but at a terminal the person can still say yes. The app uninstalled last undoes the setup fully if it adopted it, which its cluster does when it uses the cable on that Mac. An app that never used the cable there removes only Darkbloom's network service.
  • Machine-wide signals. Checks keyed on any cluster worker (ClusterService.modelLoaded, the update cycle's pairRunsHere) see the other app's worker, so production's pair update can wait while DevNet's pair holds the Mac. This fails safe.
  • Transition. Until a Mac's DevNet app runs this build, the old DevNet build still uses production's folders, which is 0.10.9's limitation. Updating DevNet from that build can ask production's cluster service to restart once, and an older DevNet's ~/.darkbloom/cluster/incidents.dev.json stays.
  • Pre-existing runner failures. The ClusterConfigurationChecks, ClusterConsoleChecks and ClusterDiagnosticsChecks runners already fail on dev: their source lists miss ClusterPublicModels, ClusterApprovalFallback and GLM5NextGPULimitEligibility. They are not in CI.
  • CHANGELOG. CHANGELOG.md's 0.10.9 known limitation is left to release preparation. The fragment changelog.d/cluster-devnet-production-separate-pairs.md says it ends, and describes the review and re-review fixes.

Refactor pass

A separate, read-only reviewer session (opencode run --agent refactor-pass, Claude Opus 5.5) reviewed the first commit. Verdict: production is pinned and unchanged, and each build touches only its own jobs. It raised 1 must-fix and 5 should-fix findings, all addressed in 081f108031:

  • M1: the cable undo records. Fixed by adopting the other app's record, read only, not by sharing production's path.
  • ClusterUserPaths.init() is for the running build only.
  • The cluster pair hint names this build's command.
  • A test that assumed a production test build was fixed.
  • Dead ClusterIncidentLog.files removed.
  • The device lease documented. It is now superseded by the shared GPU lock.

Re-review fixes (350e24789a)

The final re-review found two gaps in the GPU lock. Both are fixed red-first (table above):

  1. A refusal for the GPU is a wait, not a failure. It never counts toward the local-only fallback. The service doesn't start a part into a hold, names the hold in its status, and starts the part on the first tick after the hold ends, with its backoff and any .failing set-aside cleared. This works both ways.
  2. Rollout guard: production wins. A non-production build waits while production serves here, read only: production's serving processes cover 0.10.9/0.10.10, which take no lock, and its published status covers the seconds production's part restarts, for example for its update. A running DevNet part steps aside when production starts. Production builds have no guard.

Also from the review's should-fixes:

  • DevNet is never told to stop production. agent-setup.md now has a STOP item for this.
  • The lock moved out of the Electron app's userData folder.

Review fixes (acb63c5e8a)

The independent review (provisional "changes needed") found three issues, each fixed red-first (table above):

  1. A machine-wide GPU lock shared by all builds. Pairing state stays per build. Production's own paths and labels are unchanged.
  2. Model-copy staging scoped per build. A copy short of disk never reclaims the other app's copy under way.
  3. darkbloom-dev cluster link --remove beside production. It names production and asks, and refuses without a terminal.

Also answered: unchanged dev fails the same 47 DevNet-flavour tests (see Validation).

jonathan308 and others added 2 commits November 5, 2026 18:28
On a Mac with both the production app (darkbloom) and the DevNet app
(darkbloom-dev), both builds used one set of cluster state: the pairing
store, the setup and service folder, the device folder, the saved setups,
the observability files, the supervision files, the pair prefix cache, the
temporary-directory locks and the ports on the cable. Each build also took
every io.darkbloom.cluster-service.* login job for its own. DevNet's status
read production's pair, its update asked production's cluster service to
restart, and `darkbloom-dev cluster pair --forget` or `cluster stop
--service` removed production's login job (0.10.9's known limitation).

Every cluster path now derives from the build's own folders
(BuildEnvironment.installDirectory and configDirectory) through
ClusterUserPaths, which carries the build; the pairing store's default moves
to ProviderCore (ClusterPairingStore.default(home:environment:)), and the
library's observability defaults take an install folder. Two identity
fields name the rest: clusterServiceLabelPrefix (DevNet's login jobs are
io.darkbloom.cluster-service.dev.<12 hex>) and clusterPortOffset (DevNet's
cable ports are production's plus 10, ClusterCablePorts). Locks, the pair
prefix cache root and the placement helper's default probes follow the
build. ClusterServiceAgentPlan.isOwnAgent decides whose a login job is, so
each build lists, replaces and removes only its own; an older DevNet app's
job of production's shape is DevNet's when its program is in
~/.darkbloom-dev, and production never takes it.

Production's paths, label, locks and ports are byte for byte what they
were; a test pins them. DevNet starts unpaired and copies nothing: update
both Macs, then pair again with `darkbloom-dev cluster`. Uninstalling one
app removes only its own pairing, setup and cluster service and keeps the
cable port setup while the other app is installed; the shared-folder
special cases in the uninstall are gone. The models, the cluster model
store, the cable port setup and the orphan sweep stay shared on purpose.

Tests: ClusterInstallIsolationTests (production pinned; every build's
paths, labels, locks and ports disjoint; real pairing ceremonies in
private homes; update requests and service files; screen locks; the
placement helper; a source check that no provider call pairs, probes or
listens on the library's production ports, which caught the guided
pairing still on 47421), the login-job and uninstall crossings both ways.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s build's names

From the independent refactor pass over the DevNet/production isolation:

- M1: the cable port setup stays shared, but each build now keeps its own
  record of how to undo it. Uninstalling the app that set a port up, while
  the other stays, deleted the bridge slot and the services that setup turned
  off, so the remaining app could only partly undo it. A port the other app
  set up is now adopted with what that app's record says the setup changed
  (ClusterLinkRepair.otherInstallsIsolationEntries, adoptionEntry): read from
  the other app's record and never written there. Red first in
  ClusterLinkChecks (1 of 2543 failed without it); ClusterInstallIsolationTests
  covers the read and the uninstall in CI.
- ClusterUserPaths.init() is public only for the running build.
- `cluster pair` names this build's command for the other Mac (DevNet's said
  `darkbloom cluster pair`, which now pairs production on its own port).
- The GLM prefill frame-timing switch is read from the worker's own install
  folder.
- ClusterIncidentLog.files, unused since the uninstall rework, is gone.
- Docs: each app's pair has its own device lease, so two pairs at once share
  the Macs' memory; what is shared on purpose; doc comments that named only
  production's paths.
- Tests that assumed a production test build (a label fixture, a hard-coded
  ~/.darkbloom, an unstamped incident file) now pass in a DevNet test build.

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

vercel Bot commented Nov 6, 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 6, 2026 8:55am UTC
d-inference-console-ui-dev Error Error Nov 6, 2026 8:55am UTC
d-inference-landing Ready Ready Preview Nov 6, 2026 8:55am UTC
darkbloom-status Ready Ready Preview Nov 6, 2026 8:55am UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 6, 2026 8:55am UTC

Request Review

… --remove asks

From the independent review of #1846:

- Two pairs on one Mac: each build kept its own device lease, so a DevNet
  pair could start beside production's and push it out of memory. Every
  build's device scope (a pair's owner session, a member's preparation, a GLM
  calibration) now also takes one lock all builds share,
  ~/Library/Application Support/Darkbloom/cluster-native-device.lock: flock
  only, in no build's folder (ClusterMachineDeviceLock,
  ClusterUserPaths.machineDeviceLock). It is taken after the build's own
  lease, so a second process of the same build is still refused by its lease;
  the other build's start is refused with a line naming the app that holds
  the Mac and its stop command. Production's paths, label, locks and ports
  are unchanged. Red first in ProcessChecks' device exclusion check (a second
  build's scope started beside the first's); ClusterInstallIsolationTests
  covers both builds' real paths and the refusal, and a source check that
  every device scope passes the lock.
- Model copies: a copy short of disk reclaimed every staging folder in the
  store both apps share, the other app's copy under way included. Staging is
  named per build (production's .darkbloom-incoming-<digest> unchanged,
  DevNet's .darkbloom-incoming-dev-<digest>), and a copy reclaims only its own
  build's abandoned staging. Red first in ClusterModelProvisioningChecks (3 of
  169).
- `cluster link --remove` beside the other app that still holds the port in
  its link record (read only) names that app and asks at a terminal, even
  with --yes; without a terminal, or with --json, it changes nothing. Red
  first in ClusterPairCommandsTests (4 issues).
- Docs and the changelog fragment say all three.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The final re-review of #1846 found two gaps in the shared GPU lock:

1. A start refused for the lock counted as a failing part, so after three
   the leader served the pair on its local API for an hour, even once the
   other app had stopped.
   - Every refusal says "holds this Mac's GPU"
     (ClusterMachineDeviceLock.isRefusal), and
     ClusterApprovalCheck.memberQuickEnds never counts it.
   - The cluster service doesn't start its part into a hold
     (heldByAnotherBuild probes the lock shared and checks its own lease).
     The part waits, says so once, and is named in the status's heldBack,
     so the leading Mac waits too.
   - The part starts on the first tick after the hold ends, with its
     backoff, quick ends and any .failing set-aside cleared
     (blockerCleared). A refused end seeds the same wait. This works in
     both directions.
   - A start retries a held lock for up to 100 ms, so the other build's
     probe never refuses it.

2. Production 0.10.9/0.10.10 takes no lock. A build other than production's
   now treats production serving as a hold, read only and never through
   production's locks (ClusterMachineDeviceLock.productionServingHere):
   - a serving process of production's own app (darkbloom start,
     cluster link-follower, worker owner, worker, run from ~/.darkbloom),
     from the process table;
   - or production's cluster service published within two minutes that
     its pair serves here (service-status.json), which also covers the
     seconds production's part restarts for an update.
   Its cluster service also stops a running part when production starts
   serving (both at login). Production builds get no guard: production
   wins by default.

Also from the review:
- A DevNet build is never told to stop production. Production blocked
  by DevNet is told `darkbloom-dev cluster stop`.
- The lock moves out of the desktop app's folder, to
  ~/Library/Application Support/io.darkbloom.cluster/native-device.lock.

Tests, red first:
- ClusterInstallIsolationTests: refusals never count;
  DevNet refuses beside production's worker process; the process and
  status rules.
- ClusterApprovalServiceStartTests, on the real service loop: refused
  starts never count and the lock's release starts the part; a part waits
  while the other app holds the real lock; a part steps aside for
  production.
- ProcessChecks device exclusion: the other holder, and a probe waited
  out.

Docs: agent-setup (STOP: never stop production from DevNet),
two-mac-cluster, troubleshooting, architecture/inference, and the
changelog fragment.

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

This branch had an error being deployed

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