Repository navigation
cluster: Both, me first for a pair in darkbloom cluster (local-first L5b-cli) - #1884
Merged
Merged
Conversation
Tests first for the local-first settings section, with a skeleton that compiles but is not wired: [local] is never decoded or validated and the writer changes nothing. - an absent [local] keeps today's mode, port, bind and route; - every key round-trips with the documented spelling; - invalid values are refused with one plain line naming the key; - the [local] edit keeps unknown keys and every other value, is a no-op when the file already says it, and refuses before writing. Red (prod, CPU-only, sandboxed): 11 of 15 core tests and both CLI tests fail (49 issues). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LocalSettings {mode, meFirst, meFirstIdleMinutes, route, port, bind} in
provider.toml's new [local] section:
- Parse: every key optional; ProviderConfig.local is nil while the
section is absent, so other writers never add it.
- Validate: enums, me_first_idle_minutes 1-120, port 1-65535, bind as
`cluster local` takes it. A refusal is one plain line naming the key,
what it takes and what the file has (LocalSettingsError), never a
decoder dump. Integers are narrowed here: TOMLKit traps on its own.
- Defaults when absent: the launch flags decide the mode as today; port is
the build's defaultLocalPort, bind 127.0.0.1, route this-mac (my-macs
once an account key is saved), me first on only for mode both, and the
owner's 2-minute idle before Darkbloom traffic resumes.
- Write: ConfigManager.updateLocal / setLocalSettings edit the raw TOML
table under the config lock, like the cluster pointer and model
selection writers, so unknown keys keep their values. Shaped like
setIdleUnloadMinutes: refuse before writing, no-op when the file holds
the change, pin explicit defaults.
Green (prod, CPU-only, sandboxed): LocalSettingsTests 15/15,
LocalSettingsMutationTests 2/2; config regression suites 128 + 33 pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… per test case
Same behaviour. The public API is unchanged: LocalSettings, its fields and
enums, the resolvers, validate(), LocalSettingsError, ConfigManager.updateLocal
and setLocalSettings.
- ConfigManager.updatingLocal says why the section edit is safe:
- `local` is a section or absent, because parseValidating refused anything
else and the encoder writes one;
- an existing section is edited in place, because TOMLKit hands out the
table's own node;
- a new section always gets a key, because `after` differs from an empty
`before`.
- LocalSettings.CodingKeys drops CaseIterable. Nothing iterates the keys, and
[local] takes unknown keys on purpose. Elsewhere in Config/, CaseIterable
CodingKeys feed key checks (exact fields, retired keys).
- LocalSettingsTests.validateMatchesDecoding calls validate() once per case
and checks the words on the refusal that #expect(throws:) returns. Before,
a second call in a do/catch checked the words only when something was
thrown. A mutant validate() (no port check; bind found unquoted) fails the
test on the same two cases, before and after.
Checks, all CPU only (empty kernel libraries in the test build, no command
buffer submitted), on Xcode 27.2 at nice 19 with ~/.darkbloom* denied:
- LocalSettingsTests 15/15 and LocalSettingsMutationTests 2/2: dev identity
before and after, and prod identity after.
- The PR's config regression filter: prod 128 + 33 pass. Dev 128 + 33, with
the same 3 issues before and after, all in ClusterPrefixCacheSettingsTests,
which hard-codes prod's cache paths. They are pre-existing, and CI tests
prod only.
- docs-check, docs-impact-check --base origin/dev and changelog check pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…L5a) Eleven CPU-only tests, each failing today: - the leader member's local API serves its pair slot (today a member refuses any local API at `prepareClusterMemberControl`); - only the slot's host runs one, and only with a key; - "the pair is not serving now" is a 503 (today the member guard's untyped error, a 500); another model is a 404; - a local request waits in a bounded FIFO queue for one of the pair's lanes (today it is handed the bridge at once and refused at submit): 429 when full, 503 past its ceiling, cancelled waiters leave; - nothing slips in during the warmup canary; - retirement while queued is a 503 and the stream in flight ends; - a three-rank roster (today the pair engine requires exactly two peers); - a local request behind a Darkbloom request wakes when it ends; - Darkbloom requests see no extra wait with the local API idle; - stopping drains a local stream and frees the port. The counts the tests read (waiting requests, the owner's use) are stubbed at zero; the next commit implements them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests first for "me first": while the owner uses this Mac through its local API, Darkbloom work pauses and resumes after the owner's idle time. The skeleton compiles but is not wired: the policy never pauses, noteLocalUse does nothing, and only the busy reason `owner` exists. - the policy's edges on a fake clock: idle 1 min at 59.9 s / 60 s, the 2-minute default at 119.9 s / 120 s, no resume while a local request runs, the countdown from the end of the last request; - heartbeat JSON while paused (draining, busy_reason owner) and after resume (idle or serving, no busy fields); - a racing coordinator request gets one capacity/503/draining refusal; load_model and prefetch_model get the drain failures; - a local acquire during the pause succeeds; Darkbloom work accepted before it finishes and is never cancelled; - quotes refuse while paused; desired_models wait, then replay; - an add-on hold outranks the pause and its release keeps it; - event heartbeats only on transitions, and a fresh registration keeps the pause (loopback mock coordinator); - with me first off, nothing pauses and no timer or task exists; - an unknown busy_reason still decodes. A test seam skips the capacity rebuild (it reads MLX's Metal allocator), so these loop tests never open the GPU. Red (prod, CPU-only, sandbox without the GPU): 22 of 26 tests fail (67 issues). The 4 that pass are the me-first-off guard and the busy codec guards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The leader member's unified local endpoint now serves its published pair slot, through the slot's one bridge and its lanes. No process, copy or buffer is added, and a Darkbloom request's path is unchanged. - Only the member that hosts the slot (the serving host role a rank-0 installation gives) may run a local API, and only with a key; every other member keeps refusing one at `prepareClusterMemberControl`. - "The pair is not serving now" (before its slot, while it re-forms, after it retired) answers 503, as `cluster local` does, not the member guard's untyped error (a 500). Another model is a 404. - A local request that finds every lane busy waits in a FIFO queue, bounded as `cluster local`'s (`DARKBLOOM_CLUSTER_QUEUE_WAITING`, 429 when full, 503 past the ceiling). A waiter is parked, never polled: a released local lane, the capacity refresh after each Darkbloom request, admission opening and the slot retiring wake it. A free lane with nobody waiting is taken at once. - Local admission opens only after the warmup canary passed: a request made during it waits, and hears 503 if the slot retires. - `noteClusterPairLocalUse` is the owner-pause hook: the owner's use of the pair begins when a request starts waiting (or takes a lane) and ends once. - The pair engine's identity check accepted exactly two peers; it now takes two or more distinct peers (pairs of two unchanged). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Direct mode gains the leader member's local API (who runs it, its answers, its queue, what it costs); the inference architecture gains its invariants. One changelog fragment. The cluster guide keeps "no local API" for a pair served through Darkbloom: no command starts the leader's API yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests first for the local router, with an unwired skeleton: the router types, the account key store, `darkbloom route key` and the host wiring compile, but the responder passes every request through, the policy returns nothing, the key store and the CLI flow do nothing, and the upstream client throws. - each fallback trigger (this Mac's 404, 429, 503) makes exactly one upstream call with `X-Darkbloom-Route: self`, to the coordinator URL derived from `[coordinator] url`; - 400, 401, an engine failure and anything after the first byte never go upstream; `this-mac` and a missing key never dial out; - the coordinator's 503/409/429/402 bodies and Retry-After come back verbatim; the client's route header and key are dropped; the account key is in no response and no log line; - `my-macs-first` tries `self` before `prefer`; a 402 on the network hop says the network fallback needs a balance; - a `self` hop is skipped when this Mac is the only one of the owner's Macs serving the model; a chat request's `max_completion_tokens` is read as `max_tokens`; `/v1/models` merges with limits and survives an unreachable coordinator; - SSE passes through chunk by chunk; the URLSession client streams, follows no redirect and fails plainly; - a CPU benchmark of this Mac's path with and without the router. Red (prod, CPU-only, sandboxed): 34 tests fail with 213 issues; the 7 that pass are the key-store and flag-parsing checks, the 2 MiB refusal the engine already makes, and the two overhead benchmarks (a pass-through router costs nothing). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The local API (standalone, unified and a pair's) now routes like the iPhone app: this Mac first, then the coordinator with `X-Darkbloom-Route: self` (`[local] route = "my-macs"`), and with "my-macs-first" `self` then `prefer`. `darkbloom route key` keeps the account API key in the Keychain. - This Mac's path stays in process: the body is collected once (the engine collects it anyway) and never parsed by the router, nothing is read from the Keychain, and the engine's response is returned as it is with `X-Darkbloom-Served-By: this-mac`. The upstream client is made by the first request that needs the coordinator. - Only this Mac's 404, 429 or 503 before any byte pass a request on. The original body goes upstream with the account key and the saved route; the client's key and route header never do. 2xx answers stream through chunk by chunk; refusals come back with their status, body and Retry-After, plus `X-Darkbloom-Route-Used`. - `self` comes before `prefer` because `prefer` needs a funded account even when an owned Mac answers. A 402 on the network hop starts with "No balance for the network fallback"; a refused account key is a 502 `account_key_refused`, an unreachable coordinator a 502. - A `self` hop never comes back to this Mac: on a Mac that takes coordinator work and serves the model (or a build of the alias), the router asks the coordinator's `self` view of that model first and skips `self` when no other owned Mac serves it (`this_mac_only`, or straight to `prefer`). - `/v1/models` merges this Mac's models (`this-mac`), the owner's (`my-macs`) and, with my-macs-first, the public list (`darkbloom`), with `context_length` and `max_output_length` from the engine or the catalog. Lists are cached 30 s, the catalog 5 min, failures 10 s. - A chat request's `max_completion_tokens` is read as `max_tokens` on every local API (`LocalChatRequest`). - The account key is never printed, logged, written to a file or put in a response; upstream error bodies are redacted. Green (prod, CPU-only, sandboxed): the 40 router and `route key` tests pass; 174 core and 53 CLI tests across the local API, distributed HTTP, cluster API parity and start suites pass. Overhead on this Mac's path, n=3000, in process: +1.2 us p50 / +5.2 us p99 to the first byte; over loopback: +3.9 us p50, p99 within noise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
While the owner uses this Mac through its local API, the provider takes no Darkbloom work, and takes it again once none of the owner's requests has run for the idle time (2 minutes by default). Nothing enables it yet: the local API's hooks come next (L2). - MeFirstPolicy: a pure state machine on a caller's clock. - ProviderState.ownerPausesPublic, apart from refusingNewWork: the heartbeat says draining with busy_reason owner, quotes refuse, and local admission is untouched. - rejectIfDraining gives a racing dispatch the typed capacity/503/draining refusal; load_model and prefetch_model get the drain failures; Autopilot reports draining. - desired_models wait and are replayed when the pause ends; a drain, switch or hold ending mid-pause leaves them to it. - One busy writer (publishBusy): an add-on hold outranks the pause, and its release hands the busy fields back. - Event heartbeats on entry and resume; a fresh registration carries the owner's busy fields and its first heartbeat repeats draining. - DaemonState.meFirst for status. - API: enableMeFirst(idle:), noteLocalUse(.start/.end), resumeIfOwnerIdle(), meFirstSnapshot. Cost: event-driven. A local request's start and end are O(1) updates; heartbeats only on transitions; one timer, armed when the idle time starts counting and gone when the pause ends; nothing when me first is off. Green (prod, CPU-only, sandbox without the GPU): 26/26, three serial runs and two parallel ones. Regressions: 96 tests in 9 GPU-free selections pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An opt-in end-to-end suite (DARKBLOOM_ROUTER_E2E_BASE and _KEYS) that runs the router, with the stub engine as this Mac and the real URLSession client, against the V0 harness: darkbloom-platform 90ee29fc0d in development mode on 127.0.0.1:<ephemeral>, seeded through its own routes, with the owner's other Mac as a stub provider. Run once on Mac A, 23:17Z, then every harness process was stopped: - /v1/models lists the owner's v0/stub-small-model as my-macs with context 32768 and output 8192 from the catalog (the self view has none); - a chat this Mac doesn't serve goes through `self`, 200 from the owner's other Mac, Served-By darkbloom, Route-Used self; - a consumer without a Mac gets the coordinator's 409 no_linked_machine verbatim; - a zero-balance owner whose Mac is offline, with my-macs-first: `self` refused, `prefer` 402, which starts with "No balance for the network fallback"; - the real GET /v1/models/<id with a slash> self view counts one Mac, so a Mac that takes coordinator work answers this_mac_only, and one that doesn't passes the request on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the periodic capacity refresh off, a local request parked for a lane hears a drain (a stop or an update) only when some other event wakes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`beginServingDrain` wakes them, so each hears the drain's refusal (429) at once instead of at the next capacity refresh. With nobody waiting, and on every single Mac, the call is one count check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1870's head moved 00f5afa -> 2a2987c: a comment on the [local] section edit in ConfigManager.updatingLocal, the internal LocalSettings.CodingKeys without CaseIterable, and one validate() per case in LocalSettingsTests.validateMatchesDecoding. No public name or signature changed and no router file is touched, so the merge is clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… owner pause (L1) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1870's head moved 00f5afa -> 2a2987c: a comment on the [local] section edit in ConfigManager.updatingLocal, the internal LocalSettings.CodingKeys without CaseIterable, and one validate() per case in LocalSettingsTests.validateMatchesDecoding. No public name or signature changed and no owner-pause file is touched, so the merge is clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the independent review of #1870; the public API is unchanged. - Bug: clearing the last key of a file that holds only [local] threw a false "did not serialize" error, because the round-trip guard refused an empty text. An empty table now serializes to an empty file, which loads as defaults. Red first: clearingTheOnlySection failed with that error; it now passes. - Route.myMacsFirst's comment: the coordinator with X-Darkbloom-Route: self first, then prefer, as the router does. - Docs and comments say exactly what the writer keeps: every value, unknown keys included. Like every config writer, it drops comments and re-sorts sections and keys. Other writers drop unknown keys. Tests (prod, CPU-only, sandboxed): LocalSettingsTests 16/16, LocalSettingsMutationTests 2/2, config/idle/beta/model-switch suites 130 + 35 pass; changelog, docs and docs-impact checks pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the model reads Behaviour-preserving cleanup of the local router (L3). No public name, signature, header, owned_by value, status, message or test assertion changes; LocalRouterPolicy.myMacs is the one addition. - LocalRouter.route labels this Mac's answer (X-Darkbloom-Served-By: this-mac) once, then returns it unless it passes the request on; the two label-and-return branches go. passOn's unreachable tail returns this Mac's answer instead of a this_mac_only refusal for "this model". - The coordinator's model reads (the owner's and the public lists, the keyless catalog, one model's self view) build their GET in one place, modelsRequest. /v1/models reads its two lists with two async lets instead of an indexed task group. - LocalRouterPolicy.myMacs joins thisMac and darkbloom, so the three owned_by values of the integration contract are named together. - LocalRouterRequestBody, one two-line function in its own file, moves next to its only caller as LocalRouter.model(in:). - RouteKeyFlow.save switches once on the check, without the dead .refused branch; its unused `cli` property goes. The Keychain store passes its operation name as a string; StandaloneServerConfig sets `router` in declaration order. - Comments state the invariants: the account key leaves its store only as the Authorization header to the configured coordinator (no redirects); this Mac's path collects the body once, within the engine's own ceilings, hands the same buffer down and reads no key; a `self` hop that could only come back to this Mac is not sent, and a count the coordinator can't give fails closed. - Tests: RouterFixture.makeApp(router:engine:localModels:...) builds the endpoint for the fixture and the opt-in E2E suite alike. CPU-only (empty kernel libraries), prod identity, sandboxed, before and after on the merged head: the router and route key suites 35 + 9 pass, the regression suites 175 + 61 pass, with identical test names. The overhead benchmark (n=3000), this Mac's path, first byte: +1.2 us p50 in process and +1.6 us over loopback (before: +1.1 and +1.8), under the asserted 0.5 ms and 1 ms. The opt-in suite against the V0 coordinator on 127.0.0.1:<ephemeral> passes 4 of 4, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests first for wiring the local endpoint into me first (L1's owner pause): a local request that holds a model on this Mac is the owner's use, so it pauses Darkbloom work, and the pause ends two idle minutes after the last one ends. The skeleton compiles but is not wired: LocalSettings.meFirstIdle always answers nil, so me first is never on, and acquireModelForLocal and releaseLocalReservation call no hook. - where me first applies (pure): the local API beside a coordinator, two idle minutes by default and the saved idle time otherwise; never with me_first = false, without the local API, outside mode both, or for --local, which has no coordinator; a provider loop reads [local] from its loaded config; - through the endpoint's real HTTP application, over a slot whose engine the test scripts: a local stream pauses Darkbloom (heartbeat draining / busy_reason owner) however long it runs, and the pause ends two idle minutes after it ends, on a fake clock; the loopback mock coordinator hears one draining and one idle heartbeat; - a request refused before it holds a model (not served here, its load refused, cancelled while its model loads, draining) never pauses; - /v1/models, health, metrics and the tokenizer utilities are not use; - me_first = false: the heartbeat is byte for byte the heartbeat of a loop without the local endpoint (system metrics masked); - exactly one start and one end per request, with a request held throughout as the witness: completed (streamed or not), an engine error mid-stream, refused after it took the model, cancelled mid-stream, and a client reset over a real loopback connection; - nothing per token: 500 tokens stream and the owner's last use stays at the stream's start; the hook costs a few microseconds, writes nothing, and is measured against me first off. The application builder moves out of startLocalEndpoint (makeLocalEndpointApplication), so the tests drive the endpoint's own closures without a fixed port or a discovery file; startLocalEndpoint calls enableMeFirstIfConfigured first. Red (prod, CPU-only, sandbox without the GPU): 9 of 13 tests fail (43 issues). The 4 that pass are guards: me first off, me_first = false, no coordinator, and no local API or another mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests first for one `darkbloom start` screen: only me, the Darkbloom network, or both with me first. The skeleton compiles but decides nothing: the new flags parse, every start serves as its flags said before [local], nothing is asked or saved, and the words are empty. - the question and the route follow-up, rendered exactly, with Both, me first pre-selected; Enter takes it; - each answer (1, 2, 3, Enter) is saved in [local], with a port for a new local API; the follow-up only with an account key saved; - cancelled at the end of input or after three wrong answers, and an answer the start refuses (--schedule, --autopilot with Only me): nothing is saved; the save waits until the start goes ahead; - a non-TTY start without [local] is today's: no question, no Keychain or port probe, nothing saved, the LaunchAgent argv byte for byte, no local listener and no key file; - a saved choice applies with or without a terminal; --choose asks again with the saved answer pre-selected; without a terminal it is refused; - old flags keep their modes: --local, --local-endpoint (now me first, same argv), --local-endpoint --no-me-first (today's shared mode); settings flags are saved, a flag's mode is not; - --local --me-first and the other contradictions are refused at parse; the new flags are single-Mac options on a paired Mac; - a new local API never takes 8000 or 47420-47423 (never even probed), starts from the configured port, keeps this install's own port, and says which port it chose; - the summary, status and local lines for every state; a grep for tok/s, "tokens per second" and a number per second finds nothing. Red (prod, CPU-only, sandbox without the GPU or ~/.darkbloom*): 30 of 33 tests fail (131 issues). The 3 that pass are guards: today's non-TTY start, flags that stay compatible, and no key in any status line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…local-first L4) `darkbloom start` decides how a single Mac serves, in this order: a mode flag for that start (`--local`, `--network`, `--me-first`, `--local-endpoint`); `--choose`, the question again; the saved `[local] mode`; in a terminal, one question, pre-selecting Both, me first. Without a terminal and without a saved choice, a start keeps today's behaviour exactly: the Darkbloom network, no local port, no Keychain look-up, nothing written, the same LaunchAgent argv. - Only the question saves a mode; its route follow-up is asked only with an account key saved. `--no-me-first`, `--me-first-idle` and `--route` are saved settings, as `--idle-timeout` is. Everything is written once the start goes ahead (after the model picker), so a cancelled or refused start saves nothing. - A new local API (the question's, a saved choice without a port, `--me-first`) takes the first free port from `[local] port` or the build's default, never 8000 or 47420-47423, which are never even test-bound; this install's own running API keeps its port. The port is saved and said once. `--local` and `--local-endpoint` keep their old port rule; `--port` is used as given. - The LaunchAgent keeps exactly the arguments `--local-endpoint` has always baked, built from the resolved mode, port and address, so a rolled-back provider reads the same plist. `--local-endpoint` now means Both, me first; `--no-me-first` keeps today's shared mode. - "Only me" from the question serves in the terminal as `--local` does, taking the stop signals itself (it isn't AppKit-hosted). - Contradicting flags are refused at parse with plain words; the new flags are single-Mac options on a paired Mac (`--port`/`--bind` now count when given explicitly). - The summary says how this Mac serves, its address and where your requests go, never the key; status has a `Serving:` line per state (network, me first open or paused with what is finishing, shared, only me) and a requests line with whether a key is saved; `local` adds both and names `start --me-first` beside `start --local`. Overhead: nothing on the serving path. A start reads `[local]` once (no hardware detection); the Keychain only with a local API; port probes only for a new local API. The launchd child adds one config parse. Status asks the Keychain only when a local API runs. Green (prod, CPU-only, sandbox without the GPU or ~/.darkbloom*): the 33 new tests pass; LocalEndpointCommandTests updated for the new hint. Regressions pass: StartCommandOptions (but one), StartLaunchdGuard, UnpairedMacServesNormally, LocalSettingsMutation, RouteKeyCommand, StatusCommand, StatusCommandRun, StartCommand, CLIDispatch, RootCommandOutput, DistributedStartCommand, LocalSettings, LaunchAgent (restart, environment, plist), ClusterPairCommands (102), Schedule, pickers, ServiceDrain, ClusterMemberSupervisor, Autopilot commands. Two tests construct a StandaloneServer, whose init opens MLX's Metal device; in this GPU-denied sandbox they abort (the D2a review saw the same on its base), so they are left to CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New docs/provider/local-first.md, for people using their Mac themselves: the three choices, the question and what it saves, no terminal = no question, me first, where requests go when this Mac can't take them, the local API's port and key, status lines, the --local-endpoint change, pairs. Linked from docs/README.md and direct-mode.md. - cli-reference: the new start flags, "How this Mac serves: one question" (order, saving, port rule, refusals, summary), the paired-Mac options, status's Serving lines and local's new lines. - configuration: [local] is now read by start; who writes which key; the LaunchAgent keeps --local-endpoint's arguments. - changelog.d/local-first-start-screen.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… switch gap documented
Behaviour-preserving. No public name or signature changed:
enableMeFirst(idle:), noteLocalUse(.start/.end), ownerPausesPublic,
meFirstSnapshot, resumeIfOwnerIdle(), MeFirstPolicy,
ProviderBusyReason.owner and the MeFirstSnapshot fields are as they were.
- The add-on hold's release and the owner pause's end repeated the same
guard and replay of the deferred desired_models, in a different order.
Both now call replayDesiredModels(deferred:), beside the deferral in
ProviderLoop+Prefetch, so whichever of a drain, a hold and the pause
ends last replays them. Same conditions, same log lines.
- ProviderLoop+MeFirst states its invariants: the pause cancels nothing;
an add-on hold outranks it; desired_models wait for whichever ends
last; heartbeats only on transitions; at most one timer, and none while
me first is off. reassertOwnerPauseAfterReconnect no longer ends the
pause inside a guard condition.
- The known gap is documented where it bites: a model switch during the
pause waits up to 30 s for an idle or serving heartbeat that the pause
never sends, so switch reports routing readiness unconfirmed; the
selection holds, and the heartbeat that ends the pause reopens routing
(a comment at the wait in resumeAfterModelSwitch; owner-pause.md gains
"Known gaps", with the PR's two other known edges, and invariant 5).
- Tests, none weakened:
- A race in the fake-clock tests: they advanced the clock, then called
resumeIfOwnerIdle() in a second actor turn, and the real resume timer
armed by the last .end could end the pause in between, so the call
returned false. Seen once in 12 parallel runs; a loaded probe lost
7 of 6000 rounds that way, and 0 of 6000 with the fix. The test-only
resumeIfOwnerIdleForTesting(advancing:by:) does both in one actor
turn; ownerGoesIdle and the four other advance-then-resume steps use
it, with the same assertions.
- A new test, the other order of the precedence: a pause that ends
under an add-on hold leaves the busy fields and desired_models to the
hold, whose release replays them. It passes on 373f5ad too, and it
covers the hold's replay without the GPU.
- The unused helper OwnerPauseOutbound.completed(_:) is gone.
Tests (prod, CPU-only, sandbox without the GPU): the L1 selection 26/26
before, 27/27 after (serial, repeated; 20 parallel runs with 4 more
suites, 51/51); each term of the shared replay guard is pinned by a
mutant; 13 regression selections give the same per-test outcomes before
and after. docs-check, docs-impact and changelog-check pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A local request that holds a model on this Mac is the owner's use: with the local API beside Darkbloom (start --local-endpoint), Darkbloom work pauses from the moment one holds a model and resumes once none has run for [local] me_first_idle_minutes (2 by default). - LocalSettings.meFirstIdle(local:localEndpoint:): me first applies only with a coordinator and the local API beside it, in mode both, unless me_first = false. --local has no coordinator, so nothing to pause. - ProviderLoopConfig.meFirstIdle reads [local] from the loaded config; startLocalEndpoint turns me first on (enableMeFirstIfConfigured) before the endpoint can take a request. - acquireModelForLocal calls noteLocalUse(.start) right after it takes the request's reservation; releaseLocalReservation calls noteLocalUse(.end) when it drops one. The request's OneShotRelease drops it once, on completion, error, cancellation or disconnect, so each request starts and ends its use exactly once. A request refused before the reservation never pauses; routes that hold no model (models, health, metrics, tokenizer utilities) are not use. Cost: the hooks are O(1) in the reservation's own actor turn, with no I/O, once per request and never per token. Measured in a debug build: ~150 ns per start/end pair with me first on, ~75 ns off; a local acquire and release p50 3-4 us and p99 4-6 us either way. The first request of a pause carries L1's entry (one daemon-state write): ~0.6-0.75 ms once per pause. Docs: owner-pause (where it applies, what counts as use), direct mode, the CLI reference and the [local] reference; a changelog fragment, and the L0/L1 fragments no longer say that nothing reads or enables it. Green (prod, CPU-only, sandbox without the GPU): the 13 new tests pass in three serial runs and in two parallel runs with 5 neighbouring suites (79/79). L1's 26 owner-pause tests and the GPU-free local API, settings, schedule-window and drain suites pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It brings L4's review fixes (C1: without a terminal, a saved "Only me" with no mode flag is refused in one line before anything stops or starts; N1-N3), L2's final head (ac3f325), L3's review head (853345f, with the `--no-auth` lines of start, status and local) and L4's part of this branch's never-chosen ports (8519484). Three conflicts, both sides kept: - ClusterLocalServing.swift: this branch's memberArguments and the pair API's ports (localAPIPorts, localAPIFreePorts, localAPIPort) beside L4's never-chosen ports, which both sides now spell the same way; - docs/provider/direct-mode.md: L3's my-macs-first wording ("answers prefer's 402 without the self retry"), then this branch's sentence on a pair's API without a cluster approval; - docs/architecture/owner-pause.md: the API table is this branch's (the pair's callers, with L1's reconnect check that both sides have); the invariants are L4's: L1's "the pause isn't saved" as 6 and L2's final wording of "one start and one end per request" as 7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iew nits and focused confirm L3's head moved 853345f -> b79a3c5: - the re-review nits: only a 402 of type insufficient_funds is called "no balance"; any other 402 that stands says "Network fallback refused:" with Darkbloom's reason. A Keychain read never waits on a dialog. Route key's hidden prompt gives the terminal its echo back on ^C and other signals. The count of your Macs serving a model is reused for 5 s; - the focused confirm: the account key is read once and kept in memory until `route key` changes it, and the Keychain switch is touched only around the login-keychain read; - a live test pinning the upstream client's connections per host. Clean. L4 reads the key through LocalRouterAccountKeyStore.load(), whose protocol is unchanged. The router's list deadline (Timing.list) is still 3 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(L4's C1 on the pair path)
A terminal `darkbloom cluster` saves the pair's "Only me" (`cluster local`)
as `[local] mode = "local"`, which a single-Mac start on this Mac reads
too. On a Mac whose pair doesn't run here (the other Mac asleep or gone,
this Mac's part serving alone or waiting), `darkbloom start` without a
terminal (the desktop app's Start, `start --model <id> --config <path>`, or
a script's `start --solo`) takes the serve-alone branch: it records the
solo choice, stops this Mac's leftover part and clears its saved start,
and only then reaches L4's refusal of a saved Only me without a terminal.
Before L4's fix it then became a foreground server that never returned.
ClusterPairControlTests.nonTerminalStartWithThePairsOnlyMeLeavesThePart
runs both starts on a stale pair with the pair's Only me saved: the start
must be refused in L4's one line, with the part never released and no
"saved start is cleared" line. Red: 4 issues, both starts release the part
first ("released", then the refusal).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…c's part is touched (L4's C1 on the pair path) On a Mac whose pair doesn't run here, `darkbloom start` takes the serve-alone branch (Start.PairStart.serveAlone): with `--solo`, with single-Mac options such as the desktop app's `--model`, and from a script. That branch records the solo choice, stops this Mac's leftover part (its waiting rank, or the solo server serving the model alone) and clears its saved start, before resolveServing reads how this Mac serves. With "Only me" saved, which a terminal `darkbloom cluster` saves for the pair as `[local] mode = "local"`, a start without a terminal then stopped there on L4's refusal (before L4, it became a foreground server that never returned) with the pair's part already stopped and its start cleared. run() now makes the mode's refusals (LocalFirstOptions.modeStep: a saved Only me or `--choose` without a terminal) for a paired Mac's single-Mac start before that branch touches anything, in the same one line; resolveServing makes them again where the start goes ahead. Unpaired Macs and every other branch are unchanged: a pair that runs here still starts with its saved start (`cluster local` stays local), and the cluster service's and launchd's own starts never reach this code. Green: ClusterPairControlTests.nonTerminalStartWithThePairsOnlyMeLeavesThePart (red at f99bc06) and the pair command suites (36); DarkbloomCLITests in full, 1,109, with the two Metal-only startup-preload tests skipped. Docs: cli-reference.md (serve alone) and two-mac-cluster.md (Saved); the changelog fragment says it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2f418ae is fa673b9 (merged here in e9ddfc5) plus L3's final head (b79a3c5): the account key read once and kept in memory, the Keychain switch only for login-keychain reads, the 402 wording, and the upstream client's connections per host. No conflicts. Checked against the heads it brings together: - ProviderLoop+LocalEndpoint.swift holds both L2's final owner-use hooks (noteLocalUse at the reservation and at its release, me first enabled before the endpoint takes a request, makeLocalEndpointApplication) and L5a's pair-local path (acquireClusterPairForLocal, the bound port reported to local.json), plus L3's model limits; - docs/provider/direct-mode.md keeps L3's wording and this branch's sentence on a pair's API without a cluster approval. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d no answer saved on the login fallback (#1884 review) From #1884's independent review (§3, N1): - §3: the pair's API (Both, `cluster local`) listens on every network of its Mac, and a single Mac's can with `--bind`. Anyone there with the key can name a model this Mac doesn't serve, get its 404, and have the request passed on with this Mac's account key; with `my-macs-first` that hop is `prefer`, billed. LocalRouterRemoteClientTests drives the local API's whole responder stack on a connection whose TCP peer each test sets: a peer on another machine (192.168.1.20, 10.0.0.7, 100.101.102.103, 2001:db8::20, fe80::1) must get `self` only, never `prefer`, and a model list without the network's models; a loopback peer (127.0.0.1, 127.0.0.2, ::1, ::ffff:127.0.0.1) keeps `prefer`. Red: 3 tests, 12 issues, every other-machine peer takes `prefer` and reads the network list; the loopback cases pass (guards). - N1: "Serve locally only" at the login check after Both saves Only me, which the person never chose. The onboarding check theLoginChecksServeLocallyOnlySavesNoAnswer expects the pair served locally only and no answer saved. Red: 1 of 1,924 checks fails ("saveServingChoice local"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 of 16 tasks
- N1: "Serve locally only" at the login check after Both no longer saves Only me: the scope is set to local only, and the answer is saved only when the start serves the way the person answered (startScope == scope). Red at a124a7f (theLoginChecksServeLocallyOnlySavesNoAnswer). - N2: under the question, the screen says the pair's pause, route and account key are the leading Mac's (its [local] and `darkbloom route key`): the pair's API on rank 0 reads them there. - N3: the other Mac's status line adds that `darkbloom local` on the leading Mac shows the pair's address and key. A relay on that Mac, as `cluster local` has, can follow. - N6: the review's three flows become onboarding checks (Both to the Darkbloom network from the list; q at the list after answering; q at the list's question), and ClusterPairSlotHostTests pins which member hosts the pair's slot (rank 0 of a coordinator-paired setup over the link), which the review's mutant M17 survived. hostsPairSlot keeps its public property, over a static of the saved setup. - N8: an API bound to ::1 alone is shown at http://[::1]:<port>/v1, not 127.0.0.1. Docs (the question and the other Mac's line in two-mac-cluster.md) and the changelog fragment follow. N7 (the status lines' two-Mac wording, which is ClusterPairSummary's) is left as is: no logic counts Macs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
review §3) The pair's API (Both, `cluster local`) listens on every network of its Mac, and a single Mac's can with `--bind`. Anyone there with the key could name a model this Mac doesn't serve, get its 404, and have the request passed on with this Mac's account key; with `my-macs-first` that hop is `prefer`, billed to the owner. The router now decides per connection, from its TCP peer, never from a header: - LocalHTTPClient.isAnotherMachine(peer:): any peer but loopback (127.0.0.0/8, ::1, and an IPv4 loopback peer seen as ::ffff:127.x.y.z by a dual-stack listener) is another machine. A channel without a peer (in process) or a Unix socket is this Mac's. - LocalHTTPConnectionCancellation reads it once, when the connection's first request makes its registry entry, and LocalDisconnectResponder binds the task-local LocalHTTPClient.fromAnotherMachine for that connection's requests only. A request from this Mac binds nothing more. - LocalRouterPolicy.route(_:fromAnotherMachine:) serves `my-macs-first` as `my-macs` for such a client: `self` (free) only, never `prefer`, with the `this_mac_only` check `my-macs` has, and a log line saying why. Its `/v1/models` lists no network model. `this-mac` and `my-macs`, and every program on this Mac, are unchanged. No flag, no setting, nothing per token; L3's names are unchanged. Green: LocalRouterRemoteClientTests (red at a124a7f), driven through the local API's whole responder stack on a connection whose peer each test sets, plus the classifier on its own. Docs: local-first.md ("Requests from other machines never use the paid network; they can use this Mac and your other Macs."), direct-mode.md (how it is decided) and configuration.md (`[local] route`); the changelog fragment says it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
two-mac-cluster.md, Both, me first: - N5: the macOS firewall prompt, as `cluster local`'s section has it; the other Mac passes no port on (no relay, unlike `cluster local`); requests the pair can't take go on as that Mac's `[local] route` says, with its account key, and requests from other machines never use the paid network. - N4: while the pair isn't offered, the leader's fallback API listens on that Mac only (127.0.0.1), on the same port, with that Mac's own key rather than the pair's (`StartCommand+Distributed`: no `--bind` for Both, `LocalEndpoint.loadOrCreateToken`); tools on other machines, or set up with the pair's key, reach the pair again once Darkbloom has it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
marked this pull request as ready for review
November 7, 2026 07:10
19 of 24 tasks
jonathan308
added a commit
that referenced
this pull request
Nov 8, 2026
…nswering" only when asked #1892's review, nits 1-3, with the owner's decision on nit 1: - The desktop app's Start serving (`DesktopBackend.arguments`: `start --model <id> [--local-endpoint] --config <path>`, no terminal) on a paired Mac starts the pair, as a plain `start` does, in every state of the pair. It never serves that Mac alone and never waits for an answer. - `Start.appStartOptions` (`--model`, `--local-endpoint`) without a terminal give `.startPair`. - In a terminal, where a person can add --solo, `start --model` stays refused by name, and so do other single-Mac options such as `--autopilot` anywhere. - The pair serves its own model and its own way. When the app named another model, a start that serves or is loading (exit 0 or 3) ends with one line the app shows: "This Mac serves in a pair: started the pair with <the pair's model>; `darkbloom cluster` changes its model." (`ClusterPairSummary.appStartModelLine`). - `servingAloneLine` says "(the other Mac (…) isn't answering)" only while this Mac's cluster service runs and so asked it, as `restart`'s sentence already does. A started pair's line is said only while that service is down, when nothing asked. - agent-setup: the stale **Serve on this Mac alone** is gone from the row on single-Mac serving that blocks the pair (and its missing full stop). Rule 11 and the start paragraph say what `--model` does now. - Docs: cli-reference (paired start, options table, the serving-alone line), two-mac-cluster, local-first, troubleshooting (the refusal row, and a row for the app's line), agent-setup; the changelog fragment. #1884's pending fragment now says `start --solo` for the saved Only me's refusal. - Two more tests pinned the refusal without a terminal and now run in one: `startWithAModelOnThePair` and `refusalsDrawNoMark`. Green (CPU-only, Xcode 27.2): the red commit's tests, and all of DarkbloomCLITests, 1212 tests in 175 suites (Metal-loading suites skipped). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch had an error being deployed
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
PR L5b-cli of the local-first work for provider 0.10.11. With this PR, a pair gets the same three choices as
darkbloom startgives one Mac: Only me (this pair, local), Darkbloom network, or Both, me first. The leader's local API now actually starts: with Both, me first, the part that runs rank 0 serves the pair's local API beside Darkbloom, and Darkbloom pauses for the whole pair while you use it. That pause is L5a's API with L5b-core's wiring. Nothing here assumes two Macs.Stacked on L4 (#1878) and L5b-core (#1881).
local-first/l5b-cliis a signed, non-force merge of:3e0bdc289f, then its refactor pass71406b1191, its final headfa673b9082(review finding C1, N1–N3, L2's finalac3f325766) and its newest head2f418aee78(with L3's finalb79a3c528f);560bfeec9f, which sits on L1 and L5a, then its final head55c7c11120(L1's review fixes1de0e9f6fb, L5a's final headc7b49d5e01, L5b-core's refactor pass and review nits).The refactor pass of this PR is
8b2a119214ande62517f982; the commits after it only add.The L5b-core merge had two conflicts, both where L2's endpoint meets L5a's:
ProviderLoop+LocalEndpoint.swift: L5a's bound-port report now rides in the closure that L2'smakeLocalEndpointApplicationtakes.owner-pause.md: both sides kept.The final L5b-core merge (
a2aafbaeb5) had one conflict,owner-pause.md, with both sides kept: L1's reconnect check (reassertOwnerPauseAfterReconnect) in the API table, L1's "the pause isn't saved" as invariant 7, and both test paragraphs.The L4 final merge (
e9ddfc54fe) had three conflicts, with both sides kept:ClusterLocalServing.swift: this branch's two hunks (memberArguments, the pair API's ports) beside L4's never-chosen ports, which both sides now spell the same way;direct-mode.md: L3'smy-macs-firstwording, then this branch's sentence on a pair's API without a cluster approval;owner-pause.md: this branch's API table (the pair's callers), with L4's invariants (L2's final wording).ProviderLoop+LocalEndpoint.swiftmerged without a conflict and keeps both L2'snoteLocalUsehooks and L5a's pair-local path. The newest L4 merge (c00667efb7) was clean.Stack: up to date. L0
f7c398b9f2, L11de0e9f6fb, L2ac3f325766, L3b79a3c528f, L42f418aee78, L5ac7b49d5e01, L5b-core55c7c11120.git merge-tree --write-treefinds no conflict when merging the head93705df823intodev(1703f03a5a, and81b4a2c0a6since), when merging it with D2b's head29eae9cec9(and its newer6ec65d54ff), or when merging both intodev.Independent review (
e62517f982). R1, the only required change, is the pair C1 trap below, fixed inc00667efb7(redf99bc06e37, green15c26713e7). The review's §3 recommendation and its nits are new commits on top: reda124a7fb5e, then37337cb63f(N1–N3, N6, N8),b4b96c7f07(§3) and93705df823(docs, N4 and N5).Draft. Do not merge. Nothing merges into
devuntil the owner says so, because adevmerge publishes a DevNet build.What changes
darkbloom clusterfirst setup[local] mode(local/network/both) together with the scope, after the adopt, so q or a cancelled start saves nothingstartwith no TTY)localAPIand reads as the Darkbloom network, byte for bytedarkbloom cluster local[local]; same arguments, part key and portstart --foreground --cluster-member+ --local-endpoint --port <p> --bind <b>, rank 0 only. Every other rank keeps today's arguments. The part key gets:local-api@<b>, so Network ↔ Both restarts only that part and keeps the plancluster local's rule (free on every Mac that says, the last one kept), but never 8000 or 47420–47423, which are never even test-bound: 8001–8020start --cluster-member --local-endpoint--no-auth,--always-onor--supervise). Only the member that hosts the slot (ClusterMemberPreparation.hostsPairSlot) gets the endpoint, with the pair key (cluster_local_token, synced by the serve command, as forcluster local) and the L3 router. Any other member logs one line and runs none. If the key can't be read, Darkbloom keeps serving without the API; it is never opened without a keystatus/cluster statusServes: through Darkbloom, and on its local API with you first. On the rank-0 Mac:Pair: you first — Darkbloom paused since …(L4's own words, "Pair:" for "Serving:"),Local API: http://127.0.0.1:<p>/v1 on this Mac…(never the key), andMembers: the other Mac (…) is part of the pair; it runs no local API. On another Mac: where the API is, andMembers: this Mac is part of the pair; it runs no local APIScope model.
ClusterServingScope.publicServingWithLocalAPI(bind:)is kept in the record (localAPI+localBind), in the serve command, in the forwarded scope request and in the service status. The sync resends a start whoselocalAPIdiffers; nil, from an older build, is not compared.bindstays local only's, so--no-coordinator, the solo server and the relay never see Both.localAPIBindis the new name for "where a local API listens".Bind default is
cluster local's: 0.0.0.0, every network of the rank-0 Mac, with the key always required. There is no relay on the members, because members run no local API.Found and fixed on the way.
ClusterInstallIsolationTests("every place the provider pairs, probes or listens on the cable names this build's port") fails on L4's head, becauseStartLocalFirst.swiftspells 47420–47423. The never-chosen set and its words now come fromClusterCablePorts(production's pair ports, plus this build's own). Under the prod identity the set is unchanged.A pair leader's router (L3 review, nit 4).
start --local --distributedbuilt its router withtakesCoordinatorWork: !noCoordinator, before its registration wait decides how the pair serves. It now takes no coordinator work in every outcome (LocalRouterConfig.pairLeaderOutsideDarkbloom):cluster local, or the fallback when the coordinator can't take the member role): there is no coordinator connection;start --cluster-membercallsinstallPairServing), so it hosts no pair slot and refuses every dispatch (ProviderLoop.consumeClusterMemberEvent). The coordinator lists a member to its owner only through a pair it formed (darkbloom-platform90ee29fc0d,coordinator/registry/pair_routing.go:116,listedForModelLocked).So a
selfrequest never comes back to this leader, and theselfview never counts it. Before, with exactly one other Mac serving the model, the router answered a falsethis_mac_only; now the request goes toselfonce, without reading the view. The "true" side of the review's mapping (Network and Both) is the coordinator-paired member,start --cluster-member: Network runs no local API, and Both's API on rank 0 keepstakesCoordinatorWork: true(clusterMemberLocalEndpoint), now pinned by a test.L4's C1 on the pair path. A terminal
darkbloom clustersaves the pair's Only me as[local] mode = "local", which a single-Mac start on that Mac reads too. On a Mac whose pair doesn't run here,darkbloom startwithout a terminal (the app's Start with--model, a script,--solo) serves this Mac alone (Start.PairStart.serveAlone). That branch recorded the solo choice, stopped this Mac's leftover part (its waiting rank, or the solo server serving the model alone) and cleared its saved start before the mode was read, so it then hit L4's refusal with the pair already stopped. Before L4's fix, it became a foreground server that never returned.run()now makes the mode's refusals (LocalFirstOptions.modeStep) for a paired Mac's single-Mac start before that branch touches anything, in L4's one line. Nothing else hangs or stops on a saved choice:cluster localstays local; at most a 10-minute wait);--foregroundchild never read the saved mode.Requests from other machines never use the paid network (review §3). The pair's API listens on every network of its Mac (Both,
cluster local), and a single Mac's can with--bind. So anyone there with the key could name a model this Mac doesn't serve and have the request passed on with this Mac's account key, billed undermy-macs-first. The router now decides per connection, from its TCP peer and never from a header:127.0.0.0/8,::1, or::ffff:127.x.y.z) getsmy-macs-firstasmy-macs:selfonly (free), neverprefer, and a/v1/modelswithout the network's models;How it works:
LocalHTTPClient.isAnotherMachineis read once per connection (LocalHTTPConnectionCancellation).LocalDisconnectResponderbinds the task-localLocalHTTPClient.fromAnotherMachineonly for such a connection.LocalRouterPolicy.route(_:fromAnotherMachine:)makes the decision. There is no flag and no setting, nothing runs per token, and L3's names are unchanged. It covers single-Mac binds beyond loopback too.The review's nits:
darkbloom localthere shows the address and key. A relay on that Mac, ascluster localhas, can follow later.hostsPairSlottest that kills mutant M17.::1alone is shown athttp://[::1]:<port>/v1.ClusterPairSummary's, and no logic counts Macs.Overhead (criterion 8)
cluster local, and never 8000.statusreads two small files (local.json, the daemon state), and only for a pair set to Both.Test plan
CPU-only throughout:
Xcode 27.2,
nice -n 19,DARKBLOOM_RELEASE_ENVIRONMENT=prod;sandbox-execdenying~/.darkbloom*and the GPU's user clients (Metal sees no device);temp daemon state, local dir and home;
no port 8000 or 47420–47423 bound; no
darkbloomCLI run.Red at
74a5636c31(tests plus a compiling skeleton that keeps today's behaviour):ClusterPairBothMeFirstTests(ProviderCore): 9 of 10 tests fail (37 issues).ClusterPairBothMeFirstCLITests: 8 of 10 fail (26 issues).cluster local's arguments, the refusals, defaults when nothing is saved.Green at
0084782be4, and again at the head25bbb5aca4: all of the above pass, and the onboarding checks give 1,917/1,917. The new tests cover:tok/s, "tokens per second" and a number per second), on the question, the list, the card and every status line, and never a key;[local] modeand nothing else: unknown keys kept, other keys kept, Both preselected, a saved answer preselected with its idle minutes;--local-endpoint;cluster localis unchanged: arguments, part key, request scope, no question;Regressions:
ClusterApproval*,ClusterInstallIsolation,ClusterLeaderFailover,ClusterLocalServing,ClusterOnboarding*,ClusterPairWatch,ClusterPublicServingCheck,ClusterService*,ProviderInstanceHolder,ProviderUninstall,SoloBlockPeer,LocalSettings,MiMoImageOnboardingSelection, and L1's and L2's owner-pause suites.ClusterPairLocalTests: the 5 CPU-capable tests pass, includingtheLeaderServesItsPairOnItsLocalAPI, which checkslocal.json's bound port and pair key (the merge's conflict).ClusterPairMeFirstTests: the 5 CPU-capable tests pass.DarkbloomCLITestsin full: 1,104 tests, of which 1,103 pass. The one failure is L4's known GPU-onlyStartServingGuardTests"startup preload…", which builds aStandaloneServerand needs Metal; it is left to CI, as on L4.[local], my suites), all pass.Router fix, red at
9ddb4f9f54:LocalRouterPairLeaderTestsfails 1 of 2 (6 issues: theselfview is read and the answer isthis_mac_only). Green at the head9a0a57e0f3, after L5b-core's final head:LocalRouter*,route key);ClusterPairBothMeFirst*,ClusterInstallIsolation,ClusterLocalServing,LocalSettings, start, status,DistributedStartCommand, pair commands);ClusterApproval*,ClusterLeaderFailover,ClusterOnboarding*,ClusterService*, owner-pause suites and others);ClusterPairLocalTestsandClusterPairMeFirstTests;Pair C1, red at
f99bc06e37:nonTerminalStartWithThePairsOnlyMeLeavesThePartgives 4 issues, because both starts release the part before the refusal. Green at the headc00667efb7, after L4's newest head:DarkbloomCLITestsin full: 1,112/1,112. The two Metal-only startup-preload tests are skipped: they build aStandaloneServer, and with no Metal device the abort ends the whole process;Review round, red at
a124a7fb5e:LocalRouterRemoteClientTests: 3 tests, 12 issues. Every peer on another machine tookpreferand read the network list; the loopback cases pass, as guards.theLoginChecksServeLocallyOnlySavesNoAnswer: 1 of 1,924 fails.Green at the head
93705df823, CPU only, with a sandbox that also denies binds on 8000 and 47420–47423:DarkbloomCLITestsin full: 1,113/1,113, the two Metal-only startup-preload tests skipped;LocalDrainHTTPneeds Metal and is left to CI);GPU, left to CI: the wire tests of
ClusterPairLocalTestsandClusterPairMeFirstTests, which complete real Darkbloom requests (MLX allocator stats). Their PRs ran them with the GPU visible.python3 scripts/changelog.py check,scripts/docs-check.sh, andscripts/docs-impact-check.py --base 560bfeec9fpass.Full CI.
Pair-2 / DevNet. The member path needs a coordinator-committed start, so it can only be shown on a DevNet build after the owner's go (
SPIKE-S5.md§6).Components touched
Protocol / interface changes
localAPIon the serve command, the forwarded scope request and the status. An older build ignores it and reads the network.start --cluster-membertakes--local-endpoint --port --bind. Thedarkbloom clusterscreen asks the question.[local] modeis written by the cluster screen too.cluster status --jsonis unchanged.Documentation impact
docs/provider/two-mac-cluster.md: the new section "Both, me first: the pair's own API beside Darkbloom", the steps table, the list's line, and the offered mode's "no local API … unless Both".docs/provider/cli-reference.md:cluster,cluster local,--cluster-member, and the status lines.docs/provider/local-first.md: two Macs.docs/provider/direct-mode.md: the leader's API now starts, and a pair's API without a cluster approval never asks theselfview.docs/provider/cli-reference.md(serving alone) andtwo-mac-cluster.md(Saved): a saved Only me without a terminal is refused before the pair's part is touched.docs/provider/local-first.md,direct-mode.md,two-mac-cluster.mdanddocs/reference/configuration.md: requests from other machines never use the paid network.docs/provider/two-mac-cluster.md: the leading Mac's settings under the question, the other Mac's line, and N4/N5.docs/architecture/inference.md: item 8.docs/architecture/owner-pause.md: who turns it on.changelog.d/cluster-pair-both-me-first.md; L5a's and L5b-core's fragments no longer say that no command starts the API.Notes for reviewers
[local] mode, which is also whatdarkbloom start --soloreads there. That matches the single-Mac rule: only a question saves a mode.local_tokenon loopback, as today (S5's item 6), now said in the docs (N4);self/preferrequests don't reach it.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.