Skip to content

Gemma 4 and <think> models: client stop sequences skip reasoning and tool calls - #1650

Merged
davidtai merged 18 commits into
devfrom
fix/reasoning-stop-scope
Nov 3, 2026
Merged

davidtai merged 18 commits into
devfrom
fix/reasoning-stop-scope

Conversation

@jonathan308

@jonathan308 jonathan308 commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Extends the client stop fix from GPT-OSS (#1645) to Gemma 4 and every <think>-format model (Qwen 3.5/3.6/3.8, Bonsai, Nemotron 3.5, GLM, MiMo and the others that use the qwen3/deepseek_r1 parser). With reasoning on, a client stop string was matched against the model's private reasoning too. One that appeared while the model reasoned ended the request before any answer: finish_reason: "stop", reasoning only, empty content. Now stops skip reasoning and tool-call frames and match the rest of the output. That is almost, but not exactly, the text clients receive as content; the exceptions are in the 2026-11-02 update below.

#1645 is merged (e7f98181a) and this PR targets master. The engine half is Layr-Labs/mlx-swift-lm branch fix/reasoning-stop-scope-exclude-on-2beb401f (commits d0c3a8e2 + 5ffbb801), on top of mlx-swift-lm main at 2beb401f: the same SDK commit master pins. This PR pins that branch commit; re-pin to the mlx-swift-lm merge commit before merging.

Update 2026-10-28: #1645 moved to SDK main (mlx-swift-lm 25bcd63f, mlx-swift c633d221, mlx 72dffa2d), and this PR is merged up with its head 2841c6fe5 (75abd7d48). The only conflict was the libs/mlx-swift-lm pin. The two engine commits (95e1d2b9, b5d4c754 on fix/reasoning-stop-scope-exclude, kept for history) are replayed onto 25bcd63f with an identical diff, and this PR's own changes on top of #1645 are byte-identical to before.

Update 2026-10-30: #1645 was squash-merged and GitHub retargeted this PR to master, where its copies of #1645's commits conflicted. 93739a62a merges master 093aaf3d8. The result is master plus only this PR's own changes: the same changed lines as 2841c6fe5..75abd7d48 outside libs/. The two engine commits are replayed again, onto master's SDK pin 2beb401f, with an identical diff. 2beb401f is one commit after 25bcd63f (mlx-swift-lm#368) and touches none of these files. mlx-swift c633d221 and mlx 72dffa2d are unchanged.

Update 2026-10-31 (Target: 0.10.7). Refreshed onto master 6ffeaf06c2 by a signed merge, not forced (2660933fb). Besides the gitlink and doc date lines, the merge resolved the removal of logprobsChannel, defaultMaxTokensContextLimit and the min_p row against this PR's changes. The engine branch merges SDK main 7933a0fa (7f00abc4, draft Layr-Labs/mlx-swift-lm#375). It still pins that branch commit; re-pin to the merge commit before merging. mlx-swift c633d221 and mlx 72dffa2d are master's pins.

Live on this head (binary a01edb2c…) against master (binary 67534aba…): gemma-4-26b-qat-4bit, 36 fresh prompts, reasoning on, temperature 0, MTP off, one at a time. Script and results in the sweep folder.

Master This PR
stop: ["."]: empty answer 36 of 36 0 of 36
stop: ["\n\n"]: empty answer 36 of 36 0 of 36
stop: ["."]: answer equals the full answer cut at its first stop 0 of 36 36 of 36
stop: ["\n\n"]: same 0 of 36 35 of 36

On the one miss, the answer has a space before the blank line and the reply came back without that space (…the largest ocean. for …the largest ocean. ). The stop itself landed in the right place. Focused provider suites on this head: 121 tests in 18 suites pass. SDK stop tests on 7f00abc4: 55 of 55 pass. Not run here: timed sets (this PR's perf check above is from an earlier base) and the other <think> families on this head.

Update 2026-11-01. v0.10.6 is tagged at master 84ddfdba6b, with the same SDK, mlx-swift and mlx pins, and SDK main is still 7933a0fa. Measured on 2660933fb; master 84ddfdba6b was merged into this branch afterwards (f8df74879, no conflict). make provider-test steps on a local combination of v0.10.6, this PR, #1693, #1668, #1669, #1703 and the Gemma decode limits candidate (never pushed): 644 XCTest, 129 skipped, 0 failures; 6,736 Swift Testing tests plus 9 isolated runs pass, 0 crashes. The metallib was staged by hand: the Metal Toolchain is not installed here. Combined timed A/B against v0.10.6, 2026-11-01, frozen 11-request Gemma conversation, MTP off, same-text A/A 5 pairs then 10 ABBA pairs, under the 25% background-CPU rule with the owner's waiver for iCloud's fileproviderd and bird: summed follow-up TTFT 8.911 → 6.336 s, −28.87%, 10/10 beyond 4.33%; donor waits 5.633 → 2.639 s, −53.07%, 10/10 beyond 4.34%; summed time 20.219 → 14.213 s, −29.74%, 10/10 beyond 3.01%; decode +11.41%; outputs and cached tokens equal on 110/110. One no-regression clause fails as written: non-donor stream-end waits +27.67% against a 13.21% threshold, on all 10 pairs, which is 12 → 16 ms per request. A no-regression timing set and a fresh verifier on this head, including Qwen3.5-9B and Nemotron Lightning, are queued in the sweep and will be added here.

Update 2026-11-02: independent verifier on 2660933fb + SDK 7f00abc46 against master 6ffeaf06c, verdict PARTIAL. The fix reproduces and the stated rule does not hold in full. The report is in the sweep folder (N7-05); I recounted the numbers here from its raw files.

Live, reasoning on, one at a time, --mtp off Master This PR
Gemma 4, stops ., \n\n, the, . + \n\n: empty answers 48 of 48 0 of 48
Nemotron 3.5 Lightning: same 48 of 48 0 of 48
Qwen3.5-9B: same 48 of 48 4 of 48, all on one prompt that reasoned to the 2,400-token limit with no answer, also without a stop
No stop strings, Gemma and GPT-OSS: outputs and logprobs equal to master 78 of 78, 15,790 logprob entries
GPT-OSS's Harmony scope, with and without stops: equal to master 114 of 114

What this costs, on purpose: a request now runs until its answer stops. Median completion tokens over those 48 requests: Gemma 13 → 502, Qwen 5 → 917, Nemotron 7 → 528. A token limit reached inside reasoning now finishes length where it used to finish stop.

Findings, ranked, none a gate failure:

  1. Regression, live: with no tools declared, a literal <tool_call> or <|tool_call> in an answer turns stops off until the closer, or to the end if there is none. Qwen3.5-9B, thinking off, stop .: master returns the first sentence (19 tokens), this PR returns three sentences (61 tokens) with the stop visible. Fixed on this branch at 76bb741e6, re-check REPRODUCED; see the next update.
  2. Still empty: on Qwen 3.8 Flash-Next and Bonsai, scripted, nested <think> closes the scope early. A related live case: a Qwen3.5-9B prompt about those tags, thinking on, returns an empty answer on both arms, 6 tokens on master and 337 here; its reasoning ends at a quoted tag. I did not trace the cause of that one.
  3. Live on Qwen3.5-9B: a tool argument that quotes </tool_call>, with stop ., returns raw XML or finish error and no call. With thinking on, master gave a clean empty answer instead.
  4. Scripted: a bare <function=…> frame on Nemotron loses the call and puts partial XML in content. Not seen live.
  5. Live, same on both arms: reasoning_parser: "none" on Nemotron still splits channels but matches the whole output, so stop . leaves an empty answer.
  6. Not in the changelog on this branch: a stop that names a marker no longer fires, such as </think>, <channel|>, or <tool_call> with tools declared. Master returned reasoning only or stopped before the call. This PR returns the full answer or the call.
  7. From reading the code, not run: diffusion Gemma, Nemotron Super and the two-Mac pair's media paths still match the whole output.
  8. Test gap: no test added here notices if the text path stops passing the scope, and no unit test covers the vision or native media wiring. Live vision on Gemma and Qwen3.5 does show that path working.
  9. The whitespace rule also resets after every span and applies with thinking off. On real outputs it lost nothing, and it fixed Nemotron's \n<tool_call> with stop \n.

Not run: the coordinator's sealed path, Qwen 3.8 on this head, Bonsai, GLM, MiMo, the two-Mac pair and any request with MTP on. The sweep's no-regression timing set ran under its load rule (kept 2026-11-02 20:06 UTC): total +0.06%, follow-up TTFT +0.04%, decode −0.56%, outputs and cached tokens equal on 110/110. One pair of ten was beyond its threshold on non-donor waits (+13.15% against 11.90%, about 15 ms); the rule reports such a pair rather than failing on it. That set's baseline was the pre-v0.10.6 master 6ffeaf06c2, while the measured binary carries v0.10.6, so a same-base set against v0.10.6 followed (kept 2026-11-02 20:36 UTC): total +0.17%, follow-up TTFT −0.47%, decode −0.50%, no pair beyond its threshold, outputs and cached tokens equal on 110/110. Its thresholds were wide (9.82% on total) because one of its five A/A pairs differed by 3.27%; every A/B pair's total stayed within −0.93% to +1.74%.

Update 2026-11-02, later: finding 1 is fixed on this branch, and a fresh re-check reproduces the fix. Head 76bb741e6 is a signed merge, not forced, of the previous head f8df74879 with b4f0800d2 (the fix), 7d085fe0e (comments and docs) and 9804143f4 (changelog). Tool-call spans are now excluded from stop matching only when the request has a tool stream handler. Without one, for example with no tools declared, a literal tool tag in an answer is text the client receives, and stops apply to it again. The SDK half, Layr-Labs/mlx-swift-lm#375, is unchanged.

The independent re-check of b4f0800d2, run against v0.10.6 merged with this branch, gives REPRODUCED:

Gate Result
Unit: the change's tests and the verifier's own 325 tests in 44 suites pass. Of 255 probe lines, the 24 that moved from 2660933fb are exactly the no-tools tool-frame cases, and each now equals master. No line with tools declared moved
Mutations 3 of 4 caught. The fourth, the native media call site always passing true, cannot change any output: that path serves only MiMo, which always has a tool handler
No tools, live: equal to master Thinking off: Qwen3.5-9B 40 of 40, Gemma 40 of 40, for example the first sentence (19 tokens) for stop .. Thinking on: 32 of 32 per model equal the model's own full answer cut at its first stop, where master still returns the empty answer
Gemma stops, thinking on 32 of 32 non-empty, each equal to the full answer cut at its first stop
Tools declared, live: tool frames equal to the previous head Gemma 38 of 38, Qwen 38 of 38, Nemotron 30 of 30, including forced tool choice, stops that name the tags and image requests with tools

What this commit leaves, now stated in the changelog:

  • With tools declared, a tool argument that quotes its own closing tag (finding 3) and a bare <function=…> frame (finding 4) are still cut by a stop.
  • On families without native media tools, a media request has no tool handler, so stops now apply to tool-frame text there. This matches what the client receives. It was not seen live: the models wrote no frames on those requests.
  • Test gap: the change's tests cover ReasoningStopScope.scope only. Nothing in this PR notices if the text or vision call site stops passing whether the request has a tool handler; the verifier's end-to-end tests caught both, but they need a private harness and are not part of this PR.

The sweep's timing set runs on a binary built from v0.10.6 merged with b4f0800d2, whose provider source differs from this head by one comment. The provider suite and the other 0.10.7 PRs, combined with this branch, pass locally (0 failures); outputs on Gemma, gpt-oss and Lightning without stops equal v0.10.6's.

Linked issue

OpenRouter report, 2026-10-27 (reasoning-only empty answers). #1645 fixed GPT-OSS; this PR fixes the same defect on Gemma 4 (gemma-4-26b-qat-4bit, 498 routable providers today) and on the <think> families.

Before And After

flowchart LR
  A["client stop: '.' or '\n\n'<br/>reasoning on"] --> B["StopHoldback scans ALL text"]
  B --> C["thought: '…It is Canberra' + '.'"]
  C --> D["match in reasoning → finish 'stop'"]
  D --> E["content: '' (reasoning only)"]
  classDef bad fill:#fde7e9,stroke:#d93025,color:#5c0a0a
  classDef same fill:#f1f3f4,stroke:#5f6368,color:#202124
  class A,B same
  class C,D,E bad
Loading
flowchart LR
  A["client stop: '.' or '\n\n'"] --> B["ReasoningStopScope.scope(parser, prompt probe)<br/>gemma4: exclude &lt;|channel&gt;…&lt;channel|&gt;, &lt;|tool_call&gt;…&lt;tool_call|&gt;<br/>qwen3/deepseek_r1: exclude &lt;think&gt;…&lt;/think&gt;, &lt;tool_call&gt;…&lt;/tool_call&gt;<br/>(starts inside when the prompt opened &lt;think&gt;)"]
  B --> C["reasoning and tool frames pass through unmatched"]
  C --> D["answer: 'The capital of Australia is Canberra' + '.'"]
  D --> E["match in answer → finish 'stop'<br/>content: 'The capital of Australia is Canberra'"]
  classDef good fill:#e6f4ea,stroke:#188038,color:#0b3d1a
  classDef gate fill:#fef7e0,stroke:#e37400,color:#3d2c00
  classDef same fill:#f1f3f4,stroke:#5f6368,color:#202124
  class A same
  class B gate
  class C,D,E good
Loading

Code flow: MultiModelBatchSchedulerEngine (text, media and MiMo-media paths) → ReasoningStopScope.scope(reasoningParser:reasoningPrefix:) → EngineV2Bridge.submitTokenized(stopStringScope:) (overrides the bridge's model scope; nil keeps it, so GPT-OSS keeps its Harmony final scope) → CBv2Request.stopStringScope → SDK StopHoldback. The pump replays the request's scope in matchedStopSequence, which names the first candidate that alone stops at the same place, so the reported stop_sequence is never a candidate seen only in reasoning. The native block engine (diffusion Gemma) builds its matcher without a scope, so the bridge sends its requests none and matching and reporting stay consistent there.

The scope mirrors what the request's reasoning parser returns as content:

  • the parser is the request's resolved reasoningParser (ProviderLoop / local HTTP set it from model_type when the client does not);
  • "starts inside" comes from the same prompt-tail probe that seeds the think parser (ReasoningPromptProbe): an open <think> (Qwen's thinking prefill) starts inside, a pre-closed block or plain tail starts outside;
  • whitespace before the answer's first character cannot complete a stop on its own. Qwen writes </think>\n\n before the answer; without this rule stop: ["\n\n"] would still empty every Qwen thinking answer. Collected answers are whitespace-trimmed anyway.

Test plan

Production artifacts, file-by-file SHA-256 verified against their manifests (aggregates equal the live catalog): gemma-4-26b-qat-4bit 10/10 (2468a0cb…) with the production MTP drafter; EigenLabs/Qwen3.8-27B-4bit-mtp 14/14 (bbd0e0ad…). Paged KV and a ready prefix cache were confirmed by metrics at every server start. Before = 0.10.4 (8effff7f7, binary 1de54ae6…). After = ac39dada1 + SDK 95e1d2b9 (binary 89dbd609…) and the final head 5e56f0515 + SDK b5d4c754 (binary d11cc9ef…), both built with --build-system native like release, metallib 6ccc6296…; a rebuild of each committed tree reproduces its binary byte for byte. The review follow-up changes no matching behavior (300,000-case differential), so runs on 89dbd609… hold for the head; the warmed Gemma run below is on the head binary.

  • Gemma 4, controlled (enable_thinking: true, 36 prompts = 18 general/coding/math × with/without system prompt, temperature 0, one request at a time, max_tokens 4096):

    client stop reasoning-only before proven cut inside the thought reasoning-only after answer holds a stop (after)
    none 0/36 — 0/36 —
    "\n\n" 36/36 36/36 0/36 0
    "\nUser:", "\nHuman:" 0/36 — 0/36 0
    "\nObservation:" 0/36 — 0/36 0
    "." 36/36 36/36 0/36 0
    • "Proven" means the empty response's reasoning is an exact prefix of the no-stop twin's reasoning and the twin continues with the stop string (6 of the "\n\n" cuts hit Gemma's own thought\n channel header).
    • Answers are exact: for every prompt, the "." and "\n\n" answers equal the full answer cut at its first stop, with identical reasoning: 36/36 each on 89dbd609…, and 36/36 each again on the head binary d11cc9ef… (a second full run, prompts warmed first; reasoning-only 0/180, no stop leaked, 0 violations).
    • The reference full answer is a same-prompt request whose stops never matched ("\nUser:" row, which equals the "\nObservation:" row on all 36), not the no-stop request. Requests without stop strings decode with MTP speculation and requests with stops decode without it (EngineLoopV2+MTPPlanning.swift, pre-existing), so a no-stop twin can take a different greedy path before any stop: against it, 15/36 are exact, 21 diverged before the cut, and 0 are violations (identical text, wrong cut). compare_samepath.py and compare.py in the evidence folder do the two checks.
  • Gemma 4, realistic (same settings as GPT-OSS: match client stop sequences in the Harmony final message only (fixes reasoning-only empty answers) #1645: 18 prompts × 2 seeds, temperature 1.0, 4 concurrent, max_tokens 4096; on 89dbd609…):

    client stop reasoning-only before reasoning-only after answer holds a stop (after)
    none 0/36 0/36 —
    "\n\n" 36/36 0/36 0
    "\nUser:", "\nHuman:" 0/36 0/36 0
    "\nObservation:" 0/36 0/36 0
    "." 36/36 0/36 0

    At temperature 1.0 a fixed seed does not reproduce on Gemma with MTP (8/8 repeats of one request differed, sequential or not), so this run checks counts and leaks, not answer equality; the controlled runs above do that.

  • Qwen3.8-27B (EigenLabs/Qwen3.8-27B-4bit-mtp, qwen3_5, <think>; the template prefills <think>\n, so output starts inside reasoning): 12 general/math prompts, temperature 0, one at a time, prompts warmed first, max_tokens 2048, on 89dbd609…:

    client stop reasoning-only before where it was cut reasoning-only after answer holds a stop after vs no-stop twin: exact / sampling diverged / violation
    none 0/12 — 0/12 — —
    "\n\n" 12/12 9 proven at the </think>\n\n separator (3 diverged) 0/12 0 8 / 4 / 0
    "\nUser:", "\nHuman:" 0/12 — 0/12 0 5 / 7 / 0
    "\nObservation:" 0/12 — 0/12 0 5 / 7 / 0
    "." 12/12 11 proven inside reasoning 0/12 0 8 / 4 / 0

    On the same decode path (reference = the non-matching-stop rows, as for Gemma) the "." and "\n\n" answers are exact 12/12 each. Qwen3.8's reasoning rarely has a blank line, so on 0.10.4 "\n\n" mostly matched the separator after </think>. That is why whitespace before the answer's first character cannot complete a stop on its own. "Sampling diverged" means the outputs already differed before the cut, which this hybrid model shows even at temperature 0; "violation" (identical text, wrong cut) is 0.

  • Paths the suite does not cover (Gemma, temperature 0, stop: ["."], 0.10.4 → 89dbd609…):

    • image request (media path, which now probes the prompt before submit): content: "" → "The color of this image is red", full reasoning;
    • "What's the weather in St. Louis right now?" with a get_weather tool: no tool call at all (cut in the thought after 14 tokens) → get_weather({"city":"St. Louis"}), arguments intact despite the ".";
    • "What is the capital of Australia?": "" → "The capital of Australia is **Canberra**".
  • Performance (Gemma, alternating fix/base server blocks, 4 each, reasoning on, identical requests, max_tokens 768, one at a time; 89dbd609… vs 0.10.4):

    • paired decode-rate ratio fix/base: 1.001 without stops (IQR 0.983–1.015) and 0.989 with never-matching stops (IQR 0.976–1.020);
    • median TTFT 0.093 s vs 0.094 s without stops, 0.091 s vs 0.103 s with stops;
    • no measurable regression.
    • Unrelated, pre-existing, same on both binaries: any request with stop strings decodes ~23% slower (8.4 s vs 10.9 s for the same 768 tokens) because MTP speculation is disabled when stopStrings is non-empty (EngineLoopV2+MTPPlanning.swift). Worth its own follow-up.
  • SDK unit tests (libs/mlx-swift-lm): swift test --filter 'CBv2SamplingStopHoldbackTests|CBv2SamplingScopedStopHoldbackTests|CBv2SamplingExcludedStopHoldbackTests': 27/27 on both SDK commits, and again on the replayed 25e65afc and 5ffbb801 (all 55 CBv2Sampling tests pass on each). The 11 new tests cover Gemma and Qwen shapes, start-inside, chunking invariance (whole, per character, 2/3/7; plus 4,000 seeded random outputs with markers split anywhere), tool-call frames, the whitespace rule, unclosed reasoning, marker text, and equality with unscoped matching when no markers appear (4,000 seeded cases). The 16 existing holdback tests are unchanged and pass. A 200,000-case differential against the previous StopHoldback showed identical output for unscoped and Harmony-scoped matching.

  • Provider unit tests. swift build --build-tests, staged test metallib, isolated state files:

    • merged with master 093aaf3d8 (93739a62a), metallib for mlx 72dffa2d, same filter as the next item: swift-testing 469 tests in 68 suites passed; XCTest 37/38, and the one failure (MiMoV26ConsumerParityTests) passes with CI's fixture (10 passed, 1 skipped by its opt-in gate);
    • merged with GPT-OSS: match client stop sequences in the Harmony final message only (fixes reasoning-only empty answers) #1645's SDK re-pin (75abd7d48), metallib for mlx 72dffa2d: the broad sweep below plus the files GPT-OSS: match client stop sequences in the Harmony final message only (fixes reasoning-only empty answers) #1645 adapted (EngineV2ProductionWiring|GemmaToolCallLive|Qwen36ProductionCanary|FlintAnswerStop|FlintResponseFormat|QwenJSONAnswerServing|NemotronSuperLocalOutput|GLM5NextResponseFormat|JSONAnswerFormat|InferenceErrorClassifier): swift-testing 469 tests in 68 suites passed; XCTest 37/38, and the one failure (MiMoV26ConsumerParityTests, needs MIMO_PROMPT_ARTIFACT_DIRECTORY) passes with CI's prepare-mimo-prompt-fixtures.py fixture (10 passed, 1 skipped by its opt-in gate);
    • final head: …MultiModelBatchSchedulerEngine|EngineV2Bridge|NativeBlockRetirementBridgeTests|NativeToolStreamRouter|VisionPrefill|MediaIngest|Harmony|StopSequence|ReasoningStopScopeTests|…: 258 tests in 25 suites passed;
    • first commit, focused: EngineV2MatchedStopSequenceTests|EngineV2TranslationTests|ReasoningStopScopeTests|ReasoningPromptProbeTests|EngineV2EventFramingTests|ThinkStreamingLatencyTests|StreamedToolCallTests|…: 79 tests in 10 suites passed;
    • broad sweep MultiModelBatchSchedulerEngine|EngineV2Bridge|EngineV2Translation|Reasoning|Think|NativeToolStreamRouter|StreamedToolCall|VisionPrefill|MediaIngest|Harmony|StopSequence: 348 swift-testing tests in 55 suites passed; XCTest 17/18, the one failure being MiMoV26ConsumerParityTests, which needs the local MIMO_PROMPT_ARTIFACT_DIRECTORY artifact (XCTUnwrap of the env var);
    • new: scope mapping per parser and prompt state, Qwen and Gemma outputs through the real scope, a request scope reaching the engine and the reported stop_sequence, request scope overriding the model scope, the reported candidate under the whitespace rule and span boundaries, and a real CBv2NativeBlockEngine reporting the stop it matched (fails without the fix).
  • python3 scripts/changelog.py check passes.

  • Full provider suite: CI.

Components touched

  • provider-swift (Swift CLI)
  • native runtime / MLX (libs/mlx-swift-lm pin)
  • docs

Protocol / interface changes

  • No protocol/interface changes. Wire stop semantics for Gemma 4 and <think> models now match OpenAI-compatible behavior (stops apply to returned text). The reported stop_sequence follows the same scope.

Documentation impact

  • Canonical documentation updated: docs/architecture/inference.md (stop row); changelog.d/reasoning-stop-outside-reasoning.md.

Changelog

  • Added changelog.d/reasoning-stop-outside-reasoning.md and ran python3 scripts/changelog.py check.

Notes for reviewers

  • Scope follows the parser, not the model id. A client that sets reasoning_parser: none gets raw output as content and keeps whole-output matching.
  • Limits, documented in the SDK type: markers must arrive whole (they are single tokens for Gemma 4 and Qwen 3.x); stops never match across a span, so "a<think>…</think>b" cannot match "ab"; a model that nests <think> examples inside its reasoning (Bonsai/Qwen4 preserveInnerReasoningSpans) has the scope close at the first </think>; a close-only reasoner whose prompt leaves the parser undecided starts outside, as before this change.
  • The excluding scope follows the parser, so non-reasoning models that fall back to the qwen3 parser also get the whitespace rule: output that starts with whitespace and a whitespace-only stop is no longer emptied.
  • Tool formats other than <tool_call>/<|tool_call> (DeepSeek's) are not excluded.
  • Not covered: Nemotron Super's owner path (superOwner, no reasoningParser) and Flint (its own answer-channel stops) are unchanged.
  • The media path now probes the rendered prompt before submit instead of after; the probe is a pure decode of the last 8 prompt tokens.

Refactor Pass

Independent review subagent (read-only, ran its own harnesses):

  • StopHoldback: nothing found. 400,000 random cases (single stop, whole and chunked, markers split anywhere or token-aligned, stops containing marker characters) matched a separate reference implementation. A 200,000-case differential found unscoped and Harmony matching unchanged.
  • Fixed (5e56f0515): the native block engine (diffusion Gemma) matches unscoped, so a scoped replay lost its stop_sequence. Its requests now carry no scope. The new test fails without the change.
  • Fixed (5e56f0515): a scoped report could name a candidate that only starts where the matching one does. Two new cases are covered.
  • Changed (b5d4c754): a simpler excluded-span release (300,000-case differential: identical). The randomized chunking test now draws one stop per trial: with several overlapping stops, chunking can change which one wins, as in unscoped matching.
  • Documented, not changed (see Notes): nested <think> in Bonsai/Qwen4 reasoning; close-only reasoners; tool formats other than <tool_call>/<|tool_call>; the whitespace rule also applies to non-reasoning models that fall back to the qwen3 parser (output that starts with whitespace and a whitespace-only stop is no longer emptied).

Merge order

  1. CBv2: optional stop-string scope so reasoning text cannot end a request mlx-swift-lm#369 and GPT-OSS: match client stop sequences in the Harmony final message only (fixes reasoning-only empty answers) #1645 are merged. Merge the SDK half, CBv2: stop-string scope that excludes reasoning and tool-call spans mlx-swift-lm#375 (fix/reasoning-stop-scope-exclude-on-2beb401f).
  2. Re-pin libs/mlx-swift-lm here to the SDK merge commit.
  3. Merge, then release. No weights, registration or routing change.

🤖 Generated with Claude Code

jonathan308 and others added 2 commits October 27, 2026 23:24
The engine matched `stop` against every generated character, including the
private Harmony analysis. A sequence that appeared while gpt-oss reasoned
ended the request before any answer: finish_reason "stop", reasoning only,
empty content. On provider 0.10.4 with production gpt-oss-20b weights,
stop ["."] did this to 36/36 requests and ["\n\n"] to 14/36 (0/36 without a
stop); each cut reasoning is an exact prefix of its same-seed no-stop twin,
which went on to answer.

ModelEOSPolicy.stopStringScope gives GPT-OSS the Harmony final-channel scope
(<|channel|>final ... <|message|> up to <|end|>/<|return|>/<|call|>/<|start|>).
It travels with the EOS policy: EngineV2SlotFactory -> makeBridge ->
EngineV2Bridge -> CBv2Request.stopStringScope, and the matched-sequence
replay uses the same scope. Other models keep whole-output matching.

Bumps libs/mlx-swift-lm to 38b90ed1 (fix/harmony-final-stop-scope), which
adds the scope to StopHoldback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tool calls

With reasoning on, a client stop string matched the model's private
reasoning too, so one that appeared while the model reasoned (for example
"." or "\n\n") ended the request before any answer: finish_reason "stop",
reasoning only, empty content. GPT-OSS got an answer-channel scope in the
previous commit; Gemma 4 and <think> parsers need the opposite shape.

ReasoningStopScope picks the scope per request from its reasoning parser:
- gemma4: exclude <|channel>...<channel|> and <|tool_call>...<tool_call|>;
- qwen3/deepseek_r1: exclude <think>...</think> and <tool_call>...
  </tool_call>, starting inside when the prompt probe left a think block
  open (Qwen's "<think>\n" prefill);
- Harmony and no parser keep the model's scope.
submitTokenized(stopStringScope:) overrides the bridge's model scope, the
text, media and MiMo-media paths pass it (media now probes its prompt
before submit), and the reported stop_sequence replays the request's
scope. Pins mlx-swift-lm fix/reasoning-stop-scope-exclude (95e1d2b9).

Recorded on provider 0.10.4 with gemma-4-26b-qat-4bit, reasoning on, 36
prompts at temperature 0: stop ["."] and ["\n\n"] each gave 36/36 empty
answers, all proven cut inside the thought. With this change: 0/36 for
every stop set, no answer holds a stop, and each "."/"\n\n" answer equals
the full answer cut at its first stop with identical reasoning (36/36 each).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
d-inference Error Error Nov 3, 2026 11:45am UTC
d-inference-console-ui-dev Error Error Nov 3, 2026 11:45am UTC
d-inference-landing Ready Ready Preview Nov 3, 2026 11:45am UTC
darkbloom-status Ready Ready Preview Nov 3, 2026 11:45am UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 3, 2026 11:45am UTC

Request Review

…matched

From the review pass:
- The native block engine (diffusion Gemma) builds its stop matcher
  without a scope, so it still matches the whole output. Its requests now
  carry no scope either, so the reported stop_sequence is the one that
  matched instead of nil.
- A scoped report could name a candidate that only starts where the
  matching one does: "\n" for "\nUser:" right after </think>, or a stop
  reaching into a span. It now names the first candidate that alone stops
  at the same place.
- Pins mlx-swift-lm b5d4c754 (simpler excluded-span release, identical
  behavior).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 and others added 4 commits October 28, 2026 12:04
libs/mlx-swift-lm moves to main 25bcd63f, the squash merge of
Layr-Labs/mlx-swift-lm#369 (the Harmony final-channel stop scope this PR
depends on). SDK main calls mlx-swift APIs newer than the pinned M5 hotfix
(MLXFast fencedInputs), so the stack moves with it to the revision SDK main
declares, as #1596 did: libs/mlx-swift c633d221 (nested mlx 72dffa2d,
mlx-c 2ac897e3) and libs/mlx 72dffa2d. All three are on their repos' main.
72dffa2d carries the NAX head-dim split attention JIT fix (mlx main
6bc9de5b), the same get_steel_attention_nax_kernel change as the 0.10.3
hotfix 31f550af.

Provider adaptations for the new SDK enum cases, behavior-preserving:
- MLXServerGenerationEvent.logprobs is token metadata, handled like .info by
  the GLM and JSON answer-format observers (the provider streams logprobs
  through its own channel and emits no such events today).
- MLXOpenAIServiceError.responseFormatCutOffByMaxTokens is the case the SDK
  split out of invalidResponseFormatOutput for a structured answer cut off
  by max_tokens; it keeps that case's 422 and retryable classification.

Verified on M5 Max: Gemma 4 26B QAT serves an 8,204-token prompt (the
0.10.2 crash path) with an 8,192-token prefix hit on repeat; gpt-oss-20b
stop ["."] still returns "The capital of Australia is Canberra".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The re-pinned mlx-swift-lm adds MLXServerGenerationEvent.logprobs. Seven
test helpers switch exhaustively over events; each treats it like its
existing non-content cases (.info / skipped). No assertion changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… into fix/gptoss-stop-in-reasoning

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Attempt 2 of run 40756992782 failed test_cli_result_write_failure_preserves_original_error_and_findings:
the test inherits the runner's GITHUB_RUN_ATTEMPT=2, so the budget runner reports
MANUAL_SCAN_RERUN_DISABLED. Attempt 1 on the same tree passed. No code change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1645 now pins mlx-swift-lm 25bcd63f (#369 merged on SDK main), mlx-swift
c633d221 and mlx 72dffa2d. The only conflict was the mlx-swift-lm pin.

The two engine commits of this PR (95e1d2b9, b5d4c754 on branch
fix/reasoning-stop-scope-exclude) are replayed onto 25bcd63f as 50ee329a and
25e65afc (branch fix/reasoning-stop-scope-exclude-on-25bcd63f), with an
identical diff, and the pin moves there.

Verified on the merged tree: SDK CBv2Sampling 55/55 (stop holdback 27/27);
provider swift-testing 469 tests in 68 suites, XCTest 37/38 with the one
failure only needing MIMO_PROMPT_ARTIFACT_DIRECTORY, which passes with the CI
fixture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head 253801c32c7a against base 84ddfdba6bb7.

Review not completed for this head. Previous findings are superseded, not confirmed resolved.
First pass completed; selected deeper review is pending

Reviewers: anthropic/claude-sonnet-5.5: first pass completed; anthropic/claude-opus-5.5: selected depth completed (1 batches); openai/gpt-6.1-sol: selected depth completed (1 batches)

Scan incomplete: 1 file(s) could not be fully read as text. Binary, Git LFS and submodule changes require manual review.
Affected files: libs/mlx-swift-lm

Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging.

Human review required: CI did not complete the security review. A maintainer must review the saved findings and remaining scope. A green advisory job is not security clearance; do not manually rerun the paid scan.

Coverage: 95/95 source units; cross-file integration complete. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned.

Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 33 reused batch(es), 0 provider cache-hit tokens.

Saved findings and earlier report · Historical findings are not confirmed resolved.

Bedrock: 0 request(s), 0 uncached + 0 cache-read + 0 cache-write input / 0 output tokens; 0 request(s) with unknown usage. OpenRouter backup used 0 time(s). Dollar amounts above cover OpenRouter only; AWS billing is reconciled separately.
Workload allowance: 34 native request(s), including one shared response repair; 500 emergency ceiling. Selected depth and integration rounds are admitted as their scope becomes known.

#1645 merged as squash e7f9818, so this branch's #1645 commits no
longer match master. The result is master plus only this PR's own
changes (the same +/- lines as 2841c6f..75abd7d outside libs/).

libs/mlx-swift-lm moves to 5ffbb801, the same two SDK commits replayed
on master's pin 2beb401f (branch
fix/reasoning-stop-scope-exclude-on-2beb401f; diff identical to
25bcd63f..25e65afc). libs/mlx-swift and libs/mlx stay at master's
c633d221 and 72dffa2d.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No file changes. In CI run 41412596359, Provider Unit Tests shards 4 and 5 hung in actions/checkout on self-hosted runners and reached the job time limit before any test ran; Docs Impact in the Contribution Policy run hung the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No file changes. CI run 41428558024 on the identical tree had Provider Unit Tests shard 1 hang in actions/checkout on a self-hosted runner until the job time limit; shards 2-5 passed there and shards 1-3 passed in run 41412596359.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… main 2311af6e

SDK main 2311af6e contains SDK #375 and the 0.10.7 SDK merges (#370,
#371, #377, #382, #383, #384, #375, #376). The only conflict with dev was
the submodule pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@davidtai davidtai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for the 0.10.7 release (David's order, 2026-11-03). Deferred lane, released by David 2026-11-03. Full-diff review: provider-lane-review.md, section Deferred lane. Composition check: draft #1738, CI run 41631482989 green.

@davidtai
davidtai merged commit 5ec0e74 into dev Nov 3, 2026
22 of 25 checks passed
@davidtai
davidtai deleted the fix/reasoning-stop-scope branch November 3, 2026 12:23
jonathan308 added a commit that referenced this pull request Nov 5, 2026
* fix(cluster): DevNet round 2 integration: one CLI name, one app name, this install's incidents, per-Mac login line

The integration edits after merging the six DevNet round 2 branches.

1. One CLI name: ClusterOnboardingCommand.name starts from
   BuildEnvironment.current.cliName in the package (#if SWIFT_PACKAGE; the
   checks that compile the screens alone keep "darkbloom" and set theirs
   with use), and OnboardingLive.cli reads it. The wizard's and main.swift's
   own use(...) calls set the same value again and go. Production bytes are
   unchanged.
2. One app name: ClusterService.appName (the identity's appDisplayName)
   everywhere. The screens' seam starts from it and the link follower's
   refusal reads it; Cluster.LinkFollower.localNetworkApp(cli:) goes.
   Production's hint now says "Allow Darkbloom under ..." (decided), as the
   ✗ does. The DevNet exit test that pinned "darkbloom" through the helper
   now checks the follower's real output.
3. The follower writes the words the service reads from ClusterService's
   constants (followerLinePrefix, followerConnected, followerSessionOpened,
   followerLinkRefused); followerLinkOpenedLines and followerLinkRefusedLine
   are built from them. Bytes unchanged.
4. A-4 reads this install's incidents: OnboardingLive.ownWorker passes
   ClusterIncidentLog.forThisInstall() (its file and install filter)
   instead of production's defaultFile; the static reader takes the log, and
   F1's real-records test passes it, its records and expectations unchanged.
5. P2-11, the ✓ card's login line (loginLine): "on both Macs" only when this
   Mac's service outlives its window and the other Mac's status says
   startsAtLogin; otherwise it names the Mac that doesn't, or says the other
   Mac doesn't say. The new operation otherMacStartsAtLogin reads the other
   Mac's status over the cable (default true). The guide's card line holds
   (an example; verify checks each Mac).
6. P2-2 in onboarding: the member's Local Network hint names the app; its
   command and the stop line already named OnboardingLive.cli, which now
   follows the identity in exit tests too.

7. Found in validation: placement flow-run and setup didn't compile on
   the CLI branch's changes (its validation didn't run them). run-flow.sh
   now compiles ClusterIncidentLog+Install.swift and BuildEnvironment, as
   the CLI branch did for the diagnostics runner; the setup runner gets
   OnboardingCommandStandIn.swift (production's name), in its stand-in
   pattern.

The development-build check (developmentBuildKeepsTheWindowsOpen) now says
the other Mac's service doesn't start at login either, as in a real
development pair; the card then says to keep both windows open, as before.
The changelog's A-4 sentence says the ✗ names this Mac's worker too, so it
doesn't read as contradicting the earlier "names the other Mac's side".

Red first:
- theLoginLineNamesTheMacThatDoesNot against the merged screens with only
  the knob added: 6 failures; green with the change.
- onboardingTextsNameTheIdentity (DevNet identity): 3 issues;
  followerWritesTheWordsTheServiceReads: 1 issue ("Allow darkbloom under").
Guards: onlyThisInstallsRecordsNameThisMac, theNamesAreThisBuildsWithoutBeingSet.
Docs: two-mac-cluster.md (the login line), architecture/inference.md (one
CLI name, one app name, the follower's phrases); changelog: a bullet in
cluster-candidate-findings.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(cluster): the configuration check compiles again with the command's stand-in

ClusterConfigurationChecks compiles ClusterConfiguration.swift without the
onboarding screens. Since the CLI branch, its tensorAssistantServesLocally
names the command with ClusterOnboardingCommand.named, so the check stopped
compiling ("cannot find 'ClusterOnboardingCommand' in scope"), as the
placement setup check had; neither runs in CI.

It now compiles the setup check's OnboardingCommandStandIn.swift
(production's name), as it already compiles the installed session's
AttestationSignerStandIn.swift.

Red: on the integrated head 5732dda926 the check fails to compile. On dev
6497e8e7a8 it passes (9 file groups, the provider config file, 14
configuration groups). Green with this change: the same three pass, and
placement setup still passes 264.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(changelog): a start's card says whether it starts at login on each Mac

Read as a user, the 0.10.8 section contradicted itself: the console's
bullet said every start ends with "Starts by itself at login on both
Macs.", and P2-11's bullet says the card says so only when the cluster
service on both Macs does, and otherwise names the Mac where it doesn't.

The console's bullet now names the line by what it tells (whether it
starts by itself at login on each Mac), as the guide does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cluster): plain words in the ✗ line for this Mac's own worker

The ✗ line for a worker that ended on this Mac named the incident code ("worker_crashed in its incident log"). It now says "its worker ended unexpectedly"; the incident list in `cluster status` keeps the code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(cluster): keep non-production identity values out of source comments

Release Integrity's test-provider-identity.py allows the DevNet and staging names only in the generated identity. Three doc comments added in this round quoted them; they now say the value comes from the build identity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(provider): uninstall beside the other install removes its own incident log

Pair-2 re-test (R-6): `darkbloom-dev uninstall --keep-models` keeps the
shared ~/.darkbloom/cluster* for the production app, and so left the
DevNet-only incident log (its log and lock, and a corrupt copy if any)
behind. As a test, both directions, with the files named by the log's own
`ClusterIncidentLog.defaultFile(homeDirectory:install:)`:

- uninstalling the non-production install removes its own incident files
  and names them in the summary; the other install's files and every
  shared cluster file stay;
- uninstalling production beside it keeps production's log: it is the
  shared folder's `incidents.json`, which an older build of the other
  install still writes.

Red at 6940be379c: the non-production install's three incident files stay
and no summary line names them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(provider): status says a Local Network refusal, and a stopped pair reads stopped (red)

From the pair-2 re-test of dev @ 6940be379c:
- R-1: with the member's link follower refused by macOS, both Macs'
  `status` and `cluster status` read `loading` with no reason. They must
  read not_serving with the setup screens' words: on the refused Mac its
  own service's state, on the leading Mac the other Mac's refusal under
  the ✗'s 20 s rule.
- R-5: a stopped pair whose other Mac is gone read other_mac_away; it
  must read stopped, with a line that the other Mac isn't answering.
Adds, at today's behavior, ClusterLocalNetworkAccess.Refused,
otherMacRefused, refusalCanBeCurrent, otherMacStatus and statusWords, and
ClusterPairSummary.read(localNetworkRefused:).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(cluster): the pairing screens name the app; the Local Network ✗ says its refusal once (red)

The pair-2 re-test of DevNet 6940be379c, R-3 and R-4:
- R-3: the 2/4 Pair hint's firewall bullet said "Darkbloom" in the DevNet
  app, whose firewall entry is its own name. pairingLinesNameTheApp (the
  onboarding checks) runs the pairing with the DevNet app's name;
  thePairingLinesNameThisBuildsApp checks this build's name (DevNet in a
  dev-identity build).
- R-4: the leader's Local Network ✗ added the follower's own instruction
  as a fourth line, cut at 300 characters inside a parenthesis.
  theLocalNetworkCrossSaysTheRefusalOnce and
  aLongLineIsCutAtAWordOutsideAnyParenthesis.

The seams the tests call are added with today's behaviour, so they fail
on what they check: ClusterConsoleText.boundedAtWord cuts as bounded
does, and errorLines' refusalSaid is ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(provider): status says a Local Network refusal, and a stopped pair reads stopped

From the pair-2 re-test of dev @ 6940be379c:
- R-1: `status` and `cluster status` read not_serving (exit 3) while
  macOS keeps a Mac's link follower off the local network, by the setup
  screens' rule and in their words: on the refused Mac its own service's
  state (ClusterLocalNetworkAccess.serviceState, as `start` reads it); on
  the leading Mac the other Mac's status, asked over the cable only while
  the pair has been starting past the ✗'s 20 s settle time. reason and
  next come from localNetworkBlockedLines and localNetworkRefusalLines,
  ending with `<cli> start` or Retry in `<cli> cluster`
  (ClusterLocalNetworkAccess.statusWords). A script start on the leading
  Mac ends its wait on it, as the ✗ does.
- R-5: a stopped pair reads stopped (exit 4) whatever the other Mac's
  presence, with "<the other Mac> isn't answering over the cable." after
  the stopped line; other_mac.answers is false.
ClusterOnboardingLive.swift is unchanged: ClusterLocalNetworkAccess calls
its internal refusal rule and words (otherMacRefused, refusalIsCurrent,
localNetworkRefusalLines, answerSeconds).
Docs: cli-reference (exit table, the refusal's words, the stopped
precedence), two-mac-cluster, architecture/inference; changelog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cluster): the pairing screens name the app; the Local Network ✗ says its refusal once

The pair-2 re-test of DevNet 6940be379c:
- R-3: the 2/4 Pair hint's firewall bullet and the line that asks to pair
  again after a reinstall name the app (ClusterOnboardingCommand.app):
  Darkbloom Dev in the DevNet app. The prose that means the service
  stays. Production's text is unchanged.
- R-4: the Local Network ✗ already says what macOS did and what to do, so
  its line for the refused Mac now says only that its part can't reach the
  local network (errorLines' refusalSaid), instead of the follower's own
  instruction; every other ✗ keeps the part's reason (A-3). Each
  lastErrors line is cut at a word, never inside a parenthesis, and ends
  with "…" (ClusterConsoleText.boundedAtWord).

Docs: two-mac-cluster.md (the leading Mac's Local Network ✗) and
architecture/inference.md (the app's name; the ✗'s lines). Changelog: one
bullet in cluster-candidate-findings.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(provider): uninstall removes this install's own incident log beside the other

R-6: with another install on this Mac, the uninstall keeps the shared
cluster folder for it, which held this install's own incident log (A-13:
each non-production install keeps its own file there).

- `ClusterIncidentLog.files` names the files a log keeps, in order: the
  log, its lock sidecar and the copy a corrupt log is moved aside to (the
  log's own rename now uses the same name).
- When the shared folder stays for the other install, the inventory lists
  this install's own incident files, from
  `ClusterIncidentLog.defaultFile(homeDirectory:install:)`, as items to
  delete before the install folder, so the summary names them ("This
  install's incident log"). Production's log is the shared
  `incidents.json`, which an older build of the other install still
  writes: it stays with the folder. When the whole cluster folder goes,
  nothing changes.
- `ProviderUninstallPaths.environment` records the install the paths are
  for.

The CLI reference, `docs/architecture/inference.md` (where the incident log is
described) and the changelog fragment say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(provider): agent setup guide matches its second literal run (G-R1 to G-R4)

An agent set up pair-2 on DevNet 0.10.6-dev.branch.77 by following the guide,
end to end. Its four differences and the status gap (R-1), fixed with the
strings of fix/cluster-status-truth (f92a578950), which ships in the same dev
round:

- G-R1: after installing the other app on a paired Mac, choose Pair again
  when the screen offers it ("This Mac's Secure Enclave key changed after it
  paired (…)", Pair again / Quit), otherwise Start over on both Macs.
- G-R2: `darkbloom status --solo` on a paired Mac with nothing beside the
  pair prints "Single-Mac serving: off (this Mac serves in its two-Mac
  cluster: `darkbloom cluster status`)": go on.
- G-R3 with R-1: during a Local Network refusal, `cluster status` says
  not_serving (exit 3) with the screens' reason; the verify table now stops
  and asks the person to turn the setting on, on the Mac `next` names,
  instead of waiting 15 minutes on loading. The troubleshooting row shows the
  status signal (the leader's once its part has run 20 s). A stopped pair
  reads stopped even when the other Mac isn't answering (R-5).
- G-R4: stop, restart and a scripted start say their waiting lines only if
  the wait lasts.

fix/cluster-ln-wording (97005b1167) changes no line the guide quotes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(provider): agent setup guide's refactor pass on its round-3 fixes

- Step 1.4: after installing another app on a paired Mac, the agent acts on
  what each Mac's `darkbloom cluster` shows (Pair again on a Mac that offers
  only Pair again and Quit, else Start over), instead of one choice "on both
  Macs": one Mac can offer only Pair again while the other offers Start over,
  as the screen itself says after Pair again.
- Step 4.3: while the pair's own part runs, `status --solo` shows `Daemon:
  running` with "This is the cluster's part on this Mac, not single-Mac
  serving (…)": go on, instead of asking to stop single-Mac serving that
  doesn't run.
- Verify, the Local Network row: ask the human (the page's word for the
  person) to turn the setting on, on the Mac `next` names; the agent then
  starts the pair, so the two don't both run `darkbloom start`.
- Verify, the `loading`/`unknown` row: after 15 minutes, STOP, and the human
  runs `darkbloom cluster` on the leader. Split from the old exit-3 row, it
  had no end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(cluster): one public entry for the leading Mac's refusal; the ✗'s step as a parameter

The refactor pass over the DevNet round 3 integration (R-1 with R-4).

- `ClusterLocalNetworkAccess.otherMacRefused()` is the leading Mac's one
  entry, beside `serviceState()`. It asks the other Mac's status
  (`otherMacStatus`) only once this Mac's part has run the ✗'s settle time,
  then applies the ✗'s rule (`otherMacRefused(member:own:now:)`). That rule
  and the status request are internal again, and `refusalCanBeCurrent` is
  gone. ProviderCore's public API grows by `Refused`, `otherMacRefused()` and
  `statusWords` only, and the CLI no longer runs the rule in three steps.
- `OnboardingLive.localNetworkRefusalLines(otherMac:app:then:)` takes the step
  after the instruction, as `localNetworkBlockedLines(app:then:)` does.
  `statusWords` passes the start command instead of replacing the screen's
  "Then choose Retry here." in the text, which a reworded ✗ would have left
  in `cluster status` without a sound.
- A test pins the ✗'s own step; the rule's test reads
  `OnboardingLive.refusalIsCurrent` directly.

Behaviour-preserving: the ✗'s lines, `cluster status`'s reason and next,
and when the other Mac is asked are as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(provider): a script start on the leading Mac ends its wait on a Local Network refusal

R-1 made a leading Mac's script `start` end its wait once `cluster status`
reads the other Mac's refusal (`ClusterPairCommands.waitUntilServing`), as the
✗ ends the screen's wait; no test covered it. The new test gives the wait a
"Starting" look, then the refusal, then a serving look: the start ends at the
refusal with its ✗ line and next step, and exits 3.

With R-1's condition in `waitUntilServing` taken out, it fails: the wait goes
on to the serving look and exits 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(changelog): the Local Network ✗'s change isn't DevNet-only

The round's bullet in `cluster-candidate-findings.md` began "In the DevNet
app, …", which also scoped the Local Network ✗'s change to the DevNet app,
although every build's ✗ changed: its last line no longer repeats the
instruction cut off mid-sentence, and a ✗ line too long for the screen is cut
at a word, marked with "…". The bullet now says that first, then the two
DevNet-only names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cluster): status keeps the Local Network refusal across the leader's restarts; JSON lines agree; DevNet's local command

Three findings from the pair-2 re-test of the DevNet build of 3ac8dd76a6:

- R-7 (`status` on the leading Mac):
  - While the other Mac is refused, the leading Mac's part ends after its 32 s wait for the link and starts again.
    `refusalIsCurrent` timed its 20 s from the current part only, so `status` and `cluster status` on the leading Mac
    said `not_serving` in only 6 of 29 samples, and `loading` with no reason the rest of the time.
  - The cluster service now publishes how long its last part ran (`ClusterServiceStatus.Child.lastRunSeconds`, a new
    optional field that older readers ignore).
  - A status read also counts the refusal when this Mac's last part ran 20 s (`acrossRestarts`), so it holds across
    the leading Mac's part restarts.
  - A start's own wait, both the wizard's and `darkbloom start`'s looks, keeps the strict rule, so a Retry just after
    the setting is turned on never ends at once on it.
  - A refusal the follower got past still never counts.
- R-9 (`cluster status --json`): during the refusal, `lines` were still "Starting …" while `state` was `not_serving`.
  They now hold the ✗ line, "Not serving: <reason>.", as the plain output does. The plain output is unchanged.
- R-8 (the DevNet command name): a stopped local-only DevNet pair said "API key: `darkbloom local`".
  - The scope's line, the API line of a pair the other Mac serves, and the missing-login remedy reach `cluster status`
    without the console's rename. They now name this build's command themselves (`ClusterOnboardingCommand.name`).
  - Production's text is byte-identical.

Red first:
- `ClusterStatusTruthTests`: 8 tests with 3 issues (R-7 1, R-9 2).
- The onboarding checks: 1211 passed, 3 failed (R-8).

Green:
- Prod: the truth suite 9, CLI pair 72, neighbours 114, look 22, ProviderCore 52, onboarding filter 80, #1774's 67.
- Onboarding 1214/0.
- Dev identity: the truth suite 9, which prints "API key: `darkbloom-dev local`".

Docs: cli-reference.md, two-mac-cluster.md, architecture/inference.md, and the changelog fragment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(provider): agent setup guide's Local Network timings (G-R5, G-R6)

The guide's third literal run on pair-2 passed; its two timing wordings follow
from R-7, fixed on fix/cluster-status-truth-2 (bfdda272d5):

- G-R6: the leader's ✗ comes within about 20 seconds of its part starting
  (refusalSettleSeconds), not at once. The same wording in step 7.3's
  Retry paragraph is corrected too.
- G-R5: `darkbloom cluster status` names the refusal on the Mac kept off at
  once, and on the leading Mac from about 20 seconds into its part, steadily
  after that while that Mac stays refused (the status read keeps it across
  the leader's part restarts).

The guide quotes neither the JSON `lines` during the refusal nor the stopped
local-only pair's "When it starts: …" line, so neither needed a change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(cluster): say what lastRunSeconds holds after a stop, and where a status read asks for it

Comment-only refactor pass on R-7 (no code or output change):

- `ClusterServiceStatus.Child.lastRunSeconds` is set only when a part ends by itself; a stop the service makes
  (`stopChild`: a planned restart, `cluster stop`, the service's own stop) leaves it as it was. The wire field's doc
  now says so, since `refusalIsCurrent(acrossRestarts:)` reads it.
- `ClusterPairSummary.live(config:bounded:)`: `bounded` (a person's `status` or `cluster status`) also selects the
  status read's rule for the other Mac's refusal; nil keeps the strict rule of a start's looks.
- `ClusterLocalNetworkAccess.otherMacRefused(member:own:now:acrossRestarts:)` names its `acrossRestarts` case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(release): a squash-promoted release's notes must list its dev pull requests

Regression test, red on purpose: a synthetic local history (dev pull
requests, a master-only pull request, a master-into-dev sync, a squash
promotion, a dev pull request merged after the promoted commit and a
Prepare pull request) publishes v1.1.0 through publish_github_release.
Today the notes file holds only the header, and the pull request list is
left to --generate-notes, which lists master's pull requests only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(provider): status names the serving mode and split for every mode (red)

From the round-3 re-test (branch.78), R3-4: serving GLM-5.3-Flash in
pipeline, `cluster status --json` gave mode and split as null and the
"Model:" line had no mode, though the ✓ line said "(pipeline)". The
deployment line is read from its first ": ", which GLM's display name
("Z.ai: GLM-5.3-Flash") already holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(cluster): the mode question's split is the one that loads; the follow reads the login state at its end (red)

The M5 Ultra pair's round-3 re-test of DevNet 3ac8dd76a6 (branch.78):
- R3-3: GLM's mode question offered "this Mac 1 layers / the other Mac
  44 layers" while Qwen served, and 26 / 19 while GLM's tensor parallel
  served; 44 / 1 loaded both times. theModeSplitIsTheOneThatLoads: each
  share is named for the Mac that runs it, in either order; one layer is
  "1 layer"; no number while a model serves.
- R3-2: the joining Mac's window ended "After a restart, this Mac serves
  again by itself" with a session service in place.
  theLoginStateIsReadWhenTheLineIsSaid.

The seams the tests call are added with today's behaviour, so the tests
fail on what they check: modeSplit words the shares as screenMode does
(ignoring serving, "1 layers"), startsAtLogin(now:setUp:) returns this
run's setup, and the phrase constant exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(provider): status names the serving mode and split for every mode

R3-4: serving GLM-5.3-Flash in pipeline, `cluster status --json` gave mode
and split as null and the "Model:" line had no mode, though the ✓ line said
"(pipeline)". ClusterPairSummary read the leader's deployment line ("Serving
<model> across both Macs: <mode>, <split>") from its first ": ", which GLM's
display name ("Z.ai: GLM-5.3-Flash") already holds. It now takes the first
": " that a mode's words follow, so every mode comes back whatever the
model's name. Without a recorded line, the mode is the ✓ line's own marker
(the saved setup's mode, as the serving line marks it), with no split.
Docs: cli-reference's mode and split rows; changelog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Release notes list every pull request a release contains, including dev's

GitHub's generated notes list only the pull requests merged into master
between two tags, so a squash promotion of dev (0.10.7's #1754) showed as
one pull request and the 45 dev pull requests it carried were missing.

scripts/provider_release_notes.py builds the GitHub release body from the
release's contents in Git: the retained header, the version's CHANGELOG.md
section at the tag (candidate heading and note left out), the pull requests
that reached master through dev and those merged directly into master, the
release pull requests named once (promotions, preparation, syncs of master
into dev), and the compare link.

- The carried dev commit is the newest dev first-parent commit that the tag
  or a promotion head contains. A promotion is found by its history: its
  head (merge commit's other parent, or the squash's refs/pull/N/head,
  fetched read-only) holds a dev first-parent commit master lacked. A
  release without a promotion carries what the release before it carried.
- dev pull requests are dev's first-parent commits between the previous
  release's carried commit and this one's, not a date window.
- Titles and authors come from one GraphQL query per 100 numbers.
- Over GitHub's 125,000-character limit the body keeps the upgrade notes and
  every pull request and links CHANGELOG.md. A generation failure logs a
  warning and still publishes the release.

publish_github_release creates the draft with that body and drops
--generate-notes. Only prod publishes a GitHub release; the dev, dev-branch
and staging lanes create none, so they need no change. The release callers'
push paths include the new module and scripts/changelog.py, which it imports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(release): how the GitHub release notes are built; changelog entry

docs/operations/provider-release.md gains "GitHub Release Notes": the four
parts of the body, how the carried dev commit, promotions, preparations and
syncs are found, the size fallback, the failure behavior and the read-only
command for checking or previewing a release's notes. docs/developer/test.md
lists and describes scripts/test-provider-release-notes.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Release notes count the release pull requests they name instead of listing

The line that names the promotions, the preparation and the syncs now says
how many there are, so a reader sees what the list leaves out and why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cluster): the mode question's split is the one that loads; the follow reads the login state at its end

- R3-3: the labels weren't swapped: each share is named for the Mac
  that runs it (its device). The split was stale: the list plans with the
  serving model's memory taken, and the adopt stops that model and plans
  again with its memory free (A-8). While a model serves, the mode
  question now says the split is decided when it loads (modeSplit). One
  layer reads "1 layer" wherever a layer count is printed: the mode
  question, the deployment line on the card and in status, and the
  setup's "cut after" lines.
- R3-2: afterRestart and serviceOutlivesWindow read this Mac's login
  state when a line says it: the running service's startsAtLogin (its
  published status), else this run's service setup. They returned the
  setup's value from the start of the run. The leader's card reads its
  own half the same way.

Docs: two-mac-cluster.md (the split while a model serves) and
architecture/inference.md. Changelog: one bullet in
cluster-candidate-findings.md. refusalIsCurrent is untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(release): a release whose preparation promoted dev must list its dev pull requests (red)

The synthetic history gains v1.4.0, whose only promotion is its Prepare pull
request cut from a dev snapshot. Its contents already hold #19 through dev,
but the body renders the dev group only when a commit is classified as a
promotion, and the preparation label wins, so #19 is silently left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(release): list the dev pull requests whenever a release carries any

render() showed the dev group only when a commit was classified as a
promotion. A Prepare pull request whose head carried dev commits is labeled
the preparation (and named once as such), so a release promoted only by it
lost every dev pull request from its body while its contents and summary
still counted them. Contents now records every commit that promoted dev,
preparations included, the dev group renders whenever there are dev pull
requests and names those commits, and a promotion with no dev pull request
left no longer prints an empty "0 pull requests" group. The labels and the
v0.10.7 output are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(release): the release notes test needs git 2.31, not 2.38, and says so

The fixture squashed with git merge-tree --write-tree (git 2.38). A squash
merge with git merge --squash writes the same commit on any git, so the
test's floor is now the notes' own: git log --diff-merges (2.31). The module
checks that floor first and stops with a message naming it and the runner's
version, instead of an unknown-option traceback, since the Release Integrity
runner's git (a Darkbloom Sandbox) is unverified. docs/developer/test.md
describes the fifth synthetic release and the floor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(release): release notes treat titles as text and say why git or GitHub failed (red)

Three checks fail on the current code:
- a pull request title or commit subject goes into the body as markdown, so
  "<!--", "[text](url)" or "<b>" in one changes the published page. v0.10.7's
  page already shows #1650 "Gemma 4 and <think> models" as "Gemma 4 and
  models". A code span (#1729's `darkbloom update --rollback`) must stay code;
- a git failure surfaces as CalledProcessError, whose message omits git's
  stderr, so the release job's warning cannot say why the notes are missing;
- a GraphQL error other than NOT_FOUND is ignored, so a pull request it hid
  would be listed as a commit without a pull request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(release): release notes treat titles as text and say why git or GitHub failed

- Titles and commit subjects are escaped outside their code spans: HTML,
  links, images, emphasis and stray backticks show as typed, and "#N" and
  "@login" stay references. On real data this changes one v0.10.7 line:
  #1650's "<think>", which the published page drops, now shows; #1729's
  code span stays code.
- Repository.git raises with git's stderr, so the release job's warning (and
  the command line) say why git failed instead of "exit status 128".
- A GraphQL error other than NOT_FOUND fails the lookup, and with it the
  notes, instead of listing the pull request it hid as a commit without one.
  The owner and name go in as GraphQL variables.
- --no-fetch says that a squash promotion is then found only through
  --pull-head. docs/operations/provider-release.md says what the four-release
  look-back does past its limit, what a missing promotion head would do, how
  a preparation that promoted dev is shown, and the escaping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(cluster): the round's layer count and mode list in one place each; one serving read per list

The refactor pass over the DevNet round 4 integration (R3-3, R3-4).

- The six-step wizard's "cut after" line calls
  `ClusterOnboardingDeployment.layers`, the one wording of a layer count,
  instead of repeating it. `ClusterPlacementSetup` keeps its own: the
  placement checks compile it without the onboarding sources.
- `ClusterOnboardingDeployment.layers` and
  `ClusterOnboardingMode.decidedWhenItLoads` are internal: only ProviderCore
  and its tests use them, as with `shownMarker` beside them.
- `OnboardingLive.localPlanModels` reads whether the pair serves once for the
  whole list instead of once per model (each read opens the setup record),
  so every model's modes in one list follow the same answer.
- `ClusterPairSummary` derives both the mode words it parses and the ✓ line's
  markers from one list of modes.

Behaviour-preserving: every string, the JSON and the list are as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(release): without GitHub's API the notes must still list every pull request (red)

The release job's token has contents: write and actions: read only, so
GitHub may refuse the GraphQL title lookup ("Resource not accessible by
integration"). Today that drops the whole changelog and pull request list.

The new publication test answers the lookup with FORBIDDEN and expects
every pull request of v1.1.0 with its title from git, escaped as on the
API path, and an author only where a GitHub noreply address names it.
Fixture titles now carry HTML, emphasis and a code span, and two commits
carry noreply authors. Two more tests pin GitHub's answer as the first
choice and titles from git on request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(release): without GitHub's API the notes take every title from git

The release job's token (contents: write, actions: read) may not read pull
requests through GraphQL. A refused lookup dropped the whole changelog and
pull request list; it now falls back to git, and no permission changes.

- GitHub's answer stays the first choice. When the lookup fails, each title
  comes from git: the first line of a merge commit's body (GitHub writes
  "Merge pull request #N from <branch>", a blank line, the title), or a
  squash's subject without " (#N)". Escaping is the same on both paths.
- The author is a login only where the pull request's oldest own commit (a
  squash: its commit) has a GitHub noreply address that names it. The
  newest commit of a branch is not used: on v0.10.7 it named David for 18
  of jonathan308's 45 dev pull requests (his merges of dev into them).
- The job's warning says the titles came from git and why GitHub did not
  answer; repeated GraphQL errors are listed once. --git-titles takes the
  titles from git on request, and the CLI prints the source.

On v0.10.7, git-only lists the same 48 pull requests: 47 titles equal
GitHub's (#1691's squash subject keeps a parenthetical its title lost),
and 34 authors, all equal to GitHub's; 14 are left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(release): titles and authors from git when GitHub's API does not answer

provider-release.md says when the notes take titles from git (the release
token may not read pull requests), how a merge commit's body and a squash's
subject give the title, that git-derived authors are commit authors shown
only where a noreply address names the login, what the warning says, and
the v0.10.7 measurement. test.md describes the refused-lookup test. The
changelog entry says authors are shown where known.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(changelog): the split while a model serves may not be the one that loads

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(release): name the title source once, as "GitHub" or "git (why)"

The warning reads "pull request titles from git (GitHub did not answer:
…)" and the command prints "pull request titles from GitHub", instead of
repeating "titles". Two lines are wrapped to the module's width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: remove provider tests that dependencies already run, and low-value tests

Class A (exact duplicates; the dependency's own Fork Tests run them on the
pinned commits): the GPTOSSOptimizationTests target, whose twelve files were
symlinks into libs/mlx-swift and libs/mlx-swift-lm; the provider copies of the
SDK's GLM5NextAlignedPayloadReaderTests, GLM5NextArtifactCachePolicyTests and
GLM5NextArtifactLoaderTests and their namespace file; SequenceStateMachineTests
(the SDK suite covers every case); EvalProbeTests (mlx-swift EvalProbeTests).

Class D (little value, David's ruling on the defaults): tests that assert only
a constant or a default, a sleep-bound test that could not detect what it
names, a reconnect test whose sibling runs the same steps and more, a
supervisor restart test that a faster test covers, a no-assertion diagnostic
that no lane runs, and redundant parameter cases (SSDBlockIndex counts
4097/20000, three --help cases of the upgrade notice test).

The shard weights drop the deleted suites' entries; docs/developer/test.md
no longer describes the removed SDK copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: drop the reload seam and section header the removed tests left behind

FlashNextReclaimDiagnostics was the only caller that passed a beforeReload
closure to runReloadLifecycle, so the parameter and its call are removed.
The coordinator reconnect section header had no test left under it. The
GLM5Next test-guide paragraph is rewrapped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: split CI into ci-dev.yml and ci-master.yml over one reusable test workflow

The test jobs (component classifier, route, provider shards and summary, SDK
lane, cluster jobs, Provider Tests gate) move unchanged into
.github/workflows/provider-tests.yml (workflow_call). CI (dev) runs it for
pull requests into and pushes to dev, and nothing else. CI (master) runs it
for master, plus Release Integrity and Docs Lint as top-level jobs, so the
check that master's ruleset requires keeps the name Release Integrity.

Release Integrity and Docs Lint keep their former fallback label: the plane
routes a run attempt once, and the test workflow's route job holds that
request. docs-impact.yml (Contribution Policy) runs only for pull requests
into master. ci.yml is removed; the scripts, tests and docs that read it name
the new files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: fewer, fuller macOS jobs; loose build-cache tier; macOS lane cap

- Provider Unit Tests: 2 shards instead of 3. Each shard builds once and
  runs PROVIDER_TEST_PROCESSES=3 selections of the 6-selection plan at the
  same time, each serial in its own process with its own TMPDIR and
  provider state files (scripts/run-provider-tests.sh). The isolated
  processes and native gates still run after them, alone; Prompt Parity
  moves to shard 1, the shard of selection PARITY_SHARD. Without
  PROVIDER_TEST_PROCESSES (release qualification) nothing changes.
- Cluster Runtime Tests: 2 shards instead of 3. Shard 1 runs `base` alone;
  shard 2 runs two ordered groups at once (batch-session + GLM/TF32/Gemma;
  the Qwen GPU chain), then the share probe alone, after
  qwen-tp-batch-gpu (scripts/cluster-test-plan.py `group`).
- Cluster GPU Tests (report only) run on pushes only.
- CI (dev): pushes share one concurrency group (one running, newest
  waiting).
- Route: DARKBLOOM_MACOS_LANES caps the macOS jobs one run asks for, in
  the caller's lane order; provider-tests.yml lists the critical path first.
- Swift build cache: a loose restore tier without the CI recipe, one cold
  rebuild after a failed loose restore (scripts/provider-ci-cold-retry.sh),
  and one saved build per lane and UTC day on Darkbloom hosts.
- MiMo metadata downloads are cached by their pinned SHA-256.

No test, selector, KEPT_APART pair, order constraint, audit or gate
condition is removed. The shard weights file is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: refactor-pass fixes for the sandbox lanes

- run-provider-tests.sh: read K and N before the process-count match
  replaces BASH_REMATCH (every sharded run failed with an unbound
  BASH_REMATCH[1] under set -u).
- cluster-test-plan.py: grouped selections pass --ignore-lock, so the
  groups of shard 2 run at the same time instead of taking turns on
  SwiftPM's .build lock.
- ci-component-paths.py: pushes to dev run every component, as pushes to
  master do; CI (dev) cancels waiting push runs, so a dev push run stands
  in for them.
- provider-test-shards.py: PROVIDER_TEST_PROCESSES makes the plan
  job-aware: Prompt Parity's and the isolated processes' seconds load
  every selection of the job that runs them after its processes. Reports
  record the process count and the audit plans with it. One process per
  job (release qualification) plans as before.
- The diagnostics artifact keeps each process's whole output.
- verified_download_cache.py: the MiMo fixture scripts share one
  content-addressed cache; the image script's cache has a test.
- A test counts the new metadata cache restore; Docs Lint's cited path
  names ci-master.yml; the GLM group wording is exact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: remove the Provider SDK Tests lane (David, 2026-11-04)

226 of its 236 test seconds repeated the SDK's own Fork Tests
(Layr-Labs/mlx-swift-lm), and it never gated. Removed with it: its route
lane, the `sdk` component of the classifier and component-changes.yml,
the `sdk` build lane of provider-ci-build and provider-ci-cache.py, and
the libs/mlx-swift-lm/.build cache path.

Its one step that Fork Tests skips, MiMoV26NativeMediaDeadlineTests, is an
SDK-only test (no provider import), so no provider shard can run it; it is
left for the SDK's Fork Tests to un-skip. Release qualification still
builds and tests the provider, with the SDK compiled in, under SDK 27.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(provider): a pair's stalled reservation must not hold back cancels, capacity reads or challenges (red)

A two-Mac pair's reservation waits on the engine queue until both ranks
answer at their next step boundary, up to 30 s. On dev a capacity read and
a cancel wait for it, a submission whose caller already left still asks the
ranks, and a cancel waiting on the engine stops the provider's coordinator
work FIFO, so an attestation challenge and the next request wait behind it.

- DistributedCBv2StalledReservationTests: an owner whose reservation is
  held; a capacity read, a cancel and the cancel of the reserving request
  must return at once and land once it returns; a lost peer reads as no
  capacity at once; a submission cancelled while it waits for the queue
  must never reserve. All five fail on dev.
- ServeLoopCancelBesideFIFOTests: with the engine held under a cancel, a
  challenge must be answered and the next request accepted, and the cancel
  must still land with one terminal. Fails on dev.
- ServeLoopColdLoadTests: a cancel for a request queued behind another
  admission runs only after its own admission (a guard; passes on dev).
- PrefillScriptEngine: an optional capacity hold, and cancel finishes the
  cancelled request's own stream.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cluster): switching a pair to Darkbloom plans it for Darkbloom, and nothing says it serves there unless offered

The DevNet traffic run on pair-2 (an M3 Ultra leads, an M5 Max follows; dev 79051ff73a, branch.79): "Switch to
serving through Darkbloom" on a pair serving Qwen 3.8 27B locally only kept the local plan's unequal tensor-parallel
shares [2, 3]. The coordinator can't register such a setup (ClusterApprovalAttachment refuses it), the switch never
asked it anyway (finishStart(registers: false); the cluster service asks only at the first check of its run), and
still the screen said ✓ "Serving … through Darkbloom on both Macs" while status and cluster status said serving,
exit 0, "earning through Darkbloom".

- changeScope: a serving pair switched to Darkbloom goes through chooseAndServe for its model with the public scope.
  It is planned for Darkbloom (equal shares, no speculative assistant under mtp_mode auto), adopted before anything
  stops, the scope saved after the adopt, then started, tested and registered as a start is. ✓ only once the
  coordinator has the pair (awaitPairServing).
- A start set to serve through Darkbloom whose pair isn't offered ends with the leading Mac's status (a new
  operation, notOfferedStatus): ✗ "Not serving: not offered to Darkbloom (<why>)." and where it answers meanwhile.
  Retry asks the coordinator again.
- OnboardingLive.localStatus: a pair on the leading Mac's API with the public scope says "<model> is not serving yet:
  not offered to Darkbloom (<why>)." instead of "Serving … (earning through Darkbloom).". servesWords never says
  earning: a pair on that API is never offered. The adopt clears the replaced setup's approval note.
- The joined Mac's follow ends with that ✗ at once; it said "Offered to Darkbloom…" and waited for the pair.
- Choosing the serving model again while the status says it isn't offered asks once and starts it again from a plan
  for Darkbloom; it said "✓ Already serving" from a test on the local API and planned nothing.
- ClusterPairSummary: the not-offered reason ends darkbloom start's wait and has its own next step, the plain Serves
  line says "(not offered)", and this Mac's own view reads a ready local API in the public scope as not offered.

Red, against origin/dev 447b230367: its five onboarding sources with a shim that adds only the new names,
1217 passed, 20 failed, all in the four new and three updated checks; the two new CLI tests with the summary's two
files as on origin/dev, 5 issues. Green (prod identity; swift test filtered, --skip-build, sandboxed): onboarding
checks 1237 passed, 0 failed; the new tests 3; ClusterStatusTruthTests 9; ClusterStatusModeTests 3;
ClusterServiceStopReasonTests 21; the CLI pair suites 74 in 11; onboarding-side 87 in 9; neighbours 37 in 8; the
approval suites 53 in 8, whose only failure is the next commit's red test. docs-check, changelog-check and
docs-impact pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cluster): the not-offered refusals name a step the list has, not the key m

The DevNet traffic run (2026-11-04): the refusal of a plan the coordinator can't register said "press m in
`darkbloom cluster` to plan equal shares" (and, for Qwen's speculative assistant, "to plan without it"). No item of
the list starts with m, so ClusterOnboardingChoice.match took nothing and the prompt came back. v0.10.7's menu had no
m either.

- ClusterApprovalAttachment.unequalTensorSharesServeLocally and ClusterConfiguration.tensorAssistantServesLocally say
  to choose the model again in `darkbloom cluster`, which since the previous commit starts a pair that isn't offered
  again from a plan for Darkbloom. Both are named for this build's command (the shares one was always production's).
- Both stay within 240 characters after the other Mac's refusal prefix and the link's "the other Mac refused: ", so
  the leader still gets them whole. The first wording didn't: the test caught "…to plan witho".
- docs/provider/two-mac-cluster.md and the pending fragment cluster-pair-equal-tensor-shares.md said "press m" too.

Red: theRefusalsNameAStepTheScreenHas before the text change, 4 issues ("press m", no step). Green (prod identity,
filtered, sandboxed): it and ClusterApprovalTensorSharesTests, ClusterApprovalTensorAssistantTests and
ClusterApprovalSyncTests, 18 tests in 3 suites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cluster): the status of an offered pair names no screen's Retry

The DevNet traffic run (2026-11-04), during the update: `cluster status --json` carried "Then choose Retry, or serve
locally only now." under "This Mac isn't verified by Apple yet; …". `cluster status` has no Retry; neither has the
other Mac's window, which shows the same lines.

- OnboardingLive.localStatus no longer appends ClusterOnboardingNotServing.remedy under an offered pair's reason
  (offeredWaitLines). The leading Mac's setup screen still adds it under its own ✗ (notServing), where Retry is a
  choice, and `cluster status` says what to do in Next: as before. Its plain output already dropped the line; its
  JSON `lines` and the other Mac's window no longer get it.
- docs/provider/two-mac-cluster.md's status table and the fragment say so.

Green (prod identity, filtered, sandboxed): anOfferedPairsWaitNamesNoScreenChoice with ClusterOnboardingPeerLabelTests
(18) and ClusterStatusTruthTests (9). No red run: the test reads the new seam; the tester's u1-watch sample at 17:22:54Z
is the before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(cluster): the agent guide's check of a pair names the not-offered reason

The DevNet traffic run (2026-11-04) followed this table: ✓ in the result block, then `serving`, exit 0, so "Go on",
for a pair the coordinator never had. Since the first commit of this branch such a pair reads `not_serving`, exit 3,
with `reason` `not offered to Darkbloom (…)`; the table now says what that means and what the human does (choose the
model again in `darkbloom cluster` on the leader), instead of leaving it to "another reason".

docs-check passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(provider): a pair's stalled reservation no longer holds back cancels, capacity reads or challenges

A two-Mac pair's reservation waits on the engine queue until both ranks
answer at their next step boundary, up to 30 s each. Capacity reads and
cancels waited for that queue, and the leader's coordinator work FIFO
awaited each cancel, so attestation challenges and new requests queued
behind it (DevNet pair-2: a request waited 17.9 s before it was read).

- DistributedCBv2Engine: capacity() off the queue answers from the
  snapshot the queue publishes after every change, with readiness read
  live, and queues one refresh for its checks. cancel() and the deadline
  timers hop onto the queue without waiting, so a stop is applied in
  queue order. A submission whose caller went away while it waited for
  the queue never reserves.
- ProviderLoop: the connection reader answers attestation and
  code-attestation challenges and routes coordinator cancels. A cancel
  for a request whose admission has not returned is held and applied
  when it returns, where the serial FIFO applied it; any other cancel
  runs beside the FIFO.
- Tests that check a cancel's effect wait for the engine queue first.
- Docs (engine queue, process boundaries, connection control) and a
  changelog fragment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(cluster): wait a minute before acting on stopped during a change or an update

R4-16 (the DevNet runs, 2026-11-04): during a model or mode change, or a pair update, `status` and `cluster status`
can read `stopped` (exit 4) or `unknown` for a minute or two while the pair is actually reloading. The fix needs a
marker shared by both Macs and goes to 0.10.9. Until then, the agent guide's `stopped` row, the `cluster status`
reference and the two-Mac guide's status table say to wait about a minute and check again before running
`darkbloom start`, rather than interrupting the reload.

Docs only; no code. make docs-check, make docs-impact-check BASE=origin/dev and git diff --check pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(provider): the bridge must answer while a pair's submission waits for its reservation (red)

A pair measures no prefill rate, so the bridge submits its requests
without a projected admission, synchronously on its actor. While another
request's reservation holds the engine queue, the bridge's actor waits
there too, and a cancel or a capacity read through the bridge waits with
it: the engine-level fix alone leaves R4-9's cancels as late as before.

The new check holds a reservation and expects the bridge to answer a
capacity read and a cancel at once, the cancel to land once the
reservation returns, and a request cancelled while it waited never to
ask the ranks. It fails at the previous commit: the bridge answered only
after the ranks' step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(provider): a pair's submission no longer holds the bridge actor while it waits for its reservation

A pair measures no prefill rate, so the bridge submits its requests
without a projected admission, and it did so synchronously on its actor.
While another request's reservation held the engine queue (up to 30 s),
the actor waited there too, and every cancel and capacity read through
the bridge waited with it. R4-9's cancels would still have landed only
after every reservation queued ahead of them.

- DistributedCBv2Engine.submitAwaitingQueue runs the same admission on
  the engine queue, in order, without blocking its caller, and trips the
  admission cancellation when the caller goes away. A request cancelled
  while it waits never reserves; one cancelled during its reservation is
  stopped before its prompt starts. It replaces submitWithRetirement,
  which nothing else used.
- EngineV2Bridge awaits it for a pair's submission without a projection,
  so the actor stays free for cancels and capacity reads. The atomic
  path already had this suspension point, and the bridge's pending-cancel
  latch and teardown cover it unchanged.
- One more HTTP test that reads a cancel's effect waits for the engine
  queue first.
- Docs (the engine queue paragraph) and the changelog fragment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(cluster): the scope switch's local-only wording has no dead Darkbloom branch

Since the switch to Darkbloom of a serving pair re-plans through chooseAndServe,
changeScope's last finishStart is reached only for the switch to local only, so its
"Switching to serving through Darkbloom: the leading Mac's part starts again that
way." branch was dead. finishStart's doc comment no longer says the switch leaves
registering to the cluster service, and the guide quotes the lines the switch says
now. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cluster): the mode question's split is the plan that loads, on both Macs

R4-13 (the M5 Ultra pair's DevNet run, branch.80): with nothing serving,
GLM-5.3-Flash's mode question offered Pipeline as "this Mac 1 layer / the
other Mac 44 layers", and 44 / 1 loaded. The question showed the pipeline
in the listed tensor-parallel plan's own assessment; the start then made
another plan in the chosen mode, from new samples (this Mac's memory and
speed index are read again at every plan), and loaded that one.

- ClusterSetupPlanning.decide plans each other mode the question offers
  as the start plans it once chosen (ClusterPlacementFlow.decide with
  chosenMode), from the same samples, and keeps that plan with its setup
  (ClusterSetupModelOption.familyPlans, Decision.familySetups).
  ClusterSetupPlanning.offered shows each mode's split from the plan that
  loads for it; a mode that can't be planned on its own shows no split.
- localAdopt adopts the plan the question showed for the mode chosen
  when nothing serves (OnboardingLive.adoption), and LiveContext.adopt
  takes it by its plan key. While a model serves it still plans again
  once that memory is back, and the question still says "decided when it
  loads" (round 4's R3-3).
- On both Macs: an adopt forwarded from the joining Mac carries the mode
  chosen on its screen (ClusterControlRequest.mode,
  OnboardingLive.adoptRequest); before, the leader adopted its own list's
  default. The fit check before a start checks the plan that mode loads.

Docs: two-mac-cluster.md and architecture/inference.md. Changelog:
cluster-mode-question-and-local-network-row.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cluster): the mode question says how many requests each way serves at once

R4-15 (the M5 Ultra pair's DevNet run, branch.80): GLM-5.3-Flash's
pipeline served one request at a time (its owner's concurrentRequests
defaults to 1, DistributedEngineFactory's maxConcurrentRequests), so
DevNet queued every other request for about 6 s and answered 429 "at
capacity": 1 of 4 and 1 of 8 in the sweep. On the same pair, tensor
parallel served 8 at once with no 429, each about 2.6x faster (105.6
against 40.8 tok/s alone). The question offered Pipeline as an equal
choice and didn't say so.

- Each mode the question offers says it, from the plan that loads for it:
  "serves one request at a time" or "serves up to 8 requests at once"
  (ClusterSetupPlanSummary.Mode.concurrentRequests, from the setup through
  DistributedInstalledPlan.batchLanes(configuration:capability:environment:),
  which the installed plan's batchLanes now calls; ClusterOnboardingMode
  .requestsWords in modeLine).
- Wording only: the modes offered and the defaults are unchanged.
  cluster status isn't changed: its Model line and JSON split come from
  the deployment line, which ClusterPairSummary parses.

Docs: two-mac-cluster.md says to choose tensor parallel on a GLM pair.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cluster): the Local Network hints name the row macOS shows, and what to do without one

R4-4 (the M5 Ultra pair's DevNet runs): the screens, status and the link
follower's log told the owner to turn on a "Darkbloom Dev" row under
Privacy & Security -> Local Network. Both apps share the bundle ID
io.darkbloom.provider, so macOS lists the DevNet app as "Darkbloom"; and
where macOS never recorded an answer for the app there is no row at all:
it asks on that Mac's own screen the next time the app dials, and someone
must click Allow.

- ClusterService.localNetworkRow: the row's name in every build, the
  production app's name (BuildEnvironment.prod.appDisplayName);
  ClusterOnboardingCommand.localNetworkRow reads it.
- Every hint names that row, says when it is the DevNet app's ("macOS
  lists Darkbloom Dev as "Darkbloom""), and what to do when it isn't
  listed: ClusterOnboardingDriver.localNetworkBlockedLines (through
  localNetworkSteps), OnboardingLive.localNetworkRefusalLines (and so
  cluster status, through ClusterLocalNetworkAccess.statusWords),
  OnboardingLive.localNetworkHint, and the follower's refusal line
  (Cluster.LinkFollower.refusalLine). The production app's words still
  name "Darkbloom".

Docs: two-mac-cluster.md, agent-setup.md and cli-reference.md, which
quote these hints. Changelog: the DevNet bullet of
cluster-everyday-commands-on-a-pair.md no longer says the hint names
Darkbloom Dev; one bullet in cluster-mode-question-and-local-network-row.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(changelog): fragment wording that renders right; plain words in the two-Mac guide

D2's review of the 0.10.8 Prepare (refactor-prepare-0.10.8.md, section 3):
- cluster-console-clarity.md: the screen's words are in a code span, so
  GitHub keeps "<model>" (it read "Offered to Darkbloom as a pair for ;
  waiting...").
- cluster-candidate-findings.md: the title says each ✗ names the Mac
  where the problem is.
- cluster-everyday-commands-on-a-pair.md: "stays refused" says what it
  means: macOS keeps the other Mac off the local network.
- provider-uninstall-keep-or-remove.md: "(and the files kept beside it)".
- cli-darkbloom-look.md: "its one-line live status".

docs/provider/two-mac-cluster.md: "an older build" (twice) is an earlier
Darkbloom release, "a scope switch" (twice) is switching between local
only and serving through Darkbloom, "tensor assistant" is the
speculative assistant. "The planner's mode" went with the paragraph the
mode question's fix rewrote.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cluster): a start through Darkbloom says ✓ only once the coordinator has the pair; an offered part reads loading

The refactor pass on this branch (overnight/round5/r4-7-validation.md):

- B1: past the registration, a start through Darkbloom whose pair isn't offered fell back to the old "✓ Serving …
  through Darkbloom" when the leading Mac's status read didn't say "not offered". A pair on the leading Mac's API
  never earns, so startOutcome now always ends it with ✗: the status's reason when it gives one, else
  ClusterOnboardingReady.notOfferedLines (no approval attached, or a coordinator that can't take a cluster member),
  with where it answers meanwhile and the test's time. ✓ comes only from awaitPairServing, as for every start the
  coordinator takes.
- The onboarding checks' scripted world now models that start: by default the coordinator serves an approval, the
  parts start again as the pair's members and the pair is awaited, so every default start ends with ✓ through
  Darkbloom and "No local API". Sequences, the refused registration (now ✗, not offered) and the leader's line and
  word budgets (+2 lines, +25 words for the offered line and the restart) follow.
- B2: this Mac's own view read a member part registered with the coordinator, before its pair line, as not offered;
  it now reads loading (child.notice == ClusterLocalServing.offeredNotice).

Red: aStartTheCoordinatorDidNotTakeNeverEndsWithATick against the flow before this commit, 4 failures (✓ shown);
ownStateOfALocalAPI before B2, 1 issue. Green: onboarding checks 1245 passed, 0 failed; prod identity, filtered,
sandboxed: new tests 5, ClusterStatusTruthTests 9, ClusterStatusModeTests 3, ClusterServiceStopReasonTests 21, CLI
pair suites 74 in 11, approval suites 53 in 8, onboarding-side 88 in 9, neighbours 37 in 8; dev identity:
ClusterStatusTruthTests 9 and the new tests 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(provider): a pair's long prefills no longer read as a wedged slot

The wedge monitor marks a slot crashed when three requests have had no
first token for 10 s while the engine's step counter stands still. A
two-Mac pair's engine has no step counter, and its ranks prefill one
prompt at a time and send nothing before a prompt's first token, so any
burst of three long prompts on a pair with lanes read as crashed after
10 s, a plausible cause of the coordinator's member_not_idle pair ends.

- WedgeMonitor.marksCrashed keeps wedgeSuspected for engines with a step
  counter. For a pair's engine it marks the slot crashed only when a
  waiting request is still without a first token 40 s past its own
  first-token allowance, which grows with the prompt: by then the
  engine's own deadline should have failed it, so a hang of the engine
  itself is still reported. The bridge records each admit's allowance.
- wedgeSuspected still feeds the step_wedge telemetry and heartbeat
  field unchanged.
- Tests: three pair prompts without a token for 11 s read running (red
  before); a single-Mac engine whose steps stop under three waiting
  requests still reads crashed; the monitor's allowance rule.
- Docs and a changelog line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(cluster): one source for the Local Network row's DevNet note

The three Local Network hints (the blocked and refusal lines, the
unanswered-Mac hint and the follower's refusal) each spelled out
"(macOS lists <app> as “<row>”)" for a build whose own name differs
from the row. ClusterOnboardingDriver.localNetworkRowNote now says it
once, and all three read it. The words are unchanged in both
identities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(provider): a pair's first-token allowances leave with their own requests

The wedge monitor kept each hanging admit's first-token allowance in the
admit FIFO and dropped the oldest one whenever any request ended without
a first token. A pair prefills one prompt at a time, so a short request
behind a long prompt ends at its own allowance first, the long prompt
inherited that expired allowance, and the pair read crashed 40 s later
while it was still prefilling normally.

- Allowances are keyed by request id: recorded at admit, removed by that
  request's own first token or end. The count rule keeps its FIFO.
- A first token on another lane no longer untracks a hung request, and
  an entry whose request already left the bridge never counts.
- A pair request without a coordinator budget is tracked by the
  allowance its engine arms (its first-token deadline, else its request
  deadline).
- Tests: the reviewer's probe (600 s and 20 s, the short one ends, +61 s)
  as a regression test, red before; the escapes above; a pair request
  without a budget is tracked and its first token clears it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(cluster): the mode question recommends one mode for these Macs

The owner (2026-11-04): "it also does not suggest which one to select for
the hardware like it should." The question listed each mode, its split
and its requests at once, but never which to pick for these two Macs. On
two M5 Ultras, GLM-5.3-Flash in tensor parallel served 8 at once and each
request about 2.6x faster than its pipeline; on a memory-tight pair a mode
may not fit at all.

- ClusterOnboardingModeAdvice.advise picks exactly one mode, or none with
  the reason, from what the plans know. Only modes whose own plan fits
  now count (while a model serves, its memory is freed first). One that
  fits alone is "the only one that fits these Macs now"; through
  Darkbloom a mode served publicly comes first
  (ClusterSetupPlanSummary.Mode.publicTraffic). Then, through Darkbloom,
  more requests at once wins (the rest are turned away at capacity);
  locally, the clearly faster one (measured, else the planner's
  prediction; within 5 % is the same speed). No fit, or no speed and no
  difference in lanes: no recommendation, and why. It never guesses.
- The leading Mac makes it with its plans (OnboardingLive.modeAdvice,
  each mode's own pla…

This branch had an error being deployed

2 failed and 3 active deployments
Preview – d-inference-landing — a57a0998 Deployed Nov 3, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — a57a0998 Deployed Nov 3, 2026 by vercel[bot]
Preview – darkbloom-status — a57a0998 Deployed Nov 3, 2026 by vercel[bot]
Preview – d-inference — a57a0998 Deployed Nov 3, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — a57a0998 Deployed Nov 3, 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.

2 participants