diff --git a/.github/actions/provider-ci-build/action.yml b/.github/actions/provider-ci-build/action.yml index c20cae65d7..03d9a2f83a 100644 --- a/.github/actions/provider-ci-build/action.yml +++ b/.github/actions/provider-ci-build/action.yml @@ -2,10 +2,13 @@ name: Provider CI Build description: Build full debug test products with lane-specific caches and source-matched Metal inputs: lane: - description: provider, sdk or cluster; each owns independent build outputs + description: provider or cluster; each owns independent build outputs required: true save-caches: - description: "'true' to save this lane's caches; ci.yml passes true only for pushes to master and dev" + description: "'true' to save this lane's caches; provider-tests.yml passes true only for pushes to master and dev" + default: 'false' + strict-cache: + description: "'true' to restore only an entry of this exact recipe (provider-tests.yml passes true for master)" default: 'false' runs: using: composite @@ -16,7 +19,7 @@ runs: LANE: ${{ inputs.lane }} run: | case "$LANE" in - provider|sdk|cluster) ;; + provider|cluster) ;; *) echo "Unknown provider CI lane: $LANE" >&2; exit 2 ;; esac - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 @@ -51,21 +54,42 @@ runs: path: ~/Library/Caches/org.swift.swiftpm/repositories key: spm-repos-v1-${{ runner.os }}-${{ steps.keys.outputs.home-layout }}-${{ inputs.lane }}-${{ hashFiles('**/Package.resolved', '!**/.build/**') }} restore-keys: spm-repos-v1-${{ runner.os }}-${{ steps.keys.outputs.home-layout }}-${{ inputs.lane }}- + # A Darkbloom host keeps the entries it saved, 10 GiB per repository, so a + # push saves at most one build per lane and UTC day there; every other + # runner keys the build by commit. + - name: Choose the Swift test build's cache key + id: build-key + shell: bash + env: + PREFIX: ${{ steps.keys.outputs.swift-prefix }} + COMMIT_KEY: ${{ steps.keys.outputs.swift-key }} + run: | + case "${RUNNER_NAME:-}" in + darkbloom-*) echo "key=${PREFIX}day-$(date -u +%F)" >> "$GITHUB_OUTPUT" ;; + *) echo "key=$COMMIT_KEY" >> "$GITHUB_OUTPUT" ;; + esac + # Restore tiers: this recipe's newest entry; then any recipe's with the + # same toolchain, dependencies and checkout path; then any entry with the + # same toolchain, checkout path and MLX pins, whose MLX objects stay valid. + # The build steps build once more from nothing if a looser entry fails. + # strict-cache (master) keeps only the first tier. - name: Restore lane-specific Swift test build id: swift-cache uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: | provider-swift/.build - libs/mlx-swift-lm/.build libs/darkbloom-cluster/.build - key: ${{ steps.keys.outputs.swift-key }} - restore-keys: ${{ steps.keys.outputs.swift-prefix }} + key: ${{ steps.build-key.outputs.key }} + restore-keys: | + ${{ steps.keys.outputs.swift-prefix }} + ${{ inputs.strict-cache != 'true' && steps.keys.outputs.swift-loose-prefix || '' }} + ${{ inputs.strict-cache != 'true' && steps.keys.outputs.swift-mlx-prefix || '' }} - name: Revalidate source timestamps and discard cached runtime resources shell: bash run: | python3 scripts/provider-release-cache.py restore-mtimes - for root in provider-swift/.build libs/mlx-swift-lm/.build libs/darkbloom-cluster/.build; do + for root in provider-swift/.build libs/darkbloom-cluster/.build; do [ -d "$root" ] || continue find "$root" -type f -name mlx.metallib -delete find "$root" -mindepth 3 -maxdepth 3 -type d \ @@ -76,28 +100,28 @@ runs: id: provider-build shell: bash working-directory: provider-swift + env: + PROVIDER_CI_MATCHED_KEY: ${{ steps.swift-cache.outputs.cache-matched-key }} + PROVIDER_CI_STRICT_PREFIX: ${{ steps.keys.outputs.swift-prefix }} # Instrumented for the coverage report. Both builds use the same flags, # so neither rebuilds the other. run: | - swift build --build-tests --enable-code-coverage - swift build --product darkbloom-fan-helper --enable-code-coverage - - name: Build all SDK test products against local MLX - if: inputs.lane == 'sdk' - id: sdk-build - shell: bash - working-directory: libs/mlx-swift-lm - run: | - swift package unedit --force mlx-swift >/dev/null 2>&1 || true - swift package edit --path ../mlx-swift mlx-swift - swift build --build-tests + build() { + swift build --build-tests --enable-code-coverage && + swift build --product darkbloom-fan-helper --enable-code-coverage + } + build || { ../scripts/provider-ci-cold-retry.sh && build; } - name: Build all cluster test products if: inputs.lane == 'cluster' id: cluster-build shell: bash working-directory: libs/darkbloom-cluster - run: swift build --build-tests + env: + PROVIDER_CI_MATCHED_KEY: ${{ steps.swift-cache.outputs.cache-matched-key }} + PROVIDER_CI_STRICT_PREFIX: ${{ steps.keys.outputs.swift-prefix }} + run: swift build --build-tests || { ../../scripts/provider-ci-cold-retry.sh && swift build --build-tests; } - name: Record timestamps for successfully built sources - if: ${{ !cancelled() && (steps.provider-build.outcome == 'success' || steps.sdk-build.outcome == 'success' || steps.cluster-build.outcome == 'success') }} + if: ${{ !cancelled() && (steps.provider-build.outcome == 'success' || steps.cluster-build.outcome == 'success') }} id: timestamps shell: bash run: python3 scripts/provider-release-cache.py snapshot-mtimes @@ -109,9 +133,8 @@ runs: with: path: | provider-swift/.build - libs/mlx-swift-lm/.build libs/darkbloom-cluster/.build - key: ${{ steps.keys.outputs.swift-key }} + key: ${{ steps.build-key.outputs.key }} - name: Save SwiftPM repositories if: ${{ !cancelled() && inputs.save-caches == 'true' && steps.timestamps.outcome == 'success' && steps.spm-repos.outputs.cache-hit != 'true' }} uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 @@ -133,7 +156,6 @@ runs: run: | cmake --version case "$LANE" in - sdk) package=libs/mlx-swift-lm ;; cluster) package=libs/darkbloom-cluster ;; *) package=provider-swift ;; esac diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml new file mode 100644 index 0000000000..a5f3cf2018 --- /dev/null +++ b/.github/workflows/ci-dev.yml @@ -0,0 +1,52 @@ +name: CI (dev) + +# Pull requests into any branch but master (dev, and stacked feature +# branches) and pushes to dev run the provider and cluster tests +# (.github/workflows/provider-tests.yml) and nothing else: Release Integrity, +# Docs Lint and the contribution gates run only for master +# (.github/workflows/ci-master.yml, docs-impact.yml). +on: + push: + # Pushes to dev save the caches that pull requests into dev restore. + branches: [dev] + pull_request: + branches-ignore: [master, main] + +permissions: + contents: read + +# Only revisions of the same PR supersede each other; pushes stay independent. +# A push whose tree a pull request run already tested runs no test job +# (provider-plan.yml), so most push runs are a few GitHub-hosted steps. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + plan: + uses: ./.github/workflows/provider-plan.yml + permissions: + contents: read + actions: read + + tests: + name: Tests + needs: plan + if: ${{ !cancelled() }} + uses: ./.github/workflows/provider-tests.yml + permissions: + contents: read + with: + provider: ${{ needs.plan.outputs.provider }} + cluster: ${{ needs.plan.outputs.cluster }} + mimo_audio: ${{ needs.plan.outputs.mimo_audio }} + changed_provider: ${{ needs.plan.outputs.changed_provider }} + changed_cluster: ${{ needs.plan.outputs.changed_cluster }} + changes_result: ${{ needs.plan.outputs.changes_result }} + skip: ${{ needs.plan.outputs.skip }} + tested_run: ${{ needs.plan.outputs.tested_run }} + tree: ${{ needs.plan.outputs.tree }} + base: ${{ needs.plan.outputs.base }} + head: ${{ needs.plan.outputs.head }} + routes: ${{ needs.plan.outputs.routes }} + strict_cache: false diff --git a/.github/workflows/ci-master.yml b/.github/workflows/ci-master.yml new file mode 100644 index 0000000000..9f99a499e5 --- /dev/null +++ b/.github/workflows/ci-master.yml @@ -0,0 +1,235 @@ +name: CI (master) + +# Pull requests into master and pushes to master run the provider and +# cluster tests (.github/workflows/provider-tests.yml), Release Integrity and +# Docs Lint. Pull requests into dev run only the tests (ci-dev.yml). +on: + push: + # Pushes to master save the caches that pull requests into master restore. + branches: [master, main] + pull_request: + branches: [master, main] + +permissions: + contents: read + +env: + # Only pushes to master save the .git caches of the jobs below. A pull + # request restores its base branch's entries and saves none + # (docs/developer/build.md#ci-caching). + SAVE_CACHES: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + # Every checkout but Docs Lint's skips the evidence tarballs and landing media + # (408 MB of the tree), which only Docs Lint reads. The rest of the evidence + # stays: provider-ci-cache.py hashes every tracked Package.swift. + CHECKOUT_SPARSE: | + /* + !/docs/reports/evidence/**/*.gz + !/landing/public/media/ + +# Only revisions of the same PR supersede each other; pushes stay independent. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + plan: + uses: ./.github/workflows/provider-plan.yml + permissions: + contents: read + actions: read + with: + linux_lanes: | + release-integrity linux_arm64 blacksmith-4vcpu-ubuntu-2404 + docs linux_arm64 blacksmith-4vcpu-ubuntu-2404 + + tests: + name: Tests + needs: plan + if: ${{ !cancelled() }} + uses: ./.github/workflows/provider-tests.yml + permissions: + contents: read + with: + provider: ${{ needs.plan.outputs.provider }} + cluster: ${{ needs.plan.outputs.cluster }} + mimo_audio: ${{ needs.plan.outputs.mimo_audio }} + changed_provider: ${{ needs.plan.outputs.changed_provider }} + changed_cluster: ${{ needs.plan.outputs.changed_cluster }} + changes_result: ${{ needs.plan.outputs.changes_result }} + skip: ${{ needs.plan.outputs.skip }} + tested_run: ${{ needs.plan.outputs.tested_run }} + tree: ${{ needs.plan.outputs.tree }} + base: ${{ needs.plan.outputs.base }} + head: ${{ needs.plan.outputs.head }} + routes: ${{ needs.plan.outputs.routes }} + strict_cache: true + + release-integrity: + name: Release Integrity + # A top-level job, so its check is named exactly Release Integrity, the + # name master's ruleset requires. It reads its lane of the run's one route + # request (provider-plan.yml). + needs: plan + if: ${{ !cancelled() }} + runs-on: ${{ fromJSON(needs.plan.outputs.routes)['release-integrity'] }} + timeout-minutes: 30 + steps: + # Every checkout in this workflow uses the same five steps: restore the + # newest .git a push saved, discard it unless git fsck accepts it, check + # out, and save .git once a day per branch (docs/developer/build.md#ci-caching). + - name: Select today's .git cache + id: git-day + run: | + day=$(date -u +%F) + echo "day=$day" >> "$GITHUB_OUTPUT" + echo "month=${day%-*}" >> "$GITHUB_OUTPUT" + echo "actions/cache compressor: $(command -v zstd >/dev/null && echo zstd || echo gzip)" + - name: Restore the newest saved .git + id: git-cache + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: .git + key: git-v1-${{ runner.os }}-${{ steps.git-day.outputs.day }} + restore-keys: | + git-v1-${{ runner.os }}-${{ steps.git-day.outputs.month }}- + git-v1-${{ runner.os }}- + - name: Discard a damaged cached .git + run: | + if [ -d .git ] && ! { git rev-parse --verify -q HEAD >/dev/null && + git fsck --connectivity-only --no-progress >/dev/null 2>&1; }; then + echo "::warning title=.git cache::git fsck rejected the restored .git; checking out without it." + rm -rf .git + fi + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false # Keeps the job token out of the saved .git/config. + sparse-checkout: ${{ env.CHECKOUT_SPARSE }} + sparse-checkout-cone-mode: false + - name: Save .git for later runs + if: env.SAVE_CACHES == 'true' && steps.git-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: .git + key: ${{ steps.git-cache.outputs.cache-primary-key }} + # A plain build of master must be prod and a plain build of dev must be + # dev. The target is the pull request's base branch, or the pushed branch. + - name: Check the provider's plain-build default for the target branch + env: + TARGET_BRANCH: ${{ github.base_ref || github.ref_name }} + run: | + python3 scripts/test-provider-build-default.py + python3 scripts/provider-build-default.py --branch "$TARGET_BRANCH" + - name: Validate changelog fragments + run: | + python3 scripts/test-changelog.py + make changelog-check + - name: Check provider release and installer integrity + run: | + ./scripts/check-release-version.sh + python3 scripts/test-provider-release-resolution.py + python3 scripts/test-provider-release-resume.py + python3 scripts/test-provider-release-toolchain.py + python3 scripts/test-provider-release-cache.py + python3 scripts/test-prepare-metal-toolchain.py + python3 scripts/test-provider-release-pipeline.py + python3 scripts/test-provider-release-publication.py + python3 scripts/test-provider-release-notes.py + python3 scripts/test-provider-cluster-runtime-models.py + python3 scripts/test-release-dev-branch.py + python3 scripts/test-provider-release-artifact.py + python3 scripts/test-provider-signing-validation.py + python3 scripts/test-provider-identity.py + python3 scripts/test-provider-test-watchdog.py + python3 scripts/test-stage-test-metallib.py + python3 scripts/test-provider-ci-cache.py + python3 scripts/test-provider-ci-workflow.py + python3 scripts/test-provider-test-shards.py + python3 scripts/test-cluster-test-plan.py + python3 scripts/test-ci-component-paths.py + python3 scripts/test-darkbloom-route.py + python3 scripts/test-ci-tested-tree.py + python3 scripts/test-prepare-prompt-fixtures.py + python3 provider-swift/Tests/test_protocol_fixture_resources.py + python3 scripts/test-app-attest-entitlements.py + ./scripts/test-setup-macos-homebrew.sh + # SDK 27.2 back-deploys Date's >= and <=; pre-release macOS 27.2 builds + # lack the symbols. The release build also checks the built binaries. + - name: Refuse back-deployed Date comparisons in provider source + run: | + python3 scripts/test-check-date-comparisons.py + python3 scripts/test-check-provider-weak-imports.py + python3 scripts/check-date-comparisons.py + - name: Test advisory threat review with local HTTP fixtures + run: | + python3 .github/scripts/test-threat-model-review.py + python3 .github/scripts/test-threat-full-scan.py + python3 .github/scripts/test-threat-ensemble.py + python3 .github/scripts/test-threat-budget.py + python3 .github/scripts/test-threat-bedrock.py + python3 .github/scripts/test-threat-diagnostics.py + python3 .github/scripts/test-threat-integration-scope.py + - name: Test native GPU CI routing without a GPU + run: python3 scripts/test-native-gpu-ci.py + - name: Test model registry workflow with loopback HTTP + run: python3 scripts/test_model_registry_workflow.py + - name: Test bounded MiMo provider fixture provisioning offline + run: python3 scripts/test-prepare-mimo-provider-fixtures.py + - name: Test serving qualification evidence and catalogs without a GPU + run: python3 -m unittest discover -s scripts/serving_performance -t scripts -p 'test_*.py' + - name: Test actual-call and bounded timing receipts without a GPU + run: | + python3 -m unittest discover -s scripts/benchmarks -p test_radix_forward_shapes.py + python3 reports/runtime-kv-path-2026-10-09/qualification/test_curate_runs.py + python3 reports/runtime-kv-path-2026-10-09/qualification/test_run_suite.py + + docs: + name: Docs Lint + needs: plan + if: ${{ !cancelled() }} + runs-on: ${{ fromJSON(needs.plan.outputs.routes)['docs'] }} + # Full-history checkouts of this repository have taken up to 21 minutes. + timeout-minutes: 45 + steps: + - name: Select today's .git cache + id: git-day + run: | + day=$(date -u +%F) + echo "day=$day" >> "$GITHUB_OUTPUT" + echo "month=${day%-*}" >> "$GITHUB_OUTPUT" + echo "actions/cache compressor: $(command -v zstd >/dev/null && echo zstd || echo gzip)" + # Full history: a separate key family, so shallow jobs never restore it. + - name: Restore the newest saved .git + id: git-cache + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: .git + key: git-full-v1-${{ runner.os }}-${{ steps.git-day.outputs.day }} + restore-keys: | + git-full-v1-${{ runner.os }}-${{ steps.git-day.outputs.month }}- + git-full-v1-${{ runner.os }}- + - name: Discard a damaged cached .git + run: | + if [ -d .git ] && ! { git rev-parse --verify -q HEAD >/dev/null && + git fsck --connectivity-only --no-progress >/dev/null 2>&1; }; then + echo "::warning title=.git cache::git fsck rejected the restored .git; checking out without it." + rm -rf .git + fi + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 # Frozen source links require committed document provenance. + filter: blob:none # Old file contents are fetched only when read. + persist-credentials: false + - name: Save .git for later runs + if: env.SAVE_CACHES == 'true' && steps.git-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: .git + key: ${{ steps.git-cache.outputs.cache-primary-key }} + - name: Initialize pinned SDK documentation + run: git submodule update --init --depth 1 libs/mlx-swift-lm + - name: Test historical source-link validation + run: python3 scripts/test-docs-check-historical-links.py + - name: Test date-only freshness stamping + run: python3 scripts/test-docs-stamp.py + - name: Check freshness stamps, links, cited paths, orphans + run: ./scripts/docs-check.sh diff --git a/.github/workflows/component-changes.yml b/.github/workflows/component-changes.yml index e7a348e93f..fdb08b9745 100644 --- a/.github/workflows/component-changes.yml +++ b/.github/workflows/component-changes.yml @@ -5,8 +5,6 @@ on: outputs: provider: value: ${{ jobs.changes.outputs.provider }} - sdk: - value: ${{ jobs.changes.outputs.sdk }} cluster: value: ${{ jobs.changes.outputs.cluster }} mimo_audio: @@ -23,7 +21,6 @@ jobs: runs-on: ubuntu-24.04 outputs: provider: ${{ steps.paths.outputs.provider }} - sdk: ${{ steps.paths.outputs.sdk }} cluster: ${{ steps.paths.outputs.cluster }} mimo_audio: ${{ steps.paths.outputs.mimo_audio }} steps: diff --git a/.github/workflows/darkbloom-route.yml b/.github/workflows/darkbloom-route.yml index 4528c2c718..07aee13139 100644 --- a/.github/workflows/darkbloom-route.yml +++ b/.github/workflows/darkbloom-route.yml @@ -4,6 +4,9 @@ name: Darkbloom Route # plane grants one, otherwise the lane's fallback label. Callers run each job on # `fromJSON(needs.route.outputs.routes)['']`. Routing is off unless the # DARKBLOOM_ROUTING variable is exactly `on`; the plane can never fail this job. +# DARKBLOOM_MACOS_LANES, when set, caps the macOS jobs one run asks for: lanes +# are kept in the caller's order while they fit, and the others keep their +# fallback without asking. on: workflow_call: inputs: @@ -36,6 +39,7 @@ jobs: env: LANES: ${{ inputs.lanes }} ROUTING: ${{ vars.DARKBLOOM_ROUTING }} + MACOS_LANES: ${{ vars.DARKBLOOM_MACOS_LANES }} PLANE_URL: ${{ vars.DARKBLOOM_SANDBOX_URL }} REPOSITORY: ${{ github.repository }} EVENT_NAME: ${{ github.event_name }} @@ -75,7 +79,24 @@ jobs: --argjson count "$count" '. + [{$lane, $profile, $fallback, $count}]' <<<"$configured") done <<<"${LANES:-}" [ "$configured" != '[]' ] || configuration_error "no lanes are configured" - requested=$(jq -c '[.[] | select(.count > 0) | {lane, profile, count}]' <<<"$configured") + + # The macOS cap is a repository setting, not caller configuration: a + # value other than 0 to 99 asks for no macOS lane rather than failing. + macos_cap=${MACOS_LANES:-} + cap_note="" + if [ -n "$macos_cap" ] && ! [[ $macos_cap =~ ^(0|[1-9][0-9]?)$ ]]; then + cap_note=" DARKBLOOM_MACOS_LANES is not a number from 0 to 99, so no macOS lane was requested." + macos_cap=0 + fi + configured=$(jq -c --arg cap "$macos_cap" ' + reduce .[] as $entry ({used: 0, lanes: []}; + if $cap != "" and $entry.profile == "macos_arm64" and $entry.count > 0 + and .used + $entry.count > ($cap | tonumber) + then .lanes += [$entry + {capped: true}] + else .used += (if $entry.profile == "macos_arm64" then $entry.count else 0 end) + | .lanes += [$entry + {capped: false}] + end) | .lanes' <<<"$configured") + requested=$(jq -c '[.[] | select(.count > 0 and (.capped | not)) | {lane, profile, count}]' <<<"$configured") plane_url=${PLANE_URL:-https://api-sandbox.darkbloom.dev} body=$(mktemp) @@ -138,6 +159,7 @@ jobs: | ($plane_decisions[.lane] | if type == "object" then . else {} end) as $decision | if .count == 0 then .target = "fallback" | .reason = "not requested" elif $fallback_reason != "" then .target = "fallback" | .reason = $fallback_reason + elif .capped then .target = "fallback" | .reason = "over the macOS lane cap (DARKBLOOM_MACOS_LANES)" elif $decision.target == "darkbloom" and $decision.runs_on == $profiles[.profile] then .target = "darkbloom" | .reason = "granted" elif $decision.target == "fallback" @@ -148,6 +170,7 @@ jobs: routes=$(jq -c 'map({key: .lane, value: .runs_on}) | from_entries' <<<"$decisions") echo "routes=$routes" >> "$GITHUB_OUTPUT" + note="$note$cap_note" echo "$note" jq -r '.[] | "\(.lane): \(.runs_on | if type == "array" then join(",") else . end) (\(.reason))"' <<<"$decisions" { diff --git a/.github/workflows/docs-impact.yml b/.github/workflows/docs-impact.yml index ded43866a5..304a8723c2 100644 --- a/.github/workflows/docs-impact.yml +++ b/.github/workflows/docs-impact.yml @@ -1,7 +1,10 @@ name: Contribution Policy +# Pull requests into master only: dev keeps no contribution gates (CI (dev) +# runs only the tests). on: pull_request: + branches: [master, main] types: [opened, synchronize, reopened, labeled, unlabeled] permissions: diff --git a/.github/workflows/provider-plan.yml b/.github/workflows/provider-plan.yml new file mode 100644 index 0000000000..536d633213 --- /dev/null +++ b/.github/workflows/provider-plan.yml @@ -0,0 +1,160 @@ +name: Provider Plan + +# What one CI run tests and where, shared by CI (dev) and CI (master). The +# classifier selects the components a change touches; the tree lookup skips +# every test job when a successful run of the same workflow already tested +# this exact tree (scripts/ci-tested-tree.py); the route asks the Darkbloom +# plane once for every lane of the run (the plane routes a run attempt once), +# the caller's own Linux lanes included. +on: + workflow_call: + inputs: + linux_lanes: + description: The caller's own route lanes, one per line (darkbloom-route.yml format) + type: string + default: '' + outputs: + provider: + description: "'true' when the provider jobs run (selected, and the tree is untested)" + value: ${{ jobs.components.outputs.provider }} + cluster: + value: ${{ jobs.components.outputs.cluster }} + mimo_audio: + value: ${{ jobs.components.outputs.mimo_audio }} + changed_provider: + description: The classifier's provider selection, before the tree lookup + value: ${{ jobs.components.outputs.changed_provider }} + changed_cluster: + value: ${{ jobs.components.outputs.changed_cluster }} + changes_result: + value: ${{ jobs.components.outputs.changes_result }} + skip: + description: "'true' when a successful run already tested this tree" + value: ${{ jobs.tested.outputs.skip }} + tested_run: + value: ${{ jobs.tested.outputs.tested_run }} + tree: + value: ${{ jobs.tested.outputs.tree }} + base: + description: The tested change's base (`push` for a push) + value: ${{ jobs.tested.outputs.base }} + head: + value: ${{ jobs.tested.outputs.head }} + routes: + value: ${{ jobs.route.outputs.routes }} + +permissions: + contents: read + +jobs: + changes: + uses: ./.github/workflows/component-changes.yml + permissions: + contents: read + + tested: + name: Find an earlier test of this tree + needs: changes + if: ${{ !cancelled() && needs.changes.result == 'success' }} + runs-on: ubuntu-24.04 + timeout-minutes: 5 + permissions: + contents: read + actions: read + outputs: + skip: ${{ steps.lookup.outputs.skip }} + tested_run: ${{ steps.lookup.outputs.tested_run }} + tree: ${{ steps.tree.outputs.tree }} + base: ${{ steps.tree.outputs.base }} + head: ${{ steps.tree.outputs.head }} + steps: + # On a pull request github.sha is its test merge commit of the event's + # base and head; on a push, the pushed commit. Only the lookup script is + # checked out. + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + sparse-checkout: scripts/ci-tested-tree.py + sparse-checkout-cone-mode: false + - name: Name the change this run tests + id: tree + env: + BASE: ${{ github.event.pull_request.base.sha || 'push' }} + HEAD: ${{ github.event.pull_request.head.sha || github.sha }} + run: | + { + echo "tree=$(git rev-parse 'HEAD^{tree}')" + echo "base=$BASE" + echo "head=$HEAD" + } >> "$GITHUB_OUTPUT" + - name: Look for a successful run that tested it + id: lookup + env: + GITHUB_TOKEN: ${{ github.token }} + REPOSITORY: ${{ github.repository }} + WORKFLOW_REF: ${{ github.workflow_ref }} + EVENT: ${{ github.event_name }} + SHA: ${{ github.sha }} + TREE: ${{ steps.tree.outputs.tree }} + BASE: ${{ github.event.pull_request.base.sha }} + HEAD: ${{ github.event.pull_request.head.sha }} + SELECTED: provider=${{ needs.changes.outputs.provider }},cluster=${{ needs.changes.outputs.cluster }},mimo_audio=${{ needs.changes.outputs.mimo_audio }} + RUN_ID: ${{ github.run_id }} + run: | + python3 scripts/ci-tested-tree.py lookup --repository "$REPOSITORY" \ + --workflow-ref "$WORKFLOW_REF" --event "$EVENT" --sha "$SHA" --tree "$TREE" \ + --base "$BASE" --head "$HEAD" --components "$SELECTED" --run-id "$RUN_ID" + + # The components the test jobs run: the classifier's, or none when the tree + # was tested. A failed lookup has already answered "test". + components: + name: Choose the components to test + needs: [changes, tested] + if: ${{ !cancelled() }} + runs-on: ubuntu-24.04 + timeout-minutes: 2 + permissions: {} + outputs: + provider: ${{ steps.choose.outputs.provider }} + cluster: ${{ steps.choose.outputs.cluster }} + mimo_audio: ${{ steps.choose.outputs.mimo_audio }} + changed_provider: ${{ needs.changes.outputs.provider }} + changed_cluster: ${{ needs.changes.outputs.cluster }} + changes_result: ${{ needs.changes.result }} + steps: + - name: Choose the components to test + id: choose + env: + SKIP: ${{ needs.tested.outputs.skip }} + PROVIDER: ${{ needs.changes.outputs.provider }} + CLUSTER: ${{ needs.changes.outputs.cluster }} + MIMO_AUDIO: ${{ needs.changes.outputs.mimo_audio }} + run: | + if [ "$SKIP" = true ]; then PROVIDER=false CLUSTER=false MIMO_AUDIO=false; fi + { + echo "provider=$PROVIDER" + echo "cluster=$CLUSTER" + echo "mimo_audio=$MIMO_AUDIO" + } >> "$GITHUB_OUTPUT" + + # Chooses a Darkbloom Sandbox or the Blacksmith fallback for each lane. A lane + # is granted whole or falls back whole, so each job (each shard) has a lane + # of its own and falls back alone. The macOS lanes are listed in the order + # the DARKBLOOM_MACOS_LANES cap keeps them: the critical-path shards first. + # refresh-caches is the only build of a push whose tree was tested. + route: + needs: [components, tested] + if: ${{ !cancelled() }} + uses: ./.github/workflows/darkbloom-route.yml + permissions: {} + with: + lanes: | + ${{ inputs.linux_lanes }} + test-cluster-1 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.components.outputs.cluster == 'true' && 1 || 0 }} + test-provider-1 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.components.outputs.provider == 'true' && 1 || 0 }} + test-provider-2 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.components.outputs.provider == 'true' && 1 || 0 }} + test-cluster-2 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.components.outputs.cluster == 'true' && 1 || 0 }} + test-cluster-focused macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.components.outputs.cluster == 'true' && 1 || 0 }} + test-cluster-gpu-1 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.components.outputs.cluster == 'true' && 1 || 0 }} + test-cluster-gpu-2 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.components.outputs.cluster == 'true' && 1 || 0 }} + refresh-caches macos_arm64 blacksmith-12vcpu-macos-27 ${{ github.event_name == 'push' && needs.tested.outputs.skip == 'true' && (needs.components.outputs.changed_provider == 'true' || needs.components.outputs.changed_cluster == 'true') && 1 || 0 }} diff --git a/.github/workflows/ci.yml b/.github/workflows/provider-tests.yml similarity index 56% rename from .github/workflows/ci.yml rename to .github/workflows/provider-tests.yml index 82f62fe580..9786246ba6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/provider-tests.yml @@ -1,10 +1,28 @@ -name: CI +name: Provider Tests +# The provider and cluster test jobs and the Provider Tests gate, shared by +# CI (dev) (.github/workflows/ci-dev.yml) and CI (master) +# (.github/workflows/ci-master.yml). Their plan (provider-plan.yml) chooses +# the components and the runners; pull requests and pushes run the same jobs. +# Only pushes save caches. on: - push: - # Pushes to master and dev save the caches that other runs restore. - branches: [master, main, dev] - pull_request: + workflow_call: + inputs: + provider: {type: string, required: true} + cluster: {type: string, required: true} + mimo_audio: {type: string, required: true} + changed_provider: {type: string, required: true} + changed_cluster: {type: string, required: true} + changes_result: {type: string, required: true} + skip: {type: string, required: true} + tested_run: {type: string, required: true} + tree: {type: string, required: true} + base: {type: string, required: true} + head: {type: string, required: true} + routes: {type: string, required: true} + # true: restore only this recipe's builds (master: release-bound + # builds never reuse objects of another recipe or dependency set). + strict_cache: {type: boolean, default: false} permissions: contents: read @@ -25,227 +43,28 @@ env: !/docs/reports/evidence/**/*.gz !/landing/public/media/ -# Only revisions of the same PR supersede each other; pushes stay independent. -concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - jobs: - changes: - uses: ./.github/workflows/component-changes.yml - permissions: - contents: read - - # Chooses a Darkbloom Sandbox or the Blacksmith fallback for each read-only - # job below. It follows the classifier so only jobs that will run are - # requested, and still routes the unconditional jobs if the classifier fails. - # A lane is granted whole or falls back whole, so each shard has a lane of - # its own and gets a free Mac even when there is not one per shard. - route: - needs: changes - if: ${{ !cancelled() }} - uses: ./.github/workflows/darkbloom-route.yml - permissions: {} - with: - lanes: | - release-integrity linux_arm64 blacksmith-4vcpu-ubuntu-2404 - docs linux_arm64 blacksmith-4vcpu-ubuntu-2404 - test-provider-1 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.changes.outputs.provider == 'true' && 1 || 0 }} - test-provider-2 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.changes.outputs.provider == 'true' && 1 || 0 }} - test-provider-3 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.changes.outputs.provider == 'true' && 1 || 0 }} - test-provider-summary macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.changes.outputs.provider == 'true' && 1 || 0 }} - test-provider-sdk macos_arm64 blacksmith-12vcpu-macos-27 ${{ (github.event_name == 'push' || needs.changes.outputs.sdk == 'true') && 1 || 0 }} - test-cluster-checks macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.changes.outputs.cluster == 'true' && 1 || 0 }} - test-cluster-1 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.changes.outputs.cluster == 'true' && 1 || 0 }} - test-cluster-2 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.changes.outputs.cluster == 'true' && 1 || 0 }} - test-cluster-3 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.changes.outputs.cluster == 'true' && 1 || 0 }} - test-cluster-gpu-1 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.changes.outputs.cluster == 'true' && 1 || 0 }} - test-cluster-gpu-2 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.changes.outputs.cluster == 'true' && 1 || 0 }} - test-cluster-focused macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.changes.outputs.cluster == 'true' && 1 || 0 }} - - release-integrity: - name: Release Integrity - needs: route - runs-on: ${{ fromJSON(needs.route.outputs.routes)['release-integrity'] }} - timeout-minutes: 30 - steps: - # Every checkout in this workflow uses the same five steps: restore the - # newest .git a push saved, discard it unless git fsck accepts it, check - # out, and save .git once a day per branch (docs/developer/build.md#ci-caching). - - name: Select today's .git cache - id: git-day - run: | - day=$(date -u +%F) - echo "day=$day" >> "$GITHUB_OUTPUT" - echo "month=${day%-*}" >> "$GITHUB_OUTPUT" - echo "actions/cache compressor: $(command -v zstd >/dev/null && echo zstd || echo gzip)" - - name: Restore the newest saved .git - id: git-cache - uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - with: - path: .git - key: git-v1-${{ runner.os }}-${{ steps.git-day.outputs.day }} - restore-keys: | - git-v1-${{ runner.os }}-${{ steps.git-day.outputs.month }}- - git-v1-${{ runner.os }}- - - name: Discard a damaged cached .git - run: | - if [ -d .git ] && ! { git rev-parse --verify -q HEAD >/dev/null && - git fsck --connectivity-only --no-progress >/dev/null 2>&1; }; then - echo "::warning title=.git cache::git fsck rejected the restored .git; checking out without it." - rm -rf .git - fi - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false # Keeps the job token out of the saved .git/config. - sparse-checkout: ${{ env.CHECKOUT_SPARSE }} - sparse-checkout-cone-mode: false - - name: Save .git for later runs - if: env.SAVE_CACHES == 'true' && steps.git-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - with: - path: .git - key: ${{ steps.git-cache.outputs.cache-primary-key }} - # A plain build of master must be prod and a plain build of dev must be - # dev. The target is the pull request's base branch, or the pushed branch. - - name: Check the provider's plain-build default for the target branch - env: - TARGET_BRANCH: ${{ github.base_ref || github.ref_name }} - run: | - python3 scripts/test-provider-build-default.py - python3 scripts/provider-build-default.py --branch "$TARGET_BRANCH" - - name: Validate changelog fragments - run: | - python3 scripts/test-changelog.py - make changelog-check - - name: Check provider release and installer integrity - run: | - ./scripts/check-release-version.sh - python3 scripts/test-provider-release-resolution.py - python3 scripts/test-provider-release-resume.py - python3 scripts/test-provider-release-toolchain.py - python3 scripts/test-provider-release-cache.py - python3 scripts/test-prepare-metal-toolchain.py - python3 scripts/test-provider-release-pipeline.py - python3 scripts/test-provider-release-publication.py - python3 scripts/test-provider-release-notes.py - python3 scripts/test-provider-cluster-runtime-models.py - python3 scripts/test-release-dev-branch.py - python3 scripts/test-provider-release-artifact.py - python3 scripts/test-provider-signing-validation.py - python3 scripts/test-provider-identity.py - python3 scripts/test-provider-test-watchdog.py - python3 scripts/test-stage-test-metallib.py - python3 scripts/test-provider-ci-cache.py - python3 scripts/test-provider-ci-workflow.py - python3 scripts/test-provider-test-shards.py - python3 scripts/test-cluster-test-plan.py - python3 scripts/test-ci-component-paths.py - python3 scripts/test-darkbloom-route.py - python3 scripts/test-prepare-prompt-fixtures.py - python3 provider-swift/Tests/test_protocol_fixture_resources.py - python3 scripts/test-app-attest-entitlements.py - ./scripts/test-setup-macos-homebrew.sh - # SDK 27.2 back-deploys Date's >= and <=; pre-release macOS 27.2 builds - # lack the symbols. The release build also checks the built binaries. - - name: Refuse back-deployed Date comparisons in provider source - run: | - python3 scripts/test-check-date-comparisons.py - python3 scripts/test-check-provider-weak-imports.py - python3 scripts/check-date-comparisons.py - - name: Test advisory threat review with local HTTP fixtures - run: | - python3 .github/scripts/test-threat-model-review.py - python3 .github/scripts/test-threat-full-scan.py - python3 .github/scripts/test-threat-ensemble.py - python3 .github/scripts/test-threat-budget.py - python3 .github/scripts/test-threat-bedrock.py - python3 .github/scripts/test-threat-diagnostics.py - python3 .github/scripts/test-threat-integration-scope.py - - name: Test native GPU CI routing without a GPU - run: python3 scripts/test-native-gpu-ci.py - - name: Test model registry workflow with loopback HTTP - run: python3 scripts/test_model_registry_workflow.py - - name: Test bounded MiMo provider fixture provisioning offline - run: python3 scripts/test-prepare-mimo-provider-fixtures.py - - name: Test serving qualification evidence and catalogs without a GPU - run: python3 -m unittest discover -s scripts/serving_performance -t scripts -p 'test_*.py' - - name: Test actual-call and bounded timing receipts without a GPU - run: | - python3 -m unittest discover -s scripts/benchmarks -p test_radix_forward_shapes.py - python3 reports/runtime-kv-path-2026-10-09/qualification/test_curate_runs.py - python3 reports/runtime-kv-path-2026-10-09/qualification/test_run_suite.py - - docs: - name: Docs Lint - needs: route - runs-on: ${{ fromJSON(needs.route.outputs.routes)['docs'] }} - # Full-history checkouts of this repository have taken up to 21 minutes. - timeout-minutes: 45 - steps: - - name: Select today's .git cache - id: git-day - run: | - day=$(date -u +%F) - echo "day=$day" >> "$GITHUB_OUTPUT" - echo "month=${day%-*}" >> "$GITHUB_OUTPUT" - echo "actions/cache compressor: $(command -v zstd >/dev/null && echo zstd || echo gzip)" - # Full history: a separate key family, so shallow jobs never restore it. - - name: Restore the newest saved .git - id: git-cache - uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - with: - path: .git - key: git-full-v1-${{ runner.os }}-${{ steps.git-day.outputs.day }} - restore-keys: | - git-full-v1-${{ runner.os }}-${{ steps.git-day.outputs.month }}- - git-full-v1-${{ runner.os }}- - - name: Discard a damaged cached .git - run: | - if [ -d .git ] && ! { git rev-parse --verify -q HEAD >/dev/null && - git fsck --connectivity-only --no-progress >/dev/null 2>&1; }; then - echo "::warning title=.git cache::git fsck rejected the restored .git; checking out without it." - rm -rf .git - fi - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 # Frozen source links require committed document provenance. - filter: blob:none # Old file contents are fetched only when read. - persist-credentials: false - - name: Save .git for later runs - if: env.SAVE_CACHES == 'true' && steps.git-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - with: - path: .git - key: ${{ steps.git-cache.outputs.cache-primary-key }} - - name: Initialize pinned SDK documentation - run: git submodule update --init --depth 1 libs/mlx-swift-lm - - name: Test historical source-link validation - run: python3 scripts/test-docs-check-historical-links.py - - name: Test date-only freshness stamping - run: python3 scripts/test-docs-stamp.py - - name: Check freshness stamps, links, cited paths, orphans - run: ./scripts/docs-check.sh - test-provider: # The provider suite runs in shards on separate Macs # (scripts/provider-test-shards.py), each routed through its own - # test-provider- lane above. Each shard runs its suites serially in - # one process. Shard 1 also runs the MLX-free test targets in one parallel - # process; shard 2 also runs Prompt Parity. The last shard runs every suite - # that no other shard selects, the isolated processes and the native gates - # below. Provider Unit Tests Summary checks that the shards together - # executed the full suite and reports coverage. + # test-provider- lane above. Each shard builds once and runs + # PROVIDER_TEST_PROCESSES selections at the same time, each serially in its + # own process (scripts/run-provider-tests.sh). Selection 1 also runs the + # MLX-free test targets in one parallel process; shard 1 also runs Prompt + # Parity. The last selection runs every suite that no other selection + # picks; the last shard then runs the isolated processes and the native + # gates below, alone. Each shard then checks that its selections executed + # exactly their plans (the last shard also that the plans cover the suite + # once) and reports its own coverage. name: Provider Unit Tests (shard ${{ matrix.shard }}) - needs: [changes, route] - if: ${{ needs.changes.outputs.provider == 'true' }} - runs-on: ${{ fromJSON(needs.route.outputs.routes)[format('test-provider-{0}', matrix.shard)] }} + if: ${{ inputs.provider == 'true' }} + runs-on: ${{ fromJSON(inputs.routes)[format('test-provider-{0}', matrix.shard)] }} timeout-minutes: 60 strategy: # A failed shard does not cancel the other shards. fail-fast: false matrix: - shard: [1, 2, 3] + shard: [1, 2] steps: - name: Select today's .git cache id: git-day @@ -288,6 +107,7 @@ jobs: with: lane: provider save-caches: ${{ env.SAVE_CACHES }} + strict-cache: ${{ inputs.strict_cache }} # The provider lane builds with --enable-code-coverage. Every provider # process after this step writes its own profile here, and the report # step at the end of this job merges them. @@ -306,13 +126,28 @@ jobs: - name: Test profile inventory authentication in a terminal if: ${{ matrix.shard == strategy.job-total }} run: python3 scripts/test-profile-inventory-auth.py + # The pinned metadata downloads, named by their SHA-256; each script + # uses an entry only if its bytes still have the pinned digest. + - name: Restore verified MiMo metadata downloads + id: mimo-metadata-cache + if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: ${{ runner.temp }}/mimo-metadata-cache + key: mimo-metadata-v1-${{ hashFiles('scripts/prepare-mimo-prompt-fixtures.py', 'scripts/prepare-mimo-audio-fixtures.py') }} - name: Prepare pinned public MiMo metadata and original corpus id: mimo-prompt-fixtures if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} run: | python3 scripts/test-prepare-mimo-image-http-fixtures.py - python3 scripts/prepare-mimo-prompt-fixtures.py --output "$RUNNER_TEMP/mimo-prompt-fixtures" --github-env "$GITHUB_ENV" - python3 scripts/prepare-mimo-image-http-fixtures.py --output "$RUNNER_TEMP/mimo-image-http-fixtures" --github-env "$GITHUB_ENV" + python3 scripts/prepare-mimo-prompt-fixtures.py --output "$RUNNER_TEMP/mimo-prompt-fixtures" --github-env "$GITHUB_ENV" --cache "$RUNNER_TEMP/mimo-metadata-cache" + python3 scripts/prepare-mimo-image-http-fixtures.py --output "$RUNNER_TEMP/mimo-image-http-fixtures" --github-env "$GITHUB_ENV" --cache "$RUNNER_TEMP/mimo-metadata-cache" + - name: Save verified MiMo metadata downloads + if: ${{ !cancelled() && env.SAVE_CACHES == 'true' && steps.mimo-prompt-fixtures.outcome == 'success' && steps.mimo-metadata-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: ${{ runner.temp }}/mimo-metadata-cache + key: ${{ steps.mimo-metadata-cache.outputs.cache-primary-key }} - name: Prepare bounded synthetic MiMo provider fixtures offline id: mimo-fixtures if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} @@ -326,6 +161,8 @@ jobs: env: MIMO_V26_PROVIDER_LIFETIME_METADATA_TESTS: '1' PROVIDER_TEST_SHARD: ${{ matrix.shard }}/${{ strategy.job-total }} + # Selections per shard, at the same time: 3 on a 12-vCPU runner. + PROVIDER_TEST_PROCESSES: '3' PROVIDER_TEST_REPORT_DIR: ${{ runner.temp }}/provider-unit-shard working-directory: provider-swift # Reuse the built bundle and matched metallib. The exact allocator @@ -340,15 +177,20 @@ jobs: uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: provider-test-diagnostics-${{ matrix.shard }} - path: ${{ runner.temp }}/provider-test-diagnostics + # The watchdog's diagnostics, and each process's whole output, which + # the runner prints only after all of the shard's processes end. + path: | + ${{ runner.temp }}/provider-test-diagnostics + ${{ runner.temp }}/provider-unit-shard/slot-*.out if-no-files-found: warn retention-days: 7 - # Prompt Parity runs once, in shard 2, against this shard's build. A - # failure fails the shard, and with it the Provider Tests gate. The - # summary checks each run's executed count against the suite list. + # Prompt Parity runs once, in shard 1 (the shard of selection + # PARITY_SHARD), against this shard's build. A failure fails the shard, + # and with it the Provider Tests gate. The summary checks each run's + # executed count against the suite list. - name: Verify public prompt golden vectors id: prompt-parity - if: ${{ !cancelled() && matrix.shard == 2 && steps.provider-ci-build.outcome == 'success' && steps.mimo-prompt-fixtures.outcome == 'success' }} + if: ${{ !cancelled() && matrix.shard == 1 && steps.provider-ci-build.outcome == 'success' && steps.mimo-prompt-fixtures.outcome == 'success' }} env: PROMPT_PARITY_SKIP_BUILD: '1' run: | @@ -359,7 +201,7 @@ jobs: python3 scripts/provider-test-shards.py counts parity ProductionPromptParityTests \ "$report/parity-prompt.log" "$report/shard-parity-prompt.json" - name: Verify pinned Nemotron prompts and numeric cache plans - if: ${{ !cancelled() && matrix.shard == 2 && steps.provider-ci-build.outcome == 'success' }} + if: ${{ !cancelled() && matrix.shard == 1 && steps.provider-ci-build.outcome == 'success' }} run: | set -o pipefail report="$RUNNER_TEMP/provider-unit-shard" @@ -424,7 +266,7 @@ jobs: # The 1.87 GB codec is fetched only when the audio gate's inputs changed # (scripts/ci-component-paths.py MIMO_AUDIO) and on master pushes. - name: Restore pinned MiMo audio codec - if: ${{ !cancelled() && matrix.shard == strategy.job-total && steps.provider-ci-build.outcome == 'success' && needs.changes.outputs.mimo_audio == 'true' }} + if: ${{ !cancelled() && matrix.shard == strategy.job-total && steps.provider-ci-build.outcome == 'success' && inputs.mimo_audio == 'true' }} uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 id: mimo-audio-cache with: @@ -432,7 +274,7 @@ jobs: key: mimo-audio-source-v2-077033345d80eef3a315e8d394e0589667e80e4cdaba9bc5a7488410c6657265 - name: Prepare selected MiMo audio fixture id: mimo-audio-fixtures - if: ${{ !cancelled() && matrix.shard == strategy.job-total && steps.provider-ci-build.outcome == 'success' && needs.changes.outputs.mimo_audio == 'true' }} + if: ${{ !cancelled() && matrix.shard == strategy.job-total && steps.provider-ci-build.outcome == 'success' && inputs.mimo_audio == 'true' }} run: python3 scripts/prepare-mimo-audio-fixtures.py --cache "$RUNNER_TEMP/mimo-audio-source" --output "$RUNNER_TEMP/mimo-audio-fixtures" --github-env "$GITHUB_ENV" - name: Cache verified MiMo audio codec if: ${{ !cancelled() && env.SAVE_CACHES == 'true' && matrix.shard == strategy.job-total && steps.mimo-audio-fixtures.outcome == 'success' && steps.mimo-audio-cache.outputs.cache-hit != 'true' }} @@ -452,8 +294,8 @@ jobs: if: ${{ !cancelled() && matrix.shard == strategy.job-total }} timeout-minutes: 2 run: ./scripts/test-install-atomic.sh - # Report-only coverage: each shard merges its own profiles, and Provider - # Unit Tests Summary merges the shards and writes the report. + # Report-only coverage: each shard merges its own profiles and writes + # its own report. - name: Merge shard coverage profiles if: ${{ !cancelled() && steps.provider-unit-tests.outcome != 'skipped' }} run: | @@ -467,117 +309,34 @@ jobs: echo "Merging ${#profiles[@]} provider coverage profiles" mkdir -p "$RUNNER_TEMP/provider-unit-shard" xcrun llvm-profdata merge -sparse -o "$RUNNER_TEMP/provider-unit-shard/provider.profdata" "${profiles[@]}" - - name: Upload shard counts, timings and coverage + # The full-suite audit, split by job: this shard's selections each ran + # exactly their plan, and the last shard checks that all plans cover + # `swift test list` once (scripts/provider-test-shards.py audit-job). + - name: Check this shard's selections against the suite list if: ${{ !cancelled() && steps.provider-unit-tests.outcome != 'skipped' }} - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: provider-unit-shard-${{ matrix.shard }} - path: | - ${{ runner.temp }}/provider-unit-shard/*.json - ${{ runner.temp }}/provider-unit-shard/*.xml - ${{ runner.temp }}/provider-unit-shard/provider.profdata - if-no-files-found: error - retention-days: 14 - - test-provider-summary: - # Checks the shards against the full suite list and reports coverage. - name: Provider Unit Tests Summary - needs: [changes, route, test-provider] - if: ${{ !cancelled() && needs.changes.outputs.provider == 'true' }} - runs-on: ${{ fromJSON(needs.route.outputs.routes)['test-provider-summary'] }} - timeout-minutes: 30 - steps: - - name: Select today's .git cache - id: git-day - run: | - day=$(date -u +%F) - echo "day=$day" >> "$GITHUB_OUTPUT" - echo "month=${day%-*}" >> "$GITHUB_OUTPUT" - echo "actions/cache compressor: $(command -v zstd >/dev/null && echo zstd || echo gzip)" - - name: Restore the newest saved .git - id: git-cache - uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - with: - path: .git - key: git-v1-${{ runner.os }}-${{ steps.git-day.outputs.day }} - restore-keys: | - git-v1-${{ runner.os }}-${{ steps.git-day.outputs.month }}- - git-v1-${{ runner.os }}- - - name: Discard a damaged cached .git - run: | - if [ -d .git ] && ! { git rev-parse --verify -q HEAD >/dev/null && - git fsck --connectivity-only --no-progress >/dev/null 2>&1; }; then - echo "::warning title=.git cache::git fsck rejected the restored .git; checking out without it." - rm -rf .git - fi - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: recursive - persist-credentials: false - sparse-checkout: ${{ env.CHECKOUT_SPARSE }} - sparse-checkout-cone-mode: false - - name: Save .git for later runs - if: env.SAVE_CACHES == 'true' && steps.git-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - with: - path: .git - key: ${{ steps.git-cache.outputs.cache-primary-key }} - # On a push this restores the shards' build; on a pull request, the base - # branch's newest compatible build. It rebuilds from the same sources and - # flags; `swift test list` and llvm-cov read its binaries. - - name: Build provider CI prerequisites - id: provider-ci-build - uses: ./.github/actions/provider-ci-build - with: - lane: provider - save-caches: ${{ env.SAVE_CACHES }} - - name: Download shard reports - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 - with: - pattern: provider-unit-shard-* - path: ${{ runner.temp }}/provider-unit-shards - - name: Check that the shards executed the full provider suite - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} working-directory: provider-swift + env: + PROVIDER_TEST_PROCESSES: '3' + SHARD: ${{ matrix.shard }}/${{ strategy.job-total }} run: | set -euo pipefail swift test list --skip-build > "$RUNNER_TEMP/provider-tests.txt" - python3 ../scripts/provider-test-shards.py audit "$RUNNER_TEMP/provider-tests.txt" "$RUNNER_TEMP/provider-unit-shards" - # Report-only: measured seconds per suite, the input for - # scripts/provider-test-shard-weights.json when the shards drift apart. - - name: Measure suite times for shard balance - if: ${{ !cancelled() }} - run: | - set -euo pipefail - mkdir -p "$RUNNER_TEMP/provider-test-shard-weights" - python3 scripts/provider-test-shards.py weights "$RUNNER_TEMP"/provider-unit-shards/*/shard-*.xml \ - > "$RUNNER_TEMP/provider-test-shard-weights/provider-test-shard-weights.json" - - name: Upload measured suite times - if: ${{ !cancelled() }} - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: provider-test-shard-weights - path: ${{ runner.temp }}/provider-test-shard-weights/provider-test-shard-weights.json - if-no-files-found: warn - retention-days: 14 + python3 ../scripts/provider-test-shards.py audit-job "$RUNNER_TEMP/provider-tests.txt" \ + "$RUNNER_TEMP/provider-unit-shard" "$SHARD" # Report-only. The test steps above keep their own exit codes, so a # coverage failure here cannot hide or replace a test failure. - name: Report provider coverage id: provider-coverage - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} + if: ${{ !cancelled() && steps.provider-unit-tests.outcome != 'skipped' }} working-directory: provider-swift run: | set -euo pipefail shopt -s nullglob - profiles=("$RUNNER_TEMP"/provider-unit-shards/*/provider.profdata) - if [ "${#profiles[@]}" -eq 0 ]; then - echo "::error::No provider coverage profiles in $RUNNER_TEMP/provider-unit-shards" - exit 1 - fi - echo "Merging ${#profiles[@]} shard coverage profiles" + # This shard's processes only: the shards run at the same time, so + # no job sees the others' profiles. out="$RUNNER_TEMP/provider-coverage" mkdir -p "$out" - xcrun llvm-profdata merge -sparse -o "$out/provider.profdata" "${profiles[@]}" + cp "$RUNNER_TEMP/provider-unit-shard/provider.profdata" "$out/provider.profdata" bin=$(swift build --show-bin-path) # The test bundle holds the libraries and the executables the tests # import; the executables are added so their own code also counts. @@ -659,7 +418,7 @@ jobs: { cat "$out/provider-coverage-summary.md" echo - echo "Denominator: Swift lines and regions in \`provider-swift/Sources\`, from every provider test process in the Provider Unit Tests shards, Prompt Parity included; the Provider SDK Tests lane runs in another job and does not count." + echo "Denominator: Swift lines and regions in \`provider-swift/Sources\`, from this shard's provider test processes (each shard reports its own); Prompt Parity counts in shard 1." echo echo "Excluded: \`Tests/\`, \`.build/\` (dependencies and generated code), the \`libs/\` checkouts, and the one C++ file in \`ProviderMetallibControl\`, which is not instrumented; Swift has no branch counters, so branches are not reported." } >> "$GITHUB_STEP_SUMMARY" @@ -667,23 +426,40 @@ jobs: if: ${{ !cancelled() && steps.provider-coverage.outcome == 'success' }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: provider-coverage + name: provider-coverage-${{ matrix.shard }} path: | ${{ runner.temp }}/provider-coverage/provider-coverage.txt ${{ runner.temp }}/provider-coverage/provider-coverage.json ${{ runner.temp }}/provider-coverage/provider-coverage-summary.md if-no-files-found: error retention-days: 14 + - name: Upload shard counts, timings and coverage + if: ${{ !cancelled() && steps.provider-unit-tests.outcome != 'skipped' }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: provider-unit-shard-${{ matrix.shard }} + path: | + ${{ runner.temp }}/provider-unit-shard/*.json + ${{ runner.temp }}/provider-unit-shard/*.xml + ${{ runner.temp }}/provider-unit-shard/attempt-1-*.log + ${{ runner.temp }}/provider-unit-shard/provider.profdata + if-no-files-found: error + retention-days: 14 - test-provider-sdk: - # Not part of the Provider Tests gate. A pull request runs it only when an - # SDK-lane input changes (scripts/ci-component-paths.py SDK); every push to - # dev or master runs it, and a failure there notifies without blocking. - name: Provider SDK Tests - needs: [changes, route] - if: ${{ github.event_name == 'push' || needs.changes.outputs.sdk == 'true' }} - runs-on: ${{ fromJSON(needs.route.outputs.routes)['test-provider-sdk'] }} + test-cluster: + # DarkbloomClusterRuntimeTests in selections, each in its own process, on + # separate Macs (scripts/cluster-test-plan.py): every test without a + # switch, and the switched tests that pass on these runners. Shard 1 runs + # the base selection alone; shard 2 runs its ordered groups of selections + # at the same time. + name: Cluster Runtime Tests (shard ${{ matrix.shard }}) + if: ${{ inputs.cluster == 'true' }} + runs-on: ${{ fromJSON(inputs.routes)[format('test-cluster-{0}', matrix.shard)] }} timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + shard: [1, 2] steps: - name: Select today's .git cache id: git-day @@ -720,172 +496,94 @@ jobs: with: path: .git key: ${{ steps.git-cache.outputs.cache-primary-key }} - - name: Build SDK CI prerequisites + - name: Build cluster test products id: provider-ci-build - timeout-minutes: 35 uses: ./.github/actions/provider-ci-build with: - lane: sdk + lane: cluster save-caches: ${{ env.SAVE_CACHES }} - # FLAKE-ORDERING GUARD (audit fix, v0.8.0): every nested step below runs - # under !cancelled() with successful build/metallib prerequisites. A - # failed suite cannot hide a later correctness gate, and a failed build - # produces one attributable failure rather than cascading test failures. - - name: Verify DiffusionGemma artifact and expert reduction - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - run: ../../scripts/run-nested-suite.sh 'DiffusionGemma(ArtifactFixture|ExpertReduction)Tests' --no-parallel - # NOTE (v0.8.0): the guards below exist because these gates once - # reported GREEN while executing NOTHING. `Tests/BenchCBv2Tests` - # depended on the BenchCBv2 EXECUTABLE target, so SwiftPM routed the - # swift-testing pass at that binary, which rejects - # `--test-bundle-path` and exits — every `@Test` in the package was - # unreachable and only XCTestCase classes ran. `swift test` exits 0 in - # that state, which is why it went unnoticed. - # - # FIXED: BenchCBv2 is now split into a `BenchCBv2Core` library plus a - # thin executable shim, and the test target depends on the library. - # - # The guards STAY as a permanent tripwire. This failure mode is silent - # by construction — a dark suite and a passing one are - # indistinguishable by exit code — so any future change that re-routes - # the swift-testing pass must be RED here, not green. - # The suites below are already compiled by the `swift build - # --build-tests` action above but were never executed, so the paged-KV - # migration had no automated numerical gate. They add no compile time, - # only run time; one step each so a slow or failing suite is - # attributable straight from the job summary. They reuse the metallib - # placed by the step above. - # - # The bodies are ONE script (scripts/run-nested-suite.sh), which is what - # carries the executed-count and zero-skip tripwires. ALL six suites go - # through it — a bare `swift test --filter` here would bypass the - # tripwire and reintroduce the dark-gate hole the script closes (the - # safety and prompt-hash suites below used to run bare for exactly that - # reason). Inline copies of a check whose failure mode is silence are - # that many chances to edit one and miss the rest. - - name: Run nested MiMo media decode tests - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - timeout-minutes: 5 - run: ../../scripts/run-nested-suite.sh 'MiMoV26(OpenRouterMedia|VisionWorkingSet|AudioWorkingSet|VisualDecodeMemory|EncodedVisualDecoder|EncodedAudioDecoder|EncodedAACAudio|EncodedAudiovisualDecoder)Tests|MiMoV26PixelsTests.test(RGB|Temporal|Invalid|Explicit)' --no-parallel - - name: Verify native historical retention policy - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - timeout-minutes: 5 - run: ../../scripts/run-nested-suite.sh CBv2NativeHistoricalRetentionTests --no-parallel - - name: Verify demanded checkpoint scheduling and projection - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - timeout-minutes: 5 - run: ../../scripts/run-nested-suite.sh CBv2DemandedCheckpointPartitionTests --no-parallel - - name: Verify demanded long range continuation and projection - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - timeout-minutes: 5 - run: ../../scripts/run-nested-suite.sh CBv2DemandedCheckpointContinuationTests --no-parallel - - name: Prepare asymmetric tiny MiMo fixture for native retention - id: sdk-mimo-retention-fixture + strict-cache: ${{ inputs.strict_cache }} + - name: Run cluster runtime tests if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - run: python3 scripts/prepare-mimo-provider-fixtures.py --output "$RUNNER_TEMP/mimo-native-retention" --asymmetric - - name: Verify native retained frontier after donor retirement - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' && steps.sdk-mimo-retention-fixture.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - timeout-minutes: 5 + timeout-minutes: 40 env: - MIMO_V26_SERIAL_NATIVE_TESTS: '1' - MIMO_V26_SERIAL_LOAD_FIXTURES: ${{ runner.temp }}/mimo-native-retention - run: ../../scripts/run-nested-suite.sh MiMoV26NativeHistoricalRetentionTests.testDemandedMiddleFrontierSurvivesNativePublicationAndReopenedFork --no-parallel - - name: Prepare tiny MiMo fixture for media-to-text isolation - id: sdk-mimo-isolation-fixture + SHARD: ${{ matrix.shard }} + run: python3 scripts/cluster-test-plan.py run blocking "$SHARD" + + test-cluster-gpu: + # The switched cluster runtime tests these runners cannot pass, the long + # ones and the benchmarks (scripts/cluster-test-plan.py). They run and + # report whenever the cluster jobs run; a failure does not fail the + # workflow. + name: Cluster GPU Tests (non-blocking, shard ${{ matrix.shard }}) + if: ${{ inputs.cluster == 'true' }} + runs-on: ${{ fromJSON(inputs.routes)[format('test-cluster-gpu-{0}', matrix.shard)] }} + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + shard: [1, 2] + steps: + - name: Select today's .git cache + id: git-day + run: | + day=$(date -u +%F) + echo "day=$day" >> "$GITHUB_OUTPUT" + echo "month=${day%-*}" >> "$GITHUB_OUTPUT" + echo "actions/cache compressor: $(command -v zstd >/dev/null && echo zstd || echo gzip)" + - name: Restore the newest saved .git + id: git-cache + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: .git + key: git-v1-${{ runner.os }}-${{ steps.git-day.outputs.day }} + restore-keys: | + git-v1-${{ runner.os }}-${{ steps.git-day.outputs.month }}- + git-v1-${{ runner.os }}- + - name: Discard a damaged cached .git + run: | + if [ -d .git ] && ! { git rev-parse --verify -q HEAD >/dev/null && + git fsck --connectivity-only --no-progress >/dev/null 2>&1; }; then + echo "::warning title=.git cache::git fsck rejected the restored .git; checking out without it." + rm -rf .git + fi + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: recursive + persist-credentials: false + sparse-checkout: ${{ env.CHECKOUT_SPARSE }} + sparse-checkout-cone-mode: false + - name: Save .git for later runs + if: env.SAVE_CACHES == 'true' && steps.git-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: .git + key: ${{ steps.git-cache.outputs.cache-primary-key }} + - name: Build cluster test products + id: provider-ci-build + uses: ./.github/actions/provider-ci-build + with: + lane: cluster + save-caches: ${{ env.SAVE_CACHES }} + strict-cache: ${{ inputs.strict_cache }} + - name: Run non-blocking cluster GPU tests if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - run: python3 scripts/prepare-mimo-provider-fixtures.py --output "$RUNNER_TEMP/mimo-media-isolation" - - name: Verify media refusal leaves the native text engine usable - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' && steps.sdk-mimo-isolation-fixture.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - timeout-minutes: 5 + continue-on-error: true + timeout-minutes: 40 env: - MIMO_V26_SERIAL_NATIVE_TESTS: '1' - MIMO_V26_NATIVE_MEDIA_DEADLINE_TESTS: '1' - MIMO_V26_SERIAL_LOAD_FIXTURES: ${{ runner.temp }}/mimo-media-isolation - run: ../../scripts/run-nested-suite.sh MiMoV26NativeMediaDeadlineTests --no-parallel - - name: Run nested paged safety tests - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - # Runtime smoke over the JIT-compiled paged Metal kernels. - timeout-minutes: 10 - run: ../../scripts/run-nested-suite.sh CBv2PagedSafetyTests - - name: Run nested prompt-hash tests - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - # Prefix-cache prompt-hash identity; pure Swift. - timeout-minutes: 10 - run: ../../scripts/run-nested-suite.sh CBv2PrefixCacheHasherTests - - name: Run nested paged eligibility tests - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - # Pure Swift threadgroup-budget arithmetic; no GPU dispatch. - timeout-minutes: 5 - run: ../../scripts/run-nested-suite.sh CBv2PagedEligibilityTests - - name: Run nested paged backend tests - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - # Pool bookkeeping, per-sequence page tables, windowed rings, - # reservation admission, backend lifecycle. Small MLX arrays only. - timeout-minutes: 10 - run: ../../scripts/run-nested-suite.sh CBv2PagedBackendTests - - name: Run nested paged kernel parity tests - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - # Heaviest of the set: fp32 decode-kernel parity, bitwise - # batch-composition invariance, and a 200-step greedy token match. - # Dispatches the JIT-compiled Metal kernels, exactly as - # CBv2PagedSafetyTests' runtimeSmoke already does in this job. - timeout-minutes: 20 - # The composition assertion opts in only in its own test process; - # both invocations retain the nonempty/no-skips tripwires. - run: ../../scripts/run-paged-kernel-tests.sh - - name: Run nested KV-sharing contiguous/paged parity tests - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - # Two-arm differential over TinyTestModel's KV-sharing variant. The - # paged arm used to XCTSkip when the backend was unavailable; the - # runner script now FAILS on any skip, because "paged unavailable on - # the gate runner" is precisely the condition this lane must not be - # green under. - timeout-minutes: 10 - run: ../../scripts/run-nested-suite.sh CBv2KVSharingParityTests - - name: Run Nemotron production SDK gates - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - working-directory: libs/mlx-swift-lm - timeout-minutes: 20 - run: | - # Each filter has its own nonzero/no-skip tripwire. Continue after a - # failure so one broken suite cannot hide another unexecuted gate. - onboarding_failed=0 - for suite in SSMDecodeBoundsTests NemotronHTests \ - NemotronH35BackendParityTests NemotronH35StorageParityTests \ - NemotronH35MTPTests NemotronH35MTPPrimingTests \ - MutableInputKernelTests MutableInputExportTests \ - CBv2QwenMTPIntegrationTests CBv2MTPDepthControllerTests \ - PagedMTPBatchedColumnsTests CBv2CompleteCheckpointEngineTests \ - NemotronH35ProductionDefaultsTests \ - OpenAIServiceTests ToolCallParserIntegrationTests; do - if ! ../../scripts/run-nested-suite.sh "$suite"; then - onboarding_failed=1 - fi - done - exit "$onboarding_failed" + SHARD: ${{ matrix.shard }} + run: python3 scripts/cluster-test-plan.py run nonblocking "$SHARD" - test-cluster-checks: - # The model-free cluster check runners. Each compiles its own source closure - # (the capability runner links the actual Runtime and MLX, but executes only - # metadata and argument checks) and runs it on the retained fixtures: no GPU, - # no model load, no weights. Every runner runs even after another fails. - name: Cluster Metadata Checks - needs: [changes, route] - if: ${{ needs.changes.outputs.cluster == 'true' }} - runs-on: ${{ fromJSON(needs.route.outputs.routes)['test-cluster-checks'] }} + test-cluster-focused: + # The model-free cluster check runners on one Mac: first the metadata + # runners with their retained release build of the cluster runtime and MLX + # (each compiles its own source closure and runs on the retained fixtures: + # no GPU, no model load, no weights; every runner runs even after another + # fails), then the other runner scripts under libs/darkbloom-cluster/Tests + # (scripts/cluster-test-plan.py focused lane). + name: Cluster Focused Checks + if: ${{ inputs.cluster == 'true' }} + runs-on: ${{ fromJSON(inputs.routes)['test-cluster-focused'] }} timeout-minutes: 60 steps: - name: Select today's .git cache @@ -1009,82 +707,117 @@ jobs: - name: Run cluster onboarding checks if: ${{ !cancelled() && steps.toolchain.outcome == 'success' }} run: bash provider-swift/Tests/ClusterOnboardingChecks/run.sh + - name: Run cluster focused checks + if: ${{ !cancelled() && steps.toolchain.outcome == 'success' }} + timeout-minutes: 40 + run: python3 scripts/cluster-test-plan.py run focused 1 - test-cluster: - # DarkbloomClusterRuntimeTests in selections, each in its own process, on - # separate Macs (scripts/cluster-test-plan.py): every test without a - # switch, and the switched tests that pass on these runners. - name: Cluster Runtime Tests (shard ${{ matrix.shard }}) - needs: [changes, route] - if: ${{ needs.changes.outputs.cluster == 'true' }} - runs-on: ${{ fromJSON(needs.route.outputs.routes)[format('test-cluster-{0}', matrix.shard)] }} - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - shard: [1, 2, 3] + provider-test-gate: + name: Provider Tests + runs-on: ubuntu-24.04 + needs: [test-provider, test-cluster, test-cluster-focused] + if: ${{ always() }} + permissions: + contents: read steps: - - name: Select today's .git cache - id: git-day - run: | - day=$(date -u +%F) - echo "day=$day" >> "$GITHUB_OUTPUT" - echo "month=${day%-*}" >> "$GITHUB_OUTPUT" - echo "actions/cache compressor: $(command -v zstd >/dev/null && echo zstd || echo gzip)" - - name: Restore the newest saved .git - id: git-cache - uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - with: - path: .git - key: git-v1-${{ runner.os }}-${{ steps.git-day.outputs.day }} - restore-keys: | - git-v1-${{ runner.os }}-${{ steps.git-day.outputs.month }}- - git-v1-${{ runner.os }}- - - name: Discard a damaged cached .git + - name: Require selected provider lanes or verified intentional skips + env: + CHANGES_RESULT: ${{ inputs.changes_result }} + SKIP: ${{ inputs.skip }} + TESTED_RUN: ${{ inputs.tested_run }} + PROVIDER_CHANGED: ${{ inputs.provider }} + CLUSTER_CHANGED: ${{ inputs.cluster }} + UNIT_RESULT: ${{ needs.test-provider.result }} + CLUSTER_RESULT: ${{ needs.test-cluster.result }} + CLUSTER_FOCUSED_RESULT: ${{ needs.test-cluster-focused.result }} run: | - if [ -d .git ] && ! { git rev-parse --verify -q HEAD >/dev/null && - git fsck --connectivity-only --no-progress >/dev/null 2>&1; }; then - echo "::warning title=.git cache::git fsck rejected the restored .git; checking out without it." - rm -rf .git + test "$CHANGES_RESULT" = success + # A tree that a successful run of this workflow already tested runs + # no test job here (provider-plan.yml); the plan then selects none. + if [ "$SKIP" = true ]; then + echo "::notice title=Tested once::This tree passed in $TESTED_RUN; no test job ran." fi + case "$PROVIDER_CHANGED" in + true) expected=success ;; + false) expected=skipped ;; + *) exit 1 ;; + esac + test "$UNIT_RESULT" = "$expected" + # The cluster jobs run only when their inputs changed; a skip passes + # only when the classifier did not select them. + case "$CLUSTER_CHANGED" in + true) cluster_expected=success ;; + false) cluster_expected=skipped ;; + *) exit 1 ;; + esac + test "$CLUSTER_RESULT" = "$cluster_expected" + test "$CLUSTER_FOCUSED_RESULT" = "$cluster_expected" + # The CI plans run on dev too, not only in master's Release Integrity: + # the cluster plan's audit against the sources and this workflow, the + # provider shard plan, the component classifier, the tested-change + # lookup, the route and the workflow pins. Python only; no build. They + # run even when a test job failed. - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + if: ${{ !cancelled() }} with: - submodules: recursive persist-credentials: false + filter: blob:none sparse-checkout: ${{ env.CHECKOUT_SPARSE }} sparse-checkout-cone-mode: false - - name: Save .git for later runs - if: env.SAVE_CACHES == 'true' && steps.git-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - with: - path: .git - key: ${{ steps.git-cache.outputs.cache-primary-key }} - - name: Build cluster test products - id: provider-ci-build - uses: ./.github/actions/provider-ci-build - with: - lane: cluster - save-caches: ${{ env.SAVE_CACHES }} - - name: Run cluster runtime tests - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - timeout-minutes: 40 + - name: Check the CI plans + if: ${{ !cancelled() }} + run: | + python3 scripts/cluster-test-plan.py audit + python3 scripts/test-cluster-test-plan.py + python3 scripts/test-provider-test-shards.py + python3 scripts/test-ci-component-paths.py + python3 scripts/test-ci-tested-tree.py + python3 scripts/test-darkbloom-route.py + python3 scripts/test-provider-ci-workflow.py + # dev has no Release Integrity, so the gate runs the Date comparison + # check too. SDK 27.2 back-deploys Date's >= and <=; pre-release macOS + # 27.2 builds lack the symbols. The release build also checks the built + # binaries (.github/actions/provider-release-build). + - name: Refuse back-deployed Date comparisons in provider source + if: ${{ !cancelled() }} + run: | + python3 scripts/test-check-date-comparisons.py + python3 scripts/test-check-provider-weak-imports.py + python3 scripts/check-date-comparisons.py + # The record a later run of the same change finds (scripts/ci-tested-tree.py): + # the tree, the event's base and head, and the components that ran. It + # counts only once the whole run succeeded. A run that tested nothing + # records nothing. + - name: Name the record of the change these tests passed + id: record + if: ${{ inputs.skip != 'true' && (inputs.provider == 'true' || inputs.cluster == 'true') }} env: - SHARD: ${{ matrix.shard }} - run: python3 scripts/cluster-test-plan.py run blocking "$SHARD" + TREE: ${{ inputs.tree }} + BASE: ${{ inputs.base }} + HEAD: ${{ inputs.head }} + RAN: provider=${{ inputs.provider }},cluster=${{ inputs.cluster }},mimo_audio=${{ inputs.mimo_audio }} + run: | + name=$(python3 scripts/ci-tested-tree.py name --tree "$TREE" --base "$BASE" --head "$HEAD" --components "$RAN") + mkdir -p "$RUNNER_TEMP/tested-change" + printf '%s\n' "$name" > "$RUNNER_TEMP/tested-change/record" + echo "name=$name" >> "$GITHUB_OUTPUT" + - name: Upload the record + if: ${{ inputs.skip != 'true' && (inputs.provider == 'true' || inputs.cluster == 'true') }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ${{ steps.record.outputs.name }} + path: ${{ runner.temp }}/tested-change/record + if-no-files-found: error + retention-days: 30 - test-cluster-gpu: - # The switched cluster runtime tests these runners cannot pass, the long - # ones and the benchmarks (scripts/cluster-test-plan.py). They run and - # report on every pull request; a failure does not fail the workflow. - name: Cluster GPU Tests (non-blocking, shard ${{ matrix.shard }}) - needs: [changes, route] - if: ${{ needs.changes.outputs.cluster == 'true' }} - runs-on: ${{ fromJSON(needs.route.outputs.routes)[format('test-cluster-gpu-{0}', matrix.shard)] }} + # A push whose tree a pull request run already tested runs no test job. This + # one build-only job refreshes the branch's build caches instead (the loose + # tier makes it incremental), for the components the push changed. + refresh-caches: + name: Refresh build caches + if: ${{ github.event_name == 'push' && inputs.skip == 'true' && (inputs.changed_provider == 'true' || inputs.changed_cluster == 'true') }} + runs-on: ${{ fromJSON(inputs.routes)['refresh-caches'] }} timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - shard: [1, 2] steps: - name: Select today's .git cache id: git-day @@ -1121,105 +854,17 @@ jobs: with: path: .git key: ${{ steps.git-cache.outputs.cache-primary-key }} - - name: Build cluster test products - id: provider-ci-build + - name: Build provider test products and save their caches + if: ${{ inputs.changed_provider == 'true' }} uses: ./.github/actions/provider-ci-build with: - lane: cluster + lane: provider save-caches: ${{ env.SAVE_CACHES }} - - name: Run non-blocking cluster GPU tests - if: ${{ !cancelled() && steps.provider-ci-build.outcome == 'success' }} - continue-on-error: true - timeout-minutes: 40 - env: - SHARD: ${{ matrix.shard }} - run: python3 scripts/cluster-test-plan.py run nonblocking "$SHARD" - - test-cluster-focused: - # The model-free runner scripts under libs/darkbloom-cluster/Tests that - # Cluster Metadata Checks does not run (scripts/cluster-test-plan.py). - name: Cluster Focused Checks - needs: [changes, route] - if: ${{ needs.changes.outputs.cluster == 'true' }} - runs-on: ${{ fromJSON(needs.route.outputs.routes)['test-cluster-focused'] }} - timeout-minutes: 60 - steps: - - name: Select today's .git cache - id: git-day - run: | - day=$(date -u +%F) - echo "day=$day" >> "$GITHUB_OUTPUT" - echo "month=${day%-*}" >> "$GITHUB_OUTPUT" - echo "actions/cache compressor: $(command -v zstd >/dev/null && echo zstd || echo gzip)" - - name: Restore the newest saved .git - id: git-cache - uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - with: - path: .git - key: git-v1-${{ runner.os }}-${{ steps.git-day.outputs.day }} - restore-keys: | - git-v1-${{ runner.os }}-${{ steps.git-day.outputs.month }}- - git-v1-${{ runner.os }}- - - name: Discard a damaged cached .git - run: | - if [ -d .git ] && ! { git rev-parse --verify -q HEAD >/dev/null && - git fsck --connectivity-only --no-progress >/dev/null 2>&1; }; then - echo "::warning title=.git cache::git fsck rejected the restored .git; checking out without it." - rm -rf .git - fi - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: recursive - persist-credentials: false - sparse-checkout: ${{ env.CHECKOUT_SPARSE }} - sparse-checkout-cone-mode: false - - name: Save .git for later runs - if: env.SAVE_CACHES == 'true' && steps.git-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 - with: - path: .git - key: ${{ steps.git-cache.outputs.cache-primary-key }} - - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + strict-cache: ${{ inputs.strict_cache }} + - name: Build cluster test products and save their caches + if: ${{ !cancelled() && inputs.changed_cluster == 'true' }} + uses: ./.github/actions/provider-ci-build with: - python-version: '3.12.10' - - name: Select SDK 27 provider toolchain - id: toolchain - run: ./scripts/prepare-provider-release-toolchain.sh - - name: Run cluster focused checks - if: ${{ !cancelled() && steps.toolchain.outcome == 'success' }} - timeout-minutes: 40 - run: python3 scripts/cluster-test-plan.py run focused 1 - - provider-test-gate: - name: Provider Tests - runs-on: ubuntu-24.04 - needs: [changes, test-provider, test-provider-summary, test-cluster, test-cluster-focused] - if: ${{ always() }} - steps: - - name: Require selected provider lanes or verified intentional skips - env: - CHANGES_RESULT: ${{ needs.changes.result }} - PROVIDER_CHANGED: ${{ needs.changes.outputs.provider }} - CLUSTER_CHANGED: ${{ needs.changes.outputs.cluster }} - UNIT_RESULT: ${{ needs.test-provider.result }} - SUMMARY_RESULT: ${{ needs.test-provider-summary.result }} - CLUSTER_RESULT: ${{ needs.test-cluster.result }} - CLUSTER_FOCUSED_RESULT: ${{ needs.test-cluster-focused.result }} - run: | - test "$CHANGES_RESULT" = success - case "$PROVIDER_CHANGED" in - true) expected=success ;; - false) expected=skipped ;; - *) exit 1 ;; - esac - test "$UNIT_RESULT" = "$expected" - test "$SUMMARY_RESULT" = "$expected" - # The cluster jobs run only when their inputs changed (and on - # pushes); a skip passes only when the classifier did not select them. - case "$CLUSTER_CHANGED" in - true) cluster_expected=success ;; - false) cluster_expected=skipped ;; - *) exit 1 ;; - esac - test "$CLUSTER_RESULT" = "$cluster_expected" - test "$CLUSTER_FOCUSED_RESULT" = "$cluster_expected" + lane: cluster + save-caches: ${{ env.SAVE_CACHES }} + strict-cache: ${{ inputs.strict_cache }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 07ab95c71b..63e12e485c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -414,7 +414,7 @@ Published 2026-11-03 ([release](https://github.com/Layr-Labs/d-inference/release - Affected: a pair of two different Macs set up with `darkbloom cluster` to serve through Darkbloom, with a Qwen model planned in tensor parallel. The planner gave the faster Mac the larger share of every layer (for example 2:1 on an M3 Ultra and an M5 Max), and the coordinator registration cannot name unequal shares yet. Both Macs still said `Registered with the coordinator as a cluster member`, then each Mac's part refused to register ("The saved roster registration is not valid for this Mac: invalidPlan"), the pair fell back to the leader's local API, and the coordinator never formed it or routed it a request. This hit Qwen3.8 27B, which pairs only in tensor parallel, and Qwen3.5 9B where tensor parallel was chosen. GLM-5.3-Flash, pipeline splits and two identical Macs were not affected. - A pair served through Darkbloom is now planned with equal tensor-parallel shares, so it registers and is routed like a pair of identical Macs; on two different Macs the slower one sets the pace. A pair that serves you alone (`darkbloom cluster local`) keeps the faster unequal split. -- A setup saved with unequal shares (by 0.10.6, or a local cluster switched to Darkbloom with `p`) is not offered for pairing, and the leader says why before it stops either Mac's part: `Not offered for pairing: this Mac's check refused it: Unequal tensor-parallel shares serve local clusters only …`. If `darkbloom cluster` shows this once both Macs run this release, press `m` and choose the model again: it is planned with equal shares and registers. +- A setup saved with unequal shares (by 0.10.6, or a local cluster switched to Darkbloom with `p`) is not offered for pairing, and the leader says why before it stops either Mac's part: `Not offered for pairing: this Mac's check refused it: Unequal tensor-parallel shares serve local clusters only …`. If `darkbloom cluster` shows this once both Macs run this release, choose the model again there: it is planned with equal shares and registers. ### Both Macs of a pair roll back together @@ -422,7 +422,7 @@ Published 2026-11-03 ([release](https://github.com/Layr-Labs/d-inference/release - The other Mac checks at its start and every minute while no update runs, also with automatic updates off. It finishes the accepted requests of its part first, as for an update, restores the release it kept from before its last update, quarantines the rolled-back release and restarts. Both Macs then skip that release, and the next newer release updates both. - A Mac that keeps another earlier release, or none, or whose part serves on the leader's local API or alone, does not follow (yet) and says so once in `~/.darkbloom/cluster-setup/service.log`. While a pair runs on it, a Mac whose partner stops answering during the follow waits at most a minute, then changes nothing and tries again at the pair's next update slot. A Mac whose partner quarantined a release does not install that release either. - Both Macs need this release or a later one, and the release a Mac rolls back to must have it too: the Mac that rolled back reports the rollback from the restored release. A rollback of this release itself is therefore not followed; rollbacks of later releases are. -- To roll back a pair by hand, stop one Mac's cluster service with `darkbloom cluster stop`, run `darkbloom update --rollback` there, and start it again with `darkbloom cluster`; the other Mac follows. +- To roll back a pair by hand, stop one Mac's cluster service with `darkbloom cluster stop --service`, run `darkbloom update --rollback` there, and start it again with `darkbloom cluster`; the other Mac follows. ### Two-Mac pairs recover after losing a rank during a stop @@ -451,7 +451,7 @@ Published 2026-11-03 ([release](https://github.com/Layr-Labs/d-inference/release - When the two Macs pair again while their cluster services run (`darkbloom cluster` or `darkbloom cluster pair`), each service starts its setup and control-lease listeners again with the new pairing within about 5 seconds. They used to keep the earlier pairing's key until the service restarted, so the other Mac's leases and its "Reading both Macs over the cable" step were refused (`refused (handshakeRejected)`). The service log says `this Mac's pairing changed (): answering the paired Mac with the new one`. - A Mac left with no pairing stops answering over the cable. A pairing store that cannot be read leaves the listeners as they are. - A Mac that paired again under a new Secure Enclave key of its own drops its earlier control state, as it already did when the other Mac's key changed. -- A cluster service started by an earlier release keeps the earlier behavior until it restarts (log out and back in, or `darkbloom cluster stop` and then `darkbloom cluster`). +- A cluster service started by an earlier release keeps the earlier behavior until it restarts (log out and back in, or `darkbloom cluster stop --service` and then `darkbloom cluster`). ### Tensor parallel for Gemma 4 and MiMo only on measured speed diff --git a/changelog.d/ci-darkbloom-watchdog.md b/changelog.d/ci-darkbloom-watchdog.md new file mode 100644 index 0000000000..e97fbcadc3 --- /dev/null +++ b/changelog.d/ci-darkbloom-watchdog.md @@ -0,0 +1,3 @@ +### CI rescues runs stranded on Darkbloom + +- A scheduled workflow, `darkbloom-watchdog.yml` (darkbloom-sandbox's GitHub-side watchdog, copied unchanged), cancels a run whose Darkbloom job waited `DARKBLOOM_WATCHDOG_MINUTES` with no runner and re-runs its route on the Blacksmith fallback, once per run. Its token can only cancel and re-run this repository's workflow runs and write a check run. diff --git a/changelog.d/ci-dev-master-workflows.md b/changelog.d/ci-dev-master-workflows.md new file mode 100644 index 0000000000..e673cba666 --- /dev/null +++ b/changelog.d/ci-dev-master-workflows.md @@ -0,0 +1,6 @@ +### CI has a dev workflow and a master workflow; dev runs only the tests + +- Two reusable workflows hold the CI jobs: `provider-plan.yml` (the component classifier, the tested-change lookup and the run's one Darkbloom route request) and `provider-tests.yml` (the provider shards, the cluster jobs and the `Provider Tests` gate). `ci-dev.yml` runs both for pull requests into any branch but `master` (`dev` and stacked branches) and for pushes to `dev`. `ci-master.yml` runs both for pull requests into `master` and pushes to `master`, with Release Integrity and Docs Lint beside them. `ci.yml` is gone. +- Pull requests into `dev` no longer run Release Integrity, Docs Lint, Commit Signatures or Docs Impact. Pull requests into `master` run all of them, as before; Release Integrity keeps its check name, which `master`'s ruleset requires. The `Provider Tests` gate runs the cluster plan audit and the CI plan self-tests on every run, `dev` included. +- The test jobs' checks are now named after the caller's job, for example `Tests / Provider Tests`. +- Release Integrity and Docs Lint read their Linux lanes from the plan's route request, with `blacksmith-4vcpu-ubuntu-2404` as the fallback. diff --git a/changelog.d/ci-macos-darkbloom-route.md b/changelog.d/ci-macos-darkbloom-route.md new file mode 100644 index 0000000000..9bd75f0344 --- /dev/null +++ b/changelog.d/ci-macos-darkbloom-route.md @@ -0,0 +1,5 @@ +### CI's macOS jobs ask for Darkbloom Sandboxes again + +- The macOS CI jobs read the Darkbloom route again, as they did before they moved to Blacksmith only. Each provider and cluster test job runs on a Darkbloom Mac when the plane grants its lane, and on `blacksmith-12vcpu-macos-27` otherwise. The job list and shard counts are those of the entry "Provider CI: fewer Mac jobs per run" below. +- A lane is requested only when its job runs: the provider lanes when provider inputs change, and the cluster lanes when cluster inputs change. +- Limitation: a lane the plane's approval does not name keeps Blacksmith, as do all lanes while `DARKBLOOM_ROUTING` is not `on` and for pull requests from forks. diff --git a/changelog.d/ci-sandbox-lanes.md b/changelog.d/ci-sandbox-lanes.md new file mode 100644 index 0000000000..9db77da2cd --- /dev/null +++ b/changelog.d/ci-sandbox-lanes.md @@ -0,0 +1,12 @@ +### Provider CI: fewer Mac jobs per run, loose build-cache restores, macOS lane cap + +- Provider Unit Tests runs in 2 shards instead of 3. Each shard builds once and runs 3 test selections at the same time, each serially in its own process with its own `TMPDIR` and provider state files. The isolated processes and the native gates still run after them, alone. The processes start 15 s apart. A selection whose SwiftPM found the build database locked by another process's startup runs once more, but only when its log proves every test passed; both attempts' logs and reports are kept. The plan is unchanged; the audit counts 6 selections. +- Cluster Runtime Tests runs in 2 shards instead of 3. Shard 1 runs the `base` selection alone, then the share probe alone. Shard 2 runs two groups at the same time, each in plan order: the batch-session suite with the GLM paged-KV, invariance and census, TF32 and Gemma selections; and the Qwen GPU chain with `glm53-prefix-ssd`. A grouped selection that finds the build database locked runs once more, under the same rule. +- The Provider SDK Tests lane is removed: 226 of its 236 test seconds repeated the SDK's own Fork Tests. Its one other step, `MiMoV26NativeMediaDeadlineTests`, is left for the SDK's Fork Tests to run. Release qualification still builds and tests the provider, with the SDK compiled in, under SDK 27. +- CI tests each change once: a run whose change a successful run of the same workflow already tested, with every component this run selects, runs no test job, and its gate cites that run. A record binds to its tree, its base and head commits and the commit its run tested; the push of a pull request's merge commit finds the pull request's record through the merge's two parents. Such a push runs one build-only job that refreshes the branch's build caches. +- Pull requests and pushes run the same jobs. On `dev` both select components by their diff (a push against the branch's previous commit); pushes to `master` and pull requests into `master` select every component. Only pushes save caches. Cluster GPU Tests (report only) run whenever the cluster jobs run. +- Provider Unit Tests Summary is gone: each shard audits its own selections against `swift test list` and reports its own coverage, and the last shard checks that the plans cover the suite once. Cluster Metadata Checks run inside Cluster Focused Checks, which makes them part of the `Provider Tests` gate. +- A provider-only pull request now runs 2 Mac jobs instead of 4 (5 with an SDK input); a cluster pull request 7 instead of 11; the push of an already tested merge commit at most 1 build-only job instead of 12. +- The Swift build cache restores from a loose tier that ignores the CI recipe, so a workflow or CI script edit no longer makes every build cold, and then from a tier keyed only on the toolchain and the MLX pins, so a manifest change still restores the compiled MLX. A build that fails over a loose-tier entry builds once more from nothing. CI (master) restores only entries of its exact recipe. On Darkbloom hosts a push saves at most one build per lane and day. +- The MiMo metadata downloads are cached by their pinned SHA-256 and used only when their bytes match. +- The repository variable `DARKBLOOM_MACOS_LANES` caps the macOS jobs one run asks Darkbloom for; the rest use Blacksmith at once. diff --git a/changelog.d/ci-xcode-27-2-toolchain.md b/changelog.d/ci-xcode-27-2-toolchain.md index 29423fd9aa..99daa9bd19 100644 --- a/changelog.d/ci-xcode-27-2-toolchain.md +++ b/changelog.d/ci-xcode-27-2-toolchain.md @@ -5,4 +5,4 @@ - The toolchain step tries the image's Xcode, then each installed Xcode, and takes the first with SDK 27.2. When it selects another Xcode than the image's, it exports `DEVELOPER_DIR`, so Metal, `xcodebuild` and signing use the same Xcode. When no Xcode qualifies, it names the installed ones. - `PROVIDER_SDK_VERSION` is the SDK that was selected, not a fixed 27.0. A resumed release signs an unsigned build only when that build linked SDK 27.2. - `mise.toml` pins Swift 6.4.2. -- No provider code compares Dates with `>=` or `<=`. SDK 27.2 back-deploys these two operators. Pre-release macOS 27.2 builds (26B5091g) do not export them, and DevNet build `0.10.6-dev.branch.87` crashed in a loop on such a Mac. `scripts/check-date-comparisons.py` refuses the pattern in source. The release build refuses a binary that imports either symbol (`scripts/check-provider-weak-imports.py`). +- No provider code compares Dates with `>=` or `<=`. SDK 27.2 back-deploys these two operators. Pre-release macOS 27.2 builds (26B5091g) do not export them, and DevNet build `0.10.6-dev.branch.87` crashed in a loop on such a Mac. `scripts/check-date-comparisons.py` refuses the pattern in source. It runs in the `Provider Tests` gate of every CI run and in Release Integrity. The release build refuses a binary that imports either symbol (`scripts/check-provider-weak-imports.py`). diff --git a/changelog.d/cluster-advice-measured-first.md b/changelog.d/cluster-advice-measured-first.md new file mode 100644 index 0000000000..68445465a8 --- /dev/null +++ b/changelog.d/cluster-advice-measured-first.md @@ -0,0 +1,3 @@ +### The mode question trusts a measured mode over a predicted one + +- While one mode has served on the pair and another hasn't, `darkbloom cluster` now recommends the measured mode ("Recommended for Gemma 4 26B on these two Macs: Tensor parallel, the only one measured on these Macs so far.") instead of comparing two predictions. On two M5 Ultras the planner predicted Gemma's pipeline at 152 tokens/s and recommended it over tensor parallel, which had served at 111; the pipeline then served at 64. Through Darkbloom a mode that serves more requests at once still comes first. diff --git a/changelog.d/cluster-coordinator-queue-unblock.md b/changelog.d/cluster-coordinator-queue-unblock.md new file mode 100644 index 0000000000..6ff65fb9cf --- /dev/null +++ b/changelog.d/cluster-coordinator-queue-unblock.md @@ -0,0 +1,7 @@ +### A two-Mac pair answers Darkbloom's checks and cancels while a long prompt is read + +- When requests arrived while a pair was reading a long prompt, each one could take up to 30 s to be admitted, because both Macs answer at the end of their current prompt step, and they were admitted one after another. Meanwhile the leading Mac held back the Darkbloom messages that came after them: attestation checks, cancels and the next requests. On one pair a cancel took effect 20–29 s late, and a request waited 18 s before the leading Mac even read it. A late answer to an attestation check counts against the pair. +- The leading Mac now answers attestation checks as they arrive, takes in each new request as soon as it arrives (its prompt is still read after the one in progress), and keeps its reports of what the pair is serving up to date. +- A cancel now takes effect as soon as the admission in progress returns, not after every admission queued behind it. A cancelled request that was still waiting to be admitted is no longer admitted at all, and one that was being admitted never starts its prompt. A request already reading its prompt frees its place on the pair within one prompt step, as before. +- A two-Mac pair reading several long prompts no longer reports itself as crashed, which could end its serving. A pair is reported crashed only when a request is still waiting well past its own first-token allowance. +- Unchanged: a request that arrives during a long prompt still waits for the pair to admit it, and for that prompt before its own is read, so a short request can still time out before its first token. Such a request is safe to retry. diff --git a/changelog.d/cluster-follow-final-outcome.md b/changelog.d/cluster-follow-final-outcome.md new file mode 100644 index 0000000000..57a69f5c0e --- /dev/null +++ b/changelog.d/cluster-follow-final-outcome.md @@ -0,0 +1,14 @@ +### The joining Mac ends with the leading Mac's outcome + +- While the pair is offered to Darkbloom and waits for Apple's verification or for the coordinator, the joining Mac now + keeps waiting. It shows a live row such as "Waiting for Apple to verify this Mac (Darkbloom retries by itself) · 2 of + 15 min". Before, it judged the pair by its own wait: on a real pair it ended with "✗ Not serving: This Mac isn't + verified by Apple yet …" while the leading Mac showed "✓ Serving … through Darkbloom on both Macs" 41 s later. +- Its last word is the leading Mac's: the same ✓, or the same ✗ with its next step. When the leading Mac's start + ends with ✗ on its screen, it publishes that ✗ in its status, and the joining Mac shows it named from its own side + ("This Mac isn't logged in to Darkbloom …"). +- "Choose Retry on the other Mac" appears only under that ✗, since the leading Mac's screen then shows Retry. It is no + longer said while a part restarts by itself. +- With a leading Mac on an earlier release, which publishes no outcome, the joining Mac waits until the stage's + 15 minutes run out. It then ends with "✗ Not serving: The other Mac (…) didn't say how its start ended within + 15 minutes.", the last state it saw, and where to look. diff --git a/changelog.d/cluster-follow-no-false-x.md b/changelog.d/cluster-follow-no-false-x.md new file mode 100644 index 0000000000..3b1349eab3 --- /dev/null +++ b/changelog.d/cluster-follow-no-false-x.md @@ -0,0 +1,8 @@ +### The joining Mac no longer shows ✗ while the leading Mac registers the pair + +- Right after both Macs loaded the model, the joining Mac's window could end with "✗ Not serving: not offered to Darkbloom + (no cluster approval is attached to its setup)" and "Choose Retry on the other Mac". Meanwhile the leading Mac went on + to register the pair and showed ✓ through Darkbloom. The joining Mac now keeps following while the leading Mac's start + still runs, and ends with the leading Mac's ✓ or ✗. +- When the leading Mac's ✗ says the pair answers on its local API, the joining Mac's copy keeps "(no Darkbloom + traffic)". diff --git a/changelog.d/cluster-follow-wait-says-why.md b/changelog.d/cluster-follow-wait-says-why.md new file mode 100644 index 0000000000..cacccdb394 --- /dev/null +++ b/changelog.d/cluster-follow-wait-says-why.md @@ -0,0 +1,24 @@ +### The Mac that joins a cluster says what it waits for + +- While the Mac that joined waits for the leading Mac to start, its line now says what the leading Mac is waiting on: + Allow on its Local Network prompt, a model choice on its screen, a login, Try again, a copy, or the start itself. + It also says how long it has waited out of 15 minutes, for example "Waiting for the other Mac (Apple M5 Max, + 128 GB): it's waiting for Allow on its Local Network prompt · 2 of 15 min (q leaves)". It only knows this when the + leading Mac runs this release or a later one. With an older leading Mac it keeps the general words. +- The live line always fits the window, even after the window is made narrower. Before, a long line could wrap and + leave a new copy of itself on screen at every redraw. A plain transcript (`NO_COLOR`, `TERM=dumb`, a pipe) gets one + line per change, never one per tick. +- If the two Macs run different Darkbloom builds, the waiting Mac now stops at once with + "✗ Not serving: The two Macs run different Darkbloom builds." It names both versions and says which Mac needs + `darkbloom update`. The leading Mac ends with the same ✗. Any other refusal by the leading Mac ends the wait + at once too, with its reason. +- If nothing starts within 15 minutes, the wait ends with a ✗. It says what the leading Mac was last doing, what to + do on it, and how to check that both Macs run the same build. Before, it ended with a plain sentence. +- The leading Mac's wait for Allow on its Local Network prompt now shows a timer and gives up after 10 minutes. It + ends with a ✗ that says where to turn Darkbloom on, and what to do when Darkbloom isn't in the list: macOS asks on + that Mac's screen the next time it connects. +- Every live line is one row: in the cluster screens, and in `darkbloom start`, `stop`, `restart` and `update`. + - A long reason is shortened and keeps its time at the end. Its newlines and tabs become spaces. + - Line wrap is off while the row is drawn, so a terminal that draws a character wider can't wrap it. + - Before, the loading line could repeat across the window at every turn of its petal ("Loading Gemma 4 26B on both + Macs (starting; this Mac's part ended (exit 1: … ▖ Loading Gemma 4 26B …"). diff --git a/changelog.d/cluster-member-progress.md b/changelog.d/cluster-member-progress.md new file mode 100644 index 0000000000..34913ef3f9 --- /dev/null +++ b/changelog.d/cluster-member-progress.md @@ -0,0 +1,16 @@ +### Both Macs of a pair show how far the start is + +- While the parts load, the leading Mac's screen shows one row per Mac with its share of the layers and the time: + "This Mac: ready (layers 0–46)", "The other Mac: loading its share (layers 47–93)", or "part ended (exit 1); + starts again in 5 s". A row that doesn't fit the window gets shorter instead of being cut. A plain transcript + (`NO_COLOR`, `TERM=dumb`, a pipe) says each row once, when it changes. +- The leading Mac now publishes the start's step in its status: downloading, copying, stopping the model that served, + loading, testing, or registering with Darkbloom. It also publishes a copy's or download's bytes as the sending Mac + counts them, and which Mac's part is ready. The Mac that joined uses this to open its own "4/4 Start" heading + and show, right under it, the same step, a real progress bar + during a copy or download, and the same per-Mac rows. While the model loads there is no percentage, because + Darkbloom has no measure of it: you see a turning mark and the time. +- On the Mac that joined, each new step gets the full 15 minutes again. A long copy no longer ends the wait with a ✗ + while its bytes still move. +- A Mac with an older Darkbloom ignores the new fields, and with an older leading Mac the joining Mac keeps its general + words. diff --git a/changelog.d/cluster-mode-question-and-local-network-row.md b/changelog.d/cluster-mode-question-and-local-network-row.md new file mode 100644 index 0000000000..be2a05eaa6 --- /dev/null +++ b/changelog.d/cluster-mode-question-and-local-network-row.md @@ -0,0 +1,37 @@ +### Two-Mac cluster: the mode question shows what loads, and Local Network hints name the row macOS shows + +- When you choose how both Macs split a model, each way now shows the split that loads, and the start loads exactly + that plan. Before, with nothing serving, GLM-5.3-Flash's pipeline was offered as "this Mac 1 layer / the other Mac + 44 layers" and loaded as 44 / 1. A way chosen on the Mac that joined now loads too; before, the leading Mac loaded + its own first choice. +- Two Macs of the same hardware (chip, GPU cores and macOS build) are planned at the same speed until the pair has + served the model. Before, each Mac's own one-second speed sample decided, and a sample 0.1% slower (taken just after + another app's pair stopped) offered GLM-5.3-Flash's pipeline as "1 layer / 44 layers" on two M5 Ultras, where 24 / + 21 is the split once the pair has served. +- Each way also says how many requests it serves at once: "serves one request at a time" for GLM-5.3-Flash's + pipeline, "serves up to 8 requests at once" for its tensor parallel. On a GLM-5.3-Flash pair, choose tensor + parallel where it fits (two 128 GB Macs fit only the pipeline): through Darkbloom its pipeline turns every other + request away as "at capacity". +- Each way's line fits the window as it is now, and the list draws again when the window is resized. Before, a line + was cut at the width the window had when the question opened, such as "… the other Mac 44 layers) · ser…" at 120 + columns, and it stayed cut after widening. A line that's too wide drops the split first, then what each Mac does. + The way's name and how many requests it serves at once always stay. +- The Local Network hints on the setup screens, in `status` and `cluster status`, and in the log of the process that + dials the other Mac name the row System Settings shows, "Darkbloom". The DevNet app's row has that name too, since + both apps share one bundle ID. Where macOS never recorded an answer for the app and lists no row, the hints say to + click Allow when macOS asks on that Mac's screen. +- The question recommends one way for these two Macs and says why: the only one that fits now, the one that serves + more requests at once through Darkbloom, or the clearly faster one. It is the same on both Macs' screens, and Enter + takes it. When nothing fits or nothing is known yet, it recommends none and says why. +- That recommendation is the question's first line and names the model, for example "Recommended for Gemma 4 26B on + these two Macs: Tensor parallel", with the mode in bold in a colour terminal; in a narrow window the reason is + shortened, never the names. +- `darkbloom uninstall` and `darkbloom cluster link --remove` undo every Thunderbolt port Darkbloom set up under one + macOS approval, instead of stopping at "More than one port qualifies …; choose one". Each port's own network service + is removed before the port goes back into its bridge (it used to end up in both), the removal stops at the first + command that fails and says which ports are left, and an uninstall that already forgot the pairing says what is + left and that running `darkbloom uninstall` again finishes it. +- On a Mac whose Thunderbolt ports start in the Thunderbolt Bridge, such as a MacBook, Darkbloom's network service is + the port's only one, which macOS refuses to remove with its usual command. The removal now takes it out through + macOS's network preferences, after checking its name and port, and setting up the cable port again reuses + Darkbloom's existing service instead of removing and remaking it. diff --git a/changelog.d/cluster-mode-question-no-speeds.md b/changelog.d/cluster-mode-question-no-speeds.md new file mode 100644 index 0000000000..a6f4786176 --- /dev/null +++ b/changelog.d/cluster-mode-question-no-speeds.md @@ -0,0 +1,4 @@ +### The mode question recommends without quoting speeds + +- `darkbloom cluster`'s mode question no longer shows tokens per second. The recommendation says why in words ("Recommended for Gemma 4 26B on these two Macs: Pipeline, faster here.") instead of "faster here (about 56 against 52 tokens/s, predicted)", and each mode's line drops its "N tok/s measured" or "not measured on these Macs yet". A re-plan's "Planned in the mode chosen" line drops the planner's predicted speed too. The measured or predicted speeds still decide which mode is recommended. +- A mode that serves more requests at once and is as fast now says "serves up to 8 requests at once and is as fast here" instead of calling itself faster. diff --git a/changelog.d/cluster-pair-batch-replan-backoff.md b/changelog.d/cluster-pair-batch-replan-backoff.md new file mode 100644 index 0000000000..b8881f83ad --- /dev/null +++ b/changelog.d/cluster-pair-batch-replan-backoff.md @@ -0,0 +1,5 @@ +### A two-Mac pair serving locally no longer reloads every half minute when requests queue + +- A Gemma 4 pair in tensor parallel, serving locally with requests waiting, tried every 30–40 s to switch to an 8-request pipeline it could not serve the same way (only tensor parallel returns token logprobs). Each attempt stopped serving, failed, and reloaded the model on both Macs for about 15 s, so queued requests waited minutes. A replacement that would change what the API offers is no longer proposed. +- A wider setup that fails to start is now remembered: the same width is not tried again for that setup for 2 minutes, then 4, up to 30, while a changed setup is tried at once. +- Known limitation, now documented: a Gemma 4 pair in tensor parallel serves one request at a time, as its mode question says, and a request cancelled while its prompt is read keeps that one place until the prompt is read (about a minute for a 16K-token prompt). diff --git a/changelog.d/cluster-pair-lanes-during-admission.md b/changelog.d/cluster-pair-lanes-during-admission.md new file mode 100644 index 0000000000..bffee7346b --- /dev/null +++ b/changelog.d/cluster-pair-lanes-during-admission.md @@ -0,0 +1,5 @@ +### A two-Mac pair keeps its requests streaming while it admits another + +- On a pair that serves several requests at once (GLM-5.3-Flash in tensor parallel serves up to 8), every running request's tokens waited while the pair admitted a new one. Under steady traffic, streaming fell to a few tokens a second. Running requests now keep streaming during an admission. +- A request the pair is admitting, or about to admit, now counts as a place taken in what the pair reports to Darkbloom. Before, Darkbloom could send one more request than the pair had room for, and the pair refused it ("provider capacity unavailable"). +- A cancel now takes effect at once, even while the pair admits another request. diff --git a/changelog.d/cluster-pair-version-split-follows-forward.md b/changelog.d/cluster-pair-version-split-follows-forward.md new file mode 100644 index 0000000000..9f21b0eb80 --- /dev/null +++ b/changelog.d/cluster-pair-version-split-follows-forward.md @@ -0,0 +1,6 @@ +### Two-Mac pairs: the Macs no longer stay on different versions + +- **Pair owners:** after an update, check that `darkbloom --version` shows the same version on both Macs; to update at once, run `darkbloom update` on **both** Macs. If either Mac ever ran a plain `darkbloom start` before 0.10.8, run `darkbloom stop --solo` on that Mac first. +- From 0.10.9 on, when one Mac of a `darkbloom cluster` pair already runs a newer release, or is updating to one, the other Mac's cluster service notices within a minute and updates right away, instead of waiting for the pair's next update slot. This covers a Mac that updated alone (single-Mac serving or `darkbloom update`), or a Mac that was asleep at the slot. Each newer release gets one immediate try; after that the Mac tries again at the update slots as before. A release quarantined on that Mac is never installed this way. With automatic updates off, the log says which version the other Mac runs and to run `darkbloom update` on this Mac. +- The provider's background updater no longer leaves a pair split: when it updates a Mac whose pair runs there, it asks the cluster service to restart into the release together with the other Mac. The watchdog doesn't install a release while the pair runs on that Mac. A Mac that only serves alone, its pair gone, simply updates. +- When the two Macs run different versions (both 0.10.9 or later), both screens say so at once: "The two Macs run different Darkbloom versions: the other Mac (…) runs 0.10.7, this Mac runs 0.10.8", with the Mac to run `darkbloom update` on. The start no longer loops: it offers to check the versions again, and a Retry checks them first. `darkbloom status`, `darkbloom cluster status --json` (`reason` and `next`) and the cluster service's wait lines also name the other Mac's version and the command. The version split is shown before single-Mac serving when both apply. DevNet builds say `darkbloom-dev`. diff --git a/changelog.d/cluster-pipeline-prediction-measured-share.md b/changelog.d/cluster-pipeline-prediction-measured-share.md new file mode 100644 index 0000000000..566100b223 --- /dev/null +++ b/changelog.d/cluster-pipeline-prediction-measured-share.md @@ -0,0 +1,7 @@ +### Two-Mac cluster: a pipeline is no longer predicted faster than a share its Mac measured + +- On two M5 Ultras the mode question recommended Gemma 4 26B's pipeline, "about 183 against 107 tokens/s, + predicted"; 59.9 and 105.1 tok/s were served. Until a model has been measured whole on a Mac, its pipeline speed + came from the Mac's device index alone, which leaves out every per-token cost. Where the Mac has measured a share of + the model (a tensor-parallel load's share probe, or requests served in tensor parallel), the whole model is now + planned at least as slow as that share plus the rest of its weights, so tensor parallel is recommended there. diff --git a/changelog.d/cluster-role-in-title.md b/changelog.d/cluster-role-in-title.md new file mode 100644 index 0000000000..6f64dead6d --- /dev/null +++ b/changelog.d/cluster-role-in-title.md @@ -0,0 +1,6 @@ +### Each Mac of a pair names its part at the top + +- On a paired Mac, `darkbloom cluster` (and the screen that `start`, `stop`, `restart` and `update` open in a terminal) + now opens with "Darkbloom cluster · Leading Mac" or "Darkbloom cluster · Joining Mac", beside the Darkbloom mark or + as the first line of plain output. You can always tell which Mac leads. A first setup, before the two Macs pair, + still says "Darkbloom cluster" alone; the pairing then says which Mac leads. diff --git a/changelog.d/cluster-scope-switch-public-plan.md b/changelog.d/cluster-scope-switch-public-plan.md new file mode 100644 index 0000000000..8148cbb6e3 --- /dev/null +++ b/changelog.d/cluster-scope-switch-public-plan.md @@ -0,0 +1,8 @@ +### Switching a pair to Darkbloom plans it for Darkbloom, and no screen claims it serves there before it does + +- Affected: a pair serving locally only, switched with **Switch to serving through Darkbloom** in `darkbloom cluster`. The switch kept the plan made to serve locally. For Qwen3.8 27B in tensor parallel that plan carries Qwen's speculative assistant, which only local serving uses, on any two Macs, and on two different Macs (an M3 Ultra and an M5 Max) unequal shares, such as 2:3. The coordinator can't register either, so the pair was never offered. Yet the screen showed ✓ "Serving … through Darkbloom on both Macs", and `darkbloom status` and `darkbloom cluster status` said `serving`, exit 0, "earning through Darkbloom". Since 0.10.8's login check, "Serve locally only" at the first setup also makes such a local plan, so a pair set up before both Macs were logged in hit this when it switched. +- The switch now plans the model again for Darkbloom, without the assistant and with equal shares. It adopts that plan before anything stops, starts both Macs, and asks the coordinator for the pair, as a start does. The screen says ✓ only once the coordinator has the pair. +- A pair set to serve through Darkbloom that the coordinator doesn't take (no approval, a refused one, or a coordinator that can't be reached) serves on the leading Mac's local API only. Both Macs now say so: `✗ Not serving: not offered to Darkbloom ().`, then where it answers meanwhile. `darkbloom cluster status` reads it as `not_serving`, exit 3, with what to do next. No line says "earning through Darkbloom" any more. +- Choosing the serving model again on such a pair asks once, then starts it again from a plan for Darkbloom. Before, it said "✓ Already serving" and planned nothing. +- When a plan can't be offered (unequal shares, or Qwen's speculative assistant), the reason now says to choose the model again in `darkbloom cluster` (`darkbloom-dev cluster` in the DevNet app). It said to press m, but no item of the list starts with m, so the key did nothing. +- `darkbloom cluster status` and the other Mac's window no longer repeat the setup screen's "Then choose Retry, or serve locally only now." after a reason such as "isn't verified by Apple yet": neither has a Retry. `Next:` says what to do. diff --git a/changelog.d/cluster-screen-sharing-note.md b/changelog.d/cluster-screen-sharing-note.md new file mode 100644 index 0000000000..44fb40cb08 --- /dev/null +++ b/changelog.d/cluster-screen-sharing-note.md @@ -0,0 +1,6 @@ +### `darkbloom cluster` says up front that its prompts are on each Mac's own screen + +- Setting up a pair raises macOS prompts on each Mac's own screen: the password for the cable port, Allow for Local Network, and Yes to the pairing code. `darkbloom cluster` now opens with that on both Macs, and says to open Screen Sharing first to a Mac with no display, such as a Mac Studio or a MacBook with its lid closed. +- Once paired, the line for the other Mac's Local Network prompt names that Mac and says to use Screen Sharing if it has no display. +- Over SSH, macOS can't show its approval prompt. `darkbloom cluster` now says so before its first step, before anything is tried, and offers Quit (nothing changed) or to go on over SSH. `darkbloom cluster link --fix` and `--remove` say it before they start and no longer wait for a prompt that cannot appear. `darkbloom uninstall` over SSH stops before it changes anything when a cable port setup is left to undo, instead of stopping part way. +- The first line of the setup's Connect step now reads "Allow macOS permissions." (over SSH: "Allow macOS permissions here and on this Mac's screen (Screen Sharing if headless).") instead of naming the password and Local Network prompts. diff --git a/changelog.d/cluster-served-speed-out-of-limits.md b/changelog.d/cluster-served-speed-out-of-limits.md new file mode 100644 index 0000000000..b94ffde4df --- /dev/null +++ b/changelog.d/cluster-served-speed-out-of-limits.md @@ -0,0 +1,5 @@ +### A pair keeps a model on its list after a request longer than the model's limit + +- A pair no longer loses a model from its list after serving a request longer than the model's limit. On two M5 Ultras, Qwen 3.8 27B vanished from `darkbloom cluster`, and `darkbloom start` could not start it, after the pair served prompts of 71,545 to 94,423 tokens in tensor parallel. The next plan now skips each such served request and still uses every other request the pair served. It says so in one line, for example "Skipped 7 speed records longer than the 65,536 tokens planning covers (the longest was 94,522)". +- If the speed-up a speculative pipeline served can't be recorded, the plan now says so in one line instead of failing. That pipeline is then predicted at its plain speed, so the plan may choose another mode even where the speculative pipeline served faster. +- A model approved for clusters that can't be offered on these two Macs now says why, in one line above the model list, instead of disappearing. For example: "Qwen 3.8 27B: not offered on these two Macs: the plan for it failed (…)". diff --git a/changelog.d/cluster-solo-block-both-screens.md b/changelog.d/cluster-solo-block-both-screens.md new file mode 100644 index 0000000000..9b2c0f9a3b --- /dev/null +++ b/changelog.d/cluster-solo-block-both-screens.md @@ -0,0 +1,6 @@ +### Both Macs say when single-Mac serving blocks the pair + +- The Mac that joined now shows the same ✗ as the leading Mac when single-Mac serving blocks the pair. The ✗ names its own single-Mac provider and process, and gives `darkbloom stop --solo`. It also says that the leading Mac's screen offers to stop it and start the pair. Before, that window said "registering with the coordinator" for minutes. Once single-Mac serving stops, it follows the start by itself. +- Each Mac reports single-Mac serving as soon as it runs, not only once the pair wants to start. So the leading Mac sees it before anything starts. +- The leading Mac's part no longer starts and ends every 38 seconds while the other Mac reports single-Mac serving. It waits until that changes. The same rule covers any reason the other Mac reports that its part can't start. +- In `darkbloom cluster status`, `Next:` now says what to run on both Macs instead of "Both Macs keep trying by themselves". A `darkbloom start` run from a script ends its wait at once for this reason. diff --git a/changelog.d/cluster-solo-block-stopped-pair.md b/changelog.d/cluster-solo-block-stopped-pair.md new file mode 100644 index 0000000000..61716fd3e9 --- /dev/null +++ b/changelog.d/cluster-solo-block-stopped-pair.md @@ -0,0 +1,3 @@ +### The single-Mac block shows on both Macs when the pair is stopped + +- When you start a stopped pair from the leading Mac and single-Mac serving blocks it, the joining Mac's `darkbloom cluster` screen now shows the same ✗ instead of "Stopped … Close". It names the provider and process, gives `darkbloom stop --solo`, and says that the leading Mac's screen offers to stop it. Both Macs' `darkbloom cluster status` say the block too (`not_serving` with its reason, exit 3) while single-Mac serving runs, instead of `stopped` with no reason. diff --git a/changelog.d/cluster-solo-provider-blocks-pair.md b/changelog.d/cluster-solo-provider-blocks-pair.md new file mode 100644 index 0000000000..721f3d3853 --- /dev/null +++ b/changelog.d/cluster-solo-provider-blocks-pair.md @@ -0,0 +1,7 @@ +### A pair says when single-Mac serving blocks it, and offers to stop it + +- When single-Mac serving (`darkbloom start --solo`, or a plain `darkbloom start` from before 0.10.8) runs on either Mac of a two-Mac pair, the pair can't start: both use the Mac's one serving lock. `darkbloom cluster` now checks both Macs before it starts the pair. It shows one ✗ that names the Mac and the process, with the command to run on that Mac: `darkbloom stop --solo`. It also offers "Stop single-Mac serving on both Macs and start the pair", and stops nothing unless you choose it. +- The pair no longer loops "this Mac's part ended … and starts again by itself" for this cause. Each Mac's cluster service waits for single-Mac serving to stop, and its status names the provider. The other Mac's line then gives that reason instead of "its part is running, no error reported". +- The lock's message names its owner correctly. It used to say "another update operation owns the lock (pid N, provider-instance)" for a provider that was serving. It now says "a single-Mac Darkbloom provider (process N) is serving on this Mac". An update, a rollback and a stop or restart are each named as such. +- The pair's advice when single-Mac serving runs, and the refusal of the pair's part, now say `darkbloom stop --solo`. On a paired Mac, plain `darkbloom stop` stops the pair and leaves single-Mac serving running. +- On a Mac whose pair is started, `darkbloom update` restarts the pair, and the watchdog no longer revives a single-Mac provider job that was left set up there. Before, the update restarted that job first and never restarted the pair. That job then took the serving lock, and the pair could not start again. The update says the job was left as it was and how to remove it. diff --git a/changelog.d/cluster-solo-steps-aside.md b/changelog.d/cluster-solo-steps-aside.md new file mode 100644 index 0000000000..d400c7200c --- /dev/null +++ b/changelog.d/cluster-solo-steps-aside.md @@ -0,0 +1,5 @@ +### Single-Mac serving steps aside for a started pair, and the pair goes back to Darkbloom at once + +- When the pair is started and wants this Mac's part, but single-Mac serving holds the Mac's serving lock and nobody chose it since the pair was started, the cluster service now stops it the way `darkbloom stop --solo` does. It logs why, and `darkbloom status` says so too. This covers single-Mac serving restarted by 0.10.8's updater during the update to 0.10.9, by a login, or by the watchdog. It doesn't step aside when you chose single-Mac serving yourself: `start --solo`, the terminal's "Serve on this Mac alone" and serving alone from the app record that choice, and starting the pair or `stop --solo` on that Mac clears it. A Mac updated from 0.10.8 has no recorded choice, so the started pair wins. It never steps aside while the pair isn't running there (serving alone stays as it is). +- Parts that ended because single-Mac serving held a Mac's serving lock no longer count toward the pair falling back to local-only serving. Once single-Mac serving stops, through the offer, `stop --solo` or a step aside, the count resets. An approval set aside for "parts kept ending" is offered to Darkbloom again at once, instead of after up to an hour. +- When the two Macs run different versions, the start's ✗ says that first, not the single-Mac block. diff --git a/changelog.d/cluster-solo-stop-on-the-right-mac.md b/changelog.d/cluster-solo-stop-on-the-right-mac.md new file mode 100644 index 0000000000..149f6bbc78 --- /dev/null +++ b/changelog.d/cluster-solo-stop-on-the-right-mac.md @@ -0,0 +1,6 @@ +### `stop --solo` on the wrong Mac finds the right one + +- If `darkbloom stop --solo` finds no single-Mac serving on this Mac but finds it on the other Mac of the pair, it names that Mac and its process and offers to stop it there. `--yes` stops it without asking, for scripts. It no longer points to plain `darkbloom stop`, which stops the pair and leaves single-Mac serving running. +- While single-Mac serving blocks a started pair whose other Mac answers, `darkbloom start` starts the pair (in a terminal, the screen that offers to stop it). It no longer offers "Serve on this Mac alone", which would recreate the block. +- "Single-Mac serving is set up" now means its job is loaded, not that its file exists. After `stop --solo`, a pair whose other Mac goes quiet no longer gives up its part for single-Mac serving that can't come back. +- An orphaned pair part, one that outlived its cluster service, is never reported as single-Mac serving. `stop --solo` can't stop it, so you're never told to try. diff --git a/changelog.d/cluster-status-part-ended-reason.md b/changelog.d/cluster-status-part-ended-reason.md new file mode 100644 index 0000000000..4287bc57f8 --- /dev/null +++ b/changelog.d/cluster-status-part-ended-reason.md @@ -0,0 +1,3 @@ +### `cluster status` says why a load keeps starting again + +- While a Mac's part of the pair keeps ending and starting again during a load, `darkbloom cluster status` and `cluster status --json` now give that end as the reason, as the start's screen says it, for example "this Mac's part ended (exit 1: deadline) and starts again by itself". Before, both Macs said only `loading`, with no reason. diff --git a/changelog.d/cluster-steps-fold.md b/changelog.d/cluster-steps-fold.md new file mode 100644 index 0000000000..975e5a8970 --- /dev/null +++ b/changelog.d/cluster-steps-fold.md @@ -0,0 +1,10 @@ +### The cluster screen folds each finished step to one line + +- In a color terminal, `darkbloom cluster` (and the screen that `start`, `stop`, `restart` and `update` open on a paired + Mac) now folds each step to one line once the next one begins, for example "✓ 2/4 Pair (1 min 12 s)". The screen + no longer runs down with a line for every update. +- The lines that stay are the pairing code, each question with the answer you gave, any ✗ with its next steps, and the + final outcome. A step taller than the window stays as it was. +- Nothing is lost: each run's whole flow, line by line, goes to a log file in `~/.darkbloom/cluster-setup/screens/`. + Its path is the last line ("Full log: …"), and a ✗ names it too. +- Plain output (pipes, logs, `NO_COLOR`, `TERM=dumb`) doesn't change. diff --git a/changelog.d/cluster-stop-service-other-mac-off.md b/changelog.d/cluster-stop-service-other-mac-off.md new file mode 100644 index 0000000000..f5f228e932 --- /dev/null +++ b/changelog.d/cluster-stop-service-other-mac-off.md @@ -0,0 +1,10 @@ +### `darkbloom cluster stop --service` works when the other Mac is already off + +- On the Mac that leads, `darkbloom cluster stop --service` failed (exit 1) when the other Mac's cluster service was + already off or did not answer, and left this Mac's cluster service and login agent running; only + `--local-only` finished it. +- Once this Mac has stopped serving, its cluster service now stops and leaves login anyway, and the command says what + happened on each Mac: `This Mac stopped serving.`, then that the other Mac did not answer and was not asked to stop + (its cluster service may already be off), and to run `darkbloom cluster stop --service` there too if it is still on. +- When this Mac's own part has not finished releasing its memory, the command still fails and keeps the service, as + before. diff --git a/changelog.d/cluster-update-member-waits-for-leader-setup.md b/changelog.d/cluster-update-member-waits-for-leader-setup.md new file mode 100644 index 0000000000..fd9565b74a --- /dev/null +++ b/changelog.d/cluster-update-member-waits-for-leader-setup.md @@ -0,0 +1,11 @@ +### The second Mac of a pair waits for the new setup after an update + +- After the pair restarts into a new release, the Mac that follows no longer starts its part from the setup it saved + for the previous release. That setup still names the previous release's files, so the part ended within a second, + again and again ("Installed input identity or SHA-256 differs"), until the leading Mac sent the setup for the new + release: on the M5 Ultra pair's update to 0.10.8, six times in about 2 minutes. +- It now waits for the leading Mac's setup and says so once: `this Mac runs Darkbloom v, but its saved setup + is for an earlier build: waiting for the other Mac's setup for v (the old setup is not started)`. Every + check of the installed files stays as strict; a setup that does not match them is never loaded. +- The leading Mac, waiting for both Macs to run the new release, checks again every 5 seconds instead of every + minute, so it sets the pair up again sooner. diff --git a/changelog.d/cluster-wait-honest-and-leavable.md b/changelog.d/cluster-wait-honest-and-leavable.md new file mode 100644 index 0000000000..29ae483390 --- /dev/null +++ b/changelog.d/cluster-wait-honest-and-leavable.md @@ -0,0 +1,5 @@ +### The two-Mac setup's wait for the coordinator says the real cause, can be left, and the joining Mac follows a model change + +- When a pair offered to Darkbloom isn't paired within 15 minutes, both Macs are registered and authorized, and the coordinator gave no reason, the ✗ now says "The coordinator didn't pair both Macs within 15 minutes". If the coordinator's reason is known, that reason is shown instead. Apple verification is named only while a Mac actually reports its App Attest authorization missing. Before, a reason seen once early in the wait could become the ✗, and two authorized Macs could read "isn't verified by Apple yet". +- q or Esc now leaves the wait for the coordinator: both Macs stay registered and keep trying by themselves, and the screen says to check with `darkbloom status`. A `darkbloom cluster stop` from another window or the other Mac ends the wait at once on both Macs with "Stopped (by `darkbloom cluster stop` …)", instead of waiting on with rows that go back to "registering". +- `darkbloom cluster` on the Mac that joined now follows any start the leading Mac runs, including a model or mode change: the steps, the bytes bar, each Mac's row and the final outcome. Before, it showed "This Mac runs its part by itself … Close". diff --git a/changelog.d/gemma-pair-eligibility.md b/changelog.d/gemma-pair-eligibility.md new file mode 100644 index 0000000000..06e3546d33 --- /dev/null +++ b/changelog.d/gemma-pair-eligibility.md @@ -0,0 +1,5 @@ +### A pair the coordinator won't pair for its model says why + +- A two-Mac pair offered through Darkbloom for a model that the coordinator's model catalog doesn't list waited on "waiting for the coordinator to pair both Macs" until the 15-minute limit, and `darkbloom cluster status` showed `loading` for as long as it ran. The coordinator refuses such a pair every time it checks and tells neither Mac. On DevNet this hit Gemma 4 26B and every other model that has a DevNet pair approval but no DevNet catalog entry. +- Each Mac's part now reads the coordinator's public model catalog once after it registers. If the catalog doesn't list the model, the part says so: "The coordinator does not pair Macs for : its model catalog does not list it". The setup screens on both Macs show that reason at once, and `darkbloom cluster status` and `darkbloom status` report the pair as not serving with that reason instead of `loading`. A catalog that can't be read changes nothing. The part keeps running, so a pair whose model is added to the catalog later still forms. +- A pair that the coordinator paired, but under an approval it serves only to this account's own requests, no longer shows "✓ Serving … through Darkbloom". On DevNet a Gemma 4 26B pair under a DevNet model approval showed ✓ while every public request was refused because the pair was not public. The coordinator serves the public only from a pair under a release's build-pinned approval, for a model the release approves for public pairs and in a mode it approves. Each Mac's part now checks its saved approval against that rule. Both screens and `darkbloom cluster status` say "Not serving publicly: the coordinator paired both Macs but doesn't send public requests to this pair (…)" and what to do: update both Macs to a release that approves the model, choose an approved model, or choose an approved mode. A pair that meets the rule still shows ✓ once it serves; the provider doesn't see the coordinator's other public-serving checks. diff --git a/changelog.d/glm-pair-128gb-load.md b/changelog.d/glm-pair-128gb-load.md new file mode 100644 index 0000000000..d4aca91bbc --- /dev/null +++ b/changelog.d/glm-pair-128gb-load.md @@ -0,0 +1,7 @@ +### GLM-5.3-Flash runs on two 128 GB Macs + +- Two M5 Max Macs with 128 GB each now load and serve GLM-5.3-Flash together, about half the model on each Mac. Before, `darkbloom cluster` refused the pair even with plenty of free memory, because each Mac set aside room for the longest possible request before loading. +- Each Mac now loads its half on what loading needs, and each request is checked against the memory free when it arrives. If a Mac is busy, the pair serves shorter requests and answers a longer one with a retryable "busy" error before it starts, never by running out of memory. Closing large apps brings back the full context. +- New: `darkbloom cluster gpu-limit` lets the GPU of any Apple silicon Mac with 128 GB or more keep more memory (its memory less 16 GiB: 112 GiB on a 128 GB Mac), an M4 Max or M3 Ultra as well as an M5, which leaves room for long requests. Run it on each Mac: it asks you once, then macOS asks for an administrator password, and the setting stays after a restart. `darkbloom cluster gpu-limit --undo` puts macOS's default back. Darkbloom never changes the limit on its own. After macOS approves, the command reads the setting back and shows ✓ only if it took effect; otherwise it shows ✗, what is off and what to run next. +- When a Mac's GPU limit is what stops a plan, the plan now says so and names that command on the Macs it runs on. A Mac that cannot load its part says which memory it is short of. +- `darkbloom cluster` offers only the ways a pair can actually run GLM-5.3-Flash: on two 128 GB Macs, including an M4 Max with an M5 Max, that is the pipeline. When nothing fits as the Macs are, the model's row says either "Needs `darkbloom cluster gpu-limit` first" (with the Mac and the figures) or "Needs more memory" with the reason, instead of the old "Too large … even with every application closed". The plan counts a GPU-limit raise only on Macs the command runs on (Apple silicon with 128 GB or more), so it never asks for a step that would be refused; Intel Macs and Macs under 128 GB are refused with the reason, and a Mac that does not report its GPU limit is never changed. diff --git a/changelog.d/mimo-tensor-parallel-load-reads.md b/changelog.d/mimo-tensor-parallel-load-reads.md new file mode 100644 index 0000000000..7b64214a59 --- /dev/null +++ b/changelog.d/mimo-tensor-parallel-load-reads.md @@ -0,0 +1,3 @@ +### MiMo-V2.6-Flash tensor parallel now loads in time + +- Each Mac read its half of MiMo's expert weights in about 100 million tiny pieces, which took over an hour, so the load always ran out of time and both Macs showed "Loading" until "this Mac's part ended (exit 1: deadline)". The pieces that sit next to each other on disk are now read together, which takes seconds. The bytes loaded, and the memory used to read them, are unchanged. diff --git a/changelog.d/unpaired-mac-serves-normally.md b/changelog.d/unpaired-mac-serves-normally.md new file mode 100644 index 0000000000..930689686c --- /dev/null +++ b/changelog.d/unpaired-mac-serves-normally.md @@ -0,0 +1,9 @@ +### A Mac that stopped clustering serves normally again + +- In 0.10.8, a Mac that had been in a two-Mac pair could show as online but get no requests. Its cluster service still had the pair's saved start, so it kept running its part of a pair that no longer formed. That part registers only as a pair member, and ordinary requests never go to it. `darkbloom start`, the app's Go Online and Autopilot enroll then acted on the pair, or were refused, so there was no simple way back. +- Whether the pair runs on a Mac now comes from what actually runs: the other Mac answering over the cable, and the pair serving. It no longer comes from the saved start alone. +- When the pair doesn't run on a Mac, `darkbloom start` serves that Mac alone. It first stops the leftover part, then says so in one line. The same goes for `darkbloom start --solo`, `start --model`, the app's Go Online and `darkbloom autopilot enable`. In a terminal, `darkbloom start` asks whether to serve this Mac alone or start the pair. Serving alone is the default when the other Mac isn't answering. While the other Mac answers but the pair hasn't served yet (a large model may still be loading), only `start --solo` and that choice stop the pair's part on this Mac. The pairing stays, and `darkbloom cluster` starts the pair again. +- `darkbloom stop` and `darkbloom restart` act on what runs on that Mac. `darkbloom update` and the watchdog bring back single-Mac serving there. On a Mac whose pair does run, they still protect the pair as before. +- A part whose other Mac hasn't answered for 15 minutes stops by itself and frees the Mac. `darkbloom status` says why, with the command to serve alone. The part starts again when the other Mac answers. A reboot of a few minutes doesn't break the pair, and time a Mac spends asleep doesn't count toward the 15 minutes. +- **Still on 0.10.8:** to serve a Mac alone again, run `darkbloom cluster pair --status` (it shows the other Mac's pin), then `darkbloom cluster pair --forget `, then `darkbloom start`. Plain `darkbloom stop` on 0.10.8 stops the pair, not single-Mac serving. +- **Known limitation:** on the Mac that follows, serving alone clears only that Mac's saved start. While the leading Mac keeps the pair started, it may start the following Mac's part again once single-Mac serving stops there. `darkbloom start` says so, and `darkbloom stop` on the leading Mac stops the pair. diff --git a/changelog.d/update-ends-once-the-cluster-service-runs-it.md b/changelog.d/update-ends-once-the-cluster-service-runs-it.md new file mode 100644 index 0000000000..b774fc9191 --- /dev/null +++ b/changelog.d/update-ends-once-the-cluster-service-runs-it.md @@ -0,0 +1,7 @@ +### `darkbloom update` on a pair Mac ends once this Mac runs the new release + +- `darkbloom update` on a Mac set up with `darkbloom cluster` could wait its full 10 minutes and end with "Still + waiting after 600 s", although the Mac had already restarted into the new release: the restarted cluster service + reports that no update runs, and the command waited to see its own request reach "restarting". +- It now also ends as soon as this Mac's cluster service runs the release it installed, and says so: `This Mac's + cluster service now runs v; the cluster sets itself up again once both Macs run it.` diff --git a/docs/architecture/components/provider.md b/docs/architecture/components/provider.md index 76b50303fc..ca833ea363 100644 --- a/docs/architecture/components/provider.md +++ b/docs/architecture/components/provider.md @@ -65,20 +65,33 @@ flowchart LR ### Process boundaries -`ProviderLoop+Serve.swift` reads App Attest messages, authorization status and -connection invalidation before forwarding slower events to its ordered work -consumer. An inference handler awaiting a model load therefore cannot hold a -renewal reply or a received grant update. Both consumers belong to the same -serve invocation; shutdown finishes the work stream and waits for its consumer. -The [attestation lifecycle](../security/attestation.md#provider-connection-control) +`ProviderLoop+Serve.swift` reads App Attest messages, authorization status, +attestation challenges, coordinator cancels and connection invalidation before +forwarding slower events to its ordered work consumer. An inference handler +awaiting a model load therefore cannot hold a renewal reply, a received grant +update or a challenge answer. Both consumers belong to the same serve +invocation; shutdown finishes the work stream and waits for its consumer. The +[attestation lifecycle](../security/attestation.md#provider-connection-control) owns the connection and trust guarantees. +A coordinator cancel never waits in the work consumer. Cancelling reaches the +request's engine, and a two-Mac pair's engine can be held for up to 30 s by a +rank reservation (see [the pair engine queue](../inference.md)); a cancel in the +consumer used to hold every later event that long, so challenges timed out and +new requests spent their first-content budget waiting. The reader now holds a +cancel for a request whose admission has not returned and applies it when that +admission returns, exactly where the consumer applied it; any other cancel runs +at once, beside the consumer (`routeCoordinatorCancel` in +`provider-swift/Sources/ProviderCore/ProviderLoop+WorkFIFO.swift`). A cancel +therefore never runs before or during its own request's admission and is never +lost, and it waits for no other request's work. + An accepted request whose model is not resident releases the work consumer when it starts waiting for the load (`releaseWorkFIFO` in `provider-swift/Sources/ProviderCore/ProviderLoop+WorkFIFO.swift`), so later -inference requests, cancels and attestation challenges are not held behind -weight loading. A coordinator cancel for the waiting request is applied when its -admission returns, where the serial consumer applied it. Connection, drain and +inference requests are not held behind weight loading. A coordinator cancel for +the waiting request is applied when its admission returns, before the events +that wait for it. Connection, drain and model-management events, and the end of the work stream, still wait for it. So does a request for another model that is not resident, before its pre-accept capacity check (`awaitReleasedLoads`): the waiting load may not yet hold the diff --git a/docs/architecture/hardware-support.md b/docs/architecture/hardware-support.md index dc223ac6d2..49a98b3468 100644 --- a/docs/architecture/hardware-support.md +++ b/docs/architecture/hardware-support.md @@ -1,6 +1,6 @@ # Hardware support and the provider memory model -> Last updated: 2026-11-02 +> Last updated: 2026-11-04 What hardware the provider runs on and how it decides, in bytes, whether a model may load and how much KV cache each resident model may use. Read this to @@ -328,6 +328,43 @@ The provider neither lowers the cap nor changes admission for this; `doctor`, (`provider-swift/Sources/ProviderCore/Diagnostics/GLM5NextWiredLimit.swift`, `GLM5NextWiredLimit`). +#### GLM-5.3-Flash pairs on 128 GB Macs + +Two 128 GB Macs (two M5 Max) serve GLM-5.3-Flash as a pipeline. A serving +rank reserves no request at LOAD +([GLM pair admission](inference.md#glm-pair-admission)): it loads on its weights +and what only loading holds, and admits each request when it arrives. Figures +for the most balanced cut (24), from the worker's quotes on the registered +artifact's headers (`GLM5NextResidentResourceEnvelope.quote`, +`budget(descriptor:contextTokens:)`), not measured peaks: + +| | Rank 0 | Rank 1 | +|---|---|---| +| Weights at their allocator bounds | 89.65 GB | 89.17 GB | +| What only loading holds (construction copies, read buffers, metadata) | 7.68 GB | 6.71 GB | +| Load peak, which must fit the GPU's working set | 97.34 GB | 95.87 GB | +| A 65,536-token request (KDA chunk state, the 5.5 GiB activation floor, DSA histories; rank 1 also a chunk's logits) | 22.37 GB | 22.83 GB | +| Weights and that request together | 112.02 GB | 111.99 GB | + +The GPU's working set is 107.52 GiB (115.45 GB) on an M5 Max 128 GB by +default. Both columns fit it, with about 3.4 GB to spare beside a full request. +Raising the GPU limit to the Mac's memory less 16 GiB, 112 GiB (120.26 GB), +with [`darkbloom cluster gpu-limit`](../reference/configuration.md#gpu-memory-limit-for-a-glm-pair) +leaves room for prompt prefixes and MLX's buffers and admits cuts 23 to 25. +The plan places the same way (`ClusterModelLayout.requestsOnArrival`). At +cut 24 rank 0 needs 103.24 GB admissible to load (it needed 129.06 GB when the +plan reserved the request), and the plan reports the longest context each +rank admits now beside its weights. A request that does not fit then is +refused at reservation. Requests use the host memory gate's floor and +headroom, the allocator limit and the GPU's working set beside the loaded +stage. + +Tensor parallel still does not fit: each rank's load gate asks for about 153 GB +beside its headroom, more than the Mac's 128 GiB. That is its shard (88.7 GB), +the NextN layer (4.2 GB), the request charge at 65,536 tokens (56.1 GB) and +the freed-buffer cache (`GLM5NextTensorParallelLoadMetadata`). It still +reserves its request at LOAD. + `GLM5NextConstructionOwner` retains actual partial-load roots before evaluation. `GLM5NextArtifactLoadRoots` retires individual expert sources only after the packed bank's checked evaluation, then retains completed modules instead of a diff --git a/docs/architecture/inference.md b/docs/architecture/inference.md index 73fe641fac..23edeb35d3 100644 --- a/docs/architecture/inference.md +++ b/docs/architecture/inference.md @@ -65,11 +65,37 @@ request stream's `onTermination` and the admission cancellation hop onto the queue without waiting, or run in place when already on it. The retirement task never blocks a cooperative thread. Waiting there deadlocked a pair slot's retirement: `EngineV2Bridge.shutdown` cancelled a pump while the queue -published that request's peer loss. Lease events, the owner's invalidation and -the public calls keep their synchronous queue order. Source: +published that request's peer loss. Lease events, the owner's invalidation, +submissions and shutdown keep their synchronous queue order. + +A reservation waits until both ranks answer at their next step boundary, up to +the lane admission wait (30 s), one reservation after another on the engine's +`admissionQueue`, never on the engine queue. Rank 0 waits a bounded time each +step for the owner's answer to every running lane's token, and that answer is +given on the engine queue; a reservation that held the queue stalled every +lane, and the step at which the reservation itself is answered. A submission +holds a lane from the moment it is accepted (`holdLane`, the engine's +`admitting` count): the lane check counts it, and `capacity()` reports it as a +waiting request, so the heartbeat's `num_waiting` covers requests the pair is +reserving or about to reserve. `cancel` hops onto the queue without waiting; a +request whose reservation is in flight, or still waiting, is stopped as soon as +it is admitted. A submission whose caller went away while it waited +(`DistributedAdmissionCancellation`) is refused before it asks the ranks, and a +shutdown waits for the reservation in flight and stops its request. The +first-token and request deadline timers hop the same way. `capacity()` called +off the queue answers at once from the snapshot the queue publishes after every +change, with the owner's readiness read live, and queues one refresh that runs +the readiness and accounting checks once the queue is free. A pair measures no +prefill rate, so the bridge submits its requests without a projected admission +and awaits that admission (`submitAwaitingQueue`), so its actor stays free for +cancels and capacity reads. Sources: `provider-swift/Sources/ProviderCore/Inference/Distributed/Engine/DistributedCBv2Engine.swift` -(`onQueueWithoutWaiting`) and -`provider-swift/Sources/ProviderCore/Inference/Distributed/Engine/DistributedCBv2Engine+Admission.swift`. +(`onQueueWithoutWaiting`, `cancel`), +`provider-swift/Sources/ProviderCore/Inference/Distributed/Engine/DistributedCBv2Engine+Capacity.swift`, +`provider-swift/Sources/ProviderCore/Inference/Distributed/Engine/DistributedCBv2Engine+Admission.swift`, +`provider-swift/Sources/ProviderCore/Inference/Distributed/Engine/DistributedCBv2Engine+Submission.swift` +(`submitAwaitingQueue`) and +`provider-swift/Sources/ProviderCore/Inference/Engine/Bridge/EngineV2Bridge+Submission.swift`. A pair request's admission deadline (the first-content budget left when it arrived, `DistributedRequestDeadlineContext`) is that request's alone. It bounds @@ -121,7 +147,13 @@ and fail at its own first-token deadline. The cancel ends only that lane, at both ranks' next step boundary, and the next request is served at once. The pair's own shutdown (`ClusterWorkerPair.shutdown`) likewise cancels such a lane without waiting for a clean stop. A pair without such lanes keeps the clean -stop, since a cancel there ends the pair. Before, a client that closed its +stop, since a cancel there ends the pair. So on a one-lane pair (a pipeline that +serves one request at a time, and a tensor-parallel setup whose batch width is +not priced: Gemma 4 today, which has no tensor-parallel batch quote, so its +saved setup keeps `DistributedInstalledPlan.defaultBatchLanes`) a cancel during +the prompt keeps the lane until the whole prompt is read: about 68 s for a +15.8K-token prompt on an M3 Ultra + M5 Max Gemma pair (2026-11-05). This is a +known limitation, the same as on a GLM-5.3-Flash pipeline. Before, a client that closed its connection 15 s into a 60K-token prompt on a Qwen 3.8 27B tensor-parallel pair kept both Macs prefilling it for about 4 minutes, and every other request failed meanwhile. Sources: @@ -186,11 +218,25 @@ previewed without credit for 10 minutes for that setup (`DistributedAutomaticBatchCreditRefusals`), so steady demand cannot cycle release and restore. +A replacement is proposed only when it serves the running generation's +endpoint contract: the local server swaps in only a session with the same +profile (`DistributedLocalSessionBinding.permitsPlacementChange`), and the mode +decides whether committed-token logprobs are captured +(`ClusterModelFeaturePolicy.capturesLogprobs`). Gemma 4 has no tensor-parallel +batch quote, so its batch scope prices only the pipeline; a tensor-parallel +Gemma pair is therefore never offered a pipeline replacement, which would fail +after the drain (`DistributedAutomaticBatchPlanner.keepsEndpointFeatures`). +A replacement that fails after release (the host restores the previous setup) +is remembered for that setup and width: it is not proposed again until a hold +passes, 2 minutes doubling on each repeat up to 30 minutes, while a different +setup is tried at once (`DistributedAutomaticBatchFailures`). + Every refused width logs one line, `cluster.batch_replan refused lanes=N`, in the preview and in the post-release recheck (`DistributedAutomaticBatchPlanner.refusalFields`). Its fields are `phase` (`preview` or `post_release`), `reason` (`not_now`, `not_possible`, -`outside_gpu_working_set`, `not_accepted`, `no_setup` or `no_placement`), +`outside_gpu_working_set`, `not_accepted`, `no_setup`, `no_placement` or +`endpoint_features`, which also names `running_mode`), `requested_lanes`, `previous_lanes`, `require_now`, `credits_incumbent_weights`, `mode`, `tensor_shares` and, for each rank N, `rankN_need_bytes`, `rankN_load_need_bytes`, `rankN_request_need_bytes`, @@ -367,7 +413,29 @@ with hardware names, is no longer on the screens, which say one serving line nothing more once paired, also for `darkbloom cluster local` (`ClusterOnboardingDriver.joinedLocalLine`): it follows the leader's start from the cluster status over the cable and ends with the same ✓/✗ block, bounded like the leader's start -(`ClusterOnboardingDriver.followStart`, `ClusterOnboardingFollowTiming`). Serving through Darkbloom, the +(`ClusterOnboardingDriver.followStart`, `ClusterOnboardingFollowTiming`). + +- **What it waits on.** The leading Mac's screen records each step it waits on in its setup record + (`OnboardingLive.publishStep`, `ClusterSetupRecord.onboardingStep`, `ClusterOnboardingLeaderStepMark`). Its status + reply carries that step (`ClusterControlReply.step`, `ClusterOnboardingLeaderStep`). A step counts only while that + screen's process runs; a refusal counts for 30 minutes after it was set, because the screen ends with it. A reply + from an older build has no step, and the Mac that joins keeps the general words. +- **The live line.** The Mac that joins says each step once and shows a live line fitted to the window's current + width (`ClusterOnboardingDriver.followWaitingLine`). The terminal reads that width at each redraw and climbs back + over the rows a reflowed window shows (`ClusterOnboardingTerminal.climb`), so a redraw never leaves a wrapped copy + behind. +- **The mode question's lines.** Each mode's line is asked for its text again at every draw, for the room a row has + then (`ClusterOnboardingDriver.modeLine(_:recommended:room:)`, `ClusterOnboardingTerminal.chooseFitting`), and the + list draws again within about 100 ms of a resize. Too wide, a line drops the split, then what each Mac does, then + the long words. The mode's name and how many requests it serves at once are never cut; at 40 columns they take two + rows. Plain output prints each whole line. +- **How the wait ends.** A refusal ends the wait at once with the leader's ✗ (`followRefused`; different builds: + `differentBuildsLines`). Running out of time ends it with a ✗ and next steps (`notStartedReason`, + `notStartedLines`). +- **The leader's own Local Network wait** has a bound too (`ClusterOnboardingOperations.localNetworkWaitSeconds`, + `localNetworkOffLines`). + +Serving through Darkbloom, the leader's start asks the coordinator after its test whether to offer the pair; until it has, the setup record says so (`ClusterSetupRecord.registrationPendingPID` and `registrationPendingStarted`, set only by the screen's start, `OnboardingLive.markRegistrationPending`, never by `serve` alone as `darkbloom start` and `restart` run @@ -418,8 +486,10 @@ at …", `ClusterOnboardingReady.summary`, from the setup each Mac saved). Every of a missing model is a list as well, a short one with its predicted time (`ClusterOnboardingDriver.provision`). The public-traffic line (`ClusterOnboardingModelChoice.publicTraffic`) is said only for a private image -candidate; the serving line ends "(earning through Darkbloom)" or "(local -only)" (`ClusterOnboardingDriver.servesWords`). When the other Mac does not +candidate; a serving line on the leader's API ends "(local only)" +(`ClusterOnboardingDriver.servesWords`): such a pair is never offered, so no line +says it earns through Darkbloom, and one set to serve through Darkbloom says +`not offered to Darkbloom ()` instead (`OnboardingLive.notOfferedLines`). When the other Mac does not answer over the cable, the leader asks **Try again** or **Cancel** (`chooseAndServe`). @@ -437,7 +507,7 @@ pin). A Mac that is away never leads, so failover is unchanged. macOS's permissions are asked at stated moments (`ClusterOnboardingDriver.allowLocalNetwork`), and Connect's first line asks for -both ("Allow macOS's password and Local Network prompts.", +both ("Allow macOS permissions.", `ClusterOnboardingDriver.approvalsLine`). The command probes Local Network access in the Connect step (`ClusterLocalNetworkAccess.probe`: one datagram to the cable's subnet broadcast, refused with `EHOSTUNREACH` until allowed). macOS @@ -2159,7 +2229,22 @@ and `libs/mlx-swift-lm/Libraries/MLXLMCommon/ContinuousBatchingV2/DeadlineAdmiss `WedgeMonitor.suspectStallSeconds = 10` flags a stalled slot -(`provider-swift/Sources/ProviderCore/Inference/Engine/WedgeMonitor.swift`). +(`provider-swift/Sources/ProviderCore/Inference/Engine/WedgeMonitor.swift`): +three requests without a first token for 10 s while the engine's step counter +stands still. A two-Mac pair's engine has no step counter, and its ranks +prefill one prompt at a time and send nothing until a prompt's first token, so +that rule would report every burst of long prompts as a wedge. The bridge +(`EngineV2Bridge+Capacity.swift`, `WedgeMonitor.marksCrashed`) therefore marks a +pair's slot `crashed` only when a waiting request is still without a first +token `pastAllowanceGraceSeconds` (40 s) after its own first-token allowance. +That allowance is the one the pair's engine arms (its first-token deadline, or +its request deadline when the coordinator sent no budget), tracked by request +id: it leaves with its own request's first token or end, and an entry whose +request left the bridge never counts. The `step_wedge` telemetry still reports +the plain rule. A hung pair is ended +first by the engine's first-token and request deadlines, which fail the request +and cancel its lease, and by the cluster's fencing of a rank that does not +retire a cancelled lane within 30 s, which withdraws the pair's capacity. ### Multi-token prediction @@ -3547,9 +3632,9 @@ evidence, not a change to the normal final-row contract or the near-tie rule | Load refused: `pagedUnavailable` (503) | Explicit `engine_v2_kv_backend = paged` and the paged pool/kernels failed | `EngineV2Factory+BackendPreparation.swift` — see [`prefix-cache.md`](prefix-cache.md) | | Cold load refused with the ordinary slot (503) or insufficient-memory error although an idle model is resident | That slot holds an unexpired Autopilot placement hold: held slots are excluded from eviction (`ProviderLoop.evictableModelSlots`, `autopilotHoldsModel`) and their weights get no `free_for_load_gb` reclaim credit (`autopilotHeldWeightBytes`); the refusal's `Not evictable:` list names it with the hold's UTC expiry; see [Autopilot placements](model-autopilot.md#placements-after-an-operation) | `provider-swift/Sources/ProviderCore/Autopilot/ProviderLoop+AutopilotPlacement.swift`, `provider-swift/Sources/ProviderCore/ProviderLoop+EvictionExclusions.swift` | | Load refused (503), or a running load ends before it installs a slot | An [add-on hold](addon-hold.md) is active: no load takes the load gate, and one already running stops at its next check (after hashing, after the weight load or before install; the managed Super and native MiMo loads before their weights and at publication) | `provider-swift/Sources/ProviderCore/Addon/ProviderLoop+AddonHold.swift` (`addonHoldLoadRefusal`), `provider-swift/Sources/ProviderCore/ProviderLoop+ModelLoading.swift` (`ensureModelLoaded`), `provider-swift/Sources/ProviderCore/MiMo/ProviderLoop+NativeMiMo.swift` (`requireNativeMiMoPublication`) | -| Slot flagged wedged | No engine progress for `suspectStallSeconds = 10` | `WedgeMonitor.swift` | +| Slot flagged wedged | No engine progress for `suspectStallSeconds = 10`; a two-Mac pair only once a request is 40 s past its own first-token allowance | `WedgeMonitor.swift` | | Provider exits with `Trace/BPT trap: 5`; its log shows `[metal::Device] Unable to build metal library from source` | MLX compiled a Metal kernel at runtime and the compile failed. mlx-swift builds MLX's JIT kernel path, and the release metallib holds no NAX attention kernels, so on M5 GPUs fused attention compiles on the Mac when a shape is first used; MLX throws on a failed compile and the Swift error handler stops the process. 0.10.2 failed this way for full attention with head dim 256 or 512 and at least 1,024 query tokens (`attention_nax_dsplit`), fixed in 0.10.3. Check an MLX pin change that touches `jit_kernels.cpp` or the NAX kernels on an M5 with a long Gemma 4 or Qwen prompt | `libs/mlx-swift/Source/Cmlx/mlx/mlx/backend/metal/jit_kernels.cpp`, `device.cpp` (`build_library_`) | -| Provider crashes in a loop on a pre-release macOS 27.2 build (for example 26B5091g); the crash report shows a call to address 0 | The build was made with SDK 27.2 and compares Dates with `>=` or `<=`. SDK 27.2 back-deploys these two operators: Swift 6.4.2 calls them through weak Foundation imports behind an OS version check. These macOS builds pass the check but do not export the symbols. DevNet build `0.10.6-dev.branch.87` crashed this way. The cluster service's timed checks (memory replan, member sync, update and approval checks, part restart backoff, supervision wait, model manifest repair retry and deadline) compare with `timeIntervalSince(_:)` and keep the same thresholds. `scripts/check-date-comparisons.py` (Release Integrity) refuses the pattern in shipped source. To fix a hit, write `a.timeIntervalSince(b) >= 0` for `a >= b` and `a.timeIntervalSince(b) <= 0` for `a <= b`; `<`, `>` and `==` are safe. The release lane runs `scripts/check-provider-weak-imports.py` on the built binaries. A failure means a binary still imports `Date.>=` or `Date.<=`; the check names the calling functions. See the [build guide](../developer/build.md#sdk-27-release-builds-and-caches) | `provider-swift/Sources/ProviderCore/Inference/Distributed/Onboarding/ClusterService.swift`, `provider-swift/Sources/ProviderCore/Inference/Distributed/Onboarding/ClusterModelProvisioningStore.swift`; `scripts/check-date-comparisons.py`, `scripts/check-provider-weak-imports.py` | +| Provider crashes in a loop on a pre-release macOS 27.2 build (for example 26B5091g); the crash report shows a call to address 0 | The build was made with SDK 27.2 and compares Dates with `>=` or `<=`. SDK 27.2 back-deploys these two operators: Swift 6.4.2 calls them through weak Foundation imports behind an OS version check. These macOS builds pass the check but do not export the symbols. DevNet build `0.10.6-dev.branch.87` crashed this way. The cluster service's timed checks (memory replan, member sync, update and approval checks, part restart backoff, supervision wait, model manifest repair retry and deadline) compare with `timeIntervalSince(_:)` and keep the same thresholds. `scripts/check-date-comparisons.py` (the `Provider Tests` gate and Release Integrity) refuses the pattern in shipped source. To fix a hit, write `a.timeIntervalSince(b) >= 0` for `a >= b` and `a.timeIntervalSince(b) <= 0` for `a <= b`; `<`, `>` and `==` are safe. The release lane runs `scripts/check-provider-weak-imports.py` on the built binaries. A failure means a binary still imports `Date.>=` or `Date.<=`; the check names the calling functions. See the [build guide](../developer/build.md#sdk-27-release-builds-and-caches) | `provider-swift/Sources/ProviderCore/Inference/Distributed/Onboarding/ClusterService.swift`, `provider-swift/Sources/ProviderCore/Inference/Distributed/Onboarding/ClusterModelProvisioningStore.swift`; `scripts/check-date-comparisons.py`, `scripts/check-provider-weak-imports.py` | ## Code map @@ -3863,6 +3948,53 @@ service starts on a release that is being replaced; a service that starts then exits as already running, and its login agent starts it again ([`darkbloom update`](../provider/cli-reference.md#darkbloom-update)). +## Whether the pair runs on this Mac + +The saved start (`leadership.serving`) is only the intent: it stays on when the +other Mac stops taking part (unplugged, off, or serving on its own). Each tick, +the cluster service asks `ClusterPairWatch` whether the pair actually runs here, +from the intent, the other Mac's last real answer over the link +(`ClusterControlNode.otherAnsweredAt`, set only by a lease or an answer, never at +start) and whether this Mac's part serves (a coordinator-paired part's pair line +says serving, or a part runs while the other Mac answers within the lease's +time-to-live). Every start gets 15 minutes (`ClusterPairWatch.giveUpSeconds`). + +| Verdict | When | The service | +|---|---|---| +| `running` | The other Mac answered in the last 15 minutes, and the pair served since its start or is inside its first 15 minutes | Runs its part as before | +| `otherMacSilent` | No answer for 15 minutes | Stops its part, which frees the serving lock (`ClusterPairWatch.part`; a public pair's local-API solo server too, when single-Mac serving is set up here), and starts it again when the other Mac answers | +| `notServing` | The other Mac answers, but the pair never served in 15 minutes | Leaves its part to the person | + +The status carries `pairRunning` and, when it is false, `pairNotRunning`: the +reason with the command to serve this Mac alone. `ClusterService.pairServesHere` +(update, watchdog) and `ClusterPairSummary.partServes` (start, stop, restart, +status) read the verdict. Nothing automatic stops a `notServing` part, whose pair +may still be loading: `ClusterService.pairKeepsLock` keeps update and the watchdog +off the serving lock while the other Mac answers, and `Start.pairStart` and +`Restart.pairRestart` act on the pair then, except for `start --solo` and the +terminal's choice. A 0.10.8 service publishes none; its control mode then +decides (`waiting`, `alone`, `cannotServe` and `idle` mean the other Mac isn't +taking part). A reboot of a few minutes stays `running`. The windows run on +`ClusterControlClock.awakeSeconds` (`CLOCK_UPTIME_RAW`, paused in system sleep): +`ClusterPairWatch.tick(raw:awake:...)` places each new answer from the lease clock +on the awake clock no earlier than the previous tick, so waking from a long sleep +never gives up a part by itself. `darkbloom start` on a +Mac whose pair doesn't run clears the intent and waits for the part to end +(`ClusterService.releaseForSingleMac`) before single-Mac serving starts +([going back to serving on one Mac](../provider/two-mac-cluster.md#going-back-to-serving-on-one-mac)). + +Single-Mac serving holds a Mac's one serving lock and never ends by itself, so +neither Mac's part starts beside it. Each Mac's status reports it in +`soloServing` whenever no part of its own holds the lock, and says why its part +can't start in `heldBack` (0.10.9; both nil from an older build). At each +15-second sync the leading Mac reads the other Mac's reason +(`ClusterService.heldBack(of:)`: `heldBack`, else its `soloServing`), and while +one is reported its own part doesn't start +(`ClusterControlPartChoice.waitsForOtherMac`): a part started anyway only waits +for its missing follower and ends again. The rule applies only while this Mac +leads and runs the cluster, and never to serving alone (`solo:`); a Mac that +doesn't answer reports nothing, so its absence follows the control lease. + ## Cluster service listeners follow the cable and the pairing Each Mac's cluster service answers the other Mac on two listeners: the setup @@ -3915,7 +4047,12 @@ away; mixed pairs are first-class). - **Measured speed:** `ClusterServedModes.figures` over this build's served records of this model on these Macs (`ClusterServedSpeedRecords.servedBy`), as the planner reads them: a figure from 3 served requests on. Never a - prediction; without one the screen says "not measured on these Macs yet". + prediction; without one the model list says "not measured on these Macs yet". + The mode question uses these figures (else the planner's predictions) only + to rank the modes: its recommendation and its mode lines quote no tokens per + second (owner, 2026-11-05), and a re-plan's "Planned in the mode chosen" line + gives the size, mode and shares without the planner's predicted speed + (`ClusterOnboardingModeAdvice.fasterWords`, `OnboardingLive.localPlanModels`). - **The current model:** on a set-up pair the list preselects the model serving now (or the last one used); it keeps the mode the saved setup served in when the plan still lists it (`keepMode`, from `ClusterOnboardingResume.servingMode`), @@ -3965,35 +4102,45 @@ away; mixed pairs are first-class). reads stopped whatever the other Mac's presence (`ClusterPairSummary.state(ofStatus:started:leaderMode:)`). - **The split shown:** each mode's share names the Mac that runs it - (`OnboardingLive.modeSplit`, "1 layer" for one). While a model serves it reads - "decided when it loads": the list's plan counts that model's memory as taken, - and the adopt stops it and plans again with its memory free. + (`OnboardingLive.modeSplit`, "1 layer" for one), with the requests it serves + at once (`ClusterSetupPlanSummary.Mode.concurrentRequests`, from the setup's + `DistributedInstalledPlan.batchLanes`). It is the plan that loads when that + mode is chosen (`ClusterSetupPlanning.offered`): the listed plan for its own + family, and for each other family the plan `ClusterPlacementFlow.decide(chosenMode:)` + makes from the same samples, kept with its setup + (`ClusterSetupModelOption.familyPlans`, `Decision.familySetups`). A family + that can't be planned shows no split. Planning a family again at the start + would measure this Mac's speed index again, and on two Macs of one speed a + pipeline's layers follow whichever measured faster (offered 1 / 44, loaded + 44 / 1). While a model serves it reads "decided when it loads": the list's + plan counts that model's memory as taken, and the adopt stops it and plans + again with its memory free. - **The person's family:** `useMode` keeps the chosen family for every model (`OnboardingLive.keptFamily`), never inferred from the listing's order, which - says nothing of the plan; `localAdopt` plans again in it only when the listed - plan's mode isn't in it (`OnboardingLive.replansInFamily`). + says nothing of the plan. `localAdopt` adopts the listed plan when it is in + that family, else the family's own plan the list showed, and plans again only + while a model serves or when no plan was made for it (`OnboardingLive.adoption`). - **The scope a plan is for:** `chooseAndServe` names the scope before it plans the list (`ClusterOnboardingOperations.planScope`, `OnboardingLive.usePlanningScope`, carried in `ClusterControlRequest.scope`); a start whose scope changes before it adopts (the login check's "Serve locally only") is planned again for that scope, and the same model is adopted from the new plan. - **Forwarded choices:** a choice the other Mac forwards to the control leader - (`ClusterControlRequest`: op, index, model and scope) carries no mode, so it - is placed in the planner's family; the mode is chosen on the leading Mac. -- **The person's choice:** `useMode` keeps the family for the next adopt of that - model; `OnboardingLive.localAdopt` plans that model again with - `ClusterPlacementFlow.decide(chosenMode:)`, which places only that family the - way the developer setting does (`policy.forcedMode`), while memory fit, - qualification records and feature parity still decide, and adopts that plan. + (`ClusterControlRequest`: op, index, model, scope and the mode family chosen + on that Mac's screen, `OnboardingLive.adoptRequest`) is adopted in that family; + a request without a mode, from an earlier build, keeps the leader's own. +- **The person's choice:** `chosenMode` places only that family the way the + developer setting does (`policy.forcedMode`), while memory fit, + qualification records and feature parity still decide. A re-plan after an update keeps the served mode unless the planner and the pair's served requests both find another faster (`ClusterServedModes.hold`). Sources: `provider-swift/Sources/ProviderCore/Inference/Distributed/Console/ClusterSetupWizardPlanning.swift` -(`ClusterSetupPlanning.modes`), +(`ClusterSetupPlanning.modes`, `ClusterSetupPlanning.offered`), `provider-swift/Sources/ProviderCore/Inference/Distributed/Placement/ClusterPlacementFlow.swift` (`ClusterPlacementFlow.decide`), and `provider-swift/Sources/ProviderCore/Inference/Distributed/Onboarding/ClusterOnboardingLive.swift` -(`useMode`, `localAdopt`, `screenMode`). +(`useMode`, `localAdopt`, `adoption`, `screenMode`). ## A saved pairing the onboarding cannot use @@ -4220,10 +4367,17 @@ pages freed, and the freed-buffer cache is emptied. The probe's memory is the load's own batch ledger for a one-lane request of its size, with the loading headroom, asked of the gate without a reclaim; the batch owner's allocation baseline is taken before it, so the widened projection constants its forward -keeps count as a first request's would. Memory the gate does not admit, a load -deadline nearer than 10 s, a 1.5 s budget reached before three timed rounds, or -any error gives no probe, never a failed load; only a throwaway request that -cannot be retired fails it. +keeps count as a first request's would. Each phase's timed rounds stop 1.5 s +after its first timed round. The prefill and the warm-up rounds do not count +against that budget: the probe is the loaded model's first forward in its +worker process, and the kernels compile on first use. No round starts 8 s after +the probe started, prefill and warm-up included, which is less than the 10 s +deadline margin. Memory the gate does not admit, a load deadline nearer than +10 s, fewer than three timed rounds in the budget (`skipped=budget`), the 8 s +limit (`skipped=limit`) or any error gives no probe, never a failed load; only +a throwaway request that cannot be retired fails it. The Gemma probe +(`Gemma4TensorParallelShareProbe`) uses the same rounds, budget and limit +(`QwenTensorParallelShareProbe.rounds`). The serving leader records both ranks' probes when the pair becomes ready, next to the link probe, in owner-only `~/.darkbloom/cluster/share-probes.json` @@ -4862,6 +5016,22 @@ this build served in tensor parallel)." A plan that chooses tensor parallel on measured steps adds ", on its own step as measured on both Macs". The setup's model list says `tensor parallel: not measured yet`. +**A pipeline's step on an estimated whole model.** A pipeline decodes one whole +step across its Macs, each Mac its layers at its whole-model rate. Where that +rate is an estimate (`ClusterDeviceSpeed.wholeModelEstimated`: the device +index's, which is the weights' read time with no per-token floor, or the one a +tensor-parallel served record carries beside its measured shard rates) and a +share of this model was measured on the Mac, the planner takes the whole step as +at least that share's measured step plus the rest of the divided weights at the +index's rate (`wholeStepSeconds`): a larger share never steps faster. A +whole-model measurement is used as it is. On two M5 Ultras 256 GB the index put +Gemma 4 26B's whole step at 5.5 ms beside a measured half step of about 7 ms, so +the pipeline was predicted at about 170-183 tok/s against 107 in tensor parallel, +and the question recommended it; 59.9 and 105.1 tok/s were served. With the +measured half step the pipeline is predicted at about 95-100 tok/s, below tensor +parallel. The remaining gap to 60 is the pipeline's per-step cost between the +Macs, which the plan still prices as two small link records [INFERENCE]. + The rule changes nothing else: 1. A tensor-parallel placement in a better hardware group (it loads now, no @@ -5012,7 +5182,12 @@ tensor parallel's executor contract and one lane: artifact file is hashed against the registered manifest, and then only this rank's byte runs are read (`MiMoTensorParallelVerifiedLoad`: the plan disposes of each indexed name; the runs equal the SDK shard's `byteRuns`; any difference - refuses). Both ranks compare what they loaded before either is ready. + refuses). Runs less than a page apart are read together, up to one 8 MiB + scratch read, and copied out exactly (`CheckpointAlignedReader.read(…stride:count:)`): + the expert `down_proj`, divided on its inner axis, is about a million runs of + 512 or 32 bytes per tensor, which one uncached read each took over an hour per + rank to load, past the pair's startup deadline. Both ranks compare what they + loaded before either is ready. - Requests (`MiMoTensorParallelDecoding`). Request-owned 64-token paged histories at the rank's geometry (full layers: 2 KV heads at widths 192/128; sliding layers: window 128 and the rank's 32 sink biases). Decode runs under @@ -5241,7 +5416,7 @@ See [focused MiMo V2.6 tensor-parallel checks](../developer/test.md#focused-mimo ## Exact-quote placement -`ClusterPlacementPlanner.rankQuoted` is the model-independent decision seam for adapters that provide exact simultaneous native/host peaks and current bounds. It filters infeasible shapes and unsupported modes, then uses the same hardware-only ordering as `plan`: candidates whose every range fits its Mac's hardware (`ClusterDeviceProfile.hardwareFits`: buffer and allocator limits, the GPU-resident part (`ClusterPlacementRank.gpuResidentBytes`, the `withinGPUWorkingSet` figure) within the GPU limit, and the whole need within the at-rest admissible memory `atRestAdmissibleBytes`, physical memory less what macOS wires, because the load gate counts every file-backed page), then predicted request time, ties and the tensor-parallel margin. Live free memory and file cache never order candidates; each rank's live fit is reported and the load gate still decides each load. A supported TP adapter must supply TP layout facts and keyed reduction measurements. Neither resource balance nor chip-name rules replace request-time scoring; balance only breaks ties. Candidates whose predicted times differ only by rounding (relative 1e-9, as every serial pipeline cut does on identical Macs) are ordered by `capacityBalance`, the smallest share of a rank's hardware capacity (`min(residentCapacityBytes, atRestAdmissibleBytes)`) left beyond its need, before the lower cut, so identical Macs split evenly and live free memory cannot pick the cut. Every structural boundary, including one layer on a slower member, remains available when its adapter quotes fit. A candidate is `possible` when every rank fits the hardware, or the live gate admits it now and its GPU part is within the limit: a split the GPU cannot keep resident is never offered because memory happens to be free. `ClusterPlacementMemoryVerdict.assess` runs the caller's planning step on the Macs as they are and, when nothing fits, with each GPU limit raised to `ClusterGPUMemoryLimit.ceilingBytes` (physical memory less 16 GiB, or a sixteenth from 512 GB): `fits`, `needsGPULimitRaise` (each Mac's GPU need, limit now and ceiling, with `ClusterGPULimitRaise.question`) or `doesNotFit`. It is data only: no setup screen calls it yet, and nothing in Darkbloom raises the limit. `ClusterDeviceMemory.fit` reports `gateCountsLess` only on a sample whose gate counts file cache; above normal pressure, where the gate counts none, the answer is `afterApplicationsRelease`. A rank's live fit is the gate's decision on one sample, so it cannot foresee the gate withdrawing the file cache during the load once compression or swap-out since the load's first sample passes its limits (`QwenDenseStageLoadPolicy.maximumCompressedSinceFirstSampleBytes`, described above); the at-rest ceiling assumes the share loads into free pages, not into a file cache full of the model's own files. +`ClusterPlacementPlanner.rankQuoted` is the model-independent decision seam for adapters that provide exact simultaneous native/host peaks and current bounds. It filters infeasible shapes and unsupported modes, then uses the same hardware-only ordering as `plan`: candidates whose every range fits its Mac's hardware (`ClusterDeviceProfile.hardwareFits`: buffer and allocator limits, the GPU-resident part (`ClusterPlacementRank.gpuResidentBytes`, the `withinGPUWorkingSet` figure) within the GPU limit, and the whole need within the at-rest admissible memory `atRestAdmissibleBytes`, physical memory less what macOS wires, because the load gate counts every file-backed page), then predicted request time, ties and the tensor-parallel margin. Live free memory and file cache never order candidates; each rank's live fit is reported and the load gate still decides each load. A supported TP adapter must supply TP layout facts and keyed reduction measurements. Neither resource balance nor chip-name rules replace request-time scoring; balance only breaks ties. Candidates whose predicted times differ only by rounding (relative 1e-9, as every serial pipeline cut does on identical Macs) are ordered by `capacityBalance`, the smallest share of a rank's hardware capacity (`min(residentCapacityBytes, atRestAdmissibleBytes)`) left beyond its need, before the lower cut, so identical Macs split evenly and live free memory cannot pick the cut. Every structural boundary, including one layer on a slower member, remains available when its adapter quotes fit. A candidate is `possible` when every rank fits the hardware, or the live gate admits it now and its GPU part is within the limit: a split the GPU cannot keep resident is never offered because memory happens to be free. `ClusterPlacementMemoryVerdict.assess` runs the caller's planning step on the Macs as they are and, when nothing fits, with each GPU limit Darkbloom raises lifted to `ClusterGPUMemoryLimit.ceilingBytes` (physical memory less 16 GiB, or a sixteenth from 512 GB): `fits`, `needsGPULimitRaise` (each Mac's GPU need, limit now and ceiling, with `ClusterGPULimitRaise.question`) or `doesNotFit`. Only Macs `ClusterGPUMemoryLimit.raisedByDarkbloom` names (Apple silicon, any M generation, with 128 GB or more) are lifted (`ClusterDeviceProfile.withGPUMemoryLimitRaised` is nil elsewhere), so an Intel Mac or a Mac under 128 GB is held to the limit macOS keeps. `darkbloom cluster` never raises the limit itself. The one command that does is `darkbloom cluster gpu-limit`, which its owner runs on such a Mac, with consent and macOS's administrator prompt, to the same ceiling (`GLM5NextGPULimitEligibility` delegates to the same rule; see [GLM pair admission](#glm-pair-admission)). When no placement fits a pair as its Macs are, the setup's model row (`ClusterSetupPlanning.decide`) plans again with those Macs lifted: if a placement fits then, the row is blocked with that step (`ClusterSetupPlanning.gpuLimitSteps`: each Mac whose part needs more GPU memory than macOS allows, the need, the limit and the raised limit); otherwise it says "Needs more memory" with the reason (`refusalWords`: the GPU limits when every part fits its Mac's memory at rest, else the model's size). Nothing is offered that would load and then fail. `ClusterDeviceMemory.fit` reports `gateCountsLess` only on a sample whose gate counts file cache; above normal pressure, where the gate counts none, the answer is `afterApplicationsRelease`. A rank's live fit is the gate's decision on one sample, so it cannot foresee the gate withdrawing the file cache during the load once compression or swap-out since the load's first sample passes its limits (`QwenDenseStageLoadPolicy.maximumCompressedSinceFirstSampleBytes`, described above); the at-rest ceiling assumes the share loads into free pages, not into a file cache full of the model's own files. GLM's placement family (`GLM5NextPlacementFamily`, `libs/darkbloom-cluster/Sources/DarkbloomClusterRuntime/Models/GLM5Next/Metadata/GLM5NextServingMetadata.swift`) offers the two-rank plan `glm5_next_heads_and_expert_channels_v1` whenever the registered row lists `tensor_parallel_v1` and the geometry halves. Each text-layer tensor is divided or replicated exactly as the SDK's `GLM5NextTensorShard.splitAxis` loads it; the embedding, final norm and head are replicated, and the NextN layer and vision tower belong to no text range. Every rank decodes in speculative rounds with the NextN layer, which it holds whole beside its share, so the plan states it (`ClusterTensorParallelFamilyPlan.speculativeHead`, `GLM5NextPlacementFamily.tensorParallelSpeculativeHead`): the planner charges each tensor-parallel rank the layout's `speculativeHead` part (4,183,320,576 stored bytes, each tensor in whole pages, as `mtp_bytes` on the worker's load line) and the request memory the rounds add at the memory plan's context (the larger of the contiguous and the paged NextN charge of `GLM5NextTensorParallelRequestCharge`), and divides a token's predicted decode step by the speed-up the pair measured at the runtime's depth over one token per step (76.0 against 62.6 tok/s at depth 2, `GLM5NextPlacementFamily.measuredTensorParallelDecode`). Served tensor-parallel requests are taken back to one-token steps by the same speed-up before they correct the shares (`ClusterServedCalibration`), so the next plan predicts what was served. Without it the plan priced no NextN bytes and one token per step: it could admit a pair the load gate then refused, and it predicted decode too slow. Three terms of the load gate are not in the plan yet: the vision tower rank 0 holds for media (1.13 GB), the freed-buffer cache (`GLM5NextTensorParallelResidentRuntime.freedBufferCacheBytes`) and the bulk prefill's further workspaces and sealed sums' buffers (`bulkPrefillChunkTokens`). On two M5 Ultra 256 GB, adding them to the planner's estimate as it stands would put each rank's need above the at-rest ceiling (`ClusterDeviceProfile.atRestAdmissibleBytes`), so the pair would no longer plan tensor parallel; they wait for the gate's own charge to replace the estimate rather than be added to it. The plan sums two partials of the 4096-wide residual per layer and one per step (91 per decode step); the partials are the row-parallel projections' bfloat16 outputs, sent as they are and added in float32 with one rounding (`GLM5NextTensorParallelResidentRuntime.partialsTransport`, bound into the load agreement). That is bit-identical to widening them to float32 before the link, as `ClusterTensorParallelTerms.current` (`partialsDType` float32) describes, with half the bytes: GLM's projections never kept float32 partials (flagged for platform review) and holds request state whole on each rank, since the DSA latent cache is replicated. The pipeline's private image profile stays pipeline-only, in both the layout and the capability; tensor parallel serves media under the text profile (below). The hardware prior (`ClusterHardwarePrior.decodeBytesPerToken`) counts a mixture of experts' routed experts at the fraction a token is routed to (`ClusterRoutedExperts`; 8 of GLM's 288), not every expert byte. Of the bytes a step reads, a tensor-parallel share divides only the plan's divided bytes (`dividedDecodeFraction`), because every rank reads its replicated bytes whole. On two identical M5 Ultra 256 GB with GLM measured alone the product's rule (tensor parallel first wherever it fits) places tensor parallel on equal shares with the NextN layer priced, both on a new pair before any load measured the link and after the first load's keyed probe; the planner's own speed comparison (the plan tool without `--tensor-parallel-first`) chooses tensor parallel once the keyed link is measured and a pipeline before (`GLMTensorParallelChecks`; through `ClusterPlacementFlow.decide` in `PlacementSetupCheck.glmTensorParallelPair`). The pair serves it with eight lanes (`DistributedInstalledPlan.tensorParallelBatchLanes`). @@ -5345,6 +5520,50 @@ whole step in one buffer (131 MB under the rank's guard), against 6.0 and 11.1 GB charged at those contexts. The decode speed effect and peak memory on registered models are not measured yet. +## GLM pair admission + +A serving GLM pipeline rank reserves no request at LOAD +(`GLM5NextResidentResourceEnvelope.admitsRequestsOnArrival`, which only +`GLM5NextResidentRuntime.serving` asks `GLM5NextServingResources.envelope` for). + +1. **LOAD** holds, and is gated on, the stage's weights at their allocator + bounds plus what only loading holds: construction copies, host read buffers + and metadata (`GLM5NextResidentResourceEnvelope.quote`). That sum must fit the + rank's load capacity, the GPU's recommended working set, and the live host + gate with its floor and loading headroom. The stage gate reserves no request + state or workspace (`GLM5NextStageLoadGate`, `reservesRequest: false`). +2. **Each request** is charged at its own context: the memory plan's scope cut + to it (`GLM5NextResidentResourceEnvelope.budget(descriptor:contextTokens:)`). + The existing reservation gate admits it (`GLM5NextResidentRuntime.reserve`): + - the host memory gate with its floor and loading headroom; + - the allocator limit; + - the GPU's working set beside the loaded stage (`requireMemory`). + + The activation floor is part of every charge. Kept prompt prefixes give way + first. A request that still does not fit is refused cleanly, and the running + request is rechecked as it runs. +3. **READY and every keep-warm answer** report the longest context that fits + now (`GLM5NextResidentRuntime.servingContext`, `refreshServingContext`). The + pair refuses a longer request before asking either rank. The value is 1 when + nothing fits, until memory frees. + +The planner places such a rank on what loading needs. It requires the GPU to +hold the weights with the memory plan's whole request, and reports each rank's +serving context (`ClusterModelLayout.requestsOnArrival`, +`ClusterPlacementRank.servingContextTokens`). Its estimate of one Mac holding +the whole model alone keeps the full quote, as that Mac's own engine loads it. When a GPU limit binds, the plan +names it, and the command that raises it on the Macs that command runs on +(`ClusterPlacementRank.gpuWorkingSetShortBytes`, `ClusterPlacementFlow.gpuLimitLines`, +`GLM5NextGPULimitEligibility`). + +A quote above a capacity refuses with the rank, the cut, and each term against +that capacity (`GLM5NextResidentResourceEnvelope.capacityRefusal`). + +Tensor parallel's quotes of the two stages, the staged reference and +calibration envelopes still reserve the whole request at LOAD. +[GLM-5.3-Flash pairs on 128 GB Macs](hardware-support.md#glm-53-flash-pairs-on-128-gb-macs) +has the figures for two M5 Max. + ## GLM cluster prefill bounds The registered NVFP4 GLM cluster candidate admits a maximum prefill chunk of @@ -6005,7 +6224,7 @@ Placement may change only for the same model artifact, tokenizer/model contract, A temporarily unavailable recommendation may be retried after 30 seconds even when queued demand remains unchanged. Increased demand may trigger an earlier attempt; no retry restarts a ticket deadline. This prevents a planner cooldown from permanently stranding a sustained burst at its earlier width. -After successful native start and capacity validation, the host logs `cluster.batch_replan activated` (or `restored` after a fresh rollback) with requested/effective lane counts, generation, process incarnation and installed setup digest/mode. These content-free diagnostics do not establish native kernel width or numerical equivalence. +After successful native start and capacity validation, the host logs `cluster.batch_replan activated` (or `restored` after a fresh rollback, which `cluster.batch_replan failed lanes=N` precedes when the factory remembers the failure) with requested/effective lane counts, generation, process incarnation and installed setup digest/mode. These content-free diagnostics do not establish native kernel width or numerical equivalence. ### GPT-OSS native batch width observations @@ -7159,8 +7378,12 @@ also waits while the leader still owns a running part. This ordering lets the leader send native shutdown commands over the live pair before the follower ends its owner stream. Local retirement failure and missing peer acknowledgement remain failures with stopped intent retained. The CLI -keeps its login service on those failures so bounded recovery/reconciliation can -continue; model-change and update callers already refuse to continue on failure. +keeps its login service on a local retirement failure so bounded +recovery/reconciliation can continue. After a completed local retirement, a peer +that does not answer (`ClusterOnboardingFailure.otherMacUnanswered`, set only by +`localStop`) no longer keeps `cluster stop --service` from removing this Mac's +service: the command says the other Mac was not asked to stop. Model-change and +update callers still refuse to continue on either failure. A forwarded stop allows 330 seconds for the local retirement and peer command. Sources: `provider-swift/Sources/ProviderCore/Inference/Distributed/Onboarding/ClusterOnboardingLive.swift` diff --git a/docs/architecture/security/attestation.md b/docs/architecture/security/attestation.md index de2be6de02..2b79971455 100644 --- a/docs/architecture/security/attestation.md +++ b/docs/architecture/security/attestation.md @@ -16,11 +16,12 @@ describes the consumed contract; provider support does not activate platform pol ## Provider connection control `provider-swift/Sources/ProviderCore/ProviderLoop+Serve.swift` consumes -`app_attest_shadow`, `trust_status` and +`app_attest_shadow`, `trust_status`, `attestation_challenge` and connection invalidation independently of the ordered inference/model consumer. -These actor-isolated handlers do not await model work. A suspended model load -therefore does not postpone starting App Attest or writing received authorization -to daemon state. Connect, disconnect and stream termination clear the old local +These actor-isolated handlers do not await model work. A suspended model load, +or a cancel waiting for a two-Mac pair's engine, therefore does not postpone +starting App Attest, answering a challenge (the coordinator allows 30 s) or +writing received authorization to daemon state. Connect, disconnect and stream termination clear the old local grant and invalidate the previous App Attest task generation before subsequent challenges are handled. Delayed model cleanup does not clear a replacement connection's grant. diff --git a/docs/architecture/security/local-control.md b/docs/architecture/security/local-control.md index c7ae20fe88..7b7de55e06 100644 --- a/docs/architecture/security/local-control.md +++ b/docs/architecture/security/local-control.md @@ -1,13 +1,15 @@ # Local control channels -> Last updated: 2026-10-27 +> Last updated: 2026-11-05 Two local channels can take a provider out of serving without the coordinator: the add-on hold socket and the lifecycle mailbox behind `darkbloom addon`. This explanation is for security reviewers: who can drive each channel, what the provider checks, and what neither protects against. Behavior is in [add-on hold](../addon-hold.md); exact values are in the -[add-on hold IPC reference](../../reference/addon-hold-ipc.md). +[add-on hold IPC reference](../../reference/addon-hold-ipc.md). It also +records the cluster commands that change macOS settings as root, each only +with an administrator's approval. ## Context @@ -86,6 +88,22 @@ flowchart LR `provider-swift/Sources/ProviderCore/Addon/AddonHoldPaths.swift` (`AddonHoldPaths.production`). +### Administrator-approved system changes + +Two cluster commands change macOS settings as root, each only after a person +approves macOS's own authorization prompt for one fixed command line. Both run +through `/usr/bin/osascript` (`ClusterLinkApproval`); Darkbloom never uses +`sudo`, never sees a password, and adds no privileged helper. + +| Command | What it changes | Values | Undo | +|---|---|---|---| +| `darkbloom cluster link --fix` | A link-local address on the cluster's Thunderbolt port, and its keeper job | Generated from the port; no operator text (`ClusterLinkPrivilegedRequest`) | `--remove` | +| `darkbloom cluster gpu-limit` | The GPU and user wire limits, and a boot job that reapplies them | From this Mac's own memory: the GPU keeps at most its memory less 16 GiB (a sixteenth from 512 GB); Apple silicon Macs with 128 GB or more only, and never where the limits cannot be read (`GLM5NextWiredLimitRequest`) | `--undo` | + +`gpu-limit` also requires a terminal and one confirmation before the prompt. A +raised GPU limit removes no admission check: the host memory gate still decides +every load and request on live memory. + ## Failure modes and limits | Action | Result | Threat-model entry | @@ -96,6 +114,11 @@ flowchart LR | The add-on crashes while its VMs, or another program, keep `ownership.lock` | An expired lease is kept for as long as the lock is held; `darkbloom addon release --force` ends it | `T-059` | | A program of the same user tampers with the add-on, the record or the lock | Outside the boundary: that user can equally stop the provider | `TB-012` | | The coordinator reads the `busy_*` fields | They are the provider's own report, not verified evidence | `TB-012` | +| `darkbloom cluster gpu-limit` runs without a terminal (the daemon, a script, a remote session without one) | No prompt and no change: it prints the commands for an administrator and exits 2 | `T-062` | +| It runs on a Mac other than an M5 of 128 or 256 GB | No values and no prompt: exit 2. The plan never names the command there; it uses the same rule | `T-062` | +| The limits are met, but the boot job is missing or differs from the one it writes | It installs the job after the same confirmation and prompt; it reports nothing to change only when both match | `TB-014` | +| A step of the raise fails as root | The command line stops at that step; the command says so, and running it again shows what is in place | `TB-014` | +| The provider is uninstalled | The boot job stays until `darkbloom cluster gpu-limit --undo` | `TB-014` | ## Code map @@ -105,7 +128,8 @@ flowchart LR | Peer policy | `provider-swift/Sources/ProviderCore/Addon/AddonPeerPolicy.swift` (`AddonPeerPolicy`) | | Operator requests | `provider-swift/Sources/ProviderCore/Addon/AddonHoldControl.swift` (`AddonHoldControlRequest`), `provider-swift/Sources/ProviderCore/Service/LifecycleMailbox.swift` (`LifecycleMailbox`) | | Hold record | `provider-swift/Sources/ProviderCore/Addon/AddonHoldStore.swift` (`AddonHoldStore`) | -| Risk register | [Threat model](../../threat-model.yaml) `TB-012`, `T-059`, `T-060` | +| GPU limit approval | `provider-swift/Sources/darkbloom/ClusterGPULimitCommand.swift` (`Cluster.GPULimit`), `provider-swift/Sources/ProviderCore/Diagnostics/GLM5NextGPULimitFlow.swift` (`GLM5NextGPULimitFlow`), `provider-swift/Sources/ProviderCore/Diagnostics/GLM5NextGPULimitEligibility.swift` (`GLM5NextGPULimitEligibility`), `provider-swift/Sources/ProviderCore/Diagnostics/GLM5NextWiredLimitApproval.swift` (`GLM5NextWiredLimitRequest`) | +| Risk register | [Threat model](../../threat-model.yaml) `TB-012`, `T-059`, `T-060`, `TB-014`, `T-062` | ## Related diff --git a/docs/developer/build.md b/docs/developer/build.md index 09627a8c54..539a7a5991 100644 --- a/docs/developer/build.md +++ b/docs/developer/build.md @@ -171,7 +171,7 @@ the only candidate. When it selects another Xcode than the image's, it exports | Mode | Used by | SDK | Apple Swift | |---|---|---|---| | `release` | `release-provider.yml`, `provider-signing-validation.yml`, master and dispatched SDK 27 release preparation | 27.2 (Xcode 27.2) | 6.4.2 | -| `qualification` (default) | `ci.yml`, pull-request SDK 27 release preparation, the Darkbloom Sandbox macOS CI base check | 27.2, or 27.0 (Xcode 27.1) | 6.4 or 6.4.x | +| `qualification` (default) | Provider CI (`provider-tests.yml`, called by `ci-dev.yml` and `ci-master.yml`), pull-request SDK 27 release preparation, the Darkbloom Sandbox macOS CI base check | 27.2, or 27.0 (Xcode 27.1) | 6.4 or 6.4.x | SDK 27.0 stays accepted in `qualification` only while the Darkbloom Sandbox production macOS CI base is on Xcode 27.1. Remove it when that base is on @@ -188,7 +188,7 @@ for `a <= b`; `<`, `>` and `==` are safe. Two checks keep the pattern out: | Check | Where it runs | What it reads | |---|---|---| -| `scripts/check-date-comparisons.py` | `ci.yml` Release Integrity | Shipped Swift source. It finds Dates by syntax, by the declaration in scope and by declared names. It refuses `>=` or `<=` passed as a function. It has no types, so it can miss a comparison | +| `scripts/check-date-comparisons.py` | The `Provider Tests` gate of `provider-tests.yml` (every CI run, dev included) and Release Integrity (`ci-master.yml`) | Shipped Swift source. It finds Dates by syntax, by the declaration in scope and by declared names. It refuses `>=` or `<=` passed as a function. It has no types, so it can miss a comparison | | `scripts/check-provider-weak-imports.py` | The release lane of `.github/actions/provider-release-build`, after the products and cluster helpers are built | The built binaries (`nm -m`). It fails on any import of the two symbols and names the calling functions (`otool -tV`) | The `scripts/provider-release-swift.sh` wrapper keeps native SwiftPM @@ -223,11 +223,11 @@ On the `dev` branch a plain `swift build` is a DevNet build: `prod`. Set `DARKBLOOM_RELEASE_ENVIRONMENT=prod` to build a production binary from the `dev` branch. -CI enforces both defaults. The Release Integrity job runs +CI enforces the master default. CI (master)'s Release Integrity job runs `scripts/provider-build-default.py`: a pull request into master, or a push to -master, fails unless the default is `prod`; one into or to `dev` fails unless -it is `dev`. Every release of master runs the same check and stops before the -build if the default is not `prod`. +master, fails unless the default is `prod`. Every release of master runs the +same check and stops before the build if the default is not `prod`. CI (dev) +has no Release Integrity, so no CI job checks `dev`'s default. Use the `dev` branch to run a provider from source against the DevNet coordinator. A push to `dev` that changes the provider publishes the DevNet @@ -277,6 +277,57 @@ the selected product without treating an old build-directory layout as a resource authority. Keep its archive/path checks and source-matched staging; see [resource and release tooling checks](test.md#focused-tooling-checks). +## CI Workflows + +Two workflows run CI. Both run the same plan, `.github/workflows/provider-plan.yml` +(the component classifier, the tree lookup and the run's one route request), +then the same tests, `.github/workflows/provider-tests.yml` (the provider +shards, the cluster jobs and the `Provider Tests` gate). Pull requests and +pushes run the same jobs; only pushes save caches. + +CI tests each change once (`scripts/ci-tested-tree.py`). The gate of a passing +run that tested something uploads an empty artifact named +`ci-tested----p<0|1>c<0|1>m<0|1>`: the tree it tested, the +event's base and head commits (`push` and the pushed commit for a push), and +the components that ran (provider, cluster, MiMo audio). Before testing, a run +looks for a record of its own change that covers every component it selected: + +- a pull request: its own tree, base and head; +- a push of commit S: S's tree with S's two parents as base and head (the pull + request that S merges, tested against S's first parent), or an earlier run of + the same push. + +The record counts only when the run that uploaded it completed successfully, +ran the same workflow file of this repository (not a fork) for the matching +event, and tested the record's head commit. Then the run starts no test job +and the gate passes, citing that run. A pull request is tested on its test +merge commit, so the push of its merge commit, when the base branch did not +move meanwhile, has the same tree and is not tested again. A squash or rebase +merge has one parent and is tested again. Any doubt (no record, a failed or +foreign run, an API error) runs the tests. Such a push runs one build-only job +instead, Refresh build caches, for the components it changed, so the branch +caches stay fresh. + +Pull requests and pushes into `dev` select the components their diff touches. +Pushes to `master` and pull requests into `master` select every component, so a +`master` record always covers the whole suite. + +The gate also checks the CI plans on every run, skipped or not: the cluster +plan's audit (`scripts/cluster-test-plan.py audit`) and the self-tests of the +shard plans, the component classifier, the tested-change lookup, the route and +the workflow pins. `dev` has no Release Integrity, so these run there too. + +| Workflow | Runs for | Jobs | +|---|---|---| +| `ci-dev.yml` (CI (dev)) | pull requests into any branch but `master` (`dev` and stacked branches), pushes to `dev` | the tests only | +| `ci-master.yml` (CI (master)) | pull requests into `master`, pushes to `master` | the tests, `Release Integrity` and `Docs Lint` | + +Release Integrity and Docs Lint are CI (master)'s own jobs, so their checks keep +their plain names (`master`'s ruleset requires `Release Integrity`). The test +jobs' checks carry the caller's job name: `Tests / Provider Tests`. The +contribution gates in `docs-impact.yml` (Commit Signatures, Docs Impact) run +only for pull requests into `master`. + ## CI Runner Routing `.github/workflows/darkbloom-route.yml` chooses where read-only CI jobs run: a @@ -288,14 +339,33 @@ lane, `format('-{0}', matrix.shard)`. | Workflow | Routed jobs | Fallback | |---|---|---| -| `ci.yml` | `release-integrity`, `docs` | `blacksmith-4vcpu-ubuntu-2404` | -| `ci.yml` | `test-provider` (lanes `test-provider-1` to `test-provider-3`, one per shard), `test-provider-summary`, `test-provider-sdk`, `test-cluster-checks`, `test-cluster` (lanes `test-cluster-1` to `test-cluster-3`), `test-cluster-gpu` (lanes `test-cluster-gpu-1` and `test-cluster-gpu-2`), `test-cluster-focused` | `blacksmith-12vcpu-macos-27` | +| `provider-tests.yml` (lanes requested by `provider-plan.yml`) | `test-provider` (lanes `test-provider-1` and `test-provider-2`, one per shard), `test-cluster` (lanes `test-cluster-1` and `test-cluster-2`), `test-cluster-gpu` (lanes `test-cluster-gpu-1` and `test-cluster-gpu-2`), `test-cluster-focused`, `refresh-caches` (pushes of a tested tree) | `blacksmith-12vcpu-macos-27` | +| `ci-master.yml` (lanes requested by `provider-plan.yml`) | `release-integrity`, `docs` | `blacksmith-4vcpu-ubuntu-2404` | | `docs-impact.yml` | `commit-signatures`, `docs-impact` | `blacksmith-4vcpu-ubuntu-2404` | | `landing.yml`, `desktop.yml`, `nightly-linear-package.yml` | `check`, `frontend`, `test` | `blacksmith-4vcpu-ubuntu-2404` | | `provider-release-cache.yml` | `warm`, pull requests only | `blacksmith-12vcpu-macos-27` | +`.github/workflows/darkbloom-watchdog.yml` is darkbloom-sandbox's GitHub-side +watchdog (`public/darkbloom-actions/.github/workflows/watchdog.yml` at +31236c54), copied unchanged: update it by copying a newer one, never by +editing. Every 10 minutes it finds a run of this repository whose job with a +Darkbloom label has waited queued with no runner for +`DARKBLOOM_WATCHDOG_MINUTES` while no Darkbloom job of the run moved, marks +it with a `Darkbloom watchdog` check run, cancels it and re-runs its route job +(`Select Runners`, here `plan / route / Select Runners`) and the jobs that +need it; the new route keeps every fallback. A run is rescued once; stranded +again, it is only cancelled. Its token has `actions: write` and +`checks: write` on this repository and nothing else. Only CI and the other +routed workflows carry Darkbloom labels, so release and signing runs are never +touched. `DARKBLOOM_WATCHDOG=off` turns it off. + Routing is off unless the repository variable `DARKBLOOM_ROUTING` is exactly -`on`. While it is off, and for pull requests from forks, every job keeps its +`on`. The repository variable `DARKBLOOM_MACOS_LANES`, when set to a number +from 0 to 99, caps the macOS jobs one run asks for: the route keeps the lanes +in the caller's order while they fit, and the others keep their fallback +without asking (any other value asks for no macOS lane). `provider-tests.yml` +lists its lanes critical path first: `test-cluster-1` (the cluster `base` +selection), then the provider shards. While it is off, and for pull requests from forks, every job keeps its fallback and the plane is not contacted. When it is on, the route job sends one `POST /v1/ci/routes` to `DARKBLOOM_SANDBOX_URL` (default `https://api-sandbox.darkbloom.dev`) for the jobs that will run, retrying at @@ -328,8 +398,12 @@ which pushed branches it admits. Other branches get `branch_not_admitted` and keep their fallback, so a push saves caches on Darkbloom only from an admitted branch and only in routed lanes ([CI Caching](#ci-caching)). Release, signing, publication, model registration, review automation and -`master` or dispatched cache warming keep literal Blacksmith labels. The -component classifier and the `Provider Tests` gate run on `ubuntu-24.04`. +`master` or dispatched cache warming keep literal Blacksmith labels. In CI, +every job that builds or tests reads its lane of the plan's one route request +(the plane routes a run attempt once); the plan's own bookkeeping (the tree +lookup, the component choice) and the `Provider Tests` gate run on +`ubuntu-24.04`. The machine shape of each profile comes from the repository's +approval, not from the request: one macOS shape and one Linux shape. Jobs on Darkbloom Sandboxes use GitHub's Actions cache, not Blacksmith's colocated cache, so their first runs start without cached build products. @@ -340,11 +414,13 @@ off and use **Re-run all jobs** to move a run back to Blacksmith. See the ## CI Caching -`.github/workflows/ci.yml` and `.github/actions/provider-ci-build/action.yml` -restore caches in every run. Only pushes to `master` and `dev` save them, when +`.github/workflows/provider-tests.yml`, `.github/workflows/ci-master.yml` and +`.github/actions/provider-ci-build/action.yml` restore caches in every run. +Only pushes to `master` and `dev` save them, when the exact key missed: the workflow's `SAVE_CACHES` is `github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev')`, -and `ci.yml` passes it to the composite action as `save-caches`. An entry saved +and `provider-tests.yml` passes it to the composite action as `save-caches` +(CI (master)'s own jobs save only on `master` pushes). An entry saved by a pull request is scoped to its merge ref, so only that pull request could restore it, and it evicted its base branch's entries from the repository's 10 GB quota. A pull request restores its base branch's newest compatible entry, @@ -357,10 +433,28 @@ the caches of the runners it ran on. | Git objects | `.git` | `git-v1--`; `git-v1---`, then `git-v1--` | every job that checks out | | Full-history Git objects | `.git` | the same under `git-full-v1-`, so shallow jobs never restore it | `docs` | | SwiftPM repositories | `~/Library/Caches/org.swift.swiftpm/repositories` | `spm-repos-v1----`; `spm-repos-v1----` | each build lane | -| Swift test build | each lane's `.build` directory | `swift-key`; `swift-prefix` from `scripts/provider-ci-cache.py` | each build lane | +| Swift test build | each lane's `.build` directory | `swift-key` (`swift-prefix` and the commit), or on a Darkbloom host `swift-prefix` and `day-`; `swift-prefix`, then `swift-loose-prefix`, then `swift-mlx-prefix`, from `scripts/provider-ci-cache.py` | each build lane | | Metal library | `$RUNNER_TEMP/metallib-cache` | `metallib-key`, exact only | each build lane | +| MiMo metadata downloads | `$RUNNER_TEMP/mimo-metadata-cache`, one file per pinned SHA-256 | `mimo-metadata-v1-`, exact only | each provider shard | | MiMo audio codec | `$RUNNER_TEMP/mimo-audio-source` | `mimo-audio-source-v2-`, exact only; fetched only when the audio gate runs ([test guide](test.md)) | the last provider shard | -| Cluster metadata build | `$RUNNER_TEMP/cluster-native-metadata` | toolchain, submodule pins, manifests and paths, then the commit | `test-cluster-checks` | +| Cluster metadata build | `$RUNNER_TEMP/cluster-native-metadata` | toolchain, submodule pins, manifests and paths, then the commit | `test-cluster-focused` | + +The Swift test build has three nested restore tiers. `swift-prefix` binds the +toolchain, the dependency manifests and pins, the checkout path and the CI +recipe (the workflows and scripts in `RECIPE_PATHS`). `swift-loose-prefix` +leaves out the recipe, which changes often and rarely changes an object, so an +edit to a workflow or a CI script no longer makes every build cold. +`swift-mlx-prefix` keeps only the toolchain, the checkout path and the MLX +gitlinks (`libs/mlx`, `libs/mlx-swift`, `libs/mlx-swift-lm`), so a change to +`Package.swift` or another pin still restores the compiled MLX. Source timestamps are +restored only for unchanged files, so SwiftPM rebuilds what changed. If a build +restored from the loose tier fails, `scripts/provider-ci-cold-retry.sh` deletes +the restored builds and the step builds once more from nothing; a failure over +an entry of the job's own recipe fails the step at once. CI (master) restores +only the first tier (`strict-cache`), so a build that may be released never +reuses objects of another recipe or dependency set. A Darkbloom host keeps +the entries it saved (10 GiB per repository), so there a push saves at most one +build per lane and UTC day; other runners key the build by commit. Every checkout uses the same five steps. The job computes the UTC day (`date -u +%F`) and restores `.git`. A step that cannot fail then deletes the @@ -408,10 +502,8 @@ flowchart LR - Swift build prefixes contain no pull-request data; the commit is only the key's suffix. A pull request that changes a CI recipe file, a manifest, a - lockfile or a submodule pin has a new prefix and builds cold. On a pull - request, the provider summary job restores the base branch's build like the - shards and rebuilds what the commit changed; on a push it restores the - shards' own build. + lockfile or a submodule pin has a new `swift-prefix`; on `dev` it restores + a looser tier and rebuilds what changed, on `master` it builds cold. - `actions/cache` stores a path outside the workspace relative to the workspace, so the SwiftPM key includes ``, a hash of `$HOME` and the workspace path. The cluster key reads only each submodule's state, pin and diff --git a/docs/developer/historical-references.md b/docs/developer/historical-references.md index e472641b4c..7b999827d0 100644 --- a/docs/developer/historical-references.md +++ b/docs/developer/historical-references.md @@ -14,7 +14,7 @@ Use a browser or a local Git checkout containing complete document history and the referenced source commits. A shallow clone may need `git fetch --unshallow origin`; check first with `git rev-parse --is-shallow-repository`. CI's Docs Lint job checks out full -history (`.github/workflows/ci.yml`, `docs`). +history (`.github/workflows/ci-master.yml`, `docs`). ## Steps diff --git a/docs/developer/test.md b/docs/developer/test.md index 3ad7fd9374..d8bd1a2d14 100644 --- a/docs/developer/test.md +++ b/docs/developer/test.md @@ -112,54 +112,74 @@ snapshots. Preserve its watchdog, cleanup and state isolation when using a focus selector. Use `scripts/run-nested-suite.sh` for documented nested Swift Testing cases and `scripts/run-exclusive-native-gpu-test.sh` for exclusive native work. -CI runs the provider suite in three shards (`Provider Unit Tests (shard K)`), one -Mac each. `PROVIDER_TEST_SHARD=K/N` selects a shard in `scripts/run-provider-tests.sh`, -and `scripts/provider-test-shards.py` chooses its suites: +CI runs the provider suite in two shards (`Provider Unit Tests (shard K)`), one +Mac each, and each shard builds once and runs three selections at the same +time. `PROVIDER_TEST_SHARD=K/N` and `PROVIDER_TEST_PROCESSES=P` make +`scripts/run-provider-tests.sh` run selections `(K-1)*P+1` to `K*P` of `N*P`, +each in its own `--no-parallel` process with its own `TMPDIR` and provider +state files; `scripts/provider-test-shards.py` chooses each selection's suites. +The processes start `PROVIDER_TEST_START_GAP` seconds apart (default 15). +SwiftPM in one process can find the build database locked by another's +startup (`unable to attach DB: ... database is locked`); it then runs the +tests and exits 1. Such a selection runs once more, but only when its log +proves that every test passed (`scripts/swift_test_lock_retry.py`: a passing +Swift Testing summary, XCTest summaries with 0 failures, no failed test or +issue). The first attempt's log and xUnit report stay beside the second's as +`attempt-1-shard-.log` and `.xml`, and both upload. +Without `PROVIDER_TEST_PROCESSES` (the release qualification lane), a shard +runs one selection, as before: | Class | Process | Suites | |---|---|---| -| Parallel | Shard 1, one process with Swift Testing's default parallelism | The test targets whose dependency closure has no MLX, Metal or cluster runtime (`PARALLEL_MODULES`) | -| Serial | One `--no-parallel` process per shard | All other suites. Shards 1 to N-1 take suites by measured seconds (`scripts/provider-test-shard-weights.json`). The last shard runs every suite that no other shard selects, so a new suite always runs | +| Parallel | After selection 1, in its process slot, with Swift Testing's default parallelism | The test targets whose dependency closure has no MLX, Metal or cluster runtime (`PARALLEL_MODULES`) | +| Serial | One `--no-parallel` process per selection | All other suites. Selections 1 to N-1 take suites by measured seconds (`scripts/provider-test-shard-weights.json`). The last selection runs every suite that no other selection picks, so a new suite always runs | -Shard 2 also runs Prompt Parity (`scripts/verify-prompt-parity.sh` with +Shard 1 (the shard of selection 2) also runs Prompt Parity (`scripts/verify-prompt-parity.sh` with `PROMPT_PARITY_SKIP_BUILD=1`, and `scripts/verify-nemotron-prompt-parity.sh`) against its own build; a parity failure fails that shard and the `Provider Tests` gate. The last shard also runs the isolated processes and the -native MiMo, desktop and installer gates. `Provider Unit Tests Summary` lists the suite with -`swift test list`, fails unless each shard executed exactly its selection and -the shards together executed the full list, checks that each Prompt Parity run -executed every listed test of its suite, merges the shards' coverage -profiles and uploads measured seconds per suite (`provider-test-shard-weights`). -When the shards drift apart, replace the weights file with that artifact. -The suites in `KEPT_APART` never share a shard: a process that ran -`NemotronSuperManagedSlotTests` and then `Qwen4PagingPrefixIntegrationTests` -crashed with SIGBUS, and each passes alone. The pair stays apart until the -Nemotron fixture cleanup is fixed. A +native MiMo, desktop and installer gates, after its selections finish, one at +a time. Each shard then lists the suite with `swift test list` from its own +build and fails unless each of its selections executed exactly its plan +(`provider-test-shards.py audit-job`); shard 1 also checks that each Prompt +Parity run executed every listed test of its suite, and the last shard checks +that the plans of all selections list every test once. With every shard +required to pass, that is the full-suite audit; no Mac job exists only for it. +Each shard reports the coverage of its own processes. When the shards drift +apart, download the `provider-unit-shard-*` artifacts and run +`python3 scripts/provider-test-shards.py weights ` (it ignores a retried selection's `attempt-1-shard-*.xml`) to +refresh the weights file. A suite moves from the parallel class to the serial class when it fails or flakes in parallel; when in doubt, a suite stays serial. -The jobs that use the `provider-ci-build` action and Cluster Metadata Checks -restore their build cache by the exact key first, then by the key prefix. Only +The jobs that use the `provider-ci-build` action and the cluster metadata runners +restore their build cache by the exact key first, then by the key prefix; the +action then tries the loose prefix, which ignores the CI recipe, and builds +once more from nothing if that build fails. Only a push to `dev` or `master` saves a build; a pull request restores its base -branch's entry and saves nothing ([CI caching](build.md#ci-caching)). CI has -no separate push-only Swift cache job. +branch's entry and saves nothing ([CI caching](build.md#ci-caching)). A push +whose tree a pull request run already tested runs no test job; one build-only +job (Refresh build caches) saves the components the push changed. The last provider shard runs the MiMo audio gate (`testNativeAudioRelease`), whose fixture needs the 1.87 GB pinned audio codec, only when the gate's inputs change (`MIMO_AUDIO` in `scripts/ci-component-paths.py`: the MiMo, audio and media provider code, the MiMo tests, the MLX pins, the audio and -provider fixture scripts and the gate's recipe) and on every `master` push, which runs every -component. A pull request outside those inputs neither downloads the codec -nor runs the gate. - -The SDK has independent test products under `libs/mlx-swift-lm`. CI validates -native memory ownership, cancellation, media decoding, paged KV and resource -packaging there as well as provider behavior. `Provider SDK Tests` is not part -of the `Provider Tests` gate: a pull request runs it only when an SDK-lane input -changes (`SDK` in `scripts/ci-component-paths.py`: the `libs/mlx-swift-lm` and -`libs/mlx-swift` pins, the build recipe and the nested-suite runners), and every -push to `dev` or `master` runs it, where a failure notifies without blocking. Preserve all retained lane gates; -do not treat the repository split as permission to skip native regressions. +provider fixture scripts and the gate's recipe), on a pull request and on a +push alike. A change outside those inputs neither downloads the codec nor runs +the gate. + +The SDK has independent test products under `libs/mlx-swift-lm`: native memory +ownership, cancellation, media decoding, paged KV and resource packaging. They +run in the SDK's own CI (Fork Tests in Layr-Labs/mlx-swift-lm), not here. +d-inference CI had a Provider SDK Tests lane that ran them again, under the +provider's SDK 27 toolchain; it was removed on 2026-11-04 because 226 of its +236 test seconds repeated Fork Tests (the test inventory of PR #1785). Its one +other step, `MiMoV26NativeMediaDeadlineTests`, +is skipped in Fork Tests until the SDK sets `MIMO_V26_SERIAL_NATIVE_TESTS=1`, +`MIMO_V26_NATIVE_MEDIA_DEADLINE_TESTS=1` and `MIMO_V26_SERIAL_LOAD_FIXTURES` for it. +The provider's release qualification still builds the provider, with the SDK +compiled in, and runs its tests under SDK 27. ### Download completion ownership @@ -409,19 +429,12 @@ a runtime prohibition. `GLM5ToolFailureTests` separately exercises streaming suffix rejection, including a valid call followed by malformed output, before fallback text or partial calls can escape. -The provider test host also carries the SDK's `GLM5NextAlignedPayloadReaderTests` -(eight filesystem/resource tests), `GLM5NextArtifactCachePolicyTests` (three -filesystem policy/cleanup tests), their inventory fixture and suite namespaces, -and `GLM5NextArtifactLoaderTests` (eight native tiny-artifact tests). The first -two suites exercise real files without creating MLX arrays. The loader suite -creates arrays and belongs in an authorized native test window. Sources live in -`provider-swift/Tests/ProviderCoreTests/Inference/Models/GLM5Next/`. -Use an immutable SDK revision containing `GLM5NextAlignedPayloadReader`, -`verificationHostBytes`, `payloadReadScratchAllowanceBytes` and the internal -descriptor-policy test initializer. An older SDK pin cannot compile this host; -resolve the dependency in the SDK rather than weakening the tests or importing -cluster-stage APIs. These tests retain full-artifact verification, aligned -windows, mutation/truncation refusal, cancellation and resource charges. +The SDK's `GLM5NextAlignedPayloadReaderTests`, `GLM5NextArtifactCachePolicyTests` +and `GLM5NextArtifactLoaderTests` run in the Fork Tests workflow of +Layr-Labs/mlx-swift-lm. The provider test host does not carry copies of them. +Their inventory fixture, `GLM5NextArtifactCachePolicySDKFixtures.swift`, stays in +`provider-swift/Tests/ProviderCoreTests/Inference/Models/GLM5Next/` because the +provider's GLM cluster tests use it. The metadata-only `GLM5NextDiscoveryLoadFootprintTests`, `GLM5NextDiscoveryTests` and `rawDiscoveryQuotationMatchesManagedTinyFixture` @@ -1057,8 +1070,8 @@ against the full suite list. Signing requires `qualify-sdk` and optimized compilation. GPU suites retain serial execution and exclusive-process isolation. A cache hit never skips a test. -The SDK 27.2 Date checks run without a Mac. Release Integrity runs, from the -repository root: +The SDK 27.2 Date checks run without a Mac. The `Provider Tests` gate and +Release Integrity run, from the repository root: ```bash python3 scripts/test-check-date-comparisons.py @@ -1238,16 +1251,15 @@ Cluster logic that needs no model or GPU is covered by check runners compiled with isolated fixture runners: each `provider-swift/Tests/Cluster*Checks/run.sh`, `libs/darkbloom-cluster/Tests/*Checks/run.sh` and `libs/darkbloom-cluster-worker/Tests/*Checks/run.sh` prints its pass count and -exits non-zero on a failure. The CI job `test-cluster-checks` (Cluster Metadata -Checks, `.github/workflows/ci.yml`) runs these runners when the classifier -selects `cluster` (see below): `libs/darkbloom-cluster-worker/Tests/CapabilityChecks/run.sh`, +exits non-zero on a failure. The CI job `test-cluster-focused` (Cluster Focused +Checks, `.github/workflows/provider-tests.yml`) runs these metadata runners first when +the classifier selects `cluster` (see below): `libs/darkbloom-cluster-worker/Tests/CapabilityChecks/run.sh`, `libs/darkbloom-cluster/Tests/PrefillScheduleChecks/run.sh`, `libs/darkbloom-cluster/Tests/StageMetadataChecks/run.py`, `libs/darkbloom-cluster/Tests/GPTOSSStageChecks/run.sh`, `libs/darkbloom-cluster/Tests/NemotronStageChecks/run.sh` and -`provider-swift/Tests/ClusterModelProvisioningChecks/run.sh provisioning`. The -job `test-cluster-focused` (Cluster Focused Checks) runs every other runner -under `libs/darkbloom-cluster/Tests`. The provisioning runner runs the +`provider-swift/Tests/ClusterModelProvisioningChecks/run.sh provisioning`, then +every other runner under `libs/darkbloom-cluster/Tests`. The provisioning runner runs the provisioning checks only. Its download cache-policy check reads how many written pages stay in the file cache, which the host's kernel and disk decide: on the hosted CI VM 0.75 of the pages written with @@ -1260,23 +1272,33 @@ what changed. The worker package's tests (built for macOS 26.2) need the GPU and exclusive device access. A loopback or fixture pass never counts as a two-Mac hardware pass. -The cluster jobs (Cluster Metadata Checks, Cluster Runtime Tests, Cluster GPU -Tests and Cluster Focused Checks) run when the classifier selects `cluster` -(`CLUSTER` in `scripts/ci-component-paths.py`): the cluster packages, the MLX +The cluster jobs (Cluster Runtime Tests, Cluster GPU Tests and Cluster +Focused Checks) run when the classifier selects `cluster`, on a pull request +and on a push alike (`CLUSTER` in `scripts/ci-component-paths.py`): the cluster packages, the MLX pins, the provider's Cluster, Distributed and NativePair sources, the provider-side cluster runners (`provider-swift/Tests/Cluster*Checks`), the other provider files the cluster runners compile, the cluster plan and the -shared build recipe. A push that runs the provider lanes also runs them. The +shared build recipe. The `Provider Tests` gate accepts a skipped cluster job only when `cluster` was not -selected. A provider-only pull request runs 4 Macs (3 provider shards and the -summary), or 5 when an SDK-lane input changes. A cluster pull request adds 7 -Macs (metadata checks, 3 runtime shards, 2 GPU shards and focused checks). +selected. A provider-only change runs 2 Macs (the 2 provider shards). A cluster +change adds 5 +Macs (2 runtime shards, the focused checks with the metadata runners, and the +2 GPU shards). A change whose tree a successful run of the same workflow +already tested runs no test job at all (`scripts/ci-tested-tree.py`). CI runs the runtime test target (`DarkbloomClusterRuntimeTests`) on the provider's macOS CI runners (see [CI runner routing](build.md#ci-runner-routing)), in selections that `scripts/cluster-test-plan.py` defines. Each selection runs in a process of its own through `scripts/run-nested-suite.sh`, which fails when -the selection runs no test or skips a test. Every process starts with +the selection runs no test or skips a test. Runtime shard 1 runs `base`, the +longest selection, alone, then the share probe alone. The probe times each +rank's share against a 1.5 s budget, so it never runs on a Mac right after +the concurrent GPU groups. Shard 2 runs two groups at the same time, each in +plan order with its own `TMPDIR` (the CPU batch-session suite with the GLM +paged-KV, invariance and census, TF32 and Gemma selections; the Qwen GPU chain +with `glm53-prefix-ssd`). A grouped selection that finds SwiftPM's build database locked, and whose log +proves every test passed, runs once more, as in the provider shards; the job +log prints both attempts' logs. Every process starts with `MLX_QMV_BATCH_INVARIANT=1`, as every cluster process does. | Selection | Job | Tests | @@ -1286,7 +1308,7 @@ the selection runs no test or skips a test. Every process starts with | Opt-in | Cluster GPU Tests (non-blocking) | The switched tests that fail on the CI runners' GPU, the long-running tests and the benchmarks. The job reports their results and does not fail the workflow | | Needs a model | None | The tests that need a model directory, an artifact or its metadata (`REQUIRES_MODEL`). CI has no model | -`python3 scripts/test-cluster-test-plan.py` (Release Integrity) checks that the +`python3 scripts/test-cluster-test-plan.py` (the `Provider Tests` gate and Release Integrity) checks that the plan names each gated test in the sources once, and each runner under `libs/darkbloom-cluster/Tests` once. When you add an environment gate to a runtime test, add the test to a selection or to `REQUIRES_MODEL`. @@ -1613,7 +1635,10 @@ registered artifact for them. link and on the measured 29 us link, where tensor parallel is predicted faster on the prior alone (`predictedFasterOnPriorOnly`), and for 8,192 + 128 or on a 109 us link. Requests served in tensor parallel decide both ways on both - pairs. `provider-swift/Tests/ClusterPlacementChecks/run.sh` checks that the + pairs. Every tensor-parallel plan (forced, placed first, or chosen on served + requests) has the serial prefill schedule, the only one MiMo's + tensor-parallel runtime loads; the speculative pipeline keeps the one-chunk + lookahead. `provider-swift/Tests/ClusterPlacementChecks/run.sh` checks that the guided step credits MiMo's rounds from its shipped records and prints the fastest-plan and logprob lines. Through the guided step it also checks feature parity (`ClusterModeParity`) before the evidence rule: @@ -1685,7 +1710,8 @@ registered artifact for them. rollback). Sampled rounds (temperature 0.8: the heads, and the misses scripted from the sampled one-token run) must equal the sampled one-token path bit for bit. Two `tp` ranks over the ring must equal `simulated` for the heads, the - misses and a sampled run. + misses and a sampled run. `--mode full` with `--mtp-depth` must be refused + before loading: a verify window runs only on a tensor-parallel rank. `MIMO_ORACLE_PATHS=paged` runs one matrix. @@ -1767,6 +1793,7 @@ python3 scripts/test-provider-release-pipeline.py python3 scripts/test-provider-release-artifact.py python3 scripts/test-provider-release-cache.py python3 scripts/test-darkbloom-route.py +python3 scripts/test-ci-tested-tree.py python3 scripts/test-provider-signing-validation.py python3 scripts/test-prepare-metal-toolchain.py python3 scripts/test-stage-swiftpm-resource-bundles.py @@ -2189,7 +2216,7 @@ failed test responses, terminal restoration and plain output. Set `ONBOARDING_TRANSCRIPTS` to a private output directory to retain screen text. The harness compiles only the onboarding flow, terminal and scripted operations; it does not configure a network port, start a service or load a model. CI runs -it in the `Cluster Metadata Checks` job (step `Run cluster onboarding checks`). +it in the `Cluster Focused Checks` job (step `Run cluster onboarding checks`). Its rows include the end of the setup after the cluster registers with the coordinator: the screen waits for both parts to serve again before it says Done (`leaderWaitsForThePartsAfterTheRegistration`). @@ -3180,12 +3207,15 @@ stops and by the other Mac's before it saves, because a member's registration names no shares (`NativePairMemberRoster`). From `libs/darkbloom-cluster`, `swift test --filter QwenTensorParallelShareProbeTests` -checks the per-mille share and the probe request's shape on the CPU. With +checks the per-mille share, the probe request's shape and the probe's rounds +on the CPU: on a constructed clock, a slow prefill and warm-up leave every timed +round, slow timed rounds stop at the budget, and the limit stops every round. With exclusive GPU custody and the matching Metal library, set `QWEN_TP_SHARE_PROBE_GPU=1`: a synthetic shard's probe must cross nothing to its counting peer, reduce through it again afterwards, return its request's pages and cache, and give no probe (keeping nothing) when memory is refused, the -deadline is near, the budget runs out or the load is cancelled midway. These +deadline is near, the budget or the limit runs out or the load is cancelled +midway, and give every timed round after a setup slower than the budget. These fixtures time synthetic weights on one Mac; real share steps and the plan they lead to are paired-hardware checks. diff --git a/docs/provider/agent-setup.md b/docs/provider/agent-setup.md index 6e81225520..b3f2d78044 100644 --- a/docs/provider/agent-setup.md +++ b/docs/provider/agent-setup.md @@ -70,9 +70,22 @@ set up, three commands work from your shell without a terminal: 10. Use `sudo` only where a Darkbloom message asks for it, and let the human type the password. 11. On a paired Mac, `darkbloom start`, `stop`, `restart` and `status` act on the pair, from either Mac, and say so in their first line. Single-Mac - options such as `--model` are refused there (exit status 64). Add `--solo` - only when the human wants single-Mac serving on this Mac alone, and only - while the pair is stopped: it is refused while this Mac's part of the pair serves. + options such as `--model` are refused there (exit status 64) while the pair + runs. Add `--solo` only when the human wants single-Mac serving on this Mac + alone: it is refused while the pair runs here. While the pair doesn't run + here (stopped, or the other Mac gone), `darkbloom start` serves this Mac + alone and says so in its first line ([going back to serving on one + Mac](two-mac-cluster.md#going-back-to-serving-on-one-mac)). +12. Before `darkbloom cluster` on a pair, tell the human to be at both Macs' + screens, or to open Screen Sharing to each Mac with no display (a Mac + Studio, a MacBook with its lid closed): every macOS prompt of the setup + (the cable port's password, Local Network's Allow, the pairing code's Yes) + is on that Mac's own screen. Never run the setup, `darkbloom cluster link + --fix` or `--remove`, or `darkbloom uninstall` on a pair Mac over SSH: macOS + can't show its approval prompt there, and Darkbloom says so and stops + (``macOS can't show its approval prompt over SSH. Run `darkbloom cluster` in + Terminal on this Mac's own screen, or through Screen Sharing.``). Pass that + on to the human; never choose "Go on over SSH" for them. ### What only the human can do @@ -86,9 +99,9 @@ start, then ask for each one when it comes up and wait. | Darkbloom login | [Step 2](#2-log-in-and-check-the-mac-every-mac), on each Mac | Opens the URL that `darkbloom login` prints in a browser, signs in, and enters the code it prints | | Turn on RDMA over Thunderbolt (two Macs) | [Step 4](#4-two-macs-connect-the-cable-and-check-the-link), once per Mac, as an administrator | On macOS 27: System Settings → Privacy & Security → RDMA over Thunderbolt, then restart. On macOS 26: starts the Mac in Recovery, runs `rdma_ctl enable` in Terminal, then restarts | | Plug in the cable (two Macs) | Step 4 | Connects one Thunderbolt 5 cable directly between a Thunderbolt 5 port on each Mac, with no dock or hub | -| macOS administrator password for the cable port | [Step 5](#5-two-macs-pair-them), once per Mac, only while the port isn't set up | Types it into macOS's prompt. Over SSH, types it into `sudo` in that terminal | +| macOS administrator password for the cable port | [Step 5](#5-two-macs-pair-them), once per Mac, only while the port isn't set up | Types it into macOS's prompt on that Mac's own screen (Screen Sharing on a Mac with no display). Not over SSH: macOS can't show its prompt there ([rule 12](#rules-for-the-agent)) | | Confirm the pairing code | Step 5 | Checks that both screens show the same six digits, then chooses **Yes** on each Mac | -| Local Network permission | Step 5, right after pairing, on each Mac | At the Mac's own screen (Screen Sharing on a Mac with no display): System Settings → Privacy & Security → Local Network → turns on “Darkbloom” (on DevNet, “Darkbloom Dev”), and clicks **Allow** if macOS asks. Don't wait for a prompt: on a Mac with no display it may never show. If macOS's firewall is on, also lets Darkbloom accept incoming connections (System Settings → Network → Firewall) | +| Local Network permission | Step 5, right after pairing, on each Mac | At the Mac's own screen (Screen Sharing on a Mac with no display): System Settings → Privacy & Security → Local Network → turns on “Darkbloom” (the DevNet app is listed under that name too). With no such row, macOS has never asked on that Mac: it asks on that Mac's screen the next time the app dials over the cable, and the human clicks **Allow** there. If macOS's firewall is on, also lets Darkbloom accept incoming connections (System Settings → Network → Firewall) | | Choose the model | Step 3 or [step 6](#6-two-macs-choose-the-model-on-the-leader), and when changing it later | Picks from the list that you read out | | Screen Sharing (headless Macs) | Any macOS prompt, and the login session | macOS prompts appear only on the Mac's own screen, so the human opens it with Screen Sharing. Apple's App Attest also needs someone logged in to the Mac's desktop | | Log in to macOS after a restart or power cut | Any time | Logs in on that Mac. With FileVault on, the disk stays locked until then, and Darkbloom serves again only after that. A pair serves only once both Macs are logged in | @@ -149,8 +162,9 @@ page with these names ([dev build identity](../operations/provider-release.md#de is free on both. The card says which. Only one app serves a pair on a Mac at a time. `8001` is only the DevNet app's default for single-Mac local serving. - **The DevNet app names `darkbloom-dev`** in its screens, commands and hints, - and the Local Network lines name “Darkbloom Dev”. Type `darkbloom-dev`; the - plain `darkbloom` command is the production app. + and the Local Network lines name “Darkbloom Dev”, but tell the human to turn + on the row macOS lists, “Darkbloom”: both apps share one bundle ID. Type + `darkbloom-dev`; the plain `darkbloom` command is the production app. ## Steps @@ -361,15 +375,15 @@ with status 1. So the human runs it in Terminal on each Mac and reads the screen to you, or pastes it. If you have a real interactive terminal on that Mac, you may run `NO_COLOR=1 darkbloom cluster` there yourself: it then prints plain lines and numbered choices. Even then, the pairing code and every macOS -prompt are the human's (rules 6 and 7). A first setup opens with what the -human will be asked and about how long it takes, then has four steps: +prompt are the human's (rules 6 and 7). A first setup opens, on both Macs, with what the +human will be asked on each Mac's own screen (Screen Sharing for a Mac with +no display) and about how long it takes, then has four steps: **1/4 Connect**, **2/4 Pair**, **3/4 Model** and **4/4 Start** ([details](two-mac-cluster.md#the-steps-once)). 1. On the leader, run `darkbloom cluster`. It shows `1/4 Connect` and `Allow - macOS's password and Local Network prompts.` (over SSH: `Allow macOS's - password prompt here and its Local Network prompt on this Mac's screen - (Screen Sharing if headless).`). If the cable port isn't set up yet, macOS + macOS permissions.` (over SSH: `Allow macOS permissions here and on this + Mac's screen (Screen Sharing if headless).`). If the cable port isn't set up yet, macOS asks once for the administrator password, and the human types it; a port set up before asks nothing. Next come `✓ Cable ready`, `2/4 Pair` and ``Run `darkbloom cluster` on the other Mac.``. The leader then waits. If the @@ -385,15 +399,27 @@ human will be asked and about how long it takes, then has four steps: Local Network access. The screen may ask for it (for example `Click Allow on the Local Network prompt for Darkbloom. Allow it on the other Mac too.`, then `✓ Allowed`; on DevNet it names Darkbloom Dev), but don't wait for a macOS - prompt: on a Mac with no display it may never show. **STOP** on each Mac: - the human, at that Mac's own screen (Screen Sharing on a Mac with no - display), opens System Settings → Privacy & Security → Local Network and - turns on “Darkbloom” (on DevNet, “Darkbloom Dev”). You can't see or change - this setting. If it is still off when the pair starts, the leader's ✗ in - step 7 says so within about 20 seconds ([Local Network](#on-a-two-mac-pair)). + prompt in this terminal. **STOP** on each Mac: the human, at that Mac's own + screen (Screen Sharing on a Mac with no display), opens System Settings → + Privacy & Security → Local Network and turns on “Darkbloom”. The DevNet app + is listed as “Darkbloom” too: both apps share one bundle ID. If the list has + no “Darkbloom” row, macOS has never asked on that Mac: it asks on that Mac's + screen the next time the app dials over the cable (when the pair starts), + and the human clicks **Allow** there. You can't see or change this setting. + If it is still off when the pair starts, the leader's ✗ in step 7 says so + within about 20 seconds ([Local Network](#on-a-two-mac-pair)). 4. The other Mac then says ``Waiting for the other Mac (…) to choose the model - and start…`` and follows the start, one line per change, such as - ``The other Mac: .``. When a part ends there, it adds ``Choose Retry + and start…``. With a leader on this release or later, it also says once what + the leader's screen waits on, such as ``The other Mac (…): it's waiting for + Allow on its Local Network prompt.`` or ``… it's waiting for a model to be + chosen on its screen.``: **STOP** and have the human answer it on the + leader. Its live line shows how long it has waited out of 15 minutes. It then + follows the start, one line per change, such as ``The other Mac: .``. + If it ends with ``✗ Not serving: The two Macs run different Darkbloom + builds.``, run `darkbloom update` on the Mac it names (or on the one whose + `darkbloom --version` is lower), then `darkbloom cluster` on the leader. If + it ends with ``✗ Not serving: The other Mac (…) didn't start a model within + 15 minutes.``, the leader's screen is still waiting on the step it names. When a part ends there, it adds ``Choose Retry on the other Mac (…): its screen shows the choices.``. If macOS keeps this Mac off the local network, it says ``This Mac can't reach the other Mac over the cable: macOS keeps Darkbloom off the local network.`` and where to @@ -426,7 +452,8 @@ A line ends with `copy` or `download` when one Mac lacks the model. Lines that end with `does not fit now` (apps hold the memory it needs) or `not enough free disk` come after the others. -Tell the human how the split works. Never choose a mode for them: +Tell the human how the split works. Never choose a model for them; for the +mode, take the one the screen recommends (step 2): - **Tensor parallel** splits every layer across both Macs. Each Mac holds half of every layer, and both work on every token. @@ -444,9 +471,14 @@ Tell the human how the split works. Never choose a mode for them: 1. **STOP**: read the list to the human and ask which model to serve. Enter selects the first line. Rule 5 applies: a `download` model is downloaded on the leader and then copied, so it takes its full size on each Mac. -2. If the screen then asks ``How should both Macs split ?``, the first - choice is the fastest mode measured on these Macs, or the planner's choice - when none is measured yet. Keep it unless the human wants the other. +2. If the screen then asks ``How should both Macs split ?``, its first + line is ``Recommended for on these two Macs: , .`` (the + why is shorter, or left out, in a narrow window) and that mode's line + ends with `· recommended for these Macs`; Enter selects it. Pick the + recommended mode unless the human wants the other: it is the one that fits, + serves more requests at once through Darkbloom, or is faster on these Macs. + When the line is ``No recommendation for on these two Macs: .``, read the why + to the human and keep the selected line unless they choose otherwise. 3. If the model still has to reach a Mac, a second list offers `Download`, `Copy to the other Mac (about N s)` or `Copy from the other Mac`, and `Cancel`. Enter selects the first. Progress is shown, and an interrupted @@ -556,10 +588,11 @@ Check all three: | Exit status | `state` | Do | |---|---|---| | `0` | `serving` | Go on | - | `3` | `not_serving` with `reason` ``This Mac can't reach the other Mac over the cable: macOS keeps Darkbloom off the local network`` or ``The other Mac can't reach this Mac over the cable: macOS keeps Darkbloom there off the local network`` (on DevNet, both name Darkbloom Dev) | macOS keeps that Mac off the local network, and nothing changes until someone turns it on. Don't wait. **STOP**: ask the human to do this on the Mac `next` names: System Settings → Privacy & Security → Local Network → turn on “Darkbloom” (on DevNet, “Darkbloom Dev”), through Screen Sharing on a Mac with no display. Then run `darkbloom start` (on either Mac), or choose **Retry** in `darkbloom cluster` on the leader ([Local Network](#on-a-two-mac-pair)) | + | `3` | `not_serving` with `reason` ``This Mac can't reach the other Mac over the cable: macOS keeps Darkbloom off the local network`` or ``The other Mac can't reach this Mac over the cable: macOS keeps Darkbloom there off the local network`` (on DevNet, both name Darkbloom Dev) | macOS keeps that Mac off the local network, and nothing changes until someone turns it on. Don't wait. **STOP**: ask the human to do this on the Mac `next` names: System Settings → Privacy & Security → Local Network → turn on “Darkbloom” (the DevNet app is listed under that name too); if it isn't listed, click **Allow** when macOS asks on that Mac's screen, the next time the app dials over the cable; through Screen Sharing on a Mac with no display. Then run `darkbloom start` (on either Mac), or choose **Retry** in `darkbloom cluster` on the leader ([Local Network](#on-a-two-mac-pair)) | + | `3` | `not_serving` with `reason` ``not offered to Darkbloom (…)`` | The pair serves on the leading Mac's local API only: the coordinator doesn't have it, and it earns nothing. The parenthesis says why. Don't restart anything. **STOP**: ask the human to run `darkbloom cluster` on the leader and choose the model again, which plans it for Darkbloom and asks the coordinator (`next` says the same) | | `3` | `not_serving` with another `reason` | Follow `next` and [troubleshooting](#troubleshooting) | | `3` | `loading`, `unknown` | Check again every few minutes, for up to 15 minutes, without restarting anything (rule 8). If it still says so after 15 minutes, **STOP**: the human runs `darkbloom cluster` on the leader, which shows more | - | `4` | `stopped` | The pair is stopped. If the other Mac isn't answering too, the lines add ``The other Mac (…) isn't answering over the cable.``. **STOP**: ask the human, then run `darkbloom start` | + | `4` | `stopped` | The pair is stopped. If the other Mac isn't answering too, the lines add ``The other Mac (…) isn't answering over the cable.``. During a model or mode change, or while the pair updates Darkbloom, `status` and `cluster status` can read `stopped` (exit 4) or `unknown` for a minute or two while the pair is actually reloading. If such a change happened recently, or the status showed "Updating…", wait about a minute and check again before you act. Only if it still reads `stopped`: **STOP**, ask the human, then run `darkbloom start` | | `5` | `other_mac_away` | The other Mac isn't answering over the cable. **STOP**: `next` says why and what to run on that Mac | | `6` | `not_paired` | This Mac isn't in a pair. Go back to [step 5](#5-two-macs-pair-them) | | `7` | `pairing_unreadable` | This Mac's pairing record couldn't be read. **STOP**: the human runs `darkbloom cluster` on this Mac to check it | @@ -625,7 +658,7 @@ otherwise ([stopping and starting again](two-mac-cluster.md#stopping-and-startin | Change or test the model, or switch between serving through Darkbloom and locally only | The leader, in a terminal | `darkbloom cluster`, or `darkbloom start` in a terminal ([below](#the-pairs-model-list)) | | Start over and pair again | Either Mac, in a terminal | `darkbloom cluster` → **Start over (unpair and set up again)** → **Yes, start over**. Then run `darkbloom cluster` on the other Mac and choose **Start over (unpair and set up again)**, or **Pair again**, if it offers it ([pairing again](two-mac-cluster.md#pairing-again)) | | Update | Every Mac | `darkbloom update` on each Mac, and the pair restarts together. Automatic updates are on by default | -| Serve on one Mac alone instead of the pair | That Mac | Stop the pair first (`darkbloom stop`), then `darkbloom start --solo --model `. `--solo` is refused while this Mac's part of the pair serves. `stop --solo`, `restart --solo` and `status --solo` act on single-Mac serving alone. Stop it with `darkbloom stop --solo` before you start the pair again | +| Serve on one Mac alone instead of the pair | That Mac | While the pair runs: stop it first (`darkbloom stop`), then `darkbloom start --solo --model `. While it doesn't run here (the other Mac is gone or stopped clustering): `darkbloom start` serves this Mac alone. `--solo` is refused only while the pair runs here. `stop --solo`, `restart --solo` and `status --solo` act on single-Mac serving alone. Stop it with `darkbloom stop --solo` before you start the pair again | | Stop one Mac whose partner is gone for good | That Mac | `darkbloom cluster stop --local-only` | | Keep this Mac's cluster service from starting at login | That Mac | `darkbloom cluster stop --service`. It stops the pair first. `darkbloom cluster` turns it on again | | List the cluster commands | Any Mac | `darkbloom cluster --help` | @@ -746,7 +779,9 @@ yet"](troubleshooting.md#a-two-mac-cluster-says-not-serving-yet) and | Signal | Cause | Do | |---|---|---| -| The leader's ✗ says ``The other Mac can't reach this Mac over the cable: macOS keeps Darkbloom there off the local network.``, then ``The other Mac (…): System Settings → Privacy & Security → Local Network → turn on “Darkbloom” (on a Mac with no display, through Screen Sharing). Then choose Retry here.``. On that other Mac: ``This Mac can't reach the other Mac over the cable: macOS keeps Darkbloom off the local network.`` (on DevNet, both name Darkbloom Dev). `darkbloom cluster status` shows the same reason as ``✗ Not serving: .``, then ``Next: …`` (`--json`: `state` `not_serving`, exit status 3), on that Mac at once, and on the leading Mac from about 20 seconds into its part, steadily after that while that Mac stays refused | macOS keeps that Mac's cluster service off the local network, so its link to the other Mac is refused | **STOP**: the human, at that Mac's screen (Screen Sharing if it has no display), opens System Settings → Privacy & Security → Local Network and turns on “Darkbloom” (on DevNet, “Darkbloom Dev”). Then choose **Retry** where the ✗ offers it (usually on the leader), or run `darkbloom start` on either Mac, as `next` says. Until then, `darkbloom start` on the Mac that is kept off ends at once with the same lines and exit status 1 | +| The human stopped clustering, and the Mac is online but gets no requests; `darkbloom status` says ``The other Mac (…) hasn't answered for 15 min; this Mac's part stopped.`` or ``The pair hasn't served for … min``; on 0.10.8 `darkbloom start --solo` says ``This Mac's part of the pair holds its serving lock`` | The Mac kept the pair's saved start, so its cluster service ran its part of a pair that no longer forms. That part registers only as a pair member, which gets no ordinary requests | With the human's go, run `darkbloom start` on that Mac (0.10.9 or later): it stops the leftover part and serves this Mac alone. On 0.10.8: `darkbloom cluster pair --status`, then `darkbloom cluster pair --forget `, then `darkbloom start`. Never plain `darkbloom stop` on 0.10.8 for this: it acts on the pair | +| ``✗ The pair can't start: a single-Mac Darkbloom provider (process ) is serving on , …``; a cluster status or log line ``a single-Mac Darkbloom provider (process ) is serving on this Mac, so this Mac's part can't start``; an incident `local_provider_running`. In 0.10.8 the same cause read ``another update operation owns the lock (pid , provider-instance)`` and looped ``this Mac's part ended … and starts again by itself`` | Single-Mac serving runs on that Mac and holds its one serving lock, so the pair's part can't start there. It doesn't end by itself | **STOP**: ask the human whether to stop single-Mac serving on each Mac named. With their go, run `darkbloom stop --solo` on that Mac, then `darkbloom start` (on DevNet, `darkbloom-dev`). In `darkbloom cluster`, **Stop single-Mac serving on both Macs and start the pair** does both. Both Macs' `darkbloom cluster status` say the block, with `next` ``Single-Mac serving doesn't stop by itself: …`` (`state` `not_serving`, exit status 3), and the joining Mac's window shows the same ✗. Neither Mac keeps restarting its part meanwhile; don't wait for it to clear by itself. From 0.10.9, single-Mac serving that nobody chose since the pair was started steps aside by itself (`darkbloom status` says ``Single-Mac serving stepped aside for the pair …``). Only a choice the human made (`start --solo`, **Serve on this Mac alone**) keeps it. `darkbloom stop --solo` on the other Mac finds it there and asks (`--yes` for scripts) Never plain `darkbloom stop` for this: on a paired Mac it stops the pair and leaves single-Mac serving running | +| The leader's ✗ says ``The other Mac can't reach this Mac over the cable: macOS keeps Darkbloom there off the local network.``, then ``The other Mac (…): System Settings → Privacy & Security → Local Network → turn on “Darkbloom”; if it isn't listed, click Allow when macOS asks on that Mac's screen, the next time Darkbloom dials over the cable (on a Mac with no display, through Screen Sharing). Then choose Retry here.``. On that other Mac: ``This Mac can't reach the other Mac over the cable: macOS keeps Darkbloom off the local network.`` (on DevNet, both name Darkbloom Dev, and add that macOS lists Darkbloom Dev as “Darkbloom”). `darkbloom cluster status` shows the same reason as ``✗ Not serving: .``, then ``Next: …`` (`--json`: `state` `not_serving`, exit status 3), on that Mac at once, and on the leading Mac from about 20 seconds into its part, steadily after that while that Mac stays refused | macOS keeps that Mac's cluster service off the local network, so its link to the other Mac is refused | **STOP**: the human, at that Mac's screen (Screen Sharing if it has no display), opens System Settings → Privacy & Security → Local Network and turns on “Darkbloom” (the DevNet app is listed under that name too), or, with no such row, clicks **Allow** when macOS asks on that screen. Then choose **Retry** where the ✗ offers it (usually on the leader), or run `darkbloom start` on either Mac, as `next` says. Until then, `darkbloom start` on the Mac that is kept off ends at once with the same lines and exit status 1 | | doctor: ``[FAIL] cluster savedConfiguration: saves this Mac's cluster setup, but other users can open it (mode 644); run `chmod 600 ` …`` | The saved setup is in a file other users can open | **STOP**: tell the human, and run that `chmod 600` command only with their go ([step 2](#2-log-in-and-check-the-mac-every-mac)) | | After installing another Darkbloom app on a paired Mac (DevNet beside production, or the signed release over a local build), `darkbloom cluster` shows the old pairing as usual, or says the other Mac isn't answering, and offers no **Pair again** | The apps share the pairing, and the new app may not notice that its key differs | With the human's go, choose **Start over (unpair and set up again)** → **Yes, start over** on both Macs, then pair as in step 5. It unpairs the Mac for both apps | | doctor: `[FAIL] cluster localLinkIsolation.rdma_enN: clusterSubnetInUse: The cluster port enN cannot be isolated yet (the cluster subnet 10.219/16 is already used on this Mac) …`, on a version below 0.10.8 | A known false alarm on paired Macs: macOS reaches the port's own address through a loopback route | Don't stop for it, and never run `darkbloom cluster link --remove` because of it. Verify serving instead, and update both Macs. 0.10.8 no longer reports it | diff --git a/docs/provider/cli-reference.md b/docs/provider/cli-reference.md index 4874cd9599..6aa472e2b0 100644 --- a/docs/provider/cli-reference.md +++ b/docs/provider/cli-reference.md @@ -149,7 +149,12 @@ set to any value skips it. Logging goes to stderr so launchd captures it in In a terminal, `start`, `stop`, `restart`, `status` and `update` open with the Darkbloom mark beside the command's name and show a one-row live line while they wait (a drain, a restart, an update's download). It is look only: every -line they print is the same, in the same order. The cluster setup's rules +line they print is the same, in the same order. The live line, here and on the +cluster's screens, is always one row: +- It is fitted to the window's width at each redraw, minus 6 columns. +- Control characters in a reason become spaces, and a wide character counts as two columns. +- A long reason is shortened, keeping its time at the end. +- Line wrap is off while the row is drawn, so it is cut at the window's edge, never wrapped. The cluster setup's rules apply (`DarkbloomCommandLook`, `provider-swift/Sources/ProviderCore/Terminal/DarkbloomCommandLook.swift`): pipes, logs, the LaunchAgent's files, `NO_COLOR`, `CLICOLOR=0`, `TERM=dumb`, a non-UTF-8 locale and windows under 40 columns get the plain bytes; @@ -232,7 +237,11 @@ without one is a leftover, which `darkbloom cluster status` names), `start` star (`This Mac is in a two-Mac cluster with the other Mac (…): starting the pair.`): - In a terminal it opens exactly the screen `darkbloom cluster` shows on this - Mac (`ClusterPairCommands.openScreen`). + Mac (`ClusterPairCommands.openScreen`), whose title names this Mac's part: + "Darkbloom cluster · Leading Mac" or "Darkbloom cluster · Joining Mac". + In a color terminal each finished step folds to one line, and the run's whole + flow goes to `~/.darkbloom/cluster-setup/screens/` ("Full log: …" at the end); + see [Two Macs as one provider](two-mac-cluster.md). - Without a terminal (scripts) it starts the pair's saved model on both Macs (on the Mac that follows, through the leading Mac), waits up to 10 minutes until it serves or says why not, and ends with a result block shaped like @@ -256,9 +265,27 @@ This Mac is in a two-Mac cluster with the other Mac (Apple M5 Max, 128 GB): star ``` `--solo` starts single-Mac serving on this Mac instead, after one line, while -the pair is stopped: single-Mac serving and this Mac's part of the pair take -the same serving lock, so `start --solo` while the part serves is refused -(stop the pair first). The +the pair doesn't run here: single-Mac serving and this Mac's part of the pair take +the same serving lock, so `start --solo` while the pair runs here is refused +(stop the pair first). + +While the pair doesn't run here (`ClusterPairWatch`: stopped, or its other Mac +hasn't answered for 15 minutes, or it never served in its first 15 minutes), +`darkbloom start` serves this Mac alone (`Start.PairStart.serveAlone`): with +`--solo`, with single-Mac options such as `--model` (the app's Go Online, +`autopilot enable`), and from a script. In a terminal it asks **Serve on this +Mac alone** (the default when the other Mac isn't answering) or **Start the pair +(`darkbloom cluster`)**. It first stops a part of the pair still running here and +clears the pair's saved start on this Mac (`ClusterService.releaseForSingleMac`, +up to 5 minutes), then says one line: ``This Mac is in a two-Mac cluster with the +other Mac (…), which isn't running here: serving this Mac alone, and its saved +start is cleared (`darkbloom cluster` starts the pair again).`` A part that +doesn't stop in time starts nothing (exit 1) and names `darkbloom cluster pair +--status`, then `darkbloom cluster pair --forget `, then `darkbloom start`. +While the other Mac answers but the pair hasn't served yet (it may still be +loading), only `--solo` and the terminal's choice serve this Mac alone; the +other forms act on the pair as while it runs. +See [going back to serving on one Mac](two-mac-cluster.md#going-back-to-serving-on-one-mac). The cluster's own starts (`--cluster-member`, `--distributed`, the cluster service's solo part) and launchd's `--foreground` child are never redirected, and a replacement drains only the provider service's process, never the @@ -268,15 +295,16 @@ On a paired Mac, `darkbloom start` says first when it replaces a cluster service running from a terminal session with the login agent. When macOS's Local Network setting keeps this Mac's link follower off the cable, it ends its wait at once with where to turn it on (System Settings → Privacy & Security → Local Network → -"Darkbloom", or "Darkbloom Dev"; through Screen Sharing on a Mac with no -display), and exits 1. +"Darkbloom", the row macOS lists for the DevNet app too; with no such row, Allow +on macOS's prompt on that Mac's screen at the next dial; through Screen Sharing +on a Mac with no display), and exits 1. Options on a paired Mac (`Start.singleMacOptions`, `ClusterPairSummary.singleMacOptionsRefusal`): | Options | Without `--solo` on a paired Mac | |---|---| | `--config` | Applies to the pair (its cluster service settings) | -| `--model`, `--all`, `--idle-timeout`, `--schedule`, `--autopilot`/`--no-autopilot`, `--coordinator-url`, `--timeout`, `--force`, `--local-endpoint`, `--port`, `--bind`, `--no-auth` | Refused by name, nothing starts, exit 64: ``This Mac is in a two-Mac cluster with the other Mac (…): `--model` is for single-Mac serving, so nothing was started.`` then ``To choose the pair's model, run `darkbloom start` in a terminal; to serve this Mac alone with it, add --solo.`` | +| `--model`, `--all`, `--idle-timeout`, `--schedule`, `--autopilot`/`--no-autopilot`, `--coordinator-url`, `--timeout`, `--force`, `--local-endpoint`, `--port`, `--bind`, `--no-auth` | While the pair doesn't run here: single-Mac serving with them, as above. While it runs here: refused by name, nothing starts, exit 64: ``This Mac is in a two-Mac cluster with the other Mac (…): `--model` is for single-Mac serving, so nothing was started.`` then ``To choose the pair's model, run `darkbloom start` in a terminal; to serve this Mac alone with it, add --solo.`` | | `--local` | Refused the same way, plus ``To serve the pair on the leading Mac's own API only: `darkbloom cluster local`.`` (also said for `--local-endpoint`) | | `--cluster-member`, `--distributed`, `--foreground` | The cluster's own starts and launchd's child: never redirected to the pair | | `--always-on`, `--supervise`, `--no-coordinator` | Valid only with `--cluster-member` or `--distributed` (refused at parse otherwise) | @@ -658,6 +686,27 @@ per share of this model within 30 days, by member ID), or from any every share is predicted as before. A named file that is not a share probe history stops the command. +### `darkbloom cluster gpu-limit` + +```bash +darkbloom cluster gpu-limit [--undo] +``` + +| Flag | Type | Default | Effect | +|---|---|---|---| +| `--undo` | flag | `false` | Remove the job that keeps the limit raised and return `iogpu.wired_limit_mb` to the macOS default | + +Lets this Mac's GPU keep its memory less 16 GiB resident, so GLM-5.3-Flash runs +on two 128 GB Macs with room for long requests (Apple silicon Macs with 128 GB +or more only; exit 2 elsewhere, with the reason, and where the Mac does not +report the limits). It prints the current and the new limit, asks once (`y`), and +then macOS asks an administrator to approve. Where the limits are already met, +it installs the boot job that keeps them if that job is missing or differs, and +changes nothing if it is in place. It needs a terminal; without one it prints +the commands an administrator can run and exits 2. Values, persistence and +undo: [GPU memory limit for a GLM pair](../reference/configuration.md#gpu-memory-limit-for-a-glm-pair) +(`provider-swift/Sources/darkbloom/ClusterGPULimitCommand.swift`). + ### `darkbloom cluster local` The setup response check uses the model's default reasoning controls. It does not send a binary thinking override; if its token budget ends during reasoning, it reports that the model is still thinking. This is a liveness check, not an answer-quality benchmark. Source: `provider-swift/Sources/ProviderCore/Inference/Distributed/Console/ClusterSetupProbeRequest.swift` and `ClusterSetupWizardLiveOperations.prompt`. @@ -707,8 +756,8 @@ Next: Leave both Macs running: Darkbloom retries by itself. Or serve locally onl | Exit status | `state` | Meaning | |---|---|---| -| `0` | `serving` | The pair serves (through Darkbloom, or on the leading Mac's local API) | -| `3` | `loading`, `not_serving`, `unknown` | Not serving yet: loading, or a reason in `reason` (such as macOS keeping a Mac off the local network, below) | +| `0` | `serving` | The pair serves: through Darkbloom once the coordinator has it, or on the leading Mac's local API when it serves locally only | +| `3` | `loading`, `not_serving`, `unknown` | Not serving yet: loading, or a reason in `reason` (such as macOS keeping a Mac off the local network, or a pair not offered to Darkbloom, below). A load whose part keeps ending gives that end as its reason, as the start's screen says it: "this Mac's part ended (exit 1: deadline) and starts again by itself" | | `4` | `stopped` | Stopped (Stop in `darkbloom cluster`, or `darkbloom cluster stop`), also while the other Mac isn't answering | | `5` | `other_mac_away` | The pair is started and the other Mac isn't answering over the cable (its cluster service is off, it sleeps, or waits for a login) | | `6` | `not_paired` | This Mac isn't in a cluster | @@ -716,19 +765,49 @@ Next: Leave both Macs running: Darkbloom retries by itself. Or serve locally onl While macOS's Local Network setting keeps a Mac's link follower off the cable, both Macs read `not_serving` (exit 3) by the setup screens' rule and in their words (`ClusterLocalNetworkAccess.statusWords`), instead of a load that never -ends. The DevNet app names "Darkbloom Dev" and `darkbloom-dev`. +ends. The DevNet app names "Darkbloom Dev" and `darkbloom-dev`, and says that macOS lists it as "Darkbloom" +(`ClusterService.localNetworkRow`: both apps share one bundle ID). - On the Mac that is kept off (its own cluster service's refusal), `reason` is "This Mac can't reach the other Mac over the cable: macOS keeps Darkbloom off the local network" and `next` is "On this Mac: System Settings → Privacy & - Security → Local Network → turn on “Darkbloom” (on a Mac with no display, through Screen Sharing); then run + Security → Local Network → turn on “Darkbloom”; if it isn't listed, click Allow when macOS asks on this Mac's + screen, the next time Darkbloom dials over the cable (on a Mac with no display, through Screen Sharing); then run `darkbloom start` here, or choose Retry in `darkbloom cluster` on the other Mac." - On the leading Mac, from about 20 seconds into its part (the ✗'s rule; it then asks the other Mac's status), and then steadily while the other Mac stays refused, also while its part ends on the missing link and starts again, `reason` is "The other Mac can't reach this Mac over the cable: macOS keeps Darkbloom there off the local network" and `next` names that Mac: "The other Mac (Apple M5 Max, 128 GB): System Settings → Privacy & Security → Local - Network → turn on “Darkbloom” (on a Mac with no display, through Screen Sharing). Then run `darkbloom start` here, + Network → turn on “Darkbloom”; if it isn't listed, click Allow when macOS asks on that Mac's screen, the next time + Darkbloom dials over the cable (on a Mac with no display, through Screen Sharing). Then run `darkbloom start` here, or choose Retry in `darkbloom cluster`." Once the setting is on, it clears when that Mac's follower gets through. - On both Macs, `lines` then holds that state's line, "Not serving: .", as the plain output's ✗ line does. +A pair set to serve through Darkbloom that serves on the leading Mac's local API has no cluster approval attached, so +the coordinator can't form it and it earns nothing. Both Macs read `not_serving` (exit 3), never `serving` or "earning +through Darkbloom" (`OnboardingLive.notOfferedLines`): +- `reason` is `not offered to Darkbloom ()`: the leading Mac's latest approval check (for example `this Mac's + check refused it: Unequal tensor-parallel shares serve local clusters only …`), `no cluster approval is attached to + its setup`, or `the coordinator could not be reached or has no cluster support`. +- `lines` add where it answers meanwhile: `Meanwhile it answers only on the local API at http://localhost: (no + Darkbloom traffic).` +- The plain output says `Serves: through Darkbloom (not offered)`; `serves` stays `darkbloom`, the way it is set to + serve. +- `next` is "To offer it to Darkbloom: `darkbloom cluster` on , then choose the model again (it is + planned for Darkbloom). Or serve locally only: `darkbloom cluster local` on ." +- `darkbloom start` without a terminal stops waiting at once on this reason (exit 3). + +While single-Mac serving runs on either Mac of a started pair, the pair can't start there and it doesn't stop by +itself. Both Macs read `not_serving` (exit 3), never "keep trying by themselves": +- `reason` is "The pair can't start: a single-Mac Darkbloom provider (process ) is serving on , and the pair + can't share a Mac with it". +- `next` is "Single-Mac serving doesn't stop by itself: run `darkbloom stop --solo` on each Mac named, then + `darkbloom start` on either Mac. Or `darkbloom cluster` on offers to stop it and start the pair." +- `darkbloom start` without a terminal stops waiting at once on this reason (exit 3). + +During a model or mode change, or while the pair updates Darkbloom, `status` and `cluster status` can read `stopped` +(exit 4) or `unknown` for a minute or two while the pair is actually reloading. If such a change happened recently, +or the status showed "Updating…", wait about a minute and check again before acting. Run `darkbloom start` only if it +still reads `stopped`. + A stopped pair reads `stopped` (exit 4) even while the other Mac isn't answering, as after a stop the other Mac asked for before it left (its uninstall does): `lines` are "Stopped; last model …" and "The other Mac (…) isn't answering over the cable.", with `other_mac.answers` `false`. @@ -785,7 +864,7 @@ resident assistant, GLM-5.3-Flash in tensor parallel), otherwise | Command | On a Mac in a cluster | |---|---| | `darkbloom cluster stop` | The same as `darkbloom stop` on a paired Mac: stops the pair on both Macs, which stay stopped after a restart while both cluster services stay up, idle (`Cluster.Stop.mode`). `--service` also stops this Mac's cluster service and keeps it from starting at login, the earlier `cluster stop`: on the Mac that follows a started cluster it asks the leading Mac to stop both Macs first (`This Mac follows the other Mac (…), which leads: \`darkbloom cluster stop\` stops the cluster on both Macs.`, `Cluster.Stop.pairStop`). `--local-only` stops only this Mac's service, without asking the other Mac | -| `darkbloom cluster link --remove` | Says first that it undoes the cable port setup that works now and that the cluster stops serving on both Macs until `darkbloom cluster` (or `link --fix`) sets it up again, then asks `Remove it? [y/N]`. `--yes` (`-y`) removes without asking; without a terminal, or with `--json`, it needs `--yes` (exit 1, nothing changed). `--dry-run` never asks (`Cluster.Link.removalGate`) | +| `darkbloom cluster link --remove` | Says first that it undoes the cable port setup that works now and that the cluster stops serving on both Macs until `darkbloom cluster` (or `link --fix`) sets it up again, then asks `Remove it? [y/N]`. `--yes` (`-y`) removes without asking; without a terminal, or with `--json`, it needs `--yes` (exit 1, nothing changed). `--dry-run` never asks (`Cluster.Link.removalGate`). Without `--device` it undoes every port Darkbloom set up under one macOS approval, naming them (`Thunderbolt ports en2, en1 and en6`); `--device` undoes that one (`ClusterLinkRepair.removeIsolation`). Each port's service goes before the port goes back in its bridge (a port's only service through `scutil --prefs`, which `networksetup` refuses to remove), and the approval stops at the first command that fails: the message then says the commands after it did not run and which ports are still to undo (`--json`: `remaining`), exit 4 | `darkbloom cluster --help` ends with these commands and what each is for (`Cluster.commandList`). @@ -1607,6 +1686,12 @@ Mac's cluster service anyway (`Cluster.Stop.refusal`). After never touches the pair; a daemon state the cluster's part wrote is never drained (`ServiceDrain.soloProviderState`). +While the pair doesn't run here (`Stop.PairedStop.stopHere`), plain `stop` stops +what runs on this Mac: a leftover part of the pair (its saved start on this Mac +is cleared) and single-Mac serving. It never asks the other Mac. While the +other Mac answers but the pair hasn't served yet, plain `stop` stops the pair +on both Macs, as while it runs. + Code: `provider-swift/Sources/darkbloom/ServiceDrain.swift` (`DrainOptions`, `ServiceDrain.prepare`) and `provider-swift/Sources/darkbloom/StopCommand.swift` (`Stop`). See [graceful lifecycle behavior](#graceful-stop-and-restart) for signal @@ -1786,7 +1871,10 @@ On a Mac in a two-Mac cluster, `restart` restarts the pair: it stops serving on both Macs, starts the current model again, waits until it serves, and ends with the same result block and exit status as `start` without a terminal (`Restart.pairRestart`, `ClusterPairCommands.restart`). `--solo` restarts -single-Mac serving on this Mac only. +single-Mac serving on this Mac only. While the pair doesn't run here, plain +`restart` restarts single-Mac serving (after stopping a leftover part of the +pair), or, with none set up, restarts nothing and says `darkbloom start` serves +this Mac alone. A drain timeout returns non-success and leaves the old process draining with automatic restart disabled; repeat the command with a new deadline or explicitly @@ -2394,7 +2482,11 @@ replacing the running binary (`provider-swift/Sources/ProviderCore/Update/SelfUp On a Mac whose `darkbloom cluster` service runs, the command then asks that service's supervisor to restart into the installed release together with the other Mac, after the pair drained, and prints its progress until the restart -(at most `--timeout` seconds); a deferral exits 1 +(at most `--timeout` seconds); a deferral exits 1. It also ends as soon as this +Mac's cluster service runs the installed release (`This Mac's cluster service now +runs v; the cluster sets itself up again once both Macs run it.`): the +restarted service may report that no update runs before the command reads the +restart (`provider-swift/Sources/darkbloom/UpdateCommand.swift`, `ClusterServiceUpdateRequest`; [updating Darkbloom on the pair](two-mac-cluster.md#updating-darkbloom-on-the-pair)). @@ -3067,11 +3159,20 @@ Code: `libs/darkbloom-cluster-worker/Sources/DarkbloomClusterWorker/Startup/Work On a paired leader, `darkbloom cluster stop --service` waits for its owned part to retire before asking the member to stop and removing the local login service. A local -retirement timeout or missing peer acknowledgement exits with status 1 and prints -the pair's reason (a runtime failure, not a usage error, so no usage text follows), -and retains the login service and saved stopped intent. Run the command again after the -reported condition clears; retries repeat the drain/acknowledgement path. An -already stopped local part does not require another model load. +retirement timeout exits with status 1 and prints the pair's reason (a runtime +failure, not a usage error, so no usage text follows), and retains the login service +and saved stopped intent. Run the command again after the reported condition clears; +retries repeat the drain/acknowledgement path. An already stopped local part does not +require another model load. + +When this Mac has stopped serving but the other Mac does not answer (its cluster +service is already off, or the cable is down), this Mac's service still stops and +leaves login, and the command exits 0. It says what happened on each Mac: +`This Mac stopped serving.`, `The other Mac (…) did not answer (…), so it was not +asked to stop (its cluster service may already be off).`, the service line, and +a last line to run `darkbloom cluster stop --service` on the other Mac if its +service is still on. A stop forwarded from the Mac that follows to the leading +Mac that cannot finish still exits 1 and keeps this Mac's service. When the other Mac is gone for good (wiped, sold, or no longer cabled), `darkbloom cluster stop --local-only` stops only this Mac. It skips the drain and diff --git a/docs/provider/hardware-requirements.md b/docs/provider/hardware-requirements.md index 2473fde560..123ff04862 100644 --- a/docs/provider/hardware-requirements.md +++ b/docs/provider/hardware-requirements.md @@ -1,6 +1,6 @@ # Provider hardware requirements -> Last updated: 2026-10-25 +> Last updated: 2026-11-05 Reference for what a Mac needs to run the `darkbloom` provider: the minimum requirements, the chip families the provider distinguishes, which catalog @@ -58,10 +58,21 @@ buffers past it fail with "Insufficient Memory". Set the values the production and `vm.global_user_wire_limit=261134011596` and `vm.user_wire_limit=261134011596` (95% of physical memory), then restart the provider. The [troubleshooting steps](troubleshooting.md#glm-53-flash-gpu-wired-memory-limit) -keep them after a reboot. Only the 256 GB values are defined +keep them after a reboot. Only the 256 GB values are defined for one Mac (`provider-swift/Sources/ProviderCore/Diagnostics/GLM5NextWiredLimit.swift`, `GLM5NextWiredLimit.recommendation`); they change no admission or capacity -figure. +figure. A rank of a GLM pair, which on a 128 GB Mac holds about half the +model, uses the same derivation for 128 and 256 GB, applied with +[`darkbloom cluster gpu-limit`](../reference/configuration.md#gpu-memory-limit-for-a-glm-pair) +(`GLM5NextWiredLimit.pairRankRecommendation`). + +A GLM pair of 128 GB Macs serves as a pipeline only. An M4 Max can be one of +them: its part is sized to the GPU limit its macOS reports (107.52 GiB on +macOS 26). `darkbloom cluster gpu-limit` raises the limit on any Apple silicon +Mac with 128 GB or more (an M4 Max, M3 Ultra, M2 Ultra, M1 Ultra or M3 Max as +well as an M5), so where a raise makes a split fit the setup names that step +first, and otherwise says "needs more memory" +([two-Mac cluster](two-mac-cluster.md)). Current backend behavior is owned by the [platform's latest default branch](https://github.com/Layr-Labs/darkbloom-platform/tree/master). diff --git a/docs/provider/installation.md b/docs/provider/installation.md index 17dff0b73d..32b426092e 100644 --- a/docs/provider/installation.md +++ b/docs/provider/installation.md @@ -355,6 +355,7 @@ use it: sudo darkbloom fan uninstall # fan control: restores macOS automatic control darkbloom sandbox uninstall # Darkbloom Sandbox darkbloom unenroll # a legacy MDM profile +darkbloom cluster gpu-limit --undo # only if you raised the GPU limit with it; asks for approval ``` Then remove the `# Darkbloom` `PATH` line from your rc file by hand. On a @@ -364,6 +365,12 @@ removes only the provider, watchdog and desktop API agents and keeps every file. Every flag, step and path rule is in the [CLI reference](./cli-reference.md#darkbloom-uninstall). +`darkbloom cluster gpu-limit --undo` (`provider-swift/Sources/darkbloom/ClusterGPULimitCommand.swift`) +removes the root boot job `com.layrlabs.glm53-wired-limits` and returns the GPU +limit to the macOS default +([GPU memory limit for a GLM pair](../reference/configuration.md#gpu-memory-limit-for-a-glm-pair)). +Neither `darkbloom uninstall` nor `darkbloom stop --uninstall` removes that job. + ## Related - [Quickstart](./quickstart.md) — login, start, status. diff --git a/docs/provider/two-mac-cluster.md b/docs/provider/two-mac-cluster.md index 33282c34b5..c9780e8297 100644 --- a/docs/provider/two-mac-cluster.md +++ b/docs/provider/two-mac-cluster.md @@ -1,6 +1,6 @@ # Two Macs as one provider (guided setup) -> Last updated: 2026-11-04 +> Last updated: 2026-11-05 Two Apple Silicon Macs joined by one Thunderbolt 5 cable serve a model together: each Mac holds part of its layers, and the pair serves as one provider. Setting @@ -24,6 +24,29 @@ Remote Login, no IP address and no network setting is typed anywhere. cable; a catalog model neither Mac has is downloaded once on the leader, then copied ([Models](#models) below). +## Before you start: be at both screens + +Setting up a pair raises macOS prompts on each Mac's own screen: its +administrator password for the cable port (and again to undo it), Allow for +Local Network, and Yes to the pairing code. Many pair Macs have no display (a +Mac Studio, a MacBook with its lid closed): open Screen Sharing to such a Mac +before you start. `darkbloom cluster` opens with the same note on both Macs +("You'll approve macOS prompts on each Mac's own screen: … For a Mac with no +display, open Screen Sharing to it first."), and once paired it names the other +Mac where its prompt is ("Approve it on the other Mac's screen too (); use +Screen Sharing if it has no display."). + +Don't run the setup over SSH. In an SSH session with no desktop macOS can't +show its approval prompt, so `darkbloom cluster` says so before 1/4, before +anything is tried ("macOS can't show its approval prompt over SSH. Run +`darkbloom cluster` in Terminal on this Mac's own screen, or through Screen +Sharing."), and offers Quit (the default: "✗ Nothing changed. …") or Go on over +SSH (the password then goes into `sudo` in that terminal, and Local Network is +still answered on the Mac's own screen). `darkbloom cluster link --fix` and +`--remove` say the same before they start and try no prompt, and +`darkbloom uninstall` over SSH stops before it changes anything when a cable +port setup is left to undo. + ## The steps, once Run `darkbloom cluster` on each Mac, pick a model, done. The Mac you start on @@ -54,8 +77,8 @@ Qwen3.8 27B, MiMo-V2.6-Flash and Gemma 4 26B QAT) that these two Macs can serve; model named on the command line that is not approved is refused. Each Mac asks for up to two macOS approvals, at stated moments while you are at -that Mac, and Connect's first line says so ("Allow macOS's password and Local -Network prompts."). Each prompt's line says what to click: +that Mac, and Connect's first line says so ("Allow macOS permissions."). Each +prompt's line says what to click: - **Connect:** the cable's port, once per Mac (your password). macOS lets a command run from a terminal or over SSH onto the local network by itself @@ -67,12 +90,13 @@ Network prompts."). Each prompt's line says what to click: cluster service (a launchd agent, which macOS does ask about) asks for as it starts (`ClusterLocalNetworkAccess.startServiceProbe`). Pairing ends on both Macs at once, so both ask at the same moment: "Click Allow on the Local - Network prompt for Darkbloom. Allow it on the other Mac too." The setup + Network prompt for Darkbloom. Approve it on the other Mac's screen too + (); use Screen Sharing if it has no display." The setup waits until Allow ("✓ Allowed"), however long you take at the other Mac, or until q; after 15 s it also names the switch in System Settings → Privacy & Security → Local Network. A cluster service that - reports no probe within 10 s (an older build) gets the line as an "if", and - the setup goes on. + reports no probe within 10 s (one an earlier Darkbloom release started) gets + the line as an "if", and the setup goes on. When macOS cannot show its password window (an SSH session with no desktop), the setup runs the same commands with `sudo` in that terminal ("Type this Mac's @@ -89,7 +113,26 @@ follows the start from the cluster's status the two Macs exchange over the cable 1. It says "Waiting for the other Mac () to choose the model and start…" while the leader's person chooses (started with `darkbloom cluster local`, it first says "Run `darkbloom cluster local` on the - other Mac: it leads."). + other Mac: it leads."). The leading Mac publishes what its screen waits on in + its status (`ClusterControlReply.step`), and this Mac says each new one once, + for example "The other Mac (Apple M5 Max, 128 GB): it's waiting for Allow on + its Local Network prompt." The steps are Allow on its Local Network prompt, + reading both Macs, Try again, the model list, a copy, a login and starting. + The live line says the same and how long it has waited out of the bound + ("… · 2 of 15 min (q leaves)"). The line is fitted to the window's width as + it is now, so a narrow window, or one made narrower, never wraps it. A plain + transcript (`NO_COLOR`, `TERM=dumb`, a pipe) has no live line, only the lines + said once per change. A leader on an older build publishes no step, and the + line keeps the general words. + - If the leading Mac refused every model, this Mac ends at once with the same ✗. + When the two Macs run different builds, that is "✗ Not serving: The two Macs + run different Darkbloom builds." with both versions when the leading Mac + said its version, and `darkbloom update` on the Mac that is behind. + - If nothing starts within 15 minutes, it ends with "✗ Not serving: The other + Mac (…) didn't start a model within 15 minutes.". Under it: what that Mac was + last doing, to answer what its screen asks or run `darkbloom cluster` there + again, and `darkbloom --version` on both Macs. The pair still starts by + itself if the leader starts later. 2. Once the leader starts, its live line follows the start (loading, offered to Darkbloom, then one row per Mac while Darkbloom pairs them). Serving through Darkbloom, the leader's start asks Darkbloom whether to offer the pair after @@ -98,37 +141,88 @@ follows the start from the cluster's status the two Macs exchange over the cable in `darkbloom cluster` on either Mac) and this Mac keeps following. Offered, it says "Offered to Darkbloom as a pair for ; waiting for Darkbloom to accept this pair…" and waits as the leader does, so both screens end the - same way. Every start the leader's screen makes publishes its test's outcome, + same way. When Darkbloom's model catalog does not list the model, Darkbloom + never pairs the Macs for it; each Mac's part reads the catalog after it + registers, and both screens and `darkbloom cluster status` end with "✗ Not + serving: The coordinator does not pair Macs for : its model catalog + does not list it" (`ClusterLocalServing.catalogRefusal`) instead of waiting. + A pair Darkbloom pairs under an approval that serves only this account's own + requests (a model approval such as `devnet//s1`, a pair approval saved + by hand, a model a release doesn't approve for public pairs, or a mode it + doesn't approve) ends with "✗ Not serving publicly: the coordinator paired + both Macs but doesn't send public requests to this pair ()." and what to + do, never ✓ (`ClusterPublicServingCheck`). + Every start the leader's screen makes publishes its test's outcome, and this Mac ends with it, without a test of its own: a pass with the leader's response time ("Test response in 0.61 s (the leading Mac's test)"), a failure with the same ✗, reason and note ("Setup saved, but the test failed."; through Darkbloom "… the pair was not offered to Darkbloom."). Serving locally only, the leader's status says "Starting : loaded on both Macs; the leading - Mac is testing it." until its test is answered. With a leader on an older - build, which publishes none of this, this Mac sends its own test request and - may show ✓ before Darkbloom accepts the pair. Later tests from the leading - Mac's screen (choosing the serving model, its Retry, a scope switch's test) + Mac is testing it." until its test is answered. With a leading Mac on an + earlier Darkbloom release, which publishes none of this, this Mac sends its + own test request and may show ✓ before Darkbloom accepts the pair. Later + tests from the leading Mac's screen (choosing the serving model, its Retry, + the test after switching between local only and serving through Darkbloom) replace that result in the status: a failure reads "The last test from the - leading Mac failed." under the not-serving line. A scope switch, the next - start or serve, and a stop clear it. -3. It ends with the same ✓ or ✗ block as the leader's screen. After ✓: "You can - close this window." After ✗: the reason, then "Choose Retry on the other Mac - (…): its screen shows the choices."; after a failed test, "To test again, run - `darkbloom cluster` on the other Mac (…) and choose the model it serves." + leading Mac failed." under the not-serving line. Switching between local + only and serving through Darkbloom, the next start or serve, and a stop + clear it. +3. Offered to Darkbloom and not serving yet, it waits for the leading Mac's + outcome and never judges the pair by a wait of its own. A reason that clears + by itself keeps it waiting, with a live row and the time of the bound, e.g. + "Waiting for Apple to verify this Mac (Darkbloom retries by itself) · 2 of + 15 min" or "Waiting for Darkbloom to pair both Macs". +4. It ends with the leading Mac's outcome. After ✓, the same ✓ block, then "You + can close this window." After the leading Mac's ✗ (`ClusterControlReply.start` + with phase `failed`, named from this Mac's side), the same ✗ and next step, + then "Choose Retry on the other Mac (…): its screen shows the choices." That + line appears only in that ✗, since the leading Mac's screen shows Retry then. + After a failed test: "To test again, run `darkbloom cluster` on the other Mac + (…) and choose the model it serves." It ends early only for a reason of its + own, such as a different Darkbloom build. Between its local test and the + registration that starts both parts again as cluster members, the leading + Mac's status says "not offered to Darkbloom". While the leading Mac still + publishes its start's step, this Mac keeps following until the leading Mac + shows ✓ or ✗; the 15-minute bound of each stage still applies. + +Running `darkbloom cluster` on the Mac that joined while the leading Mac runs a +start (a model or mode change, or a Retry) follows that start the same way: the +steps, the bytes bar, one row per Mac and the final outcome. It no longer shows +"This Mac runs its part by itself … Close" while the other Mac loads. q leaves at any time: "The pair keeps going; run `darkbloom cluster` here to see it." The follow is bounded like the leader's start: 15 minutes for the start to begin, then 15 minutes for each of its stages (loading; the test and the check -with Darkbloom; the registration's restart), then the pair's own wait once it is -offered. Its end always says why. A signed +with Darkbloom; the registration's restart; the wait once it is offered). A +leading Mac that says no outcome within a stage's bound (an earlier release +publishes none) ends it with "✗ Not serving: The other Mac (…) didn't say how +its start ended within 15 minutes.", the last state, and "Its screen shows how +the start ended and what to do next." Its end always says why. A signed Darkbloom.app's login agent keeps serving; without one, as for a development build, the screen ends "Keep this window open." and the Mac serves only while the window stays open. The Start step opens with "Loading takes a few minutes for a large model; both Macs show progress here." On a color -terminal the live rows then give the wait and one row per Mac (for a pair -registered with the coordinator: registering, registered, loading its share), -each with the time since loading began; no bar or percent, since no load -fraction is reported. The leader ends with the outcome as its own block, between +terminal the live rows then give the wait and one row per Mac, each with the +time since loading began: "This Mac: ready (layers 0–46)", "The other Mac: +loading its share (layers 47–93)", "starting its part", or "part ended (exit +1); starts again in 5 s" (for a pair registered with the coordinator: +registering, registered, loading its share). There is no bar or percent while +the parts load, since no load fraction is reported. A row that doesn't fit the +window drops its layers, then shortens to "Other Mac: loading". A plain +transcript (`NO_COLOR`, `TERM=dumb`, a pipe) says each row once, when it changes. + +Both Macs show the same start. The leading Mac publishes how far it is in its +status (`ClusterControlReply.start`, `ClusterOnboardingStartProgress`): the +step (downloading, copying, stopping the model that served, loading, testing, +registering with Darkbloom), a copy's or download's bytes as the sending Mac +counts them, and which Mac's part is ready. The Mac that joined reads it and +opens its own `4/4 Start` heading. Under that heading it shows the step and its +time, a bar of the real bytes during a copy or download, the same per-Mac rows +(its own row first), and what comes next ("Next: test, Darkbloom"). Each step +it finishes is said once ("✓ Files (9 min 12 s)"). Each new step gets the +follow's whole bound again, and a copy whose bytes still move never counts as +silence. A leading Mac with an older Darkbloom publishes none, and the Mac +that joined keeps its general words. The leader ends with the outcome as its own block, between two rules, then the pair's card, as `darkbloom start` ends, and the shell: ``` @@ -229,9 +323,38 @@ On the leader, the pair's model list follows, like `darkbloom start`'s picker: (unpair and set up again)** asks once ([pairing again](#pairing-again)). - q or Esc changes nothing; the screen shows the status again and the commands. -A model that runs more than one way here asks how both Macs split it: the model -serving now keeps its mode by default, any other offers the fastest measured mode -first (else the planner's), the other one keypress away: +A model that runs more than one way here asks how both Macs split it. The +question's first line names the model and recommends a mode for these two Macs, +with why: "Recommended for Gemma 4 26B on these two Macs: Tensor parallel, +faster here and serves up to 8 requests at once." The speeds rank the modes but +the question never quotes them: neither the recommendation nor a mode's line +shows tokens per second. In a colour terminal the mode is in bold. In a narrow +window the reason is shortened ("faster, up to 8 at once"), then left out; the +model's and the mode's names never are. That mode's line ends "· recommended +for these Macs", and Enter takes it (`ClusterOnboardingModeAdvice.advise`). The +leading Mac makes the recommendation from its plans, so both Macs' screens show +the same words: + +- Only modes whose own plan fits both Macs' free memory now count (while a + model serves, its memory is freed first, so fitting now doesn't decide). One + that fits alone is "the only one that fits these Macs now". Serving through + Darkbloom, a mode Darkbloom serves publicly comes before one it doesn't. +- Among the rest, through Darkbloom, the mode that serves more requests at once + wins, because Darkbloom turns away what a busy pair can't take; serving + locally only, the mode clearly faster on this pair wins (measured, else the + planner's prediction; within 5 % counts as the same speed). +- A measurement outranks a prediction: while some modes have served on this + pair and others haven't, the fastest measured one is recommended ("the only + one measured on these Macs so far"), because the planner's figure for a mode + that hasn't served can be far off (two M5 Ultras, Gemma: a pipeline predicted + at 152 tokens/s served 64, beside tensor parallel measured at 111). +- Nothing fits, or there is no measured or predicted speed and no difference + in requests at once: "No recommendation for on these two Macs: + .", nothing is + marked, and the cursor starts as before: the model serving now keeps its + mode, any other starts on the fastest measured mode (else the planner's). + +The modes: - **Tensor parallel**: both Macs work on every layer, each holding a share of it (half each through Darkbloom; local serving balances the shares by speed). @@ -240,16 +363,25 @@ first (else the planner's), the other one keypress away: - **Speculative pipeline** (MiMo): a pipeline that drafts several tokens and checks them together. -While a model serves, each mode's split reads "decided when it loads": the list -plans with that model's memory still taken, and the start stops it and plans -again with its memory free, so a split offered then could differ from the one -that loads. The card after the start shows the split that loaded. +Each mode also says how many requests it serves at once: "serves one request +at a time" or "serves up to 8 requests at once" +(`DistributedInstalledPlan.defaultBatchLanes`). **On a GLM-5.3-Flash pair, +choose Tensor parallel.** Its pipeline serves one request at a time: through +Darkbloom, every other request waits about 6 s and is then refused as "at +capacity". On two M5 Ultras (2026-11-04, DevNet), its tensor parallel served 8 +requests at once with none refused, and each answered about 2.6 times faster +(105.6 against 40.8 tokens/s alone). + +The split each mode shows is the one that loads when you choose it: the list +plans every mode it offers, and the start loads the plan it showed. While a +model serves, each mode's split reads "decided when it loads": the list plans +with that model's memory still taken, and the start stops it and plans again +with its memory free. The card after the start shows the split that loaded. A mode is offered only if it keeps every feature of the model: Qwen 3.8 27B offers tensor parallel only, because pipeline would drop its image, video and -logprob support. Change the mode on the leading Mac: a model chosen on the -following Mac is passed to the leading Mac without its mode, so it starts in -the planner's mode. +logprob support. A mode chosen on the following Mac goes to the leading Mac +with the model, so the pair loads it the same way. Choosing the model that serves, in its mode, sends one test request, the same as a start's, and changes nothing else: "Already serving Qwen 3.8 27B; test response @@ -273,8 +405,9 @@ the test. up yet ([below](#when-something-is-in-the-way)). Switching how a serving pair serves says what it does ("Switching to serving -through Darkbloom: the leading Mac's part starts again that way."), never the -result: the outcome block follows once the pair serves, or why it doesn't. A +through Darkbloom: both Macs load the model again from a plan made for +Darkbloom." or "Switching to local only: the leading Mac's part starts again +that way."), never the result: the outcome block follows once the pair serves, or why it doesn't. A part that stops serving says why in its log ("Distributed serving stops: …", for example "the coordinator reported this member's runtime as outdated"); the ✗ block and the diagnostics file give that reason, not the cancellation @@ -331,9 +464,11 @@ coordinator never carries it. So, with the default `[backend] mtp_mode` of With `mtp_mode = "on"`, `darkbloom cluster` keeps the assistant too. That pair is then not offered to the coordinator: its plan says "not offered for public -traffic", and it serves on the leader's local API. A serving cluster switched -with **Switch to local only** or **Switch to serving through Darkbloom** keeps the setup it -has; to plan the model again for the new way of serving, stop the pair (`darkbloom stop`) and start it again from the list. Public speculative decoding for Qwen pairs needs +traffic", and it serves on the leader's local API. **Switch to serving through +Darkbloom** on a serving cluster plans its model again for Darkbloom (without the +assistant, with equal shares) and starts it as a start does. **Switch to local +only** keeps the setup it has; to plan the model again for local serving, stop +the pair (`darkbloom stop`) and start it again from the list. Public speculative decoding for Qwen pairs needs qualification evidence of its own, which no record holds yet. Rules: [Qwen27 TP assistant policy](../reference/configuration.md#qwen27-tp-assistant-policy). @@ -349,18 +484,25 @@ format instruction only, as on one Mac | # | Where | What you do | What it asks | |---|---|---|---| -| 1 | the first Mac | Run `darkbloom cluster`. Its first line is "Allow macOS's password and Local Network prompts." It checks the Thunderbolt cable ("✓ Cable ready") and Local Network access. Nobody waits on the cable yet, so this Mac leads; its last line is **"Run `darkbloom cluster` on the other Mac."**, and it waits (q cancels). With two cables it asks "Which cable goes to the other Mac?" | the cable's port, once (your password; sudo in this terminal where macOS shows no window); Local Network access for the terminal app only where macOS blocks it | +| 1 | the first Mac | Run `darkbloom cluster`. Its first line is "Allow macOS permissions." It checks the Thunderbolt cable ("✓ Cable ready") and Local Network access. Nobody waits on the cable yet, so this Mac leads; its last line is **"Run `darkbloom cluster` on the other Mac."**, and it waits (q cancels). With two cables it asks "Which cable goes to the other Mac?" | the cable's port, once (your password; sudo in this terminal where macOS shows no window); Local Network access for the terminal app only where macOS blocks it | | 2 | the other Mac | Run `darkbloom cluster`. The same checks; then it finds the waiting Mac on the cable by itself (no address, no host name). Both screens show the same six-digit code ("Code 123 456. Same on the other Mac?"); a Mac that answered first says "Now confirm on the other Mac." | the same as the first Mac; **Yes** on each Mac when the codes match | -| 3 | both Macs | Each says it is paired ("✓ Paired. This Mac leads." on the leader, "✓ Paired. The other Mac leads." on the other Mac). Both cluster services now run, and macOS asks on both Macs at the same moment to let Darkbloom find devices on your local network: click Allow on each; each screen waits for its own ("✓ Allowed"). Nothing else is ever asked on the other Mac; it says "Waiting for the other Mac (…) to choose the model and start…" and follows the start to the same ✓/✗ block. | Local Network access for Darkbloom, once on each Mac | +| 3 | both Macs | Each says it is paired ("✓ Paired. This Mac leads." on the leader, "✓ Paired. The other Mac leads." on the other Mac). Both cluster services now run, and macOS asks on both Macs at the same moment to let Darkbloom find devices on your local network: click Allow on each; each screen waits for its own ("✓ Allowed"), up to 10 minutes with a timer, then ends with a ✗ that says where to turn Darkbloom on and what to do if it isn't listed. Nothing else is ever asked on the other Mac; it says "Waiting for the other Mac (…) to choose the model and start…", says what the leader's screen waits on, and follows the start to the same ✓/✗ block. | Local Network access for Darkbloom, once on each Mac | | 4 | the leader | It lists every model approved for clusters that the pair can serve (held by both Macs, by one of them, or in Darkbloom's catalog), one line each with its size and how the planner splits it, "tensor parallel" or "pipeline" ("Qwen3.8-27B-4bit-mtp · 16.3 GB · pipeline"), ending "copy" or "download" when the model must reach a Mac first (a model no Mac holds yet is split once it arrives, so its line has no split). A model a Mac holds twice (a catalog download beside the cluster's own copy) is listed once. The planner records why a model that has tensor parallel is split otherwise (for example "tensor parallel: slower here", "tensor parallel: not measured yet" or "tensor parallel: link unmeasured"); `darkbloom cluster plan` gives the full reason under "Tensor parallel or pipeline". Models that fit in the Macs' free memory now come first; one that does not ends with "does not fit now". A model a Mac has no room for on disk now comes last, ending "not enough free disk" ([Free disk](#free-disk)). Choose the model with ↑↓ and enter (enter takes the first). If the other Mac does not answer over the cable (its Darkbloom prompt may still wait for Allow), it offers **Try again** or **Cancel**. | the copy first in a list; a short one says its time ("Copy to the other Mac (about 7 s)") | -| 5 | — | Choosing is starting: the leader saves the setup, sends it to the other Mac over the cable and starts both Macs; once both are loaded it says where and how the pair serves ("✓ Serving Qwen3.8-27B-4bit-mtp (pipeline) at http://localhost:8000 (earning through Darkbloom)", or "(local only)") and answers one test request ("✓ Test response in 0.61 s"). | nothing | +| 5 | — | Choosing is starting: the leader saves the setup, sends it to the other Mac over the cable and starts both Macs; once both are loaded it answers one test request, and through Darkbloom the coordinator is asked for the pair ([below](#registered-with-the-coordinator-as-a-cluster-member)). It says where and how the pair serves: "✓ Serving Qwen3.8-27B-4bit-mtp through Darkbloom on both Macs (pipeline)" once the coordinator has the pair, or "✓ Serving Qwen3.8-27B-4bit-mtp on this Mac's local API only (pipeline)" when it serves locally only, with the test response ("Test response in 0.61 s"). | nothing | -When it serves, the screen says where in one line, for example: +When it serves through Darkbloom, the screen says so in one line, for example: ``` -✓ Serving Qwen3.8-27B-4bit-mtp (pipeline) at http://localhost:8000 (earning through Darkbloom) +✓ Serving Qwen3.8-27B-4bit-mtp through Darkbloom on both Macs (pipeline) ``` +No screen and no status says it serves or earns through Darkbloom unless the +pair is offered (both Macs carry a cluster approval) and the coordinator has +it. A pair set to serve through Darkbloom that the coordinator doesn't take +serves on the leader's local API only, and both Macs say why: `✗ Not serving: +not offered to Darkbloom ().`, then `Meanwhile it answers only on the local +API at http://localhost: (no Darkbloom traffic).` + Every screen names the Macs from where it is shown: "this Mac" is the Mac the screen is on and "the other Mac" the other one. A line that must tell them apart adds the hardware name pairing showed ("the other Mac (Apple M3 Ultra, @@ -371,8 +513,9 @@ shows the leader's answers in the same words for its own screen. When the coordinator in your provider configuration cannot take a cluster member yet (it is unreachable, or it has no cluster support), the pair still serves, on the leader's local API only, with the same local token as -`darkbloom start --local`, and its serving line ends "(local only)" instead of -"(earning through Darkbloom)". The leader's part logs why: +`darkbloom start --local`. It isn't offered, so both Macs say `not offered to +Darkbloom (the coordinator could not be reached or has no cluster support)`. +The leader's part logs why: ``` Notice: Serving locally on this Mac's API; public serving needs a coordinator with cluster support @@ -432,6 +575,21 @@ once; one planned with the one-chunk lookahead takes one at a time once the wait has run 90 s), with the choices [above](#the-steps-once). There is no local API in this mode. + The wait says only what the Macs report at that moment. "isn't verified by + Apple yet" appears only while a Mac reports its App Attest authorization + missing. A coordinator trust word on two authorized Macs reads "The + coordinator didn't accept the pair yet ()". When the 15 minutes run out + with both Macs registered and nothing reported, the ✗ says "The coordinator + didn't pair both Macs within 15 minutes; both are registered with it, and it + gave no reason". When the coordinator's reason is known (for example a model + its catalog doesn't list), that reason is shown instead. q or Esc leaves this + wait: "Left the wait: both Macs stay registered and the pair keeps trying to + be paired by the coordinator by itself. Check with `darkbloom status`." A + `darkbloom cluster stop` from any window or either Mac ends the wait at once + with "Stopped (by `darkbloom cluster stop` on one of the Macs): the pair + isn't starting any more." The Mac that joined says the same once the leading + Mac's status has stayed stopped for 20 seconds. + An approval ends at its `not_after`, which the operator sets; one derived from a release ends 90 days after that release registered ([`releaseApprovalExpiry`](https://github.com/Layr-Labs/darkbloom-platform/blob/df61dd6f93714b4458d0eef3125c377087c08b52/coordinator/registry/cluster_release_approvals.go)). The @@ -462,12 +620,19 @@ What `darkbloom cluster` status says in each mode: | Mode | Status line | |---|---| | Registered, paired and loaded | `Serving through Darkbloom on both Macs ().` | -| Registered, not serving yet | ` is not serving yet: .`, then what to do (a missing login, App Attest, memory) | -| Coordinator gave no answer for the grace | The serving line, then `The coordinator has not answered for 10 minutes: the pair serves on the leader's local API until it answers again, then it is offered again with approval .` | -| Approval no longer listed | The serving line, then `The coordinator no longer lists cluster approval : the pair serves on the leader's local API until it lists a matching one again.` | -| Parts kept ending | The serving line, then `The coordinator-paired parts ended 3 times in a row right after starting with cluster approval : the pair serves on the leader's local API for 60 minutes, then it is offered again with it, or sooner with a later one the coordinator lists.` | -| Approval ended | The serving line, then one line that says the cluster approval `` expired and the pair serves on the leader's local API | -| No approval (staging, production before its coordinator derives approvals from releases, no matching entry) | The serving line, then (only after a refusal) `Not offered for pairing: .` | +| Registered, not serving yet | ` is not serving yet: .` (a missing login, App Attest, memory). The leading Mac's setup screen adds what to do under its ✗; `cluster status` says it in `Next:` | +| On the leader's local API: not offered | ` is not serving yet: not offered to Darkbloom ().`, then `Meanwhile it answers only on the local API at http://localhost: (no Darkbloom traffic).` and the test's line. `` is one of the rows below, never "earning through Darkbloom" | +| … coordinator gave no answer for the grace | `The coordinator has not answered for 10 minutes: the pair serves on the leader's local API until it answers again, then it is offered again with approval ` | +| … approval no longer listed | `The coordinator no longer lists cluster approval : the pair serves on the leader's local API until it lists a matching one again` | +| … parts kept ending | `The coordinator-paired parts ended 3 times in a row right after starting with cluster approval : the pair serves on the leader's local API for 60 minutes, then it is offered again with it, or sooner with a later one the coordinator lists` | +| … approval ended | The line that says the cluster approval `` expired and the pair serves on the leader's local API | +| … the check refused the approval | `this Mac's check refused it: ` (or the other Mac's refusal) | +| … no approval (staging, production before its coordinator derives approvals from releases, no matching entry) | `no cluster approval is attached to its setup` | + +`darkbloom cluster status` reads the first row as `serving` (exit 0) and a pair that isn't offered as `not_serving` +(exit 3), on both Macs. During a model or mode change, or while the pair updates Darkbloom, it can read `stopped` +(exit 4) or `unknown` for a minute or two while the pair is actually reloading: wait about a minute and check again +before running `darkbloom start`. Approval sources, checks and saved fields: [coordinator-paired member](../reference/configuration.md#coordinator-paired-member). @@ -475,13 +640,28 @@ Approval sources, checks and saved fields: Counting every key: enter for **Yes** on each Mac and enter for the first model on the leader (three keys), plus the macOS prompts [above](#the-steps-once). +In a color terminal at least 40 columns wide, each step folds to one line once +the next step begins: "✓ 2/4 Pair (1 min 12 s)". The lines that stay are the +pairing code, each question with the answer given, and an outcome block. A step +that showed a ✗ stays whole, as does a step taller than the window (rows that +scrolled off can't be redrawn) and a step during which another command wrote to +the terminal (`sudo`, `darkbloom login`). The last step and the outcome stay +whole. The whole flow, line by line, goes to a log file for this run +(`~/.darkbloom/cluster-setup/screens/screen-Z-.log`; the 20 +newest are kept, `ClusterOnboardingTerminal.screenLog`). Its path is the last +line ("Full log: …"), and a ✗ block names it as well. Plain output (a pipe, +`NO_COLOR`, `TERM=dumb`) has every line already: nothing folds and no log is +written. + Running `darkbloom cluster` again on either Mac opens with the same Darkbloom -mark, beside "Darkbloom cluster" and the part each Mac plays and the cable +mark, beside "Darkbloom cluster · Leading Mac" or "Darkbloom cluster · Joining +Mac" (`ClusterOnboardingDriver.title(_:)`; a first setup, before the two Macs +pair, says "Darkbloom cluster" alone), then the part each Mac plays and the cable ("This Mac leads · the other Mac (Apple M3 Ultra, 256 GB) follows · cable ready"; with the name System Settings gives this Mac, "This Mac (Studio A) leads · …", so two identical Macs each say which they are), then shows the -cluster's state as the outcome block ("✓ Serving Qwen3.8-27B-4bit-mtp at -http://localhost:8000 (earning through Darkbloom)", or "Stopped; last model …") +cluster's state as the outcome block ("✓ Serving Qwen3.8-27B-4bit-mtp through +Darkbloom on both Macs (pipeline)", or "Stopped; last model …") and, on the leader, the pair's model list [above](#the-steps-once). The other Mac then says its part runs by itself, names the Mac it follows and the command to run there; Enter closes it, and **Start over (unpair and set up again)** is @@ -534,12 +714,17 @@ may ask once to let Darkbloom accept incoming connections. The choice is kept: after a restart or reboot both Macs serve locally only again, until you switch back. In `darkbloom cluster` on the leader, the list's **Switch to serving through Darkbloom** serves through Darkbloom again and -**Switch to local only** serves locally only; on a serving cluster the leading -Mac's part restarts that way and the screen waits for it as after a start: a -test request on the leader's API, or, for a pair registered with the coordinator, -until the coordinator paired both Macs and both loaded the model. It ends with -the same outcome block (✓ only then; otherwise ✗ with the reason and the -choices). The model list still +**Switch to local only** serves locally only. On a serving cluster, **Switch to +serving through Darkbloom** plans the model again for Darkbloom (a local plan +may carry Qwen's speculative assistant or unequal tensor-parallel shares, which +the coordinator can't register), adopts that plan before anything stops, and +starts both Macs as a start does: a test request, then the coordinator is asked +for the pair, and the screen waits until the coordinator paired both Macs and +both loaded the model. **Switch to local only** restarts the leading Mac's part +that way and waits for a test request on the leader's API. Both end with the +same outcome block: ✓ only then; otherwise ✗ with the reason and the choices, +including `Not serving: not offered to Darkbloom ().` for a pair the +coordinator doesn't take. The model list still reads Darkbloom's catalog when the network is up (to download a model neither Mac has); with no network, it lists the models already on the Macs. Only catalog models are served. Qualification records never gate local-only @@ -631,7 +816,7 @@ Models that run tensor parallel, and when: |---|---|---| | Qwen3.5 9B, Qwen3.8 27B, Qwen3.5/3.6 35B A3B | wherever it fits | Qwen3.8 27B keeps images, video and logprobs only in tensor parallel | | GLM-5.3-Flash | wherever it fits | Eight concurrent requests by default | -| Gemma 4 26B (QAT 4-bit, 8-bit) | only where the plan predicts it faster from its own measured speed on both Macs (it keeps every feature of the pipeline, prompt-prefix and SSD reuse included) | Text only; logprobs in tensor parallel only; one request at a time unless you set `DARKBLOOM_CLUSTER_BATCH_LANES` | +| Gemma 4 26B (QAT 4-bit, 8-bit) | only where the plan predicts it faster from its own measured speed on both Macs (it keeps every feature of the pipeline, prompt-prefix and SSD reuse included) | Text only; logprobs in tensor parallel only; one request at a time unless you set `DARKBLOOM_CLUSTER_BATCH_LANES` (its tensor-parallel batch width is not priced yet); a request cancelled during its prompt keeps the pair's one lane until that prompt is read (about a minute for a 16K-token prompt) | | MiMo V2.6 Flash | only where it keeps every feature of the mode it would replace (it keeps the speculative pipeline's rounds, not the plain pipeline's batch lanes) and the plan predicts it faster from its own measured speed on both Macs | Text only; speculative decoding; logprobs in tensor parallel only; one request at a time; see [MiMo V2.6 Flash on the pair](#mimo-v26-flash-on-the-pair) | For Gemma 4 and MiMo V2.6 Flash, tensor parallel must first keep every feature @@ -816,6 +1001,35 @@ whose split needs more GPU memory than these limits is not offered. MiMo V2.6 Flash fits two 128 GB Macs at the default limit in all three modes (per Mac at most 95.9 GiB on the GPU, tensor parallel, against 107.52 GiB). +GLM-5.3-Flash on two 128 GB Macs is planned differently: each Mac loads its +half on what loading needs, and each request is checked against the memory free +when it arrives (a longer request than fits then gets a retryable "busy" answer, +never an out-of-memory crash). Its plan fits two M5 Max 128 GB at the default +limit too. When a GPU limit is what stops a GLM plan, the plan says so and, on +an Apple silicon Mac with 128 GB or more, names the one command that changes it: +`darkbloom cluster gpu-limit`. Run it on that Mac yourself: it asks once, then +macOS asks an administrator, and it raises the limit to the Mac's memory less +16 GiB (112 GiB of 128 GB), also after restarts. `darkbloom cluster gpu-limit +--undo` takes it back ([GPU memory limit for a GLM pair](../reference/configuration.md#gpu-memory-limit-for-a-glm-pair)). + +Only modes that load on the pair are offered. On two 128 GB Macs that is the +pipeline: tensor parallel needs more than either Mac has. On an M4 Max with an +M5 Max, each Mac's part is sized by its own GPU limit (107.52 GiB on macOS 26), +and `darkbloom cluster gpu-limit` runs on both (any Apple silicon Mac with +128 GB or more), so the plan counts a raise on either. When nothing fits as the Macs +are, the model's row says which of two things holds: + +- **"Needs `darkbloom cluster gpu-limit` first"**, naming the Mac, its part's + GPU need and the limit: a split fits once that Mac's limit is raised. Run the + command there, then `darkbloom cluster` again. Nothing loads before. +- **"Needs more memory"**, with the reason: no split fits even with the limits + Darkbloom can raise, or the Macs together cannot hold the model. Intel Macs + and Macs under 128 GB are never raised. + +These rules (`ClusterGPUMemoryLimit.raisedByDarkbloom`, +`ClusterSetupPlanning.gpuLimitSteps`, `refusalWords`) are checked pair by pair +in `libs/darkbloom-cluster/Tests/PlacementChecks/GLMPairOfferChecks.swift`. + When several splits predict the same time (two identical Macs, or Macs with equal measured speed), the one that leaves each Mac the largest share of its own memory is chosen: identical Macs split the layers evenly, and a Mac with @@ -835,7 +1049,8 @@ memory holds its share. Unequal shares are for a pair that serves you alone (`darkbloom cluster local`): a pair served through Darkbloom is always planned with equal shares, because its registration with the coordinator cannot name unequal ones yet. A pair saved with unequal shares is not offered for pairing, -and its status says why; press `m` in `darkbloom cluster` to plan it again. +and its status says why (`not offered to Darkbloom (…)`); choose the model again +in `darkbloom cluster` to plan it again. ## Prompt prefixes on the pair @@ -946,6 +1161,11 @@ happens by itself; `darkbloom cluster` says which applies to each Mac. ## Updating Darkbloom on the pair +**For pair owners:** run `darkbloom update` on **both** Macs, then check that +`darkbloom --version` shows the same version on both. If either Mac ever ran a +plain `darkbloom start` before 0.10.8 (which meant single-Mac serving), run +`darkbloom stop --solo` on that Mac first. + The Macs of a pair update themselves together, as a single Mac does, while `auto_update` is on (the default) and `DARKBLOOM_NO_UPDATE_CHECK` is not set on either Mac. Nothing needs to be run. Every 30 minutes, at the pair's update slot @@ -960,7 +1180,12 @@ cluster service asks the coordinator for its latest release: 4. The leader plans the same model again for the new release once both Macs answer with it, and the pair registers again under that release's cluster approval. The log says `Darkbloom changed on both Macs: setting the cluster - up again for `. + up again for `. Until both Macs answer with the release, the leader + checks again every 5 seconds. The other Mac does not start its part from + the setup saved for the previous release, which names that release's files: + it waits for the leader's setup, and its log says `this Mac runs Darkbloom + v, but its saved setup is for an earlier build: waiting for the + other Mac's setup for v (the old setup is not started)`. A pair still running a request after 120 seconds takes requests again and tries at the next slot. A release that one Mac cannot download or verify is installed @@ -988,9 +1213,56 @@ together with the other Mac, after the pair drained, and prints its progress (`drained for v; waiting for the other Mac`). Both Macs restart once both have the release. The Mac where it ran first waits up to 15 minutes, while it serves, for the other Mac: for its `darkbloom update`, or for its next slot when -its automatic updates are on. +its automatic updates are on. The command ends once this Mac's cluster service +runs the release (`This Mac's cluster service now runs v; …`). No log-out is needed. A cluster service started by an earlier release cannot do this: log out and back in on both Macs once both have the release. +If single-Mac serving is also set up on a Mac whose pair is started (for example +from a plain `darkbloom start` before 0.10.8, which meant single-Mac serving), +`darkbloom update` restarts the pair and leaves single-Mac serving as it is. It +says so, with `darkbloom stop --solo` to remove it. The watchdog doesn't start it +again while the pair is started. + +### When the two Macs run different versions + +One Mac can end up on a newer release than the other: it updated alone through +single-Mac serving, `darkbloom update` ran on it only, or the other Mac was +asleep or off at the pair's update slot. Then: + +- **The older Mac catches up within about a minute** (from 0.10.9), once its + cluster service sees the other Mac running a newer release, or updating to + one. It runs the pair's update at once instead of waiting for the slot: one + immediate try per release, then the slots as before. It never installs a + release it quarantined. With automatic updates off, its cluster service log + says "the other Mac runs v, newer than this Mac's v, and + automatic updates are off on this Mac: run `darkbloom update` on this Mac". +- **The provider's own background updater does not leave the pair split.** When + it updates a Mac whose pair actually runs there, it also asks that Mac's + cluster service to restart into the release together with the other Mac, as + `darkbloom update` does, so the other Mac follows. The watchdog doesn't + install a release while the pair runs on that Mac. A Mac that only serves + alone, its pair gone, simply updates. +- **Both screens say it at once:** "✗ The two Macs run different Darkbloom + versions: The other Mac (…) runs 0.10.7, this Mac runs 0.10.8.", then "On , run `darkbloom update`; the pair starts once both Macs run + ." The start doesn't wait or loop. It offers **Check the versions + again** (it reads both versions again, and starts the pair once they match) + or **Leave**. A Retry after any other failure checks the versions first. The + version split is said before single-Mac serving when both apply. +- **`darkbloom status` and `darkbloom cluster status --json`** give the reason + "the two Macs run different Darkbloom versions, and : run + `darkbloom update` on the Mac with ", and as `next` the Mac to update, + named for each Mac: "On this Mac, run `darkbloom update`; …" or "On the other + Mac (…), run `darkbloom update`; …". +- **The wait lines in the cluster service log name the other Mac's version:** + the leader's "Darkbloom changed on …: waiting until both Macs answer with the + same build …" and the other Mac's "waiting for the other Mac's setup for + v …" end with "; the other Mac runs v, this Mac v: + run `darkbloom update` on ". + +The other Mac's version comes from its cluster service, which publishes it from +0.10.7 on. If the other Mac publishes no version, check with `darkbloom --version` +on both Macs. DevNet builds say `darkbloom-dev`. While a Mac serves, the re-plan uses the speed it measured while idle and never runs a GPU benchmark beside the model @@ -1002,8 +1274,8 @@ drained for an update yet: its update waits while it serves (the log says ## When something is in the way At the first setup's login check, **Serve locally only** plans the model again -for serving locally before anything starts, so Qwen 3.8 27B keeps its tensor -assistant there, as any local start does. When a start's part keeps ending +for serving locally before anything starts, so Qwen 3.8 27B keeps its +speculative assistant there, as any local start does. When a start's part keeps ending because the link to the other Mac keeps closing, the ✗ says so and names the other Mac's side ("the other Mac's worker ended or the cable dropped"): that Mac's service restarts its worker without reporting it, so its line says what @@ -1029,8 +1301,13 @@ dials the other Mac, off the cable even when the cluster service's own check passed. The follower's own refusal decides: - the joining Mac's window says "This Mac can't reach the other Mac over the cable: macOS keeps Darkbloom off the local network" and what to do there: - System Settings → Privacy & Security → Local Network → turn on "Darkbloom" - (or "Darkbloom Dev"); on a Mac with no display, through Screen Sharing; + System Settings → Privacy & Security → Local Network → turn on "Darkbloom". + The DevNet app (Darkbloom Dev) is listed as "Darkbloom" too, because both + apps share one bundle ID (`ClusterService.localNetworkRow`). Where macOS + never recorded an answer for the app, the list has no such row: macOS asks + on that Mac's own screen the next time the app dials over the cable, and + someone must click Allow there. On a Mac with no display, do either through + Screen Sharing; - the leading Mac's ✗ says the same of the other Mac without waiting for the start to give up, once the leading Mac's part has run about 20 seconds (long enough for the follower to dial it again, so a setting just turned on shows @@ -1085,9 +1362,9 @@ of the leading Mac's start, and where to choose Retry when a part keeps ending. - **The leader cannot reach the other Mac**: make sure the other Mac is on and logged in; it rejoins by itself. During setup the leader offers **Try again** and **Cancel**, since the other Mac's Darkbloom prompt may still be waiting - for Allow. If you denied the Local Network prompt there, - allow Darkbloom in System Settings → Privacy & Security → Local Network, then - run `darkbloom cluster` again. When `darkbloom cluster` is run again and the + for Allow. If you denied the Local Network prompt there, turn on "Darkbloom" + (the DevNet app's row has that name too) in System Settings → Privacy & + Security → Local Network, then run `darkbloom cluster` again. When `darkbloom cluster` is run again and the other Mac does not answer, it says why that may be and what to run on that Mac, and offers **Start over**, which asks first: a Mac that is away is not a broken pairing ([pairing again](#pairing-again)). @@ -1108,6 +1385,14 @@ of the leading Mac's start, and where to choose Retry when a part keeps ending. "does not fit now". What frees the memory ("Quit apps on the other Mac (…) first.") is said, and nothing starts, if it still does not fit when checked again right before the start. +- **GLM-5.3-Flash on two 128 GB Macs**: it runs as a pipeline, about half the + model on each Mac. If the plan names `darkbloom cluster gpu-limit` for a Mac + whose GPU keeps too little resident, run it on that Mac (it asks once, then + macOS asks an administrator), then `darkbloom cluster` again. The plan names + it only on the Macs it runs on, Apple silicon Macs with 128 GB or more. Running it on + both Macs leaves room for long requests. `darkbloom cluster gpu-limit --undo` + takes it back. A request longer than what fits at that moment is refused, not + run out of memory ([figures](../architecture/hardware-support.md#glm-53-flash-pairs-on-128-gb-macs)). - **The start does not finish**: the screen shows each Mac's last error and offers **Save diagnostics for Darkbloom**, which writes a file to your home folder (no keys, addresses or names in it; nothing is written if any @@ -1122,15 +1407,124 @@ they control single-Mac serving on one Mac | Command | On a Mac in the pair | |---|---| | `darkbloom stop` (or `darkbloom cluster stop`) | Stops serving on both Macs. They stay stopped after a restart, and both cluster services stay up, idle, so the next start needs no visit to the other Mac. It waits until both Macs' parts have ended and says so (`Memory freed on both Macs ✓`) | -| `darkbloom start` | In a terminal, the same screen as `darkbloom cluster`. In a script, starts the saved model on both Macs and waits until it serves | -| `darkbloom restart` | Stops and starts the pair with its current model | +| `darkbloom start` | While the pair runs: in a terminal, the same screen as `darkbloom cluster`; in a script, starts the saved model on both Macs and waits until it serves. While it doesn't run here, see [going back to serving on one Mac](#going-back-to-serving-on-one-mac) | +| `darkbloom restart` | Stops and starts the pair with its current model. While the pair doesn't run here, restarts single-Mac serving instead | | `darkbloom status` | The pair first (who leads, the model, whether it serves now and what to do), then this Mac's fields; `darkbloom cluster status` gives the pair alone, with `--json` and exit codes | Each says first that it acts on the pair. `--solo` on any of them acts on -single-Mac serving on this Mac only and never touches the pair. If the leading +single-Mac serving on this Mac only and never touches the pair. + +Single-Mac serving and the pair can't run on one Mac at once: both use the +Mac's one serving lock. If single-Mac serving runs on either Mac, +`darkbloom cluster` (or `darkbloom start` in a terminal) says so before it +starts anything, on one ✗ that names the Mac and the process: ``The pair can't +start: a single-Mac Darkbloom provider (process 9523) is serving on this Mac, +and the pair can't share a Mac with it.``, then ``On this Mac: run `darkbloom +stop --solo` to stop single-Mac serving there.``. It offers **Stop single-Mac +serving on both Macs and start the pair** (or on the one Mac named) and +**Leave**. It stops nothing unless you choose to, and it never retries by itself. +Each Mac's cluster service doesn't start its part while single-Mac serving +runs there. Its status names that provider, so the other Mac's screen says the +same thing instead of "no error reported". The Mac that joined shows the same +✗ in its own window, naming its own provider ("… is serving on this Mac"), +with `darkbloom stop --solo` and that the leading Mac's screen offers the stop. +It never says it is registering with the coordinator meanwhile, and it follows +the start by itself once single-Mac serving stops. The leading Mac's part +waits too: it doesn't start, and end again every half minute, while the other +Mac reports single-Mac serving. `darkbloom cluster status` says the block on +both Macs, with `Next:` ``Single-Mac serving doesn't stop by itself: run +`darkbloom stop --solo` on each Mac named, then `darkbloom start` on either +Mac. …``, and a scripted `darkbloom start` ends its wait at once with that +reason (exit status 3). + +When nobody chose single-Mac serving since the pair was started on that Mac +(for example, the update from 0.10.8 restarted a job a plain `darkbloom start` +left set up, or a login or the watchdog started it), the Mac's cluster service +stops it by itself, as `darkbloom stop --solo` does. It writes that to its log, +and `darkbloom status` on that Mac says ``Single-Mac serving stepped aside for +the pair at