Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .github/actions/provider-release-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,17 @@ runs:
if: inputs.lane == 'qualification'
shell: bash
working-directory: provider-swift
env:
MIMO_V26_PROVIDER_LIFETIME_METADATA_TESTS: '1'
run: |
python3 ../scripts/prepare-mimo-prompt-fixtures.py \
--output "$RUNNER_TEMP/mimo-sdk-prompt-fixtures" --github-env "$GITHUB_ENV"
python3 ../scripts/prepare-mimo-provider-fixtures.py \
--output "$RUNNER_TEMP/mimo-sdk-provider-fixtures" --github-env "$GITHUB_ENV"
export MIMO_PROMPT_ARTIFACT_DIRECTORY="$RUNNER_TEMP/mimo-sdk-prompt-fixtures"
export MIMO_PROMPT_REFERENCE_VECTORS="$GITHUB_WORKSPACE/fixtures/prompt-contract/mimo-v26-additional20.json"
export MIMO_V26_SERIAL_LOAD_FIXTURES="$RUNNER_TEMP/mimo-sdk-provider-fixtures"
export MIMO_V26_WIRED_METADATA_FIXTURE="$RUNNER_TEMP/mimo-sdk-provider-fixtures/tiny-bf16"
python3 ../scripts/run-provider-test-watchdog.py \
--output-dir "$RUNNER_TEMP/provider-sdk-tests" \
--diagnostic-after-seconds 480 --timeout-seconds 900 \
Expand Down
43 changes: 42 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
python3 .github/scripts/test-threat-ensemble.py
- name: Test native GPU CI routing without a GPU
run: python3 scripts/test-native-gpu-ci.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'

Expand All @@ -44,11 +46,13 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0 # Frozen source links are checked at their stamped commits.
fetch-depth: 0 # Frozen source links require committed document provenance.
- 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

Expand Down Expand Up @@ -231,7 +235,15 @@ jobs:
run: |
rustup toolchain install 1.88.0 --profile minimal
rustup override set 1.88.0
- name: Prepare pinned MiMo prompt metadata and original corpus
run: python3 scripts/prepare-mimo-prompt-fixtures.py --output "$RUNNER_TEMP/mimo-prompt-fixtures" --github-env "$GITHUB_ENV"
- name: Prepare bounded synthetic MiMo provider fixtures offline
id: mimo-fixtures
run: |
python3 scripts/prepare-mimo-provider-fixtures.py --output "$RUNNER_TEMP/mimo-provider-fixtures" --github-env "$GITHUB_ENV"
python3 scripts/prepare-mimo-provider-fixtures.py --output "$RUNNER_TEMP/mimo-prefix-fixtures" --asymmetric
- name: Build provider-swift (incl. tests)
id: build-provider-tests
working-directory: provider-swift
# Build the TEST bundle too, so the .xctest bundle exists before we
# place the metallib next to its runner binary (see next step).
Expand All @@ -241,17 +253,46 @@ jobs:
# not guaranteed to be linked merely because the test bundle builds.
swift build --product darkbloom-fan-helper
- name: Build and stage source-matched mlx.metallib
id: place-provider-metallib
run: |
set -euo pipefail
command -v cmake >/dev/null 2>&1 || brew install cmake
provider_bin=$(cd provider-swift && swift build -c debug --show-bin-path)
METALLIB_CACHE_DIR="$RUNNER_TEMP/metallib-cache" \
./scripts/stage-test-metallib.sh "$provider_bin"
- name: Run Swift tests
env:
MIMO_V26_PROVIDER_LIFETIME_METADATA_TESTS: '1'
working-directory: provider-swift
# Reuse the built bundle and matched metallib. The exact allocator
# suite runs in its own process even if the general suite fails.
run: ../scripts/run-provider-tests.sh
- name: Run isolated native MiMo startup gates
if: ${{ !cancelled() && steps.mimo-fixtures.outcome == 'success' && steps.build-provider-tests.outcome == 'success' && steps.place-provider-metallib.outcome == 'success' }}
working-directory: provider-swift
timeout-minutes: 5
env:
MIMO_V26_SERIAL_NATIVE_TESTS: '1'
run: ../scripts/run-nested-suite.sh 'MiMoV26StandaloneLifecycleTests.test(ActualScannerPreloadStartsListenerWithSameNativeOwner|StartRefusesActualUnpublishedPreloadWithoutReplacingOwner)' --no-parallel
- name: Run isolated native MiMo complete-prefix gates
if: ${{ !cancelled() && steps.mimo-fixtures.outcome == 'success' && steps.build-provider-tests.outcome == 'success' && steps.place-provider-metallib.outcome == 'success' }}
working-directory: provider-swift
timeout-minutes: 5
env:
MIMO_V26_SERIAL_NATIVE_TESTS: '1'
MIMO_V26_SERIAL_LOAD_FIXTURES: ${{ runner.temp }}/mimo-prefix-fixtures
run: ../scripts/run-nested-suite.sh 'MiMoV26NativeLoadTransactionTests.testNativeCompletePrefix' --no-parallel
- name: Run isolated native MiMo retained-fault gate
if: ${{ !cancelled() && steps.mimo-fixtures.outcome == 'success' && steps.build-provider-tests.outcome == 'success' && steps.place-provider-metallib.outcome == 'success' }}
working-directory: provider-swift
timeout-minutes: 5
env:
MIMO_V26_SERIAL_NATIVE_TESTS: '1'
MIMO_V26_PROVIDER_LIFETIME_NATIVE_TESTS: '1'
MIMO_V26_PROVIDER_LIFETIME_FAULT_CASE: testNativeFenceRefusalKeepsActualBundlePermitAndBlocksOtherOwnerReclaim
DARKBLOOM_PREFIX_CACHE: '0'
DARKBLOOM_PREFIX_CACHE_MEMORY: '0'
run: ../scripts/run-nested-suite.sh testNativeFenceRefusalKeepsActualBundlePermitAndBlocksOtherOwnerReclaim --no-parallel
- name: Verify production prompt parity
run: ./scripts/verify-prompt-parity.sh
# FLAKE-ORDERING GUARD (audit fix, v0.8.0): every nested step below runs
Expand Down
8 changes: 8 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ runs on `vX.Y.Z` tags; dev publication uses
`workflow_dispatch`, and every requested version must equal the checked-in
constants.

For ordinary PRs, follow the
[changelog contribution guidance](CONTRIBUTING.md#changelog-entries-with-less-merge-contention):
keep user-visible changes in a small topic-specific `Unreleased` section,
update it in place, and preserve other PRs' entries when resolving conflicts.
Do not assign a release version, rewrite unrelated sections or claim shipment
without an explicitly requested release operation. Topic-local edits reduce
contention but cannot prevent same-location insertion conflicts.

## Deploying

Canonical runbook: `docs/operations/coordinator-deploy.md`
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
- Let an idle, loaded provider compete beside feasible peers after the 5-minute measurement-age threshold, using connection age when measurements are undated. This breaks the evidence-first exclusion of newly connected and long-idle providers without guaranteeing selection or measurement recovery. Hedge and fresh-feasible requests still require feasible evidence.
- Treat outstanding service-retirement leases and reported service usage as busy even when slot counters are idle, and recheck exploration eligibility at atomic reservation. Older providers can still qualify using their existing slot telemetry.

## Unreleased — CI and contributor workflow

- Separate prerequisite-dependent MiMo qualification from ordinary provider tests, retaining required prepared-fixture checks and explicit qualification gaps. Normalize the rollback test's filesystem identity and synchronize the zombie-stream timing test with the initial cancellation.
- Pin the production prompt fixture's EOF format during regeneration; parity still compares the complete corpus bytes and unchanged token/contract expectations.
- Keep documentation freshness stamps date-only, preserving existing dates, immutable source links and historical evidence. Historical source validation reads committed provenance rather than requiring a hash in the stamp.
- Document topic-local changelog updates and conflict resolution that preserves other PRs' entries, keeping release assignment separate from ordinary contributions.

## Unreleased — cache routing state persistence

- Preserve a write-behind copy of SSD cache holders and observed demand across coordinator restarts while routing reads stay in memory. Restore is bounded by TTL, index caps, clock-skew checks and the cache-key generation; holders bind only to matching live provider capabilities, retaining measured stage-cost deadlines. Disconnects park holders, and shutdown joins provider sockets and the periodic writer before the final bounded flush. No prompts, raw chain hashes or memory-tier holders are persisted.
Expand Down
36 changes: 35 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,44 @@ The PR template will prompt you about this.

## Release cadence

Releases are cut by maintainers, not contributors. Don't bump versions or create tags in your PR — the release workflow handles that. If your change should land in a specific upcoming release, set the milestone on the PR.
Releases are cut by maintainers, not contributors. Don't bump versions or create tags in an ordinary PR. Maintainers prepare the version constants and changelog, then tag the reviewed source for the release workflow. If your change should land in a specific upcoming release, set the milestone on the PR.

The release runbook is [`docs/operations/provider-release.md`](docs/operations/provider-release.md); production coordinator deploys are [`docs/operations/coordinator-deploy.md`](docs/operations/coordinator-deploy.md).

### Changelog entries with less merge contention

User-visible changes need an entry in the root [`CHANGELOG.md`](CHANGELOG.md).
Keep the entry in the same PR as the change; it does not replace the canonical
documentation required by [`docs/AGENTS.md`](docs/AGENTS.md).

1. Read the target branch's current changelog before editing. For an ordinary
PR, add a small, self-contained section near the top using the existing
`## Unreleased — <topic>` style. Describe observable changes and important
limitations, not a commit-by-commit implementation log.
2. Keep review updates inside your topic's section. Do not keep moving it back
to the top as other PRs land, rename a shared `Unreleased` heading for your
feature, or reorder, rewrap or clean up unrelated entries. Extend an existing
topic only when your change actually belongs to it.
3. Leave version assignment, release dates and consolidation to an explicitly
requested release-preparation change. A current version constant or an
unshipped release-candidate heading is not a reason to add an ordinary PR
to that release. Do not change shipped history or claim publication from a
source merge or version bump.
4. When updating your branch, resolve changelog conflicts by preserving the
target branch's entries and your topic's intended changes. Do not take the
whole file from either side. If release preparation has moved your topic,
check the new release boundary rather than duplicating it or putting new
work into an already shipped section.
5. Review the final changelog diff against the current target branch, not just
the last commit: unrelated entries must remain intact and your change must
appear once. Run `git diff --check` and the documentation checks before
requesting review.

Small topic-local edits reduce contention and make resolution easier; they do
not eliminate conflicts when parallel PRs insert at the same location. Keep
the existing single-file changelog rather than introducing per-PR fragments
or a new release-generation process for an ordinary contribution.

## Code of conduct

Be respectful. Disagree with ideas, not people. Maintainers reserve the right to remove comments, close issues, and block users that don't engage constructively.
Expand Down
13 changes: 12 additions & 1 deletion coordinator/api/cancellation_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,15 @@ func TestIntegration_ProviderDeduplicationPreservesNewest(t *testing.T) {
type providerCancelLog struct {
mu sync.Mutex
cancels []time.Time
first chan struct{}
}

func (l *providerCancelLog) add(at time.Time) {
l.mu.Lock()
l.cancels = append(l.cancels, at)
if len(l.cancels) == 1 && l.first != nil {
close(l.first)
}
l.mu.Unlock()
}

Expand Down Expand Up @@ -792,7 +796,7 @@ func runZombieStreamScenario(t *testing.T, terminal string, zombieFor time.Durat
conn := connectRoutableProvider(t, ctx, ts.URL, model, pubKey, reg)
defer conn.Close(websocket.StatusNormalClosure, "")

cancels := &providerCancelLog{}
cancels := &providerCancelLog{first: make(chan struct{})}
reqCh := make(chan protocol.InferenceRequestMessage, 1)
readerDone := runFakeProviderReader(ctx, conn, pubKey, cancels, func(inferReq protocol.InferenceRequestMessage) {
writeProviderFrame(ctx, conn, testEncryptedChunk(t, inferReq, pubKey, cancelTestChunkSSE("Hello")))
Expand All @@ -816,6 +820,13 @@ func runZombieStreamScenario(t *testing.T, terminal string, zombieFor time.Durat
resp.Body.Close()

inferReq := <-reqCh
// Exercise the resend schedule, not the separate stray-first/abandon race.
// A chunk before the initial cancel may legitimately trigger two sends.
select {
case <-cancels.first:
case <-ctx.Done():
t.Fatal("provider did not receive the initial cancel")
}
// The provider ignores the cancel and keeps generating.
deadline := time.Now().Add(zombieFor)
for i := 0; time.Now().Before(deadline); i++ {
Expand Down
19 changes: 18 additions & 1 deletion coordinator/promptsidecar/src/bin/prompt-fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ async fn main() -> Result<()> {
cases: generated_cases,
});
}
let encoded = serde_json::to_vec_pretty(&GeneratedCorpus {
let encoded = encode_corpus(&GeneratedCorpus {
schema_version: 1,
models,
})?;
Expand All @@ -173,6 +173,10 @@ async fn main() -> Result<()> {
Ok(())
}

fn encode_corpus(corpus: &GeneratedCorpus) -> serde_json::Result<Vec<u8>> {
serde_json::to_vec_pretty(corpus)
}

fn is_dynamic_time(error: &anyhow::Error) -> bool {
error
.downcast_ref::<PlanError>()
Expand Down Expand Up @@ -328,6 +332,19 @@ fn require_case_ids(cases: &[FixtureCase]) -> Result<()> {
mod tests {
use super::*;

#[test]
fn generated_corpus_matches_the_checked_in_fixture_eof_format() {
let encoded = encode_corpus(&GeneratedCorpus {
schema_version: 1,
models: vec![],
})
.unwrap();
assert_eq!(encoded, b"{\n \"schema_version\": 1,\n \"models\": []\n}");
let fixture =
include_bytes!("../../../../fixtures/prompt-contract/v1/production_vectors.json");
assert!(fixture.ends_with(b"}"));
}

#[test]
fn production_model_inventory_is_mandatory() {
assert!(require_model_manifests(&[]).is_err());
Expand Down
35 changes: 23 additions & 12 deletions docs/AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Darkbloom docs — how this documentation is organised and maintained

> Last updated: 2026-09-27 · commit `ca4eb0b16`
> Last updated: 2026-09-30

Rules for anyone — human or agent — who reads, writes, or checks a file under
`docs/`. The code is the source of truth; a doc that disagrees with the code is
Expand Down Expand Up @@ -76,9 +76,9 @@ skeleton.
and nowhere else. Delete superseded text instead of caveating it. Where code
says it better, cite the code instead of paraphrasing it.
8. **Docs are code.** Under version control, reviewed with the code they
describe, linted in CI (`make docs-check`), stamped with a freshness date and
the commit they were verified against, and deprecated on purpose — never
abandoned. The owner of a doc is whoever changes the code it describes. —
describe, linted in CI (`make docs-check`), stamped with a freshness date,
and deprecated on purpose — never abandoned. The owner of a doc is whoever
changes the code it describes. —
SWE at Google ch. 10 (freshness dates, canonical docs, deprecation).
9. **Write for agents as well as people.** Agents forage with `grep`/`glob`
and read a page in isolation. Use stable, grep-able identifiers (exact env
Expand Down Expand Up @@ -122,33 +122,44 @@ sentence lede (principle 3). Then, by type:
Line 3 of every doc:

```
> Last updated: YYYY-MM-DD · commit `<short sha>`
> Last updated: YYYY-MM-DD
```

- *Last updated* is the day the content was last written or re-verified
against the code, not the day the file was touched by a rename.
- *commit* is the repository commit the claims were checked against.
- Update it whenever you change a doc's content: `make docs-stamp
FILES="docs/path.md"` (today + HEAD). For frozen records use
`scripts/docs-stamp.sh --from-git <file>`.
FILES="docs/path.md"` (today, UTC; `DOCS_STAMP_DATE` overrides the date).
- For a format-only migration or a frozen record, use
`scripts/docs-stamp.sh --from-git <file>`. It preserves an existing stamp's
date; without a stamp it uses the last content commit's date, following
renames. An untracked file without a stamp uses today or `DOCS_STAMP_DATE`.
- Keep source revisions in immutable source URLs or body evidence when needed,
not in freshness metadata. Never remove dependency pins, evidence commits,
or source URLs while migrating a stamp.
- A doc whose stamp is older than the code it cites is suspect; re-verify and
restamp rather than trusting it.

## 6. Checks (`make docs-check`, CI job "Docs Lint")

`scripts/docs-check.sh` fails on: a missing stamp; a relative link to a
`scripts/docs-check.sh` fails on: a missing date-only stamp in the first 12
lines (SHA suffixes are rejected); a relative link to a
missing file; an inline-code citation of a repo path that does not exist
(exempt: `reports/`, `releases/`, `design/`); and an orphan page that no other
doc links to. Run it before opening a PR that touches `docs/`. It checks only
git-tracked files by default; `--all` includes untracked drafts.

For a missing relative source link in a frozen report, release note, or design
record, the checker can verify the source at that document's exact stamped
commit. The commit and target must exist in local Git history; current docs
record, the checker recovers the most recent legacy header stamp from the
document's committed history and verifies the source at that exact commit.
For a record created with date-only stamps, it uses the commit that introduced
the particular link. History follows renames, not copies; freshness dates are
never mapped to commits. Complete local Git history, resolvable provenance, and
the exact source target are required; otherwise validation fails. Current docs
and relative documentation links still require an existing working-tree
target. Keep frozen records unchanged and use the
[historical source procedure](developer/historical-references.md) to navigate
their original source. Docs Lint checks out full history for this validation.
their original source. Docs Lint checks out full history for this validation
and tests both historical-link handling and date-preserving, idempotent stamping.

## 7. When you change code, change these docs

Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Darkbloom documentation

> Last updated: 2026-09-28 · commit `3d0d9261c`
> Last updated: 2026-09-28

> Darkbloom is a decentralized private-inference network: an OpenAI- and
> Anthropic-compatible HTTP API served by a Go coordinator that routes each
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Architecture — how Darkbloom works

> Last updated: 2026-09-28 · commit `1902940eb`
> Last updated: 2026-09-28

Explanation pages: context, mechanism, invariants, failure modes, and a code
map for each part of the system. The code in `coordinator/`,
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/billing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Billing: pricing, reservations, ledger, and payouts

> Last updated: 2026-09-28 · commit `8305ac7aa`
> Last updated: 2026-09-28

Darkbloom is prepaid. A consumer account holds an integer micro-USD balance;
the coordinator reserves the worst-case cost of a request before dispatch,
Expand Down
Loading
Loading