Skip to content

feat: streamline provider onboarding to one post-install command - #223

Merged
Gajesh2007 merged 5 commits into
masterfrom
streamline-onboarding
May 26, 2026
Merged

Gajesh2007 merged 5 commits into
masterfrom
streamline-onboarding

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented May 26, 2026 •

Copy link
Copy Markdown
Member

What

Reduce the provider onboarding flow from 5+ manual steps to a single command after the curl installer.

Before

curl ... | bash
# ... installs, blocks on MDM profile, shows model catalog ...
# Then prints:
#   darkbloom doctor
#   darkbloom models catalog
#   darkbloom models download <id>
#   darkbloom login
#   darkbloom start

After

curl ... | bash
# ... installs, MDM is non-blocking ...
# Then prints:
#   source ~/.zshrc && darkbloom start

darkbloom start now handles the rest:

  1. Runs preflight checks (SIP, debugger, min 8GB RAM) — fails fast before downloading GBs
  2. Prompts Link account? [Y/n] — inline login, no separate darkbloom login step
  3. Shows model picker (already existed) — pick, download, launch

Changes

scripts/install.sh

  • Remove [5/5] model catalog step (redundant — start has its own picker)
  • Make MDM enrollment non-blocking (no more read -p wait)
  • Replace 5-line "next steps" with single: source ~/.zshrc && darkbloom start
  • Renumber steps [1/5]...[5/5] → [1/4]...[4/4]

LoginCommand.swift

  • Fix stale darkbloom serve → darkbloom start in success message

StartCommand.swift

  • Add runPreflightChecks() — SIP disabled, debugger attached, <8GB RAM all fail before model picker
  • Add offerInlineLogin() — Y/n prompt, runs device code flow inline, gracefully handles errors
  • Both skip in non-interactive / --foreground / --model modes

Testing

  • swift build passes (provider-swift)
  • Preflight + login are only in the launchDaemon path (interactive darkbloom start without --model)
  • --model, --foreground, --local paths unchanged

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

Reduce the provider onboarding flow from 5+ manual steps to a single
command after the curl installer.

install.sh:
- Remove [5/5] model catalog step (redundant with start's picker)
- Make MDM enrollment non-blocking (no more read -p wait)
- Replace 5-line 'next steps' with: source ~/.zshrc && darkbloom start
- Renumber steps from [1/5]...[5/5] to [1/4]...[4/4]

LoginCommand.swift:
- Fix stale 'darkbloom serve' -> 'darkbloom start' in success message

StartCommand.swift:
- Add preflight doctor checks (SIP, debugger, min RAM) before model
  picker so problems surface before downloading GBs of weights
- Add inline login prompt ('Link account? [Y/n]') before model picker
  so users don't need a separate darkbloom login step
- Both are skipped in non-interactive/foreground/--model modes
@vercel

vercel Bot commented May 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
d-inference Ready Ready Preview May 26, 2026 11:50pm
d-inference-console-ui-dev Ready Ready Preview May 26, 2026 11:50pm
d-inference-landing Ready Ready Preview May 26, 2026 11:50pm

Request Review

@github-actions

github-actions Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark Results

Runner: macos-15 (M1 Virtual) | Date: 2026-05-26 23:45 UTC

1-provider-streaming

1 providers, 1 users, 30 requests, concurrency=5, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 1 0.5 GB
Metric Value
Total Requests 30
Success 4
Errors 26
Total Duration 5.581s
Throughput 0.7 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 4 1.889s 1.889s 1.889s 1.889s
parse 4 1ms 1ms 1ms 1ms
reserve 4 1ms 1ms 1ms 1ms
route 4 11µs 13µs 17µs 17µs
encrypt 4 406µs 451µs 486µs 486µs
dispatch 4 26µs 27µs 47µs 47µs
coordinator_to_provider 4 1.883s 1.883s 1.884s 1.884s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=903.75µs (threshold=1ms)
parse:p95<=5ms PASS p95=1.013ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.08025ms (threshold=50ms)
reserve:p95<=200ms PASS p95=1.363ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=405.5µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=486µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=25.75µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=47µs (threshold=50ms)

1-provider-non-streaming

1 providers, 1 users, 20 requests, concurrency=5, streaming=false

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 1 0.5 GB
Metric Value
Total Requests 20
Success 4
Errors 16
Total Duration 3.497s
Throughput 1.1 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 4 3.473s 3.468s 3.497s 3.497s
parse 4 2ms 2ms 3ms 3ms
reserve 4 3ms 3ms 3ms 3ms
route 4 18µs 21µs 23µs 23µs
encrypt 4 528µs 527µs 606µs 606µs
dispatch 4 39µs 41µs 49µs 49µs
coordinator_to_provider 4 1.779s 1.78s 1.78s 1.78s

Assertion Report: FAIL

Assertion Result Detail
parse:mean<=1ms FAIL mean=2.08175ms (threshold=1ms)
parse:p95<=5ms PASS p95=2.648ms (threshold=5ms)
reserve:mean<=50ms PASS mean=2.53075ms (threshold=50ms)
reserve:p95<=200ms PASS p95=3.036ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=528.25µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=606µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=38.5µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=49µs (threshold=50ms)

7-provider-multi-model

7 providers, 5 users, 50 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 4 0.5 GB
mlx-community/gemma-3-270m-4bit 3 0.2 GB
Metric Value
Total Requests 50
Success 50
Errors 0
Total Duration 16.654s
Throughput 3.0 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 50 715ms 185ms 3.793s 3.796s
parse 49 0s 0s 1ms 2ms
reserve 49 1ms 1ms 2ms 2ms
route 49 32µs 23µs 71µs 122µs
encrypt 50 1ms 0s 1ms 2ms
dispatch 50 53µs 35µs 134µs 216µs
coordinator_to_provider 50 661ms 181ms 3.752s 3.789s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=468.714µs (threshold=1ms)
parse:p95<=5ms PASS p95=1.198ms (threshold=5ms)
reserve:mean<=50ms PASS mean=948.265µs (threshold=50ms)
reserve:p95<=200ms PASS p95=1.872ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=541.62µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=964µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=52.58µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=134µs (threshold=50ms)

3-provider-high-concurrency

3 providers, 10 users, 60 requests, concurrency=20, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 3 0.5 GB
Metric Value
Total Requests 60
Success 12
Errors 48
Total Duration 4.25s
Throughput 2.8 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 12 2.524s 2.215s 2.98s 2.98s
parse 12 1ms 1ms 1ms 1ms
reserve 12 1ms 1ms 2ms 2ms
route 12 10µs 9µs 19µs 19µs
encrypt 12 387µs 406µs 570µs 570µs
dispatch 12 27µs 26µs 72µs 72µs
coordinator_to_provider 12 2.515s 2.209s 2.973s 2.973s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=964µs (threshold=1ms)
parse:p95<=5ms PASS p95=1.485ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.22375ms (threshold=50ms)
reserve:p95<=200ms PASS p95=1.713ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=386.833µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=570µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=27.25µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=72µs (threshold=50ms)

1-provider-queue-saturation

1 providers, 10 users, 40 requests, concurrency=15, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 1 0.5 GB
Metric Value
Total Requests 40
Success 4
Errors 36
Total Duration 3.547s
Throughput 1.1 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 4 2.169s 2.169s 2.169s 2.169s
parse 4 1ms 1ms 1ms 1ms
reserve 4 2ms 2ms 2ms 2ms
route 4 32µs 44µs 49µs 49µs
encrypt 4 1ms 1ms 1ms 1ms
dispatch 4 22µs 16µs 46µs 46µs
coordinator_to_provider 4 2.162s 2.162s 2.163s 2.163s

Assertion Report: FAIL

Assertion Result Detail
parse:mean<=1ms FAIL mean=1.04875ms (threshold=1ms)
parse:p95<=5ms PASS p95=1.227ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.62175ms (threshold=50ms)
reserve:p95<=200ms PASS p95=1.941ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=887µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=1.096ms (threshold=50ms)
dispatch:mean<=5ms PASS mean=22µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=46µs (threshold=50ms)

3-provider-20-users

3 providers, 20 users, 60 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 3 0.5 GB
Metric Value
Total Requests 60
Success 60
Errors 0
Total Duration 10.102s
Throughput 5.9 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 60 436ms 20ms 2.248s 3.306s
parse 60 0s 0s 1ms 1ms
reserve 60 1ms 1ms 2ms 4ms
route 60 24µs 20µs 71µs 81µs
encrypt 60 0s 0s 1ms 2ms
dispatch 60 34µs 28µs 99µs 134µs
coordinator_to_provider 60 433ms 18ms 2.243s 3.301s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=339.516µs (threshold=1ms)
parse:p95<=5ms PASS p95=982µs (threshold=5ms)
reserve:mean<=50ms PASS mean=809.383µs (threshold=50ms)
reserve:p95<=200ms PASS p95=1.619ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=453.2µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=740µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=33.916µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=99µs (threshold=50ms)

1-provider-scaling

1 providers, 5 users, 30 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 1 0.5 GB
Metric Value
Total Requests 30
Success 4
Errors 26
Total Duration 3.616s
Throughput 1.1 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 4 2.304s 2.591s 2.591s 2.591s
parse 4 1ms 2ms 2ms 2ms
reserve 4 2ms 2ms 2ms 2ms
route 4 15µs 18µs 21µs 21µs
encrypt 4 640µs 761µs 874µs 874µs
dispatch 4 32µs 35µs 38µs 38µs
coordinator_to_provider 4 2.297s 2.584s 2.585s 2.585s

Assertion Report: FAIL

Assertion Result Detail
parse:mean<=1ms FAIL mean=1.421ms (threshold=1ms)
parse:p95<=5ms PASS p95=1.555ms (threshold=5ms)
reserve:mean<=50ms PASS mean=2.2215ms (threshold=50ms)
reserve:p95<=200ms PASS p95=2.342ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=639.75µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=874µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=32.25µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=38µs (threshold=50ms)

3-provider-scaling

3 providers, 5 users, 30 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 3 0.5 GB
Metric Value
Total Requests 30
Success 28
Errors 2
Total Duration 6.189s
Throughput 4.5 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 28 870ms 141ms 2.334s 2.338s
parse 28 1ms 0s 3ms 4ms
reserve 28 2ms 1ms 5ms 6ms
route 28 20µs 14µs 70µs 89µs
encrypt 28 1ms 0s 1ms 2ms
dispatch 28 41µs 31µs 104µs 163µs
coordinator_to_provider 28 860ms 140ms 2.313s 2.318s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=784.571µs (threshold=1ms)
parse:p95<=5ms PASS p95=2.521ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.679178ms (threshold=50ms)
reserve:p95<=200ms PASS p95=5.238ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=552.357µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=991µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=41.392µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=104µs (threshold=50ms)

5-provider-scaling

5 providers, 5 users, 30 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 5 0.5 GB
Metric Value
Total Requests 30
Success 30
Errors 0
Total Duration 6.686s
Throughput 4.5 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 30 826ms 148ms 2.363s 2.368s
parse 30 1ms 0s 2ms 2ms
reserve 30 1ms 1ms 2ms 3ms
route 30 23µs 22µs 38µs 47µs
encrypt 30 1ms 0s 1ms 2ms
dispatch 30 41µs 32µs 87µs 182µs
coordinator_to_provider 30 820ms 146ms 2.353s 2.354s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=743.4µs (threshold=1ms)
parse:p95<=5ms PASS p95=1.775ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.201233ms (threshold=50ms)
reserve:p95<=200ms PASS p95=2.449ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=552.1µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=818µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=40.633µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=87µs (threshold=50ms)

3-provider-heavy-100conc-10kb

3 providers, 20 users, 100 requests, concurrency=100, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 3 0.5 GB
Metric Value
Total Requests 100
Success 13
Errors 87
Total Duration 4.355s
Throughput 3.0 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 13 2.362s 2.244s 3.725s 3.725s
parse 13 3ms 3ms 4ms 4ms
reserve 13 6ms 6ms 6ms 6ms
route 13 284ms 0s 3.687s 3.687s
queue_wait 1 3.688s 3.688s 3.688s 3.688s
encrypt 13 12ms 13ms 14ms 14ms
dispatch 13 115µs 68µs 321µs 321µs
coordinator_to_provider 13 2.047s 2.208s 2.233s 2.233s

Assertion Report: FAIL

Assertion Result Detail
parse:mean<=1ms FAIL mean=3.318538ms (threshold=1ms)
parse:p95<=5ms PASS p95=3.823ms (threshold=5ms)
reserve:mean<=50ms PASS mean=5.738307ms (threshold=50ms)
reserve:p95<=200ms PASS p95=6.491ms (threshold=200ms)
encrypt:mean<=5ms FAIL mean=12.247692ms (threshold=5ms)
encrypt:p95<=50ms PASS p95=13.737ms (threshold=50ms)
dispatch:mean<=5ms PASS mean=115.23µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=321µs (threshold=50ms)

A new user running 'darkbloom models' with nothing downloaded saw
'No local MLX models found.' -- unhelpful. Now it shows the full
coordinator catalog with download status markers (✓ for downloaded),
so they can immediately see what's available.

'darkbloom models list' still works for the local-only view.
Split the catalog view into two sections:

  Supported models
    ✓ Qwen 3.5  [qwen3.5-4b]  ~2.5 GB
      Llama 4   [llama-4-8b]  ~4.8 GB

  Local only (not in current catalog)
    old-model-v1  3.2 GB

    These models are no longer served by the network.
    Remove with: darkbloom models remove <id>

Users immediately see what's active vs what's just taking up disk
space from old downloads. Nudges cleanup without being aggressive.
@github-actions

github-actions Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark Results

Runner: macos-15 (M1 Virtual) | Date: 2026-05-26 23:47 UTC

1-provider-streaming

1 providers, 1 users, 30 requests, concurrency=5, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 1 0.5 GB
Metric Value
Total Requests 30
Success 4
Errors 26
Total Duration 5.127s
Throughput 0.8 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 4 1.853s 1.853s 1.853s 1.853s
parse 4 922µs 954µs 964µs 964µs
reserve 4 1ms 1ms 2ms 2ms
route 4 10µs 13µs 14µs 14µs
encrypt 4 321µs 366µs 374µs 374µs
dispatch 4 29µs 32µs 34µs 34µs
coordinator_to_provider 4 1.848s 1.848s 1.848s 1.848s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=921.75µs (threshold=1ms)
parse:p95<=5ms PASS p95=964µs (threshold=5ms)
reserve:mean<=50ms PASS mean=1.217ms (threshold=50ms)
reserve:p95<=200ms PASS p95=1.613ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=320.5µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=374µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=29.25µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=34µs (threshold=50ms)

1-provider-non-streaming

1 providers, 1 users, 20 requests, concurrency=5, streaming=false

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 1 0.5 GB
Metric Value
Total Requests 20
Success 4
Errors 16
Total Duration 3.833s
Throughput 1.0 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 4 3.8s 3.831s 3.833s 3.833s
parse 4 872µs 906µs 922µs 922µs
reserve 4 1ms 2ms 2ms 2ms
route 4 11µs 12µs 15µs 15µs
encrypt 4 330µs 339µs 343µs 343µs
dispatch 4 32µs 33µs 41µs 41µs
coordinator_to_provider 4 2.224s 2.366s 2.366s 2.366s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=872.25µs (threshold=1ms)
parse:p95<=5ms PASS p95=922µs (threshold=5ms)
reserve:mean<=50ms PASS mean=1.472ms (threshold=50ms)
reserve:p95<=200ms PASS p95=1.769ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=330µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=343µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=31.5µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=41µs (threshold=50ms)

7-provider-multi-model

7 providers, 5 users, 50 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 4 0.5 GB
mlx-community/gemma-3-270m-4bit 3 0.2 GB
Metric Value
Total Requests 50
Success 50
Errors 0
Total Duration 17.421s
Throughput 2.9 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 50 772ms 178ms 3.824s 5.644s
parse 49 1ms 0s 3ms 5ms
reserve 49 1ms 1ms 4ms 5ms
route 49 27µs 23µs 54µs 80µs
encrypt 50 0s 0s 1ms 1ms
dispatch 50 51µs 35µs 166µs 199µs
coordinator_to_provider 50 717ms 175ms 3.809s 5.629s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=662.775µs (threshold=1ms)
parse:p95<=5ms PASS p95=3.318ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.135836ms (threshold=50ms)
reserve:p95<=200ms PASS p95=3.7ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=495.24µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=816µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=51.36µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=166µs (threshold=50ms)

3-provider-high-concurrency

3 providers, 10 users, 60 requests, concurrency=20, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 3 0.5 GB
Metric Value
Total Requests 60
Success 12
Errors 48
Total Duration 4.669s
Throughput 2.6 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 12 2.565s 2.251s 3.386s 3.386s
parse 12 1ms 1ms 1ms 1ms
reserve 12 2ms 2ms 2ms 2ms
route 12 15µs 14µs 31µs 31µs
encrypt 12 597µs 683µs 833µs 833µs
dispatch 12 27µs 21µs 68µs 68µs
coordinator_to_provider 12 2.556s 2.244s 3.375s 3.375s

Assertion Report: FAIL

Assertion Result Detail
parse:mean<=1ms FAIL mean=1.131166ms (threshold=1ms)
parse:p95<=5ms PASS p95=1.444ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.648333ms (threshold=50ms)
reserve:p95<=200ms PASS p95=2.252ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=597.416µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=833µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=26.75µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=68µs (threshold=50ms)

1-provider-queue-saturation

1 providers, 10 users, 40 requests, concurrency=15, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 1 0.5 GB
Metric Value
Total Requests 40
Success 4
Errors 36
Total Duration 3.107s
Throughput 1.3 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 4 1.848s 1.848s 1.848s 1.848s
parse 4 1ms 1ms 1ms 1ms
reserve 4 1ms 1ms 1ms 1ms
route 4 10µs 10µs 15µs 15µs
encrypt 4 443µs 456µs 496µs 496µs
dispatch 4 27µs 31µs 40µs 40µs
coordinator_to_provider 4 1.842s 1.843s 1.843s 1.843s

Assertion Report: FAIL

Assertion Result Detail
parse:mean<=1ms FAIL mean=1.0165ms (threshold=1ms)
parse:p95<=5ms PASS p95=1.112ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.29925ms (threshold=50ms)
reserve:p95<=200ms PASS p95=1.434ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=443µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=496µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=26.5µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=40µs (threshold=50ms)

3-provider-20-users

3 providers, 20 users, 60 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 3 0.5 GB
Metric Value
Total Requests 60
Success 47
Errors 13
Total Duration 8.767s
Throughput 5.4 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 47 638ms 82ms 2.641s 3.454s
parse 45 0s 0s 1ms 1ms
reserve 45 1ms 1ms 1ms 1ms
route 45 20µs 19µs 37µs 48µs
encrypt 47 428µs 354µs 752µs 804µs
dispatch 47 43µs 30µs 97µs 420µs
coordinator_to_provider 47 528ms 76ms 2.635s 3.447s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=362.844µs (threshold=1ms)
parse:p95<=5ms PASS p95=990µs (threshold=5ms)
reserve:mean<=50ms PASS mean=734.311µs (threshold=50ms)
reserve:p95<=200ms PASS p95=1.355ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=427.914µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=752µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=43.34µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=97µs (threshold=50ms)

1-provider-scaling

1 providers, 5 users, 30 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 1 0.5 GB
Metric Value
Total Requests 30
Success 5
Errors 25
Total Duration 3.718s
Throughput 1.3 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 5 2.103s 1.868s 3.044s 3.044s
parse 5 1ms 1ms 2ms 2ms
reserve 5 1ms 1ms 1ms 1ms
route 5 606ms 0s 3.031s 3.031s
queue_wait 1 3.031s 3.031s 3.031s 3.031s
encrypt 5 441µs 384µs 695µs 695µs
dispatch 5 30µs 27µs 45µs 45µs
coordinator_to_provider 5 1.492s 1.863s 1.863s 1.863s

Assertion Report: FAIL

Assertion Result Detail
parse:mean<=1ms FAIL mean=1.273ms (threshold=1ms)
parse:p95<=5ms PASS p95=1.828ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.2782ms (threshold=50ms)
reserve:p95<=200ms PASS p95=1.484ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=441.2µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=695µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=29.8µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=45µs (threshold=50ms)

3-provider-scaling

3 providers, 5 users, 30 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 3 0.5 GB
Metric Value
Total Requests 30
Success 30
Errors 0
Total Duration 5.869s
Throughput 5.1 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 30 718ms 124ms 2.079s 2.079s
parse 30 1ms 0s 1ms 1ms
reserve 30 1ms 1ms 2ms 2ms
route 30 17µs 15µs 34µs 37µs
encrypt 30 402µs 368µs 737µs 741µs
dispatch 30 41µs 26µs 123µs 126µs
coordinator_to_provider 30 715ms 122ms 2.073s 2.074s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=506.333µs (threshold=1ms)
parse:p95<=5ms PASS p95=1.071ms (threshold=5ms)
reserve:mean<=50ms PASS mean=883.7µs (threshold=50ms)
reserve:p95<=200ms PASS p95=1.574ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=402.2µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=737µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=41.4µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=123µs (threshold=50ms)

5-provider-scaling

5 providers, 5 users, 30 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 5 0.5 GB
Metric Value
Total Requests 30
Success 30
Errors 0
Total Duration 6.669s
Throughput 4.5 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 30 821ms 113ms 2.34s 2.341s
parse 30 1ms 0s 2ms 2ms
reserve 30 1ms 1ms 2ms 2ms
route 30 31µs 18µs 47µs 361µs
encrypt 30 559µs 533µs 874µs 880µs
dispatch 30 45µs 37µs 99µs 120µs
coordinator_to_provider 30 817ms 110ms 2.334s 2.336s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=595.966µs (threshold=1ms)
parse:p95<=5ms PASS p95=1.621ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.090566ms (threshold=50ms)
reserve:p95<=200ms PASS p95=2.191ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=559.2µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=874µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=44.7µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=99µs (threshold=50ms)

3-provider-heavy-100conc-10kb

3 providers, 20 users, 100 requests, concurrency=100, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 3 0.5 GB
Metric Value
Total Requests 100
Success 12
Errors 88
Total Duration 4.047s
Throughput 3.0 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 12 2.308s 2.288s 2.356s 2.356s
parse 12 6ms 6ms 7ms 7ms
reserve 12 7ms 7ms 10ms 10ms
route 12 23µs 20µs 60µs 60µs
encrypt 12 14ms 15ms 16ms 16ms
dispatch 12 148µs 81µs 936µs 936µs
coordinator_to_provider 12 2.267s 2.247s 2.316s 2.316s

Assertion Report: FAIL

Assertion Result Detail
parse:mean<=1ms FAIL mean=5.705666ms (threshold=1ms)
parse:p95<=5ms FAIL p95=6.871ms (threshold=5ms)
reserve:mean<=50ms PASS mean=7.174916ms (threshold=50ms)
reserve:p95<=200ms PASS p95=9.581ms (threshold=200ms)
encrypt:mean<=5ms FAIL mean=14.023166ms (threshold=5ms)
encrypt:p95<=50ms PASS p95=15.617ms (threshold=50ms)
dispatch:mean<=5ms PASS mean=148µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=936µs (threshold=50ms)

@github-actions

github-actions Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark Results

Runner: macos-15 (M1 Virtual) | Date: 2026-05-26 23:52 UTC

1-provider-streaming

1 providers, 1 users, 30 requests, concurrency=5, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 1 0.5 GB
Metric Value
Total Requests 30
Success 4
Errors 26
Total Duration 5.202s
Throughput 0.8 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 4 1.86s 1.86s 1.86s 1.86s
parse 4 889µs 906µs 934µs 934µs
reserve 4 1ms 1ms 2ms 2ms
route 4 8µs 7µs 14µs 14µs
encrypt 4 347µs 366µs 387µs 387µs
dispatch 4 19µs 23µs 27µs 27µs
coordinator_to_provider 4 1.854s 1.855s 1.855s 1.855s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=889µs (threshold=1ms)
parse:p95<=5ms PASS p95=934µs (threshold=5ms)
reserve:mean<=50ms PASS mean=1.081ms (threshold=50ms)
reserve:p95<=200ms PASS p95=1.501ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=346.75µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=387µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=19µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=27µs (threshold=50ms)

1-provider-non-streaming

1 providers, 1 users, 20 requests, concurrency=5, streaming=false

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 1 0.5 GB
Metric Value
Total Requests 20
Success 4
Errors 16
Total Duration 3.877s
Throughput 1.0 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 4 3.846s 3.876s 3.877s 3.877s
parse 4 2ms 2ms 2ms 2ms
reserve 4 2ms 2ms 3ms 3ms
route 4 16µs 19µs 21µs 21µs
encrypt 4 467µs 493µs 509µs 509µs
dispatch 4 45µs 48µs 68µs 68µs
coordinator_to_provider 4 2.237s 2.375s 2.377s 2.377s

Assertion Report: FAIL

Assertion Result Detail
parse:mean<=1ms FAIL mean=1.56875ms (threshold=1ms)
parse:p95<=5ms PASS p95=1.654ms (threshold=5ms)
reserve:mean<=50ms PASS mean=2.042ms (threshold=50ms)
reserve:p95<=200ms PASS p95=2.733ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=466.5µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=509µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=45µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=68µs (threshold=50ms)

7-provider-multi-model

7 providers, 5 users, 50 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 4 0.5 GB
mlx-community/gemma-3-270m-4bit 3 0.2 GB
Metric Value
Total Requests 50
Success 50
Errors 0
Total Duration 15.531s
Throughput 3.2 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 50 744ms 172ms 3.65s 5.538s
parse 48 0s 0s 1ms 1ms
reserve 48 1ms 1ms 2ms 2ms
route 48 30µs 24µs 72µs 108µs
encrypt 50 1ms 0s 1ms 3ms
dispatch 50 49µs 38µs 97µs 188µs
coordinator_to_provider 50 640ms 170ms 3.598s 5.532s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=398.25µs (threshold=1ms)
parse:p95<=5ms PASS p95=1.091ms (threshold=5ms)
reserve:mean<=50ms PASS mean=912.062µs (threshold=50ms)
reserve:p95<=200ms PASS p95=1.569ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=536.34µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=791µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=48.66µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=97µs (threshold=50ms)

3-provider-high-concurrency

3 providers, 10 users, 60 requests, concurrency=20, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 3 0.5 GB
Metric Value
Total Requests 60
Success 12
Errors 48
Total Duration 4.284s
Throughput 2.8 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 12 2.189s 2.183s 2.217s 2.217s
parse 12 1ms 1ms 3ms 3ms
reserve 12 2ms 2ms 4ms 4ms
route 12 15µs 14µs 21µs 21µs
encrypt 12 474µs 476µs 658µs 658µs
dispatch 12 38µs 28µs 128µs 128µs
coordinator_to_provider 12 2.18s 2.177s 2.208s 2.208s

Assertion Report: FAIL

Assertion Result Detail
parse:mean<=1ms FAIL mean=1.174166ms (threshold=1ms)
parse:p95<=5ms PASS p95=3.381ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.8395ms (threshold=50ms)
reserve:p95<=200ms PASS p95=4.105ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=474.166µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=658µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=37.75µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=128µs (threshold=50ms)

1-provider-queue-saturation

1 providers, 10 users, 40 requests, concurrency=15, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 1 0.5 GB
Metric Value
Total Requests 40
Success 5
Errors 35
Total Duration 4.173s
Throughput 1.2 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 5 2.475s 2.411s 3.289s 3.289s
parse 5 885µs 903µs 912µs 912µs
reserve 5 1ms 1ms 2ms 2ms
route 5 649ms 0s 3.247s 3.247s
queue_wait 1 3.248s 3.248s 3.248s 3.248s
encrypt 5 608µs 572µs 834µs 834µs
dispatch 5 81µs 51µs 181µs 181µs
coordinator_to_provider 5 1.82s 2.405s 2.405s 2.405s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=884.6µs (threshold=1ms)
parse:p95<=5ms PASS p95=912µs (threshold=5ms)
reserve:mean<=50ms PASS mean=1.393ms (threshold=50ms)
reserve:p95<=200ms PASS p95=1.787ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=607.8µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=834µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=81µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=181µs (threshold=50ms)

3-provider-20-users

3 providers, 20 users, 60 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 3 0.5 GB
Metric Value
Total Requests 60
Success 60
Errors 0
Total Duration 9.92s
Throughput 6.0 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 60 476ms 28ms 3.087s 3.199s
parse 60 0s 0s 1ms 2ms
reserve 60 1ms 1ms 2ms 2ms
route 60 22µs 19µs 47µs 90µs
encrypt 60 413µs 339µs 780µs 957µs
dispatch 60 34µs 29µs 85µs 114µs
coordinator_to_provider 60 473ms 26ms 3.082s 3.194s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=355.9µs (threshold=1ms)
parse:p95<=5ms PASS p95=1.158ms (threshold=5ms)
reserve:mean<=50ms PASS mean=714.216µs (threshold=50ms)
reserve:p95<=200ms PASS p95=1.736ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=412.683µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=780µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=34.483µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=85µs (threshold=50ms)

1-provider-scaling

1 providers, 5 users, 30 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 1 0.5 GB
Metric Value
Total Requests 30
Success 4
Errors 26
Total Duration 3.818s
Throughput 1.0 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 4 2.492s 2.663s 2.663s 2.663s
parse 4 1ms 1ms 1ms 1ms
reserve 4 1ms 1ms 2ms 2ms
route 4 16µs 18µs 21µs 21µs
encrypt 4 404µs 344µs 611µs 611µs
dispatch 4 45µs 48µs 78µs 78µs
coordinator_to_provider 4 2.486s 2.657s 2.657s 2.657s

Assertion Report: FAIL

Assertion Result Detail
parse:mean<=1ms FAIL mean=1.20025ms (threshold=1ms)
parse:p95<=5ms PASS p95=1.285ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.35025ms (threshold=50ms)
reserve:p95<=200ms PASS p95=1.765ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=403.5µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=611µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=45µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=78µs (threshold=50ms)

3-provider-scaling

3 providers, 5 users, 30 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 3 0.5 GB
Metric Value
Total Requests 30
Success 30
Errors 0
Total Duration 6.35s
Throughput 4.7 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 30 843ms 97ms 3.018s 3.254s
parse 30 0s 0s 1ms 1ms
reserve 30 1ms 1ms 2ms 2ms
route 30 19µs 17µs 40µs 45µs
encrypt 30 386µs 381µs 565µs 765µs
dispatch 30 32µs 26µs 47µs 213µs
coordinator_to_provider 30 839ms 95ms 3.011s 3.247s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=435.866µs (threshold=1ms)
parse:p95<=5ms PASS p95=1.106ms (threshold=5ms)
reserve:mean<=50ms PASS mean=821.6µs (threshold=50ms)
reserve:p95<=200ms PASS p95=1.648ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=386.4µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=565µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=31.5µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=47µs (threshold=50ms)

5-provider-scaling

5 providers, 5 users, 30 requests, concurrency=10, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 5 0.5 GB
Metric Value
Total Requests 30
Success 30
Errors 0
Total Duration 6.451s
Throughput 4.7 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 30 791ms 74ms 2.361s 2.362s
parse 30 1ms 0s 1ms 1ms
reserve 30 1ms 1ms 2ms 2ms
route 30 22µs 19µs 52µs 72µs
encrypt 30 546µs 507µs 850µs 865µs
dispatch 30 62µs 33µs 97µs 683µs
coordinator_to_provider 30 787ms 72ms 2.354s 2.356s

Assertion Report: PASS

Assertion Result Detail
parse:mean<=1ms PASS mean=647.433µs (threshold=1ms)
parse:p95<=5ms PASS p95=1.276ms (threshold=5ms)
reserve:mean<=50ms PASS mean=1.037666ms (threshold=50ms)
reserve:p95<=200ms PASS p95=1.722ms (threshold=200ms)
encrypt:mean<=5ms PASS mean=546.2µs (threshold=5ms)
encrypt:p95<=50ms PASS p95=850µs (threshold=50ms)
dispatch:mean<=5ms PASS mean=61.7µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=97µs (threshold=50ms)

3-provider-heavy-100conc-10kb

3 providers, 20 users, 100 requests, concurrency=100, streaming=true

Model Providers RAM
mlx-community/Qwen3.5-0.8B-MLX-4bit 3 0.5 GB
Metric Value
Total Requests 100
Success 12
Errors 88
Total Duration 3.287s
Throughput 3.7 req/s

Latency Decomposition

Segment Count Mean P50 P95 Max
total_e2e 12 2.01s 2.011s 2.023s 2.023s
parse 12 5ms 5ms 6ms 6ms
reserve 12 6ms 5ms 9ms 9ms
route 12 11µs 12µs 21µs 21µs
encrypt 12 12ms 13ms 13ms 13ms
dispatch 12 51µs 46µs 96µs 96µs
coordinator_to_provider 12 1.974s 1.975s 1.991s 1.991s

Assertion Report: FAIL

Assertion Result Detail
parse:mean<=1ms FAIL mean=4.839833ms (threshold=1ms)
parse:p95<=5ms FAIL p95=6.082ms (threshold=5ms)
reserve:mean<=50ms PASS mean=5.816ms (threshold=50ms)
reserve:p95<=200ms PASS p95=8.899ms (threshold=200ms)
encrypt:mean<=5ms FAIL mean=11.861333ms (threshold=5ms)
encrypt:p95<=50ms PASS p95=13.134ms (threshold=50ms)
dispatch:mean<=5ms PASS mean=50.916µs (threshold=5ms)
dispatch:p95<=50ms PASS p95=96µs (threshold=50ms)

@Gajesh2007
Gajesh2007 merged commit 279186e into master May 26, 2026
17 of 18 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

echo " Start serving:"
echo ""
echo " source ~/.zshrc && darkbloom start"

P1 Badge Mirror onboarding changes into the embedded install script

These onboarding updates only touch scripts/install.sh, but GET /install.sh serves the embedded coordinator/api/install.sh (coordinator/api/server.go uses //go:embed install.sh). As a result, production users running curl .../install.sh | bash will still get the old blocking MDM + multi-step flow, so this commit’s primary behavior change is not actually shipped through the install endpoint.


echo " source ~/.zshrc && darkbloom start"

P2 Badge Use the detected shell rc file in the final start command

The script detects and updates either ~/.zshrc or ~/.bashrc, but the final instruction is hardcoded to source ~/.zshrc && darkbloom start. On hosts where only .bashrc was updated, source ~/.zshrc fails and the && prevents darkbloom start, so onboarding fails specifically for bash users unless they manually adjust the command.


await offerInlineLogin(coordinatorURL: coordinatorURL)

P2 Badge Skip inline login prompt when models are explicitly provided

This call runs before model selection regardless of flags, so darkbloom start --model ... can now block on Link account? [Y/n] when stdin is a TTY and no auth token exists. That regresses unattended/automation-friendly --model usage, which previously avoided interactive prompts and is still documented as skipping interactive flow.


if (catalog) {
setCatalogModels(catalog);
}
if (capacity) {
setCapacityModels(capacity);

P2 Badge Clear stale model metadata when auxiliary feeds go empty

fetchModelCatalog/fetchModelCapacity return null when they get an empty but successful payload, and fetchStats only updates state when those values are truthy. After the first successful poll, a later legitimate empty response (for example, no routable capacity) leaves old catalogModels/capacityModels in state, so the stats page can continue showing stale per-model metadata and capacity cards that no longer match current backend state.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

hankbobtheresearchoor pushed a commit to hankbobtheresearchoor/d-inference that referenced this pull request May 28, 2026
…r-Labs#223)

* Improve stats model catalog display

* feat: streamline provider onboarding to one post-install command

Reduce the provider onboarding flow from 5+ manual steps to a single
command after the curl installer.

install.sh:
- Remove [5/5] model catalog step (redundant with start's picker)
- Make MDM enrollment non-blocking (no more read -p wait)
- Replace 5-line 'next steps' with: source ~/.zshrc && darkbloom start
- Renumber steps from [1/5]...[5/5] to [1/4]...[4/4]

LoginCommand.swift:
- Fix stale 'darkbloom serve' -> 'darkbloom start' in success message

StartCommand.swift:
- Add preflight doctor checks (SIP, debugger, min RAM) before model
  picker so problems surface before downloading GBs of weights
- Add inline login prompt ('Link account? [Y/n]') before model picker
  so users don't need a separate darkbloom login step
- Both are skipped in non-interactive/foreground/--model modes

* fix: default 'darkbloom models' to catalog instead of local list

A new user running 'darkbloom models' with nothing downloaded saw
'No local MLX models found.' -- unhelpful. Now it shows the full
coordinator catalog with download status markers (✓ for downloaded),
so they can immediately see what's available.

'darkbloom models list' still works for the local-only view.

* feat: show supported vs local-only models in 'darkbloom models'

Split the catalog view into two sections:

  Supported models
    ✓ Qwen 3.5  [qwen3.5-4b]  ~2.5 GB
      Llama 4   [llama-4-8b]  ~4.8 GB

  Local only (not in current catalog)
    old-model-v1  3.2 GB

    These models are no longer served by the network.
    Remove with: darkbloom models remove <id>

Users immediately see what's active vs what's just taking up disk
space from old downloads. Nudges cleanup without being aggressive.
ethenotethan added a commit that referenced this pull request May 28, 2026
* refactor: extract per-package config structs from main.go

Each package now owns its Config struct and ReadConfig() function
with env var constants scoped to the package that consumes them:

- coordinator/config: AppConfig composition + shared helpers
- coordinator/store: database URL / memory store selection
- coordinator/billing: Stripe, mnemonic, referral, mock mode
- coordinator/auth: Privy app ID, verification key, app secret
- coordinator/ratelimit: consumer + financial rate limits
- coordinator/registry: min trust level
- coordinator/mdm: MDM URL + API key
- coordinator/api: ServerConfig (port, URLs, CORS, min version)

main.go goes from ~40 inline os.Getenv() calls to a single
config.ReadAppConfig() call, with all env reads scoped to the
package that owns each config domain.

Pattern adapted from: https://github.com/Layr-Labs/eigenda-proxy

* fix: move Config structs into config.go, add Check methods

- billing.Config moved from billing.go to config.go
- auth.Config moved from privy.go to config.go
- Added Check() to billing, auth, registry, mdm, datadog Configs
- Fixed config/app_config.go to use correct function names
- Removed duplicate Config from ratelimit/ratelimit.go

* refactor: inject config structs through constructors

- store.NewPostgres(ctx, cfg store.Config) — replaces connString param
- store.NewMemory(cfg store.Config) — replaces adminKey param
- mdm.NewClient(cfg mdm.Config, logger) — replaces baseURL/apiKey params
- api.NewServer(reg, st, cfg api.ServerConfig, logger) — injects cfg fields

Added AdminKey to store.Config and ServerConfig (AdminKey/AdminEmails/ReleaseKey).
Updated all 117 NewMemory call sites, 2 NewPostgres callers, 1 mdm.NewClient,
1 api.NewServer in main.go, and ~20 api.NewServer test callers via testServer helper.

All tests pass (go test -race ./...).

* fix: update e2e testbed for new constructor signatures

- store/config.go: pass AdminKey in ReadConfig
- e2e/testbed/coordinator.go: use store.Config for NewMemory/NewPostgres
- e2e/testbed/suite.go: pass api.ServerConfig to NewServer

* fix: use shared env.EnvPrefix in ratelimit config

Create coordinator/env/ package with shared EnvPrefix constant
so that ratelimit/config.go can reference it without creating
an import cycle (config->ratelimit would conflict with
ratelimit->config).

config/app_config.go now defines EnvPrefix = env.EnvPrefix
as a package-level alias. ratelimit/config.go imports env
and uses env.EnvPrefix+"_RATE_LIMIT_RPS" etc.

* fix: wire env prefix + deduplicate NewServer wiring

Addresses review feedback on PR #187:

1. All per-package configs now use env.EnvPrefix instead of hardcoded
   "EIGENINFERENCE" strings. Previously only ratelimit/ used it; now
   store/, billing/, auth/, mdm/, registry/, and api/server_config do
   too.  No import cycles — all packages import coordinator/env.

2. NewServer now applies same trimming as the Set* methods:
   - strings.TrimRight for baseURL, r2CDNURL, r2SitePackagesCDNURL
   - strings.TrimSpace for minProviderVersion
   - strings.ToLower(strings.TrimSpace) for admin emails
   This fixes an inconsistency where NewServer left URLs untrimmed
   but the Set* calls in main.go would trim them later.

3. Removed redundant Set* calls from main.go.  NewServer already
   sets all ServerConfig fields, so the conditional SetConsoleURL /
   SetCORSOrigin / SetBaseURL / SetMinProviderVersion / SetR2CDNURL /
   SetR2SitePackagesCDNURL / SetReleaseKey / SetAdminKey blocks
   were duplicate work.

* chore: add TODO for admin email storage antipattern (PR feedback)

* ratelimit: reuse env helpers instead of local duplicates

Move EnvFloat/EnvInt/EnvOr/FirstNonEmpty from coordinator/config to
coordinator/env so they're accessible without import cycles.
coordinator/config now forwards to env for backward compatibility.
ratelimit/config.go now calls env.EnvFloat/env.EnvInt directly
instead of defining its own duplicate helpers.

Fixes: config→app_config→api→ratelimit import cycle that prevented
ratelimit from importing coordinator/config directly.

* fix: reuse env.EnvOr/env.FirstNonEmpty instead of local helpers

* registry: validate MinTrustLevel is a recognized value in Check()

* fix(billing): add MockMode+StripeSecretKey mutual exclusion to Check()

* fix: guard threat-model-review for fork PRs where ANTHROPIC_API_KEY unavailable

Two-part fix:
1. Workflow: add `if: github.event.pull_request.head.repo.full_name == github.repository`
   to skip the entire job for fork PRs (secrets not shared with forks).
2. Script: handle missing ANTHROPIC_API_KEY env var gracefully by returning a
   skip message instead of crashing.

* Revert guard block from threat-model-review.py per review feedback

* revert: remove out-of-scope workflow guard from config refactor PR

* feat(coordinator): use registry max_output_length for default max_tokens bound

The coordinator was hardcoding defaultMaxOutputTokens=8192 for all models
when the consumer didn't specify max_tokens. Now it looks up the model's
max_output_length from the registry (set at registration) and uses that
as the bound. Falls back to 8192 for models not in the registry.

GPT-OSS 20B and Gemma 4 both support 32K output, so consumers that omit
max_tokens now get up to 32K instead of being capped at 8K.

The registry lookup piggybacks on the existing GetModelRegistryRecord
call used for reasoning_parser injection -- no additional DB query.

* fix(provider-swift): exclude sliding attention layers from per-token KV cost

Sliding-attention layers have a fixed KV cache bounded by the window
size (e.g. 128 tokens for GPT-OSS 20B). Their memory does not grow with
sequence length, so counting them in kvBytesPerToken overestimates the
per-token cost and underestimates the token budget by up to 2x.

GPT-OSS 20B: 12 full + 12 sliding layers. Before: 48 KB/token, budget
~2.1M tokens on 128GB. After: 24 KB/token, budget ~4.2M tokens.

Gemma 4 has a similar hybrid layout and benefits equally.

* fix: update test files for store.Config and ServerConfig signatures

* rebrand: research preview -> public alpha (#220)

Rename all instances of 'Research Preview' and 'research project' to
'Public Alpha' across UI, landing page, legal terms, and README.

- console-ui: sidebar label, footer disclaimer, login page, provider
  setup, LLM system prompt
- landing: banner tag (now 'Low-cost private inference on idle Macs'),
  marketing copy (3 sections), terms.html (6 clauses)
- docs: terms-of-service.md (6 matching clauses)
- README: top-level callout

No legal meaning changed -- the existing ToS already listed 'alpha' as
a valid label. CSS class names (.research-tag) left unchanged.

* feat: add Vercel Web Analytics to console-ui and landing page (#221)

* feat: add Vercel Web Analytics to console-ui and landing page

Install @vercel/analytics alongside existing Google Analytics on both
surfaces. Vercel Analytics is cookieless and collects only anonymized
page-view data, so no consent banner is required.

console-ui (Next.js):
  - Added @vercel/analytics dependency
  - Added <Analytics /> component to root layout (imported from
    @vercel/analytics/next for automatic route tracking)

landing (plain HTML):
  - Added va queue shim + deferred script tag pointing at
    /_vercel/insights/script.js

Google Analytics remains untouched -- both systems run in parallel.
Vercel Analytics tracks by default; GA continues to be consent-gated.

Note: Web Analytics must also be enabled in the Vercel project dashboard
for data to start flowing.

* feat: mirror custom events to Vercel Analytics

Add Vercel track() call inside the existing trackEvent() function so
all 45 custom event call sites automatically send to both GA and Vercel
Analytics with zero call-site changes.

Vercel track() fires unconditionally (cookieless, always-on). GA
continues to be consent-gated. Vercel track() limits: string values
only and max 5 key-value pairs per event, so we convert and cap.

* feat: add landing page funnel tracking with Vercel Analytics

Add scroll-based section visibility and CTA click tracking to
landing/index.html using Vercel Analytics va() events.

Section funnel (IntersectionObserver, fires once per section at 30%
visibility threshold):
  hero -> what-you-get -> why-it-costs-less -> privacy-problem ->
  privacy-architecture -> developer-experience -> pricing -> earn ->
  footer

CTA click tracking:
  - Hero buttons (Start building, Estimate earnings, Read the Paper)
  - Card buttons (Open Console, Start Earning)
  - Paper download links (eigen-block CTAs)
  - Nav anchor clicks (Why, Privacy, API, Pricing, Earn)
  - Footer link clicks
  - Install tab toggle (CLI vs Mac App)

All events use the va() queue shim already present in <head>. The
existing scroll-reveal animation is preserved and runs alongside.

* improve stats model catalog display (#222)

* Improve stats model catalog display

* Enable analytics by default

co-authored with codex

* feat: streamline provider onboarding to one post-install command (#223)

* Improve stats model catalog display

* feat: streamline provider onboarding to one post-install command

Reduce the provider onboarding flow from 5+ manual steps to a single
command after the curl installer.

install.sh:
- Remove [5/5] model catalog step (redundant with start's picker)
- Make MDM enrollment non-blocking (no more read -p wait)
- Replace 5-line 'next steps' with: source ~/.zshrc && darkbloom start
- Renumber steps from [1/5]...[5/5] to [1/4]...[4/4]

LoginCommand.swift:
- Fix stale 'darkbloom serve' -> 'darkbloom start' in success message

StartCommand.swift:
- Add preflight doctor checks (SIP, debugger, min RAM) before model
  picker so problems surface before downloading GBs of weights
- Add inline login prompt ('Link account? [Y/n]') before model picker
  so users don't need a separate darkbloom login step
- Both are skipped in non-interactive/foreground/--model modes

* fix: default 'darkbloom models' to catalog instead of local list

A new user running 'darkbloom models' with nothing downloaded saw
'No local MLX models found.' -- unhelpful. Now it shows the full
coordinator catalog with download status markers (✓ for downloaded),
so they can immediately see what's available.

'darkbloom models list' still works for the local-only view.

* feat: show supported vs local-only models in 'darkbloom models'

Split the catalog view into two sections:

  Supported models
    ✓ Qwen 3.5  [qwen3.5-4b]  ~2.5 GB
      Llama 4   [llama-4-8b]  ~4.8 GB

  Local only (not in current catalog)
    old-model-v1  3.2 GB

    These models are no longer served by the network.
    Remove with: darkbloom models remove <id>

Users immediately see what's active vs what's just taking up disk
space from old downloads. Nudges cleanup without being aggressive.

* feat(console-ui): public models catalog proxy and earn page resilience (#224)

Models API route:
- Unauthenticated requests now proxy to /v1/models/catalog + /v1/models/capacity
  instead of the auth-gated /v1/models, so the earn page and other public
  surfaces can display the full model catalog without an API key.
- toModelEntry() normalizes catalog fields (size_gb, min_ram_gb, architecture,
  capacity stats) into the standard model shape the UI expects.

Client (api.ts):
- fetchModels() handles three response shapes: data.data (OpenAI list),
  data.models (catalog), or a raw array.

Earn page:
- Models without explicit pricing fall back to a default output price
  instead of being filtered out entirely.

Tests:
- Add catalog response unwrapping test for fetchModels.
- Update earn page tests to mock fetchModels/fetchPricing from @/lib/api.

* feat: multi-model swap — download multiple models, serve one at a time (#225)

* feat: multi-model swap — download multiple models, serve one at a time

Providers can now select and download multiple models even when their
combined size exceeds available RAM. Only one model is warm (loaded in
GPU memory) at a time; the coordinator manages demand-driven model
swaps via the existing load_model protocol.

Provider (Swift):
- TUI picker: removed simultaneous memory budget constraint; each model
  only needs to individually fit. Shows 'one model active at a time
  (swap on demand)' when total exceeds RAM.
- Fixed pre-existing download resume bug: range-resumption (HTTP 206)
  now appends to the partial file instead of replacing it.

Coordinator (Go):
- Cold-start routing: freeMemoryAdmits now admits idle providers that
  have the model on disk but not loaded, accounting for LRU eviction.
- Raised cold-start penalty from 2.5s to 30s (realistic for model swap
  times of 15–60s) so warm providers are strongly preferred.
- Proactive model swap: TriggerModelSwaps sends load_model to idle cold
  providers when queued requests have no warm provider. Includes
  deduplication (2-min cooldown per provider+model pair), one-provider-
  per-pass selection, and full routing safety gates (trust, runtime,
  privacy, challenge freshness, catalog).
- SendLoadModel, ClearPendingModelLoad, QueuedModels helpers.

* chore: gofmt billing_handlers.go and pricing_test.go

* fix: address review — routing gates on warm check, stale WarmModels, idle-only swaps, Content-Range validation

- hasWarmProviderLocked now applies full routing gates (trust, runtime,
  privacy, challenge freshness) so stale-attested providers don't
  suppress model swaps
- Heartbeat always overwrites WarmModels (including empty) to clear
  stale entries after model unload
- bestModelLoadProviderLocked only selects idle providers (pendingCount
  == 0) to avoid failed load_model on busy single-slot providers
- Download resume validates Content-Range start offset before appending;
  falls back to full re-download on mismatch

* fix: address second review round — idle slot penalty, Content-Range strictness, load oscillation, catalog gate

- slotStatePenalty: handle 'idle' state as running (0ms) — provider
  reports 'idle' for warm-but-no-active-requests models
- Content-Range: discard partial on missing/unparseable header instead
  of appending optimistically; test mock now sends Content-Range
- bestModelLoadProviderLocked: skip providers with ANY pending
  load_model (providerHasPendingLoad) to prevent swap oscillation
- providerHasWarmModelLocked: add catalog gate so retired/hash-changed
  models don't suppress swap planning

* fix: per-provider reservation race + drain queue on load success

- reservePendingModelLoads: check providerHasPendingLoad (not just
  per-key) to prevent concurrent heartbeat goroutines from reserving
  the same idle provider for different models
- load_model_status handler: drain queued requests immediately on
  success instead of waiting for next heartbeat (up to 5s)

* fix: adversarial review — BackendCapacity authority, load failure backoff, disconnect cleanup, TUI preselect

- providerHasWarmModelLocked: BackendCapacity is authoritative when
  present; only 'running'/'idle' slots count as warm. Prevents crashed
  slots from suppressing needed model swaps via stale WarmModels.
- load_model_status: only clear pendingModelLoads on success. Failures
  retain the 2-min cooldown to prevent retry storms against providers
  that consistently fail (deleted files, OOM).
- Disconnect: clear pendingModelLoads entries for the disconnected
  provider to prevent stale entries from blocking future swaps.
- TUI preselect: check canFitIndividually before preselecting a
  downloaded model.

* feat: reject queued requests immediately when model is unservable

When load_model fails and no other provider can serve the model,
queued requests are now rejected immediately with a fast error
instead of waiting 120 seconds for the queue timeout.

- FailQueuedRequestsForModel: sends nil to all ResponseChs, causing
  waiters to receive ErrQueueTimeout
- RejectUnservableQueuedRequests: checks QuickCapacityCheck after a
  load failure; if no eligible provider exists, flushes the queue
- Wired into load_model_status handler alongside the existing
  success/drain path

* fix: clear stale CurrentModel on nil heartbeat, mark provider warm before queue drain

- Heartbeat: clear CurrentModel when active_model is nil/omitted,
  preventing attestation challenges from comparing against unloaded
  models
- load_model_status:succeeded: call MarkModelWarm before draining so
  the scheduler sees the provider as warm immediately, not after the
  next heartbeat (up to 5s delay)

* fix: RejectUnservableQueuedRequests must check capacityRejections

Only reject queued requests when NO provider serves the model at all.
If providers exist but are temporarily at capacity, requests should
wait — those providers may finish current work and become available.

* fix: MarkModelWarm injects synthetic BackendCapacity slot

The scheduler uses BackendCapacity.Slots (not WarmModels) for Swift
providers. When load_model_status:succeeded arrives before the next
heartbeat, the model had no slot so the scheduler still saw it as
cold/unknown. Now injects an 'idle' slot so DrainQueuedRequestsForModel
immediately routes to the just-warmed provider.

* fix: MarkModelWarm clears stale evicted slots from BackendCapacity

When a swap evicts model A and loads model B, stale 'running'/'idle'
slots for A remained in BackendCapacity until the next heartbeat,
causing the scheduler to treat A as still warm. Now drops all warm
slots except the newly loaded model.

* fix: MarkModelWarm preserves existing warm slots

Provider may have multiple model slots loaded simultaneously
(maxModelSlots=3). Only add/update the new model's slot; leave
existing slots untouched. Next heartbeat provides authoritative state.

* docs: add coordinator state model and mutation checklist to AGENTS.md

Documents the overlapping state views (BackendCapacity vs WarmModels
vs CurrentModel vs pendingModelLoads), their precedence rules, and a
5-point checklist for mutating provider state. Learned from 10 fix
iterations on the multi-model swap feature.

* docs: fix WarmModels reader list — include legacy ScoreProvider and /v1/me/providers

* ci: require approval before running e2e benchmarks (#227)

* chore: remove dead coordinator code (#211)

Remove unused functions, methods, constants, and a duplicate directory:

- coordinator/internal/e2e/e2e/: accidental byte-identical copy of parent
  directory, never imported by any code

- api/provider.go: SendInferenceRequest() -- consumer path writes
  directly to provider.Conn, this was a leftover from a refactor

- registry/queue.go: WaitForProvider() -- superseded by
  WaitForProviderContext(), the only method actually called

- registry/queue.go: TryAssign() -- stale queue method from older
  design, never called from production code

- registry/queue.go: CleanStale() -- stale queue method, never called
  (inline cleanStaleLocked is still used by Enqueue)

- registry/registry.go: BackendInprocessMLX const -- dead enum value,
  the in-process MLX path was removed. String literal kept where needed
  for backward compat with old providers.

- registry/registry.go: ForceTrustProvider() -- bypasses attestation
  with no legitimate production use. Tests updated to use
  testMakeTextRoutable().

- registry/registry.go: ProviderCountByChip() -- analytics method
  never wired to any endpoint

- registry/registry.go: ModelProviderCounts() -- analytics method
  never wired to any endpoint

Tests updated: removed 3 tests for deleted methods, migrated 2 tests
from ForceTrustProvider to testMakeTextRoutable, replaced WaitForProvider
calls with WaitForProviderContext.

All tests pass. go vet clean.

* [codex] Add stats leaderboard tab (#226)

* Add stats leaderboard tab

* Add earn now CTA to stats leaderboard

* fix(coordinator): resolve DB connection starvation, deprecate Python providers (#228)

Production outage root cause: Postgres connection pool (20 max) exhausted by
concurrent stats scans, heartbeat upserts, and billing settlement. When
SyncRuntimeManifest happened to overlap with pool exhaustion, ListReleases
timed out, the manifest was nuked, and revalidateConnectedProvidersAgainstRuntimePolicy
set RuntimeVerified=false for ALL providers — instantly derouting the fleet.

Critical fixes:
- Increase pool MaxConns from 20 to 80, MinConns from 5 to 10
- SyncRuntimeManifest: return early on ListReleases nil (DB timeout) instead
  of nuking a working manifest
- revalidateConnectedProvidersAgainstRuntimePolicy: only deroute on intentional
  manifest withdrawal, not transient DB failures
- Add 5s timeout to telemetry batch INSERT (was unbounded)

Python/legacy provider deprecation:
- privateTextBackendSupported only accepts mlx-swift
- verifyRuntimeHashesForBackend immediately rejects non-Swift backends
- providerSupportsPrivateTextLocked: remove dead Python caps branch
- Remove dead code: r2SitePackagesCDNURL, verifyRuntimeHashes(),
  EIGENINFERENCE_KNOWN_PYTHON_HASHES, EIGENINFERENCE_KNOWN_RUNTIME_HASHES
- All test fixtures updated from inprocess-mlx to mlx-swift

DB performance optimizations:
- CreditProviderAccount: 6 sequential round-trips → single CTE
- Usage recording made async (saferun.Go)
- Provider credit + platform fee run concurrently (WaitGroup)
- Auth middleware: 3 DB queries → 1 (ValidateKeyFull) + LRU cache (60s TTL)
- PersistProviderThrottled: heartbeat writes rate-limited to 1x/30s per provider
- Add indexes: idx_usage_created, idx_usage_consumer, idx_usage_provider
- Add earnings_summary materialized table: eliminates full-table SUM scans on
  /v1/provider/account-earnings (PK lookup instead)
- Backfill migration populates earnings_summary from existing data
- Add detailed mismatch logging (component+hash, not just count)

All migrations are idempotent (CREATE IF NOT EXISTS / ON CONFLICT DO NOTHING).
No manual SQL required — indexes and tables auto-create on restart.

All tests pass. go vet clean.

* fix(coordinator): unblock WebSocket read loop from billing settlement

Root cause of challenge timeouts: handleComplete runs billing DB calls
(GetModelPrice, Credit, Charge) synchronously on the WebSocket read loop.
Under DB pressure (cross-cloud RDS latency), these block for 5+ seconds,
preventing the read loop from receiving attestation challenge responses.
The 30s challenge timeout expires, RecordChallengeFailure clears
LastChallengeVerified, and the provider becomes unroutable.

Fixes:
- Move handleComplete to a saferun.Go goroutine so billing settlement
  never blocks the read loop
- RecordChallengeFailure: only clear LastChallengeVerified on security
  failures (SIP disabled, signature mismatch, etc.), NOT on transient
  timeouts. Transient timeouts only deroute at MaxFailedChallenges (3).
- Move MaxFailedChallenges constant to registry package (was hardcoded)

All tests pass. go vet clean.

* refactor(coordinator): replace MaxMind with ip-api.com for provider geolocation

Remove the geoip2-golang dependency and MaxMind .mmdb file requirement.
Provider geolocation now uses ip-api.com (free, no API key, 45 req/min).
Called once per provider WebSocket connection so rate limit is never hit.

The resolver always initializes now — no env vars needed for basic geo.
EIGENINFERENCE_TRUST_GEO_HEADERS=1 still works as a fast-path when
behind Cloudflare/Vercel. EIGENINFERENCE_GEOIP_DB is removed.

* style: gofmt provider.go, postgres.go

* perf(coordinator): stop writing telemetry to Postgres — Datadog is sole sink

Removes the synchronous InsertTelemetryEvents call from the telemetry
handler. With 60 providers sending batches every 10s, this was 6 INSERTs
per second, each writing up to 50 rows into a table with 5 indexes.
That alone consumed ~30-40% of the DB connection pool.

Datadog already receives all telemetry asynchronously via the Logs API.
The Postgres copy was documented as best-effort secondary storage and
adds no value that Datadog doesn't already provide.

The telemetry_events table and its schema are left intact (no migration
needed). New events simply stop being written.

* fix(provider-swift): migrate SE key to AfterFirstUnlock for background signing

The SE key was created with kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
which blocks signing when the screen is locked. This caused all attestation
challenges to fail with OSStatus -25308 (errSecInteractionNotAllowed) on
provider machines with locked screens, making them unroutable.

Changes:
- New keys use kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly — accessible
  after first unlock even when screen subsequently locks
- loadOrCreate performs a test sign on existing keys; if it gets -25308,
  deletes the old key and recreates with the new policy
- Migration is automatic on provider restart — no manual intervention

Providers need to update to this version and restart. The old key is
deleted and a new one is created, which means the provider will
re-attest with a new public key on next coordinator connection.

* chore: bump provider version to 0.5.11

* fix: add missing r2SitePackagesCDNURL field and setter from PR branch

* fix: DB perf optimizations, error classification, and provider diagnostics (#232)

* fix: DB perf optimizations, error classification, and provider diagnostics

Coordinator DB performance:
- Add usage_totals counter table (O(1) vs full-table scan)
- Add partial index on usage.request_location IS NOT NULL
- Replace UsageRecordsSince + ListProviderRecords with SQL JOIN
- Add 60s cache to /v1/models/catalog endpoint
- Fix N+1 query in ListActiveModelRegistryWithError (batch file load)
- Add 20s cache to /v1/provider/account-earnings
- Merge GetBalance + GetWithdrawableBalance into single query

Billing error classification:
- Add ErrInsufficientBalance sentinel to store package
- Debit() distinguishes pgx.ErrNoRows from DB timeouts
- Consumer handler returns 503 (not 402) for DB errors
- Provider handler logs warn vs error for balance vs DB failures

Provider diagnostics:
- darkbloom logs now streams macOS unified logging by default
- darkbloom logs --last 1h shows historical unified logs
- darkbloom logs --file falls back to provider.log
- New darkbloom report command uploads 24h unified logs
- New POST /v1/provider/log-report endpoint (API key auth)
- New GET /v1/admin/log-reports admin endpoints
- New provider_log_reports DB table

Closes #230

* fix: address Codex review findings

- Accept provider tokens (eigeninference-pt-...) in requireAuth so
  darkbloom report works with device-login tokens
- Include limit param in earnings cache key to prevent stale responses
- Invalidate catalog cache in SyncModelCatalog after admin changes
- Fix log show to use --info flag instead of --level info (macOS log(1))

* fix: restore in-memory telemetry buffer, no-op Postgres telemetry writes

The telemetry Postgres removal (e0a63cc) removed both the Postgres
INSERT and the in-memory buffer write. The in-memory buffer is free
(no DB, bounded at 10K entries) and is needed by the admin metrics
endpoint and test assertions.

- Restore InsertTelemetryEvents call in the handler (writes to
  in-memory MemoryStore buffer only)
- Make PostgresStore.InsertTelemetryEvents a no-op (was still doing
  the expensive batch INSERT that the removal intended to eliminate)
- All 9 telemetry tests now pass (were failing on master)

* fix: remove telemetry Postgres writes, fix tests to assert on Datadog path

Telemetry is forwarded to Datadog only — no store writes. The previous
fix incorrectly re-added InsertTelemetryEvents to the HTTP handler.

- Remove InsertTelemetryEvents call from ingestion handler
- Make PostgresStore.InsertTelemetryEvents a no-op (was still doing
  the expensive batch INSERT the removal intended to eliminate)
- Update 3 tests to assert on HTTP response counts and metrics
  counters instead of TelemetryEventsSnapshot (which is empty since
  the handler no longer writes to the store)
- Recover middleware test unchanged (uses Emitter path, not HTTP handler)

All 12 packages pass with zero failures.

* style: gofmt server.go, stats.go, memory.go

* feat: trust_status message, auto-report, and MDM re-verification (#233)

Coordinator → Provider trust status notification:
- Add TypeTrustStatus protocol message (Go + Swift)
- Send trust_status after SE attestation (self_signed), MDM upgrade
  (hardware), ACME upgrade (hardware), and MarkUntrusted
- Provider receives trust level and status over WebSocket

Provider auto-report on degraded trust:
- When provider learns it is self_signed or untrusted, schedules a
  one-time auto-report of 24h unified logs after 10 minutes
- Report is uploaded to POST /v1/provider/log-report
- Cancelled if trust is upgraded before the 10-min window
- Once-per-session flag prevents spamming

MDM re-verification for self_signed providers:
- Challenge loop now re-attempts MDM verification after a successful
  challenge if the provider is still at self_signed trust
- Providers that install MDM enrollment after registration will get
  upgraded to hardware trust on the next challenge cycle (5 minutes)
  instead of being stuck at self_signed forever

* chore: bump provider version to 0.5.12

* fix: MDM channel saturation, timeout-marks-untrusted, and model load memory gate

MDM channel architecture (coordinator/mdm/mdm.go):
- Replace shared buffered channels (size 16) with per-UDID waiter maps
- Eliminates channel saturation: late/unsolicited webhooks no longer
  fill the buffer and block all future MDM verifications
- Eliminates CPU busy-spin: no more read-put-back loops when waiting
  for a specific UDID while other UDIDs are in the buffer
- Same fix applied to attestation (MDA) response path

MDM timeout handling (coordinator/api/provider.go):
- SecurityInfo timeout no longer marks provider untrusted
- Timeout is APN latency, not evidence of compromise
- Provider stays at self_signed trust, MDM re-check retries on next
  challenge cycle (every 5 minutes)

Model load memory gate (coordinator/registry/registry.go):
- TriggerModelSwaps now checks provider memory before sending load_model
- Uses catalog SizeGB * 2.5 as the coordinator-side memory threshold
- Prevents sending load_model to machines that will always reject
  (e.g., 32GB Mac for gpt-oss-20b needing 40.5GB)
- Stops the infinite retry loop of failed load_model commands

* fix: APN reliability for MDM — network assertions, 90s timeout, late-arrival path

Provider (Swift):
- Add NetworkPowerAssertion: IOKit assertions for NetworkClientActive
  and BackgroundTask, acquired for the entire provider session
- Keeps the macOS network stack alive during sleep so APN pushes
  (courier.push.apple.com:5223) can be delivered for MDM commands
- No root required — uses IOPMAssertionCreateWithName API

Coordinator:
- Increase SecurityInfo timeout from 30s to 90s to cover Power Nap
  cycles (every ~15 minutes on AC power)
- Add OnLateSecurityInfoCallback: when a SecurityInfo webhook arrives
  after the 90s timeout, retroactively upgrade the self_signed provider
  to hardware trust instead of silently dropping the response
- Wire up the callback in main.go alongside the existing SetOnMDA
  callback, using the same ForEachProvider + serial match pattern

* chore: bump provider version to 0.5.13

* chore: remove telemetry_events Postgres table and writes (#234)

* chore: remove telemetry_events Postgres table and writes

The telemetry_events table + 5 indexes was the single largest source of
DB write pressure (60 providers × batch/10s × 50 rows × 5 indexes consumed
~30-40% of the connection pool). The /v1/telemetry/events ingestion handler
already skips Postgres entirely — Datadog is the sole durable sink. No read
endpoints consumed this table.

- Remove CREATE TABLE telemetry_events + 5 CREATE INDEX from migration
- Delete telemetry_postgres.go, telemetry_memory.go, telemetry_test.go
- Remove InsertTelemetryEvents from Store interface
- Remove store field/param from telemetry.Emitter
- Remove telemetryEvents ring buffer from MemoryStore
- Update all callers (main.go, server.go, tests)

* ci: trigger re-run

---------

Co-authored-by: ethenotethan <42627790+ethenotethan@users.noreply.github.com>
Co-authored-by: Gajesh Naik <26431906+Gajesh2007@users.noreply.github.com>

This branch was successfully deployed

3 active deployments
Preview – d-inference — b5f6564a Deployed May 26, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — b5f6564a Deployed May 26, 2026 by vercel[bot]
Preview – d-inference-landing — b5f6564a Deployed May 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant