Repository navigation
feat(provider): darkbloom beta command to enable opt-in beta features - #423
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No files in this PR match any Trust boundaries touchedNone of the existing TB-001 through TB-009 boundaries are directly modified. However, the new surface described below warrants a threat model update. Threat coverageℹ️ No existing T-xxx threats are strengthened, weakened, or neutralised by this diff. New attack surface not covered by an existing threat
If Recommended threat model additions
The SEC-* findings resolvedNone. 🔐 Threat model: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0d97c3be0
ℹ️ 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".
| } | ||
|
|
||
| feature.apply(enabled, to: &config) | ||
| try ConfigManager.save(config, to: snapshot.configPath) |
There was a problem hiding this comment.
Write migrated beta toggles to canonical config
On providers that still have only a legacy config path, loadRuntimeSnapshot copies that file to the canonical ~/.config/darkbloom/provider.toml before returning, but snapshot.configPath remains the legacy path. Saving the toggle back there means the newly created canonical file, which ConfigManager.defaultConfigPath() and the launchd start --foreground daemon resolve first after darkbloom restart, keeps the old kv_quant value, so darkbloom beta enable/disable ... reports success but the restarted daemon ignores it. Save to the post-migration default/canonical path in this case, or ensure the daemon is launched with the same config path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch — fixed in a83c5da. When no explicit --config is passed, the toggle now persists to ConfigManager.defaultConfigPath(), which after loadRuntimeSnapshot's legacy→canonical migration resolves to ~/.config/darkbloom/provider.toml (the same path darkbloom restart/the launchd daemon reads first). An explicit --config path is still honored as-is, and the no-op check now tests the actual save target.
Adds a config-backed beta-feature toggle so providers can opt into experimental capabilities — starting with KV-cache quantization (kv-quant). - BetaFeature registry (ProviderCore/Config/BetaFeatures.swift): maps each feature to a ProviderConfig field (kv-quant -> backend.kvQuant). The command and status are driven entirely off this list, so new beta flags need no per-feature code. - `darkbloom beta list|status|enable|disable` modeled on the autoupdate read-modify-write precedent; `list` supports --json. - `darkbloom status` now shows active beta features. - Docs: docs/provider/beta-features.md, kv_quant added to the [backend] reference (quickstart), and a beta section in the CLI reference. Config-backed (not env-var) on purpose: the launchd daemon only inherits an allowlist of DARKBLOOM_* vars (LaunchAgent.passthroughEnvKeys), so a TOML field is the only toggle that reliably reaches the daemon. Default stays off (fp16). Tests: BetaFeaturesTests (7) + ConfigTests green; darkbloom CLI builds; manual smoke of enable/disable/list/status/json/unknown-feature paths.
… (Codex P2) loadRuntimeSnapshot may migrate a legacy config to the canonical ~/.config/darkbloom/provider.toml, but snapshot.configPath stays the legacy path. Saving the beta toggle there left the canonical file — which the restarted daemon resolves first — on the stale value, so enable/disable reported success but the daemon ignored it. When no explicit --config is given, persist to ConfigManager.defaultConfigPath() (the post-migration canonical path the daemon reads); honor an explicit --config path as-is. No-op check now tests the actual save target.
a0d97c3 to
a83c5da
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…hed SDK base dev moved its mlx-swift-lm pin to #434 (c85e84cf) and changed tool-call parsing for GLM, Gemma and MiMo. Conflicts, both kept: - MultiModelBatchSchedulerEngine.swift, the DEBUG _testMakeEventStream parameter list: this branch's withholdReasoning and nativeGlimmerChannels, then dev's nativeMiMoChannels (the forwarding call had merged cleanly and already passes all three, in makeEventStream's declared order). - libs/mlx-swift-lm: 39e5dc5e, feat/muse-glimmer-native (#423) with #434 merged in, so the pin carries both dev's parsers and Muse Glimmer. libs/mlx and libs/mlx-swift stay at 72dffa2d and b1c94d29. Co-Authored-By: Claude <noreply@anthropic.com>
…hed SDK base dev pinned mlx-swift-lm at main fe9b5282 (#434's merge, the same tree as c85e84cf) and says so in docs/architecture/inference.md, which merged cleanly. Only the libs/mlx-swift-lm gitlink conflicted: it now pins c1103b8c, feat/muse-glimmer-native (#423) with main fe9b5282 merged in (no file change), so the pin contains dev's. libs/mlx and libs/mlx-swift stay at 72dffa2d and b1c94d29. Co-Authored-By: Claude <noreply@anthropic.com>
…SDK base Only the libs/mlx-swift-lm gitlink conflicted. It now pins c7dbf1a0, mlx-swift-lm #429 (ATEM reference reader) with the refreshed feat/muse-glimmer-native (#423 + #434) merged in. This branch started at 7b75e0d and did not contain feat/muse-glimmer-30b's earlier dev merge; this merge brings the whole base in. libs/mlx and libs/mlx-swift stay at 72dffa2d and b1c94d29. Co-Authored-By: Claude <noreply@anthropic.com>
…SDK base Only the libs/mlx-swift-lm gitlink conflicted. It now pins 1d2ba618, mlx-swift-lm #429 (ATEM reference reader) with the refreshed feat/muse-glimmer-native (#423 + main fe9b5282) merged in. libs/mlx and libs/mlx-swift stay at 72dffa2d and b1c94d29. Co-Authored-By: Claude <noreply@anthropic.com>
libs/mlx-swift-lm moves from c1103b8c to cc2be070, the same branch (feat/muse-glimmer-native, #423) with three commits on top: - 824db4cf keeps an ATEM value nested past 63 levels as text; - 31a7ccb2 keeps JSON text nested past 63 levels as text in ToolArgumentNormalization, which both ATEM readers call after typing a value; - cc2be070 formats the new test with swift-format 6.4.4. Without them, a Muse tool call whose parameter nests about 192 objects or 224 arrays deep (160 in a debug build) exhausts the 512 KiB cooperative stack when NativeToolStreamRouter encodes its arguments, and the provider stops with SIGBUS. libs/mlx and libs/mlx-swift are unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
…sting bounds #2149 now reads the tool channel in linear time (e2c60ca) and pins #423 with the nesting bounds. Only the libs/mlx-swift-lm gitlink conflicted. It now pins 62cfabd5, mlx-swift-lm #428 (speed) with that #423 (cc2be070) merged in. libs/mlx and libs/mlx-swift stay at 72dffa2d and b1c94d29. Co-Authored-By: Claude <noreply@anthropic.com>
…sting bounds #2149 now reads the tool channel in linear time (e2c60ca) and pins #423 with the nesting bounds. Only the libs/mlx-swift-lm gitlink conflicted. It now pins 3702459f, mlx-swift-lm #427 (vision) with that #423 (cc2be070) merged in. libs/mlx and libs/mlx-swift stay at 72dffa2d and b1c94d29. Co-Authored-By: Claude <noreply@anthropic.com>
…sting bounds #2149 now reads the tool channel in linear time (e2c60ca) and pins #423 with the nesting bounds. Only the libs/mlx-swift-lm gitlink conflicted. It now pins b7672434, mlx-swift-lm #429 (ATEM reference reader) with that #423 (cc2be070) merged in. libs/mlx and libs/mlx-swift stay at 72dffa2d and b1c94d29. Co-Authored-By: Claude <noreply@anthropic.com>
The suite feeds seeded random and hostile model output, at every chunking, through: - the channel splitter; - the tool frame; - the SDK's ATEM reference reader and its strict parser; - the scheduler's forwarding body, under every tool choice. Each must hold up the way the inbound-depth (#2130), queue-budget (#2135) and TOML (#2138) fixes were tested. It must not crash, stall, buffer without bound, leak framing, raise invalidToolPayload or return a 500. A frame the model gets wrong is the model's error, a 422. deepNesting and the deep hostile frames need the nesting bounds of mlx-swift-lm #423 (824db4cf and 31a7ccb2, from d266d4e6 and 7f958c64) in the pin; this branch pins b7672434, which has them. Without them, a value nested a few hundred levels deep stops the test process with SIGBUS, as it would stop a provider. repeatedStrayCloses took about two minutes in a debug build while the splitter rescanned the tool body on every stray closing tag; with the linear splitter of #2149 (e2c60ca) it takes about a second. Test-only. Co-Authored-By: Claude <noreply@anthropic.com>
…che (replay Layr-Labs#2149) Replays Layr-Labs#2149 onto dev (82175d9) and pins libs/mlx-swift-lm to d625d5bde2bd6f181227e858422f1d072d84c6cc (Layr-Labs/mlx-swift-lm#579, multimodal SDK baseline: Layr-Labs#423, Layr-Labs#427, Layr-Labs#429, Layr-Labs#430, Layr-Labs#432; Layr-Labs#428 omitted) so every commit in the stack compiles cleanly. Drops Layr-Labs#2149's MTPAcceptancePolicy.swift edit (superseded by Layr-Labs#2723 universal exact acceptance on dev), regenerates fixtures/prompt-contract/v1/reasoning_effort_vectors.json (475 -> 504 cases, inserting muse_glimmer at indices 380-408 via scripts/generate-reasoning-effort-vectors.py), and updates CachePromptParityTests and MuseGlimmerPolicyTests for dev parity.
What
For the beta tag: a clean, discoverable way for providers to opt into experimental features. Starts with KV-cache quantization (
kv-quant), but is a general framework.darkbloom statusnow also shows aBeta features:line.Before / after
How a provider enables a beta feature (
kv-quant):Before — only an undocumented TOML field; hand-edit, no discoverability/validation/verification:
flowchart TD U([Operator wants ~2x KV capacity]) --> Q{How do I<br/>enable kv-quant?} Q -->|no command| NC[no beta command<br/>not shown in status] Q -->|not in docs| ND[kv_quant undocumented<br/>absent from quickstart + cli-reference] Q -->|env var?| NE[no kv_quant env var exists<br/>and launchd daemon ignores<br/>non-allowlisted DARKBLOOM_*] NC --> M[Only path: hand-edit<br/>~/.config/darkbloom/provider.toml] ND --> M NE --> M M --> TY["manually add: [backend] kv_quant = true<br/>typo-prone, no validation, no caveats"] TY --> R[darkbloom restart] R --> S[serve reads config.backend.kvQuant] S --> OK[engaged... but no built-in<br/>way to confirm or see state] style ND fill:#ffe9cc,stroke:#cc8400 style NE fill:#ffe9cc,stroke:#cc8400 style TY fill:#ffd6d6,stroke:#cc0000 style OK fill:#ffe9cc,stroke:#cc8400After — discoverable, validated, config-backed (reaches the daemon), with a verification path:
flowchart TD U([Operator wants ~2x KV capacity]) --> L[darkbloom beta list<br/>discovers kv-quant + on/off state] L --> EN[darkbloom beta enable kv-quant] EN --> REG[[BetaFeatures registry<br/>kv-quant → backend.kvQuant]] REG --> RMW[ConfigManager: load → set → save<br/>writes kv_quant = true to TOML] RMW --> HINT[prints model-family caveat<br/>+ 'restart to apply'] HINT --> R[darkbloom restart] R --> D[launchd daemon reads provider.toml<br/>config-backed → always reaches daemon] D --> S["serve: kvQuantEnabled = config.backend.kvQuant<br/>(ProviderLoop / StandaloneServer)"] S --> RES{BatchScheduler<br/>resolveKVQuantScheme} RES -->|Gemma-4 / GPT-OSS| OK([KV-quant engaged ~1.9x capacity]) RES -->|other family| FP[fp16 fallback - safe] OK --> V[Verify: darkbloom status 'Beta features' line<br/>+ darkbloom logs 'kv-quant' logger] style OK fill:#d6f5d6,stroke:#1a8a1a style V fill:#d6f5d6,stroke:#1a8a1a style REG fill:#dbe9ff,stroke:#2b6cb0 style FP fill:#eeeeee,stroke:#888Why a command + config (not docs-only, not env vars)
darkbloom startonly inherits an allowlist of twoDARKBLOOM_*vars (LaunchAgent.passthroughEnvKeys), so an env-var toggle would silently no-op for the normal daemon. A TOML field is read by every serve path (daemon /--foreground/--local).kv_quantwas previously 100% undocumented.betanamespace so future beta flags don't clutter the top-level command list.Design
ProviderCore/Config/BetaFeatures.swift— a small registry. EachBetaFeaturemaps to oneProviderConfigBoolfield via@Sendablegetter/setter closures (Swift 6 strict-concurrency safe).kv-quant→backend.kvQuant. The command + status are driven entirely offBetaFeatures.all, so adding a beta flag is one entry + a config field.darkbloom/BetaCommand.swift—list/status/enable/disable, modeled on the existingautoupdateread-modify-write precedent (ConfigManager.save). Idempotent no-op when already in the desired state; helpful error (exit 64) on unknown feature;list --json.kv-quantjust toggles the existingbackend.kv_quantfield consumed byresolveKVQuantScheme(...).Docs
docs/provider/beta-features.md(guide + caveats + how to verify viadarkbloom logs).kv_quantadded to the[backend]reference inquickstart.md.darkbloom betasection incli-reference.md.Testing
BetaFeaturesTests(7) green: registry lookup (case-insensitive), default-off, apply toggles + is scoped to its field,enabledIDs, TOML round-trip.ConfigTests(16) green.darkbloomCLI builds (Swift 6.1).Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.