Repository navigation
tools: darkbloom --opencode / --hermes wait for the model to load, and a start says when a tool points elsewhere (LS-4) - #1904
Merged
Conversation
…ddress
`darkbloom --opencode` / `--hermes` set the tools up as soon as the local
API answers, before the model loads, so the limits they write are the
catalog's or none ("run it again once the model is loaded"); and after a
port or key change nothing says the tools point elsewhere (UX audit R11).
Tests first; the skeleton adds only the names the tests use, unwired:
ModelLoads, InterruptWatch, LiveLine and ModelLoadWait (it never waits),
ToolPointer and ToolAddress (they read nothing), the planners' `pointer`,
`Start.noteToolsPointingElsewhere` (it says nothing), the step's
`modelLoadWait` (unused), `runAgainOnceLoaded` (today's words),
`ToolIntegrationStep.command` (#1901's helper) and `LocalEndpoint.tokenPath`
made public.
- ModelLoadWaitTests (fakes: a scripted daemon state, a clock that moves
only between looks, no file, port or signal):
- a model still loading: the step waits, reads `/v1/models` again, and
writes this Mac's window (262,144) instead of the catalog's 131,072;
- nothing loading (or Only me, which loads before it listens): no wait;
- a provider that hasn't said what it loads yet is asked again a second
later; no word at all, or nothing loaded and nothing to load: set up
after that second look;
- the deadline: one ✗ line naming `darkbloom --opencode --hermes` and
`darkbloom status`, nothing written;
- Ctrl-C: nothing written, and the start says so;
- a model it waited for that didn't load: nothing written, `darkbloom
status` says why;
- one live line on a terminal (drawn in place, erased at the end); none
without one, only a line as it starts and one as it ends;
- only the API's own process's state counts; models this Mac doesn't
list, or that are loaded, aren't waited for; the live watch takes the
signal only while it waits (SIGUSR2 stands in for SIGINT).
- ToolAddressTests: a later start on another port says so in one line
with `darkbloom --opencode --hermes` and changes no file; only the tools
set up are named; another key file is named, the same key in another file
isn't; mixed misses get one line; no line with a tool flag or without a
local API; the planners' files read back (a key file under ~, and one
with a quote and a space in its path).
- StartToolIntegrationTests: the line for a model left unloaded names it,
`darkbloom status` and the short command.
Red (prod identity, CPU-only, sandboxed): ModelLoadWaitTests 11 of 12 fail
(28 issues), ToolAddressTests 5 of 6 (11 issues), StartToolIntegrationTests
1 of 16 (2 issues). Passing on both sides by design: the live line's words
and clipping, and no line with a tool flag or without a local API.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… points elsewhere
`darkbloom --opencode` / `--hermes` now wait, before they write a tool's
config, while the local API's own process still loads the models this Mac
lists for its start; then they read `/v1/models` again, so the tools get
the limits this Mac gives each model (its window) instead of the catalog's
or none. And a start without a tool flag says, in one line, when a tool set
up for Darkbloom points elsewhere, never changing its file (UX audit R11).
- ModelLoadWait (ToolIntegration): the API's process's own daemon state
(`ModelLoads.reported`: only by the pid in `local.json`), its start's
pending models and its loaded ones. Only me's server loads before it
listens, so it isn't waited for; a provider that names nothing loaded and
nothing to load is asked once more a second later (its API may answer
before it says what it loads). A model that isn't loading (unloaded when
idle, or loaded only on a request) isn't waited for: one line names it,
`darkbloom status` and `darkbloom --opencode`.
- One live line on a terminal (`⠙ Loading Gemma 4 26B before setting up
OpenCode… 42s`, erased at the end); without one, a line as it starts and
one as it ends. At most 10 minutes. The deadline, a model that didn't
load, or Ctrl-C (`InterruptWatch` takes SIGINT only while it waits, then
gives it back) write nothing, say so in one line with the next step, and
`Darkbloom keeps serving.`
- ToolAddress: OpenCode's and Hermes' provider blocks read back
(`pointer`: the base URL and the key file `{file:}` / `key_cmd` reads),
against this start's local API: its base URL and `local_token`
(`LocalEndpoint.tokenPath`, or another file holding the same key). One
line names the tools that miss it, what they point at, and `darkbloom
--opencode` / `--hermes`. Called by the background and the terminal
starts without a tool flag, not by launchd's child, not without a local
API.
- The changelog fragment.
Green (prod identity, CPU-only, sandboxed): ModelLoadWaitTests 12/12,
ToolAddressTests 6/6, StartToolIntegrationTests 16/16; DarkbloomCLITests
1193 tests in 171 suites, with the suites that run the built binary or
open Metal skipped as before (CI runs them).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… elsewhere Renders dev's pending LS-4 markers as today's behaviour: - local-first.md (Use it from OpenCode or Hermes): it waits for your model on one live line (at most 10 minutes; a timeout, a model that didn't load or Ctrl-C write nothing); run it again when your models change; a later start names a tool set up for another address or key file, with the command that points it there, and never changes its file. - quickstart.md: the live line in the opening block; step 5 waits for the models it started with, and the tools get this Mac's limits. - cli-reference.md (Set up OpenCode or Hermes): step 4, the wait (`ModelLoadWait`: the API's own daemon state, the second look, the lines, the deadline, Ctrl-C); the one-line notice of a start without a tool flag (`ToolAddress`). - tool-integrations.md: the wait in the flow and in Models, step 6 (follow the address), a failure-mode row and the code map. - direct-mode.md: the key file row names `LocalEndpoint.tokenPath()` and the notice; the port-in-use fix says the start names tools still set up for the old port. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
#1901 (darkbloom --opencode) landed. Conflicts resolved for this PR's lines on top of #1901's short command: the step's doc comment (dev's opening, this PR's wait sentence), the unloaded-model line and its test (this PR's, which names the model and darkbloom status), and direct-mode.md's port-in-use row (this PR's: the start names each tool still set up for the old port). The ToolIntegrationStep.command this PR had added beside #1901's is dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The required refactor pass (AGENTS.md) for #1904. Behaviour is unchanged; the tests only gain checks. - The never-write rule sits where it holds: `ToolIntegrationStep.configure` says no tool's config is written while the local API's process still loads a model this Mac lists for its start. `waitForModels` owns the case without a wait, so `configure` reads: models, catalog, wait, write. - `ModelLoads.loading(among:)` holds what still loads: pending, listed by this Mac, not loaded yet (a model stays pending through its warm-up). `ModelLoads` says when its state can't tell (none, another process's, another schema, an older provider, a pair's API) and that nothing is then waited for; `ModelLoadWait` says why it asks the process and not `/v1/models`. `finish` and `end` are `nothingLoading` and `erasingLiveLine`, and the settle comment says when an empty answer stands. - No terminal, no live line: `LiveLine.standardOutput(isTerminal:environment:)` takes its inputs, so the rule is tested, and uses `DarkbloomCommandLook`'s writer and window width instead of its own. - Hermes: `modelEntries()` and `pointer()` share one lookup of Darkbloom's block, and `key_cmd`'s form lives in one place: `keyCommand(reading:)` writes it, `keyFile(readBy:)` reads it back. OpenCode: `keyFile(inReference:home:)` sits beside `keyReference`, whose form it reads. - `ToolAddress`: the unused `tools:` parameter goes; tools that miss in different ways are a guard, then an exhaustive switch. The read-only rule is said there and atop `StartCommand+Tools.swift`. - Tests, added only: no live line without a terminal or on a dumb one; what still loads (warm-up, order); the one-second second look; a trailing slash is the same address; a key command or reference Darkbloom doesn't write (another command, a relative path, an unclosed quote, the key itself) names no key file. In a mutant run they caught the 7 mutants of these rules that the PR's tests let through. - Docs: tool-integrations.md says when nothing is waited for; cli-reference.md names `darkbloom --opencode` in the unloaded-model sentence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…for-model #1893 (a single Mac lists each loaded model's whole window as its context and max output; a larger max_tokens is cut, not refused), #1897 (input_modalities in this Mac's /v1/models are the engine's; SSE prefill progress) and #1890 (the update check asks again) landed. Two docs conflicts, resolved so each side stays true to the merged code: - docs/architecture/tool-integrations.md, Models: dev's keeping sentence (Fallback.endpointSettlesImageInput), its window paragraph and its newer pending R-FULL marker, then this PR's ModelLoadWait paragraph. Its first sentence now points at the window above, and says that on one Mac input_modalities are listed loaded or not, so only the limits need the model loaded. - docs/provider/local-first.md, Use it from OpenCode or Hermes: this PR's "It waits for your model" bullet; dev's window and image-input text as a "What the tools get" bullet with dev's pending R-FULL marker; then this PR's "Run it again" and "If the address or the key changes" bullets. dev's "Run it again too once a model you just started is loaded" sentence and its pending LS-4 marker go: this PR renders LS-4. cli-reference.md, direct-mode.md and IntegrationModels.swift merged without conflicts; the wait's code needs no change for #1893's window or #1897's input modalities. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 8, 2026
jonathan308
added a commit
that referenced
this pull request
Nov 8, 2026
…ix/tools-default-model-and-names - IntegrationModels.resolve: #1897 takes the engine's image input for a model served here, which it tells by `location == .thisMac`. A pair's own models are `.yourPair` on this branch, so it is `location <= .yourPair` now: a Gemma 4 pair's models keep the text-only input its engine lists instead of the catalog's vision. Git merged it without a conflict; `aPairsModelsAreServedHere` (222c66f) is the test that says so. - cli-reference.md: #1897's image-input sentences, then this branch's model names and default-model lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 8, 2026
…ariants said where they hold Refactor pass for #1911 (AGENTS.md, "Required Refactor Pass"). Behaviour preserved: every line the start prints and every byte the planners write are unchanged. - OpenCode's config order, once: `OpenCodeConfigPlan.globalFileNames` now says what Darkbloom relies on, from OpenCode 2's source (v2.2.6, dc2ffcf8bf): `opencode.json`, then `opencode.jsonc`, and no `config.json` (`discovery.ts` `names`, `config.ts` `loadDirectory`, its test "does not load legacy config.json files"); the default is the `model` of the last config loaded (`provider.ts`, `Config.latest`); OpenCode saves to the last file that exists (`config.ts` `update`); what loads before and after the global files (`config.ts` `load`); `OPENCODE_CONFIG_DIR`, which `configFile` doesn't follow. `configFile`, `plan` and `otherGlobalDefault` point to it instead of restating it. In the docs: tool-integrations.md's new "OpenCode's config order" table, linking that commit. - One rule for "the later file wins": `GlobalDefault.merged`, used by `otherGlobalDefault` and by `plan` (this file over the other). It replaces a loop and an inline ternary, with the same results. - The invariants, where they hold: `plan` never sets a default over the owner's, and a run again finds the one it set; Hermes is the exception (`HermesConfigPlan.plan`); names are read back without where a model runs (`IntegrationModel.displayName(in:)`); `IntegrationEndpoint.live`'s defaults read this Mac's own state, so a test gives its own. - Tests never read this Mac's cluster service. `IntegrationEndpoint.live` asks `ClusterPairSummary.runningPartPID()` by default, which `runningLocalAPIShortcut`, `waitsForTheLocalAPI`, the `liveEndpoint` child and the opt-in OpenCode smoke reached. They now bind a test pair (`ClusterPairSummary.readerForTesting`, `keepCommandsOffThisMacsCluster()`) or pass `pairPart`. No expectation changed. - Tests added, none changed or dropped: `thisFilesOwnDefaultWins` (this file's `""` beats another's name, its name beats another's unnamed default, two `model` keys name none), `aDefaultWithoutANameStays` (`""`, `null` or a broken `opencode.json`: the line without a name, no `model` written), `everyChangedAndDefaultLine` (every `Changed:` wording and default line; four of them no test said). - Docs: plain words for the default model in local-first.md, cli-reference.md and the changelog fragment, with the project and `OPENCODE_CONFIG` case; test.md's coverage and isolation. Checks (Xcode 27.2, prod identity, nice 19, CPU only, in a sandbox that denies ~/.darkbloom*, the real OpenCode and Hermes configs, the GPU and ports 8000/47420-47423): ToolSetupWordsTests 8/8; OpenCodeConfigPlanTests, HermesConfigPlanTests, IntegrationModelsTests 48/48; StartToolIntegrationTests, ModelLoadWaitTests, ToolAddressTests 38/38; the other tool suites 47/47; DarkbloomCLITests 1241/1241 in 175 suites (the usual binary and Metal skips); the isolated cases pass with a planted home whose cluster service names their pid. docs-check, docs-impact-check (#1904's head), changelog check and git diff --check pass. The tested tree differs from this one in one doc comment line (`GlobalDefault.merged`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e run-again line The independent review of #1904 (`review-1904.md`, approve with nits) found: - R2: Ctrl-C pressed as the model finishes loading is dropped: the next look sees the model loaded and the config is written. - R4: a tool set to `http://localhost:<port>/v1` is called "not this Mac's local API" (a plain string match). - R3: with a route that dials out, the router lists the catalog's limits for a model that isn't loaded, so the "run again" line the docs promise never prints. - Five wiring mutants survive (C1, C2: the wait never takes or gives back the signal; L1: start's wait draws without a terminal; N1, N2: the start's hooks drop the notice, or print it in a service's child), and one (T2: the deadline never fires) hangs instead of failing. Tests first. The skeleton adds the names and seams the tests use and keeps today's behaviour: `Outcome.ready`'s `loaded` (never set), `notLoaded` (the list's word only), `ToolAddress.sameAddress` (the string match), `thisMacsNames` and the notices' `thisMac` (loopback, unused), `Local.localHostName()` (moved out of `networkURL`); wired seams: `ModelLoadWait.live(isTerminal:environment:)` and the two hooks' `noteTools`. - ModelLoadWaitTests: - Ctrl-C in the pause before the look that sees the model loaded, and Ctrl-C as the wait ends: nothing is written, and the start says so; - a model its process hasn't loaded gets the run-again line, also when the router lists the catalog's 131,072; none for a model it has; the list's word without the process's (no state, Only me); - the wait itself takes the signal at every look, stops on it, and gives it back (SIGUSR2 stands in, raised only once the wait has it); - start's wait draws its live line exactly where a terminal can; - every fake process answers at most 10,000 looks, then records an issue and presses Ctrl-C, so a wait that never ends fails instead of hanging; the suite has a one-minute time limit. - ToolAddressTests: `localhost`, `[::1]`, any case, and this Mac's `.local` name for an API on every address are this Mac; another path, scheme or port isn't; the start's two hooks say the notice, never in a service's child; a one-minute time limit. Red (prod identity, CPU-only, sandboxed): ModelLoadWaitTests 4 of 18 fail (9 issues), ToolAddressTests 1 of 10 (5 issues); StartToolIntegrationTests 16/16. The wiring tests pass on both sides by design (the wiring is there; the mutant run shows they now catch C1, C2, L1, N1, N2 and T2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…at/tools-wait-for-model - StartCommand+Tools.swift: `setUpToolsBesideDaemon` keeps #1899's `waitSeconds` and two-argument `waitForAPI`, and this branch's `noteTools`; the doc comment says both. - cli-reference.md: #1900's banner sentences ("no start screen shows it"), then this branch's step 4, whose run-again rule replaces dev's sentence about a model without a context. - quickstart.md: both pending markers go (LS-1's and LS-4's), each rendered by its own PR. - ToolAddressTests: the hooks test's `waitForAPI` takes #1899's two arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 8, 2026
…tools-default-model-and-names #1904's fixes from its independent review (Ctrl-C as the wait ends, `localhost` as this Mac, the run-again line by the process's word, the wiring tests) and its merge of dev (#1899, #1900, #1905, #1885, #1917). - ToolIntegrationStep.configure: #1904's `afterWait` (the wait's list and the process's word), then this branch's `resolve(here:)` for a pair. - local-first.md: this branch's URL in the "already serves" line, then #1899's Only me wait. - developer/test.md: the three new suites in the filter, and both rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…for-model Clean: no file conflicts. #1902 makes `settingsFile:` a required argument of `LocalRouterConfig.host(...)`; this branch adds no call to it, and dev's own calls carry it. Checked by a build and the CLI suites below. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 8, 2026
…ix/tools-default-model-and-names Clean: no file conflicts. #1902 makes `settingsFile:` a required argument of `LocalRouterConfig.host(...)`; this branch adds no call to it. `ClusterPairSummary.readerForTesting`, which this branch's tests bind, is unchanged by #1903 and #1908. Checked by a build and the CLI suites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
marked this pull request as ready for review
November 9, 2026 00:35
jonathan308
added a commit
that referenced
this pull request
Nov 9, 2026
Brings dev c5263de, which #1910 merged after 344fd29: #1907 (the pair's progress comments on the probes' own clock), #1909 (every model that reasons takes every reasoning effort), #1919 (a MiMo test flake) and #1904 (the tools wait for the model). No conflict. Shared with this PR: StandaloneServer+HTTP.swift, where #1909's reasoning-effort refusals and the envelope's param sit beside this PR's memory case, which stands; and docs (direct-mode.md, inference.md), which merge cleanly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 9, 2026
…ember-relay Two docs conflicts, each kept true to the merged code: - docs/provider/quickstart.md: #1904 rendered its own <!-- pending LS-4 --> marker and added <!-- pending LS-3: in a pair, start with opencode on either Mac. -->, which this branch's text already says; both markers are gone. The Two Macs bullet says "darkbloom --opencode on either Mac" (this branch) with #1904's note that the wait for the model and the tool-points-elsewhere line are for one Mac for now (a pair's tools wait for its API to listen, setUpToolsBesidePair). - docs/provider/direct-mode.md: the key-file row keeps this branch's rule (the key the discovery record names: this Mac's own local_token, a pair's API or its relay included) with #1904's sentence on a start without a tool flag and its LocalEndpoint.tokenPath() source; this branch's pair-key row stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 9, 2026
… fix/local-models-list-reasoning No conflicts. #1916 is in, so #1914's review condition C2 holds: Gemma 4 lists reasoning, and an effort now turns its thinking on. #1904 (tools wait for the model) adds no location.servedHere and no pair location. IntegrationModels.Location is still thisMac, yourMacs and network, and a pair's own /v1/models entries are still this-mac. So this PR's `location == .thisMac` remains exactly "served here", and a pair keeps its engine's "no". #1911, which merges after this PR, makes the switch to location.servedHere (review condition C1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 9, 2026
…ng alone, one tool reader (red) #1906's independent review (review-1906.md) asked for changes once #1899 and #1904 merged. With dev merged, these tests ask for them: - The fix that starts a local API again (its port doesn't answer, or no key file holds its key) keeps the way it serves now (C1): - Only me in a terminal: "press Ctrl-C in its window, then `darkbloom start --local --here`". `restart` never stops it, and would serve the saved choice in the background (the Darkbloom network, for one); - a service serving the saved choice, or with none saved: `restart`; - a service serving another way: `start` with that way's flag (`--local`, `--me-first`, `--local-endpoint --no-me-first`); - `--solo` where a paired Mac serves alone; `restart` for the pair's own API. - A stopped service that is installed: `restart` starts it again as saved (N6); without one, `start`. - Only me's server loading its models (no local API yet) is Only me, "starting", and the network's checks are skipped; the address line says the API opens once its models are loaded (C2). A network provider waiting for its schedule stays the network. - A paired Mac serving alone (`start --solo`) is described by what serves: its own way "(this Mac serves alone, not the pair)", the network's checks by that way, and its bind failure with `start --solo --port` (C3). - A failed bind is named by the address that failed (N1). - A pair that hasn't chosen how it serves says so, with `darkbloom cluster` (N2). A tool left pointing at a local API on a Darkbloom network pair names `darkbloom cluster` (N4). - The tools are read and judged as `start` judges them (C4): - `localhost`, and this Mac's `.local` name for an API on every address, are this Mac; - another file holding the same key is the same key; - a `key_cmd` without a full path names no key file; - a config over 4 MiB is refused unread; - a Darkbloom block without an address names the tool's command. - `live` reads whether this Mac serves alone, Only me in a terminal, the service, and this Mac's names, through stand-ins (`DoctorLocalAPI.Reads`). Four tests cover lines no test did (the review's surviving mutants), and pass already: - the pair's way decides Only me while it serves (D1); - a paired Mac's saved port isn't the pair's address (D2); - `--coordinator` runs the network's checks on Only me, end to end (D3); - the key file is the running API's port's first (D5). `addressesOnThisMacCompareByPortAndPath` goes: the address rule is #1904's, and `ToolAddressTests` covers it. Seams, with today's behaviour: - `DoctorToolSetup.Found` takes `ToolAddress`'s shape (`.notSetUp`, `.entry(ToolPointer)`, `.unreadable`), still from doctor's own reader and comparison; - `DoctorLocalAPI.Facts` gains `servingAlone`, `terminalOnlyMe`, `serviceInstalled` and `thisMac`, unused; - `live` takes `Reads`, but reads none of those. 12 of the 36 tests fail, with 42 issues; `ToolAddressTests` passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 9, 2026
…s tool reader The review's changes (review-1906.md), now that #1899 and #1904 are in dev. The red commit's 12 tests pass, and so do the other 24. - A local API that doesn't answer, or whose key no file holds, is started again the way it serves now (C1, `DoctorLocalAPI.restartFix`): - Only me in a terminal (`Restart.terminalOnlyMe`): "press Ctrl-C in its window, then `darkbloom start --local --here`". `restart` never stops it, and with an older job installed it would put the Mac back on the Darkbloom network; - the background service serving the saved choice, or with none saved: `restart`; - a service serving another way than the saved choice: `start` and that way's flag, since `restart` serves the saved one; - `--solo` where a paired Mac serves alone; `restart` for the pair's API. - "— not running" with the background service installed: `restart` starts it again as saved, without `start`'s questions (N6). - Only me's server is Only me from its first load (#1899's rule, as `status` reads it): the mode line says "(starting)", the address line that the API opens once its models are loaded, and the network's checks stay skipped (C2). - A paired Mac serving alone (`ServiceDrain.soloProviderState`) is described by what serves, "(this Mac serves alone, not the pair)": Only me and the network's checks follow it, its bind failure says `start --solo --port`, and its commands take `--solo` (C3). - A failed bind names the address that failed (N1). A pair that hasn't chosen how it serves says so, with `darkbloom cluster` (N2). A tool left on a Darkbloom network pair names `darkbloom cluster` (N4). - One reader and one set of names (C4): - the mode names are #1899's `LocalFirstWords.choice`, also for the pair's; `DoctorLocalAPI.name` goes; - the tools are read by #1904's reader, which gains a form that says why a config that is there can't be read (`ToolAddress.readPointer`, `OpenCodeConfigPlan.readPointer`, `HermesConfigPlan.readPointer`; `pointer` is that without the reason, so `start` is unchanged); - each tool is judged by one check, `ToolAddress.miss`, which `start`'s notice uses too: `localhost` and this Mac's `.local` name are here, another file holding the same key is the same key, a `key_cmd` without a full path names no file, and a config over 4 MiB is refused unread; - `DoctorToolSetup` is a thin read over it; its own JSONC and YAML readers, its address rule and `HermesConfigPlan.providerEndpoint` go. - `live` reads all this through stand-ins (`DoctorLocalAPI.Reads`). The key is still never printed: the running API's is read only for whether there is one, and the tools' key files are compared, never shown. Docs: the Local API table in cli-reference.md (with a table of the restart fixes), local-first.md, troubleshooting.md, tool-integrations.md, and the changelog fragment. Checks: 1357 tests in 184 suites of DarkbloomCLITests pass (without the suites that run the built binary). Twelve env-gated mutants, each caught: the review's D1, D2, D3 and D5, which survived before, and one each for C1, C2, C3, the `.local` name, `live`'s wiring, N6, the same key, and the 4 MiB limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 9, 2026
…ames tools: say what happened to your default model, name the URL and "(your pair)" (journey 2a J2-e/f/g; stacked on #1904)
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
LS-4 of the local-serving plan (UX audit R11).
darkbloom --opencode/--hermesset the tools up as soon as this Mac's local API answers. In Both, me first that is before the model loads, so the limits they write are the catalog's (Gemma 4 26B: 131,072 instead of this Mac's 262,144) or none, and the start ends with "run it again once the model is loaded". After a port or key change nothing says the tools now point elsewhere: they fail with "connection refused" or 401.What changes
/v1/modelsagain, so the tools get the limits this Mac gives each model (R-FULL: the whole window, and with provider: a single Mac serves its model's whole window and holds every request to it #1893/provider: this Mac's /v1/models says what each model takes, and a long prompt shows progress (R-FULL D7, D8; stacked on #1893) #1897 the output and the input modalities).⠙ Loading Gemma 4 26B before setting up OpenCode… 42s. No load percentage exists anywhere in the provider, so it is a spinner with the elapsed time.Waiting up to 10m for Gemma 4 26B to load before setting up OpenCode.) and one as it ends (Gemma 4 26B loaded after 42s.).✗ Gemma 4 26B is still loading after 10m, so OpenCode wasn't set up. Run `darkbloom --opencode` again once `darkbloom status` shows it loaded.A model it waited for that didn't load:✗ Gemma 4 26B didn't load, so OpenCode wasn't set up: `darkbloom status` says why.Nothing is written either way, andDarkbloom keeps serving.Stopped waiting for Gemma 4 26B to load, so OpenCode wasn't set up; nothing was written. Run `darkbloom --opencode` again once `darkbloom status` shows it loaded.The wait takes SIGINT only while it runs, then gives it back as it was. It asks for Ctrl-C right after every look, before "nothing loading" can end the wait, and the step asks once more as the wait returns, so a press as the model finishes loading writes nothing either:Stopped before setting up OpenCode; nothing was written. Run `darkbloom --opencode` again.(review R2).local.json): its start's pending models (startupPreloadPendingModels) that this Mac lists and hasn't loaded (warmModels). Only me's server loads before it listens, so it is never waited for. A provider that names nothing loaded and nothing to load is asked once more a second later: its API can answer a moment before it says what it loads. A model that isn't loading (unloaded when idle, or loaded only on a request) isn't waited for: one line names it,Run `darkbloom --opencode` again once `darkbloom status` shows gpt-oss-120b loaded, to pick up its limits.Which models those are, the process says (itswarmModels), so the line also prints when a route that dials out lists the catalog's limits for them; without the process's word (no state of its own, or Only me's server), a model/v1/modelslists without a context (review R3).cluster localwrites no state of its own), so it isn't waited for, as before this PR. A pair started without a terminal already waits up to 10 minutes for the pair to serve; the gap is a pair that is already running and still loading (LS-4b, below). The docs say so.local_token). A start without--opencode/--hermesthat serves a local API now reads Darkbloom's provider block back from OpenCode's and Hermes' configs and compares it with this start's address andlocal_token(or another file that holds the same key). When a tool misses it, one line says so, names the command and changes nothing:OpenCode points at http://127.0.0.1:8001/v1, not this Mac's local API (http://127.0.0.1:8002/v1): `darkbloom --opencode` points it there.The key-file and mixed cases have their own one-liners (below). Not printed by launchd's child, by a start without a local API, or when a tool flag is given (that start points the tools there itself).
ToolAddress.sameAddress): the same scheme, host and port in any case (the scheme's own port when none is given) and path (one/at its end aside);localhost,127.0.0.1and::1are one host, and so is this Mac's Bonjour name (Local.localHostName(), with.local, asdarkbloom localprints it) for an API on every address. A tool set up by hand athttp://localhost:8001/v1is this Mac's (review R4). The rule doctor: a Local API section first, and no network checks on Only me (LS-6, R17) #1906'sdoctoruses, here for both.startstarts the pair and says nothing about the tools. The docs say so.darkbloom --opencode, cli:darkbloom --opencodeanddarkbloom --hermes(short forstart --opencode/--hermes) #1901), with itsToolIntegrationStep.command.Before / After: what a user sees
flowchart LR subgraph BEFORE["Before"] direction TB b1["darkbloom --opencode<br/>(Both, me first)"] --> b2["local API answers<br/>the model is still loading"] b2 --> b3["OpenCode written at once:<br/>limit context 131072 (the catalog's)"] b3 --> b4["Run darkbloom --opencode again<br/>once the model is loaded"] b5["later: darkbloom start --port 8002"] --> b6["OpenCode still at :8001<br/>connection refused, nothing says why"] end subgraph AFTER["After"] direction TB a1["darkbloom --opencode<br/>(Both, me first)"] --> a2["local API answers"] a2 --> a3["⠙ Loading Gemma 4 26B before setting up OpenCode… 42s<br/>(no terminal: a start and an end line)"] a3 -->|loaded| a4["OpenCode written with this Mac's window:<br/>limit context 262144"] a3 -->|"10 min, didn't load, or Ctrl-C"| a5["nothing written<br/>one line names the next step"] a6["later: darkbloom start --port 8002"] --> a7["OpenCode points at :8001, not this Mac's<br/>local API (:8002): darkbloom --opencode points it there<br/>(the file is unchanged)"] end classDef cmd fill:#e8eefc,stroke:#3c5aa6,color:#111111 classDef ok fill:#e3f6e8,stroke:#1e8449,color:#111111 classDef err fill:#fde2e1,stroke:#c0392b,color:#111111 classDef text fill:#fff4d6,stroke:#b7791f,color:#111111 class b1,b5,a1,a6 cmd class a4 ok class b3,b6 err class b2,b4,a2,a3,a5,a7 textBlue: what the user types. Green: the right limits written. Red: wrong limits, or a silent failure. Yellow: what the user reads.
Before / After: code flow
flowchart LR subgraph BEFORE["Before"] direction TB B0["ToolIntegrationStep.configure"] --> B1["fetchModels: GET /v1/models"] B1 --> B2["fetchCatalog"] B2 --> B3["IntegrationModels.resolve"] B3 --> B4["ToolIntegration.configure: write"] B5["start without a tool flag<br/>setUpToolsBesideDaemon / BesideLocalServer"] --> B6["return: reads nothing"] end subgraph AFTER["After"] direction TB A0["ToolIntegrationStep.configure"] --> A1["fetchModels: GET /v1/models"] A1 --> A2["fetchCatalog"] A2 --> AW["ModelLoadWait.run<br/>ModelLoads.live: daemon state of local.json's pid<br/>LiveLine, InterruptWatch (SIGINT while waiting)"] AW -->|"waited: read again"| A1b["fetchModels"] AW -->|"timeout / not loaded / Ctrl-C"| AX["one line, nothing written"] A1b --> A3["IntegrationModels.resolve"] AW -->|"nothing loading"| A3 A3 --> A4["ToolIntegration.configure: write"] A5["start without a tool flag<br/>setUpToolsBesideDaemon / BesideLocalServer"] --> A6["Start.noteToolsPointingElsewhere<br/>ToolAddress.notice: OpenCodeConfigPlan.pointer,<br/>HermesConfigPlan.pointer vs base URL + LocalEndpoint.tokenPath()"] A6 --> A7["one line, or nothing; never a write"] end classDef same fill:#eef2f7,stroke:#64748b,color:#111111 classDef changed fill:#ede4fb,stroke:#6b46c1,color:#111111 class B0,B1,B2,B3,B4,B5,B6,A0,A1,A2,A3,A4 same class AW,A1b,AX,A5,A6,A7 changedPurple: new or changed. Grey: as before.
Every new line
⠙ Loading Gemma 4 26B before setting up OpenCode and Hermes… 1m 12sWaiting up to 10m for Gemma 4 26B to load before setting up OpenCode.Gemma 4 26B loaded after 1m 12s.✗ Gemma 4 26B is still loading after 10m, so OpenCode wasn't set up. Run `darkbloom --opencode` again once `darkbloom status` shows it loaded.✗ Gemma 4 26B didn't load, so OpenCode wasn't set up: `darkbloom status` says why.Stopped waiting for Gemma 4 26B to load, so OpenCode wasn't set up; nothing was written. Run `darkbloom --opencode` again once `darkbloom status` shows it loaded.Stopped before setting up OpenCode; nothing was written. Run `darkbloom --opencode` again.darkbloom --opencodeagain once the model is loaded…")Run `darkbloom --opencode` again once `darkbloom status` shows gpt-oss-120b loaded, to pick up its limits.OpenCode and Hermes point at http://127.0.0.1:8001/v1, not this Mac's local API (http://127.0.0.1:8002/v1): `darkbloom --opencode --hermes` points them there.OpenCode reads the key in ~/.darkbloom/cluster_local_token, not the one this Mac's local API takes (~/.darkbloom/local_token): `darkbloom --opencode` points it there.OpenCode and Hermes don't point at this Mac's local API (http://127.0.0.1:8001/v1): `darkbloom --opencode --hermes` points them there.Commits
d5d8962637: red tests, with the skeleton only (the names the tests use, unwired: the wait never waits, the address check reads nothing,runAgainOnceLoadedkeeps today's words).a01170c7db: the wait, the address check, the start hook (twoguardlines) and the changelog fragment.e9e8abbc82: docs. Renders dev's pending LS-4 markers (local-first.md,quickstart.md) and updatescli-reference.md,tool-integrations.mdanddirect-mode.md.8f1aae4dab: merge ofdev9f41e9c723(cluster: on a paired Macstartstarts the pair,--soloserves alone, no start asks without a terminal, and status says what this Mac serves #1892), signed, clean.29da718a11: merge ofdev680a2fbae5(cli:darkbloom --opencodeanddarkbloom --hermes(short forstart --opencode/--hermes) #1901), signed. Conflicts resolved for this PR's lines on top of cli:darkbloom --opencodeanddarkbloom --hermes(short forstart --opencode/--hermes) #1901's short command: the step's doc comment, the unloaded-model line and its test, anddirect-mode.md's port-in-use row. Thecommandhelper this PR had added beside cli:darkbloom --opencodeanddarkbloom --hermes(short forstart --opencode/--hermes) #1901's is dropped.6f0e0e9130: the refactor pass (behaviour unchanged; tests only added).103e4cd0cd: merge ofdev8d545e85a8(provider: a single Mac serves its model's whole window and holds every request to it #1893, provider: this Mac's /v1/models says what each model takes, and a long prompt shows progress (R-FULL D7, D8; stacked on #1893) #1897, fix(provider): the update check asks again, 15 s a try, and says what failed #1890).a2f4375f34: red tests for the independent review's nits (review-1904.md), with a skeleton that adds names and seams only:Outcome.ready'sloaded(never set),notLoaded(the list's word),ToolAddress.sameAddress(the old string match),thisMacsNames,Local.localHostName(), and the wired seamsModelLoadWait.live(isTerminal:environment:)and the hooks'noteTools.b7c549967a: the fixes (R2, R3, R4),InterruptWatch.beginsetting its source up before it ignores the signal, and the changelog fragment.1493267eb5: every fake process ends a wait at its bound both ways (Ctrl-C and a clock past any deadline), after the mutant run found C3 looping on a clock that never moved.d16dfdab6c: docs: single-Mac scope, the Ctrl-C checks, the run-again rule, the address rule, the test suites.10093d776c: merge ofdevc76445a61e(LS-1 PR-b: Only me serves in the background, and the service always serves the saved choice #1899, LS-1 PR-c: a simpler start — Autopilot only for the network, a picker that opens on what fits, no key on screen #1900, desktop, cluster: the app on a paired Mac offers Start serving, never Autopilot, and its lines say what happened #1905, ci: restore the prompt parity fixtures from a verified cache #1885, ci: hourly full CI (dev) run of dev (workflow_dispatch selects every suite) #1917), signed. Conflicts:setUpToolsBesideDaemon's doc comment (LS-1 PR-b: Only me serves in the background, and the service always serves the saved choice #1899'swaitSeconds, then the notice),cli-reference.md(LS-1 PR-c: a simpler start — Autopilot only for the network, a picker that opens on what fits, no key on screen #1900's banner sentences, then step 4),quickstart.md(both pending markers go); the hooks test takes LS-1 PR-b: Only me serves in the background, and the service always serves the saved choice #1899's two-argumentwaitForAPI. Clean againstdev28ddc01605(cluster, status: a paired start says what it does, Apple's check reads as progress, and both Macs show the pause, from now #1908).2a9158e875: merge ofdev344fd29b3e(cluster, status: a paired start says what it does, Apple's check reads as progress, and both Macs show the pause, from now #1908, cli:darkbloom route this-mac|my-macs|my-macs-firstsaves the route (LS-6, R12) #1902, cluster:darkbloom cluster leaveleaves a pair in one command, from either Mac (LS-6, R14) #1903), signed, clean. cli:darkbloom route this-mac|my-macs|my-macs-firstsaves the route (LS-6, R12) #1902 makessettingsFile:a required argument ofLocalRouterConfig.host(...); this PR adds no call to it, and dev's own calls carry it. Locally: the three suites 44/44,DarkbloomCLITests1321/1321 in 183 suites; CI run 42535299815 passed, its build of every test product included.Validation
Local runs: Xcode 27.2, prod identity (
DARKBLOOM_RELEASE_ENVIRONMENT=prod, as CI),nice -n 19, CPU only, inside a sandbox that denies~/.darkbloom*, the real OpenCode and Hermes configs, the GPU,~/Library/LaunchAgentswrites and ports 8000/47420–47423. Every test uses fakes: a scripted daemon state, a clock that moves only between looks, temp homes. No tool runs, no port is bound, no real state file is read. The signal test uses SIGUSR2, raised only once the watch has it.d5d8962637)a01170c7db; again after eachdevmerge,29da718a11last)ModelLoadWaitTests(new): wait then write this Mac's window; nothing loading means no wait; the second look; the timeout's message; Ctrl-C writes nothing; didn't load; one live line only on a terminal; only the API's own process; the live SIGINT watchToolAddressTests(new): another port in one line with the command, and no file changed; only tools set up; another key file, but not another file holding the same key; mixed misses; no line with a tool flag or without a local API; the planners' files read backStartToolIntegrationTests(the unloaded-model line)ToolShortcutTests,OpenCodeConfigPlanTests|HermesConfigPlanTests(after #1901)DarkbloomCLITests(skips below)make docs-check,make docs-impact-check BASE=origin/dev,make changelog-check,git diff --checkThe review's nits (
a2f4375f34→b7c549967a;1493267eb5;10093d776c):a2f4375f34)b7c549967a)10093d776c, withdev)ModelLoadWaitTests: Ctrl-C in the last pause and as the wait ends; the run-again line by the process's word (a route that dials out), not for a model it has, the list's word without it; the wait takes the signal at every look, stops on it and gives it back; start's wait draws only on a terminal; bounded fakes, a one-minute limitToolAddressTests:localhost,[::1], any case, this Mac's.localname for an API on every address (not on loopback alone, not another Mac's); another path, scheme or port; the start's two hooks say the notice, never in a service's child; a one-minute limitStartToolIntegrationTestsDarkbloomCLITests(skips below)docs-check,docs-impact-check --base origin/dev,changelog.py check,git diff --checkPassing on both sides by design: the wiring tests (the hooks' notice, the live line's terminal rule, the signal's raise), since the wiring was there; the mutant run below shows they now catch it.
Mutants (
overnight/review-1904-fixes-evidence/: the review's 22 and its 3 feature-off switches on the fixed code, plus L1B and 5 of the fixes, built once behindREVIEW_MUT, each againstModelLoadWaitTests,ToolAddressTestsandStartToolIntegrationTests, 44 tests, killed after 240 s): all 31 fail a test, none hangs. The review's five survivors now fail: C1 (the wait never takes the signal, 3 issues), C2 (never gives it back, 2), L1 (draws without a terminal, 2; L1B, ignoring both inputs, 1), N1 (the background start drops the notice, 1), N2 (the service's child prints it, 1). T2 (the deadline never fires) fails in 7 s instead of hanging (3). The fixes' own: R2A (no Ctrl-C check before "nothing loading", 1), R2B (no check as the wait ends, 3), R3 (the list's word only, 1), R4 (the string match, 5), R4N (no.localname, 1). The first run found C3 (Ctrl-C ignored) looping on the new signal test's still clock;1493267eb5fixed the fakes, and it fails now (4).CI (dev): run 42528344904 on
10093d776cpassed: Build provider test products, Provider Unit Tests shards 1 and 2, and Provider Tests; the new tests ran in them. Earlier: run 42447396145 on8f1aae4daband run 42448723199 on29da718a11: Build provider test products, Provider Unit Tests shards 1 and 2 and Provider Tests pass; both new suites ran there. The two Vercel deployments (d-inference,d-inference-console-ui-dev) fail on every open PR (#1901 too), unrelated.Passing on both sides by design: the live line's words and clipping, and no notice with a tool flag or without a local API.
Skipped locally, as before (CI runs them): the suites that execute the built
darkbloombinary on this production host (CLIDispatchTests,AppAttestQualificationCommandTests,UpdateRollbackEndToEndTests,ClusterServiceUpdateTests,DesktopExecutableWatchTests,MacOSUpgradeNoticeTests,DesktopRuntimeProfileTests), and the two tests that open Metal (localPreloadDisabled,preloadReportsAndHonorsStop).Not run: a real model load on a real Mac with a real OpenCode (this worker may not run
darkbloomon this Mac). That is the journey re-test on DevNet:darkbloom --opencodewith Both on pair-2's Mac Studio should show the live line and write Gemma 4 26B's 262,144.Coordination
10093d776c) at3b09e1cc40. Retarget it todevonce this merges.doctor), merging second: reuse this PR's readers rather than its own:ToolAddress.sameAddress(now the same address rule as itssameAddress, plus the scheme's own port and the.localname),sameKey, the planners'pointer,keyFile(readBy:)andkeyFile(inReference:); add one test that the start's notice anddoctoragree on the same files (review §5).git merge-treeis clean, so git won't flag the duplication.darkbloom --opencodeanddarkbloom --hermes(short forstart --opencode/--hermes) #1901 (darkbloom --opencode): landed and merged here (29da718a11); every new line uses itsToolIntegrationStep.command.103e4cd0cd. This PR re-reads/v1/modelsonce the model is loaded, so their engine limits andinput_modalitiesreach the tools without another run.IntegrationModels.displayNameis added at the end ofIntegrationModels.swift, away from provider: this Mac's /v1/models says what each model takes, and a long prompt shows progress (R-FULL D7, D8; stacked on #1893) #1897's hunks (it merges cleanly).git merge-treeagainst their heads: conflicts only indocs/architecture/tool-integrations.mdanddocs/provider/local-first.md, where both render their pending markers in the same paragraphs; keep both texts (their R-FULL sentences, then this PR's).10093d776c(conflicts above). Only me's server listens after it loads, soModelLoads.loadsBeforeListeningadds no wait after LS-1 PR-b: Only me serves in the background, and the service always serves the saved choice #1899's longer API wait. That API wait draws no live line, so an Only me background start waits silently while its model loads (review §1): a follow-up, below.dev, one more indirect-mode.md's troubleshooting table.LocalEndpoint.tokenPath()is now public (and documented), so the plain start knows the key file its local API takes before that API is up.Limitations
/v1/modelsfor that reason: they read the process's own state.darkbloom cluster statusthere). The plan (review §2):ClusterPairSummary.liveas a second source forModelLoadWait, and the leader'swarmModels; also "OpenCode wasn't set up" on a pair start's exit 3. The address notice is single-Mac too: a paired Mac's start says nothing about the tools.processIdentityorwrittenAtcheck on the state file, and a provider-side test thatwarmModelslists a loaded model (§3); names vs IDs in "darkbloom statusshows …", asstatuslists IDs (§6.1).LocalAPIPort.note(named:saved:)(--portreplacing a saved port) still says, at that start, that tools set up for the old port needdarkbloom --opencodeagain; the notice here then names which tools, at that start and every later one.6f0e0e9130).review-1904.md, at103e4cd0cd). Its requested changes 1–4 are fixed here (Ctrl-C, the run-again line, the docs' single-Mac scope, the wiring tests and bounded fakes), with R4's address rule; 5 is doctor: a Local API section first, and no network checks on Only me (LS-6, R17) #1906's. Its two other docs nits (IDs vs names, the double line on a--portchange) are left as they were.