Repository navigation
0.10.13: Qwen 3.5, 3.6 and 3.8 parse tool calls after the thinking (a mentioned <tool_call> no longer loses the call) - #2057
Merged
Conversation
…ions or drafts one (red) The production text path end to end (a scripted engine row, the real EngineV2Bridge, the scheduler, MLXOpenAIService's streamed frames and collected response) for Qwen 3.8, Qwen 3.5 9B, Qwen 3.6 35B and Qwen 3.5 35B: CONFORMANCE §2's replay cases (a lone `<tool_call>` in the thought, the tag in backticks, a call drafted in the thought, a call written only in the thought) and the shapes around them (two calls, text answers, thinking off, forced calls, arguments that spell think markers), each with deltas that cut `</think>`, `<tool_call>` and the other markers in two. Red on dev: a mentioned tag swallows the real call into content XML, a drafted call is executed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… tool calls Qwen 3.8, Qwen 3.5 9B (`qwen3_5`), Qwen 3.6 35B and Qwen 3.5 35B (`qwen3_5_moe`) took the legacy text route: the tool handler scanned the raw output, thinking included, and the service's think parser split reasoning from whatever text the handler let through. A thought that mentioned a lone `<tool_call>` opened a frame that swallowed the real call after `</think>` (the client got content XML and no call), and a call drafted in the thought was executed. A text request with tools on these builds now takes the native split, as Bonsai 2, Lightning, MiMo and Qwen4 do: `prepareCompletion` seeds `NativeChannelSplitter` with the prompt's own think state (the `reasoningPrefix` the downstream parser would otherwise get), so reasoning is classified before tool parsing. `usesNativeTextChannels` is unchanged, so `auto` calls still stream while generated, and forced calls keep their prompt policy. Requests without tools, an explicit non-think parser and a prompt whose think state is unknown keep the raw route. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fresh-context review (APPROVE WITH NITS) asked for: - the scheduler's native-prefix choice as one `if`/`else if` chain on one `modelContext` (behavior-preserving: MiMo, a JSON answer's channel, the native and GLM families, then the Qwen 3.5 seed); - `splitsQwenReasoningBeforeTools` to trim and lowercase `model_type` like its neighbours; - the docs and changelog to say what changes for forced calls (thinking stays off; a stray thought before the call is reasoning instead of a 422), for a call in a thought that never closes (reasoning, as on the native families), for an unreadable prompt tail (the local server's streamed content seed takes the split) and for collected local responses; - tests for the claims: a differential test that the raw route and the split give the client the same content, reasoning, calls and finish reason for clean outputs at every chunking; usage counts every token; reasoning frames precede call frames; JSON-dialect calls and arguments that spell `</tool_call>`, `</think>` and `<think>`; a second thought after an answer; a stray `</think>` with thinking off; `parallel_tool_calls: false` with a drafted call; a call in an unclosed thought at the end of the turn; and `reasoning_parser: none` keeping the raw route. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Nov 13, 2026
Merged
…still parses
A second fresh-context review (REQUEST CHANGES) found that the split dropped a known
Qwen 3.5 output: a tool call written inside a thought the model never closes, at the
very end of its turn (vLLM #35687, llama.cpp #20837). The raw route parsed it; the split
kept it as reasoning, so the turn came back empty.
- `NativeChannelSplitter` (`promotesTrailingCalls`, on for this route only, through
`NativeToolStreamRouter` and the scheduler): at the end of the output, a thought that is
still open and ends in complete `<tool_call>` frames (whitespace only between and after
them; a frame opens on `<function=` or `{`, and ends where the Qwen parser's own scanner
says) also returns those frames as content, so they parse as calls. A frame followed by
more thought, or by `</think>`, stays reasoning, as does a mentioned tag or a tag inside
an argument.
- The route requires the Qwen tool parser (`.qwen35`, the default): another requested
`tool_call_parser` keeps the raw route, as its frames are not the scanner's.
- `ClusterAPIParityTests`: the mid-generation rejection fixture answers the named tool
choice with the plain script's text; its old script (a thought, then the call) is no
longer a violation on Qwen.
- Tests: the trailing-frame rule at every chunking, the cases that now parse (one or two
calls, the JSON dialect, a stray unclosed thought with thinking off) and those that stay
reasoning (a draft followed by more thought, a call in a thought that closes with nothing
after it); the cases split into those the raw route got right and those it got wrong; the
differential test keeps the engine's finish reason.
- Docs and changelog: the trailing-call rule, the parser requirement, the collected
Responses shape.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oes, and not after a cut A third fresh-context review (APPROVE WITH NITS) of the rule that promotes calls written at the end of a Qwen thought that never closes asked for three changes before 0.10.13: - Frames are read left to right as the Qwen tool parser frames content, and a frame counts only if `Qwen35ToolCallParser` parses it. A mention that opens like a call (`<tool_call>\n<function=get_weather> for Bern.`) could otherwise start the frame and swallow the real call after it; it is now read as a mention and the real call is promoted. - The search is one bounded pass instead of a rescan per trailing frame: at most a few passes over the thought, and past that bound nothing is promoted (a degenerate output can no longer hold the end of the stream for seconds). - A thought the token limit cut off promotes nothing: the scheduler tells the router when the engine stops at `length` (`outputReachedTokenLimit`), as for a draft cut off before its end. - Tests: those three shapes (unit and end to end), a forced call at the end of a stray unclosed thought (a 422 before), the documented trade-off for calls separated by text (only the last run is promoted), and a differential test showing that for calls at the end of an unclosed thought the split returns the raw route's calls, content and finish reason while the whole thought stays reasoning (`_testMakeEventStream` passes the flag). - Docs and changelog: when such a call leaves, that its text stays in `reasoning_content`, the trade-off, the `length` rule and the bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd undeclared frames stay reasoning A fourth fresh-context review (APPROVE WITH NITS) of the trailing-call rule found that a few mentions that open like a call (`<tool_call>\n<function=get_weather> for Bern.`) early in a long thought could spend the search's work budget, each running on to the real call's end before failing to parse, and so drop the real call. - `NativeChannelSplitter.opensCall`: a `<tool_call>` starts a frame only when its payload starts a call as the Qwen parser reads one (`<function=NAME>` and then a parameter or the function's close, or a JSON object with a key), so a mention is rejected at its prose, at no cost. The budget is a larger fixed multiple of the thought (still linear). - A frame counts only if it parses with the request's declared tools: an echoed template example (`example_function_name`) stays reasoning next to the real call. - Docs: what a mention can and cannot do (one that reaches its first `<parameter=` cannot be told from a call whose argument spells the tags, as on the raw route), and that a frame that never closes holds the rest of the thought. - Tests: thousands of such mentions still promote the real call; the budget still trips on frames that fail late; the undeclared example; the parameter-reaching mention; a `length` cut of a stray thought with thinking off. The case "two calls at the end of an unclosed thought" moves to the differing cases: the raw route ran both calls but sent the newline between them as reasoning after the first call (found by the local red run); a back-to-back variant stays with the unchanged cases. Local red/green (trimmed package, debug): with the four production files at `dev`, exactly the 18 differing cases fail on all 4 builds and the 23 others pass; with the fix, all pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…race JSON call
A fifth fresh-context review (APPROVE WITH NITS) found that the pre-check added in the
last round rejected one payload the Qwen parser accepts: the JSON dialect with a
redundant outer brace (`{{"name": …, "arguments": {…}}}}`, which `JSONToolCallParser`
recovers). A call of that shape at the end of an unclosed thought was promoted before the
pre-check, and on `dev`; it is again.
- `NativeChannelSplitter.opensCall`: after `{`, a key, `}` or a second `{` opens a frame.
- Its comment states the name cap exactly (shorter than 256 scalars).
- Test: the redundant-brace call at the end of an unclosed thought is promoted.
Local red/green unchanged: with the four production files at `dev`, exactly the 18
differing cases fail on all 4 builds; with the fix, all 5 tests pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 13, 2026
jonathan308
added a commit
that referenced
this pull request
Nov 13, 2026
Fold order: #2057 at its reviewed head. Clean merge. Qwen-only (reasoning before tool parse, NativeChannelSplitter.promotesTrailingCalls); the Harmony path has no native channel splitter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 13, 2026
…tion Fold order: #20631815e07 (#2064 = #2063 + #2059 + #2057). #2059 and #2057 are already merged here, so this brings #2063 (G1: HarmonyFinalHeaderFilter). Clean merge. The two compose on GPT-OSS: the filter runs before the router and rewrites only `final` headers with attributes; a forced response has only `analysis` and `commentary to=functions.NAME` headers, which it passes byte for byte to the router's analysis gate. This commit is the resolution without #2065 (use it if #2065 does not ride). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 13, 2026
jonathan308
added a commit
that referenced
this pull request
Nov 13, 2026
…s thinking-off case absorbs CI of the default-on flip (88c2aed, run 43527020131) failed exactly two tests, which are this commit's red: - EngineV2ProductionWiringTests "a plain Qwen3-VL Instruct tail seeds content state ahead of output": Qwen3-VL Instruct's bare prompt tail gets a synthetic `<think></think>` content seed (ReasoningPromptProbe.plainTailContentModelTypes), not a thought its template closed, and the model never reasons; by default it took the native split. Qwen3-VL (`qwen3_vl`, `qwen3_vl_moe`) leaves QwenStrayThinkClose.modelTypes and keeps its route (tested). - QwenReasoningBeforeToolsTests "thinking off: a stray </think> stays text" (#2057's split route): that literal is exactly what #2093 absorbs, so the case now expects the close absorbed and the text around it kept; the kill switch keeps the literal (QwenStrayThinkCloseConformanceTests). Also the review's nits: ToolChoiceEnforcementPolicy's comment and the changelog's scope wording. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 of 14 tasks
jonathan308
added a commit
that referenced
this pull request
Nov 14, 2026
* feat(provider): draft through Qwen JSON reasoning and retain service opt-in
* test(provider): drain span fixtures on every failure path
* fix(inference): pin qualified native reasoning budget runtime
* fix(provider): keep the Gemma tool grammar linear in nested optional objects
A required or named tool_choice on Gemma 4 builds a byte automaton of the
call. `members` built a property's value once for each emitted state of the
members before it, and a nested object gets a fresh member scope, so an
optional object behind an optional sibling was copied twice per level. A
depth-16 chain of such objects is accepted by every compiler limit (its
grammar cost counts each property once) yet built about 2.5 million states,
and a schema near the cost ceiling projects to billions, all before the
100,000-state check ran on the finished automaton.
- Build each property's `name:value` and the members after it once per
object and enter it from both emitted states, after a comma or not. Every
member list of an object ends where the object closes, so the accepted
language is unchanged.
- Check the 100,000-state limit in `value` and `members` while building, so
an oversized grammar stops one value past the limit instead of being built
and distance-ranked in full.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): refuse deeply nested request JSON and bound schema normalization
A coordinator request's decrypted body is parsed by JSONSerialization and
JSONDecoder, which recurse once per object or array level, on a Swift
concurrency task whose stack is 512 KiB. A chat body of a few KB whose tool
schema nested a few hundred levels deep (128 in a debug build) exhausted that
stack and killed the provider with SIGBUS, below JSONSerialization's own
512-level limit. The coordinator forwards such bodies: it parses with Go's
decoder and normalizes tool schemas only to depth 64.
- Add `JSONNestingLimit`, a non-recursive scan that counts open containers
and skips brackets inside strings. Refuse bodies deeper than 64 levels
before any parse: in the coordinator handler right after decryption
(`malformed_body`), in `repairedRequestBody` for every other caller, and in
the local chat, batch, Responses and router paths (HTTP 400).
- Give tool-schema normalization a 100,000-node budget per request. Each
positional `{}` or boolean became a two-key map, so a few MiB of them
rewrote into ~85 MB of JSON and ~900 MiB of objects before decoding. Past
the budget the body is decoded as sent, as one over 4 MiB already is.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): GPT-OSS commentary content is on by default
Red first for the default flip the owner asked for (proven fixes ship on,
the switch kept as the kill switch): unset, empty or any value other than
an off word maps a recipientless commentary preamble to content; an off
word (`0`, `off`, `false`, `no`, `none`, `disabled`, any case) keeps
0.10.12's dropped preamble. #2063's byte-for-byte case for the preamble
moves to an explicit kill-switch-off test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): GPT-OSS commentary content on by default
The owner's order for 0.10.13: proven fixes ship on, with the switch as the
kill switch. `HarmonyFinalHeaderFilter.commentaryEnabled`: unset, empty or
any value other than an off word (`off`, `false`, `0`, `none`, `no`,
`disabled`; any case, surrounding space ignored) maps a recipientless
assistant commentary preamble to content; an off word restores 0.10.12
(dropped). Same parsing as DARKBLOOM_GPTOSS_FORCED_TOOLS. Still on the
LaunchAgent passthrough list, so `DARKBLOOM_GPTOSS_COMMENTARY_CONTENT=0`
reaches launchd providers. Docs and the changelog fragment say so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): Qwen stray think-close absorption is on by default
Red first for the default flip the owner asked for (proven fixes ship on,
the switch kept as the kill switch): for the Qwen types, unset, empty or any
value other than an off word absorbs a stray `</think>` and selects the
native split for a closed-thought prompt; an off word (`0`, `off`, `false`,
`no`, `none`, `disabled`, any case) keeps 0.10.12's literal close.
`NativeToolStreamRouterTests`' family table now expects `qwen4_exp` to
absorb by default (Nemotron 3.5's listing builds as before).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): Qwen stray think-close absorption on by default
The owner's order for 0.10.13: proven fixes ship on, with the switch as the
kill switch. `QwenStrayThinkClose.enabled`: for the Qwen types, unset, empty
or any value other than an off word (`off`, `false`, `0`, `none`, `no`,
`disabled`; any case, surrounding space ignored) absorbs a stray `</think>`
and gives a closed-thought prompt the native split; an off word restores
0.10.12 (literal). Still on the LaunchAgent passthrough list.
Review finding (review-2093, MINOR, now reachable by default): media path 1
resolved its request-owned tool parser after `submitTokenized`; a parser
that failed to resolve left the submitted row to stream-drop termination.
The handler is now resolved before submission, inside the same do/catch
(same inputs, same result). The stale `toolHandler: nil` doc comment says
so. Docs and the changelog fragment updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): stage an update only as the version it is signed as
`latestRelease` takes the release `version` from the coordinator's JSON, and
`checkForUpdate` judges no-downgrade eligibility by it. Staging verified the
bundle, binary and metallib hashes and the pinned code signature, but never
compared that label with the version the app is signed as, and the recovery
record then carried the label. Whoever controls the release response could
offer an older, genuinely signed build under a newer version and have it
installed.
After the deep signature check (and the runtime capability check), staging
now requires the app's sealed `CFBundleShortVersionString` to equal the
release's `version` exactly, under every policy that verifies signatures
(production and the signed test fixture). Release builds set that key to the
registered version, which the coordinator requires to be bare semver, so an
exact string comparison is the contract. `signedVersion(ofApp:)` becomes
static so staging can use the same reader as recovery.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): require the LaunchAgent to forward the SDK feature switches
DARKBLOOM_CBV2_MTP_GRAMMAR (SDK #409) and DARKBLOOM_GEMMA_SCHEMA_COERCION
(SDK #408, provider #2090) are read by the SDK; neither reaches the launchd
provider job today, so neither can be enabled or killed in the installed
service. Red: both keys are missing from LaunchAgent.passthroughEnvKeys.
* test(provider): pin 0.10.12's MiMo refusal class with the budget switch off
review prov-2099 SF3: with DARKBLOOM_NATIVE_REASONING_BUDGET off, a
reasoning object whose max_tokens is not an integer now throws inside the
decoder and skips the effort check, so {max_tokens: null, effort: bogus} is
refused as invalid_tool_payload instead of 0.10.12's
unsupported_reasoning_control. Red on 2ec6d07f98 for every listed value.
* fix(provider): forward the SDK feature switches to the installed service
LaunchAgent.passthroughEnvKeys gains DARKBLOOM_CBV2_MTP_GRAMMAR (SDK #409,
next to DARKBLOOM_CONSTRAINT_SPANS) and DARKBLOOM_GEMMA_SCHEMA_COERCION
(SDK #408 / #2090), so an operator's value, including the 0 rollback, reaches
the launchd provider job. Values are unchanged (still opt-in). Docs: the
grammar-MTP row in the configuration reference; the Gemma switch is forwarded.
* fix(provider): keep 0.10.12's MiMo refusal with the budget switch off
Decode reasoning.max_tokens only when DARKBLOOM_NATIVE_REASONING_BUDGET is
on, and never let a non-integer value throw past the effort check: off, the
key is an unknown key exactly as in 0.10.12 (invalid, then the effort check
classifies the refusal); on, an unusable value is invalid without skipping
the effort check. Accepted budgets are unchanged.
* refactor(provider): build the member comma first and pin the state-limit error
Refactor-pass follow-up. Building the comma after the shared member left its
edge pointing back to an earlier state, so the reverse-order minimum-distance
pass needed an extra sweep per comma on all-required schemas (0.24 s became
0.51 s near the grammar-cost ceiling). Build it first: an all-required
automaton is again identical to the original, node for node.
Tests now use the compiler's real maximum depth (16) and expect the exact
state-limit error; comments state the rule rather than its history.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): only Qwen JSON answers may offer free spans to the engine
review prov-2101 SF1: every JSONAnswerConstraint conforms to
CBv2FreeSpanTokenConstraint, and the SDK makes a row MTP history-eligible by
that conformance alone. With DARKBLOOM_CONSTRAINT_SPANS on, a Nemotron
Lightning, Bonsai or GPT-OSS JSON row would seed assistant history every
step instead of chained decode. Red: the Bonsai constraint conforms.
* fix(provider): offer free spans only from Qwen JSON answers
JSONAnswerConstraint no longer conforms to CBv2FreeSpanTokenConstraint; the
new QwenJSONAnswerConstraint subclass does, and JSONAnswerPolicy builds it
for the Qwen family only. With DARKBLOOM_CONSTRAINT_SPANS on, Nemotron
Lightning, Bonsai and GPT-OSS JSON rows therefore keep target-only chained
decode instead of seeding MTP history every step (review prov-2101 SF1).
Qwen behaviour is unchanged; off is unchanged.
* test(provider): Super concurrent images on by default
Red first for the default flip the owner asked for (proven fixes ship on,
the switch kept as the kill switch): with the switch unset or any value
other than an off word, two encoded images share an owner that serves at
least three requests; an off word (`0`, `off`, `false`, any case, trimmed)
keeps 0.10.12's single-media admission, as does a narrower owner.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): Super concurrent images on by default
The owner's order for 0.10.13: proven fixes ship on, with the switch as the
kill switch. `NemotronSuperLocalBridgeBuilder.concurrentImagesEnabled`:
unset, empty or any value other than an off word (`off`, `false`, `0`,
`none`, `no`, `disabled`; any case, trimmed) lets an owner serving at least
three requests take two image rows; an off word restores 0.10.12's
single-media admission. The key joins LaunchAgent.inferencePassthroughEnvKeys
(after the other Super key), so `=0` reaches launchd providers. Docs and the
changelog fragment say so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(provider): provider defaults for SDK-read feature switches (none on yet)
SDKFeatureDefaults.apply() sets each switch listed in onByDefault to 1
before the serving process builds an engine or parser, only where the shell
or the LaunchAgent plist sets nothing, so <KEY>=0 stays the kill switch
(0.10.12's behaviour). darkbloom start and benchmark call it; start logs the
switches it turned on. The list is empty here: a switch joins it only with
its hardware evidence. Tests: the projection never overrides an operator
value, and every listed switch is forwarded by the LaunchAgent.
* docs: move the Gemma quoted-number and SDK-default sections off the end of shared docs
The four docs files ASTRA-QUICK's phase-D items (#2091-#2093) also append to
no longer collide at end of file: the Gemma switch row joins the engine and
scheduler table beside DARKBLOOM_GEMMA_JSON_ANSWERS (review prov-2090 NIT 8),
the SDK feature defaults section sits before Native reasoning budgets, and
the inference, hardware-support and cli-reference sections sit beside their
Gemma / LaunchAgent neighbours. Text unchanged apart from the moved row.
* test(provider): GLM-5.3-Flash JSON answers are grammar-constrained behind a switch (red)
GLM's JSON response_format answers are prompt-steered and checked after
generation; under batching about 7 % miss the schema (an invented key, a
missing required key) and become a 422 after the streamed reasoning.
Pins the SDK change that lets GLM's native page-bank engine run token
constraints (mlx-swift-lm structured/glm-native-token-constraints e8b588dd,
on the cumulative SDK #416) and adds, without admitting GLM yet:
- JSONAnswerProfile.glm5Next (byte-level BPE below <|endoftext|> 154820,
the think markers 154841/154842 as pieces, answers ending with <|user|>
or <|endoftext|>, vocabulary 154880);
- DARKBLOOM_GLM_JSON_ANSWERS (on only with 1/on/true/yes for now), passed
to the launchd job;
- EngineV2Bridge.acceptsTokenConstraints, passed from the text path through
ToolConstraintFactory to JSONAnswerPolicy.
The admission tests fail: GLM is not admitted yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(provider): DARKBLOOM_GLM_JSON_ANSWERS constrains GLM-5.3-Flash JSON answers with the JSON answer grammar
JSONAnswerPolicy admits glm5_next (JSONAnswerProfile.glm5Next) when the
switch is on and the slot's engine runs token constraints
(EngineV2Bridge.acceptsTokenConstraints: the native page-bank profiles the
pinned SDK qualifies; never a cluster pair). The answer is then one JSON
value of the request's schema, as on Qwen, Bonsai and Lightning, so the
misses GLM shows under batching (an invented key, a missing required key,
trailing text) can no longer be sampled. GLM's JSON prompts open a thought,
and the reasoning is constrained too (EOS masked, no turn marker spelled),
so such a request decodes target-only. GLM's withheld answer and its check
are unchanged and still run.
Every request the grammar does not cover (tools, tool_choice, media, a
schema outside the subset after the rewrite, an unpinned tokenizer, an
unrecognized prompt end) keeps today's prompt-steered, checked answer with
a content-free log line. Off by default until proven on hardware.
Docs: the JSON answer grammar's family table, GLM's ids and markers, the
GLM JSON paragraph, the configuration row; a changelog fragment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): on a full Mac, the exit's continuation must not be refused for width (red)
#2100's GPU check (Mac A, Gemma 4-bit, 16 requests on 8 slots) found a
second way the continuation fails: no `admission_timeout`, but exits ended
"continuation refused: token_budget_exhausted: whole-Mac service allowance
exhausted". The bridge waits for the stopped row's share of the whole-Mac
allowance to be released before it submits the continuation; on a full Mac,
work waiting for a slot takes that share first, and the continuation (a new
submission) is refused for width: the held `length`, no answer.
The test fills every whole-Mac slot. An ordinary request is refused as
capacity (503 locally; re-routed upstream); a continuation (submitted with
the exit's admission priority) must reach the engine. Red: it is refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): stray think-close default keeps Qwen3-VL's route; #2057's thinking-off case absorbs
CI of the default-on flip (88c2aeddd4, run 43527020131) failed exactly two
tests, which are this commit's red:
- EngineV2ProductionWiringTests "a plain Qwen3-VL Instruct tail seeds content
state ahead of output": Qwen3-VL Instruct's bare prompt tail gets a synthetic
`<think></think>` content seed (ReasoningPromptProbe.plainTailContentModelTypes),
not a thought its template closed, and the model never reasons; by default it
took the native split. Qwen3-VL (`qwen3_vl`, `qwen3_vl_moe`) leaves
QwenStrayThinkClose.modelTypes and keeps its route (tested).
- QwenReasoningBeforeToolsTests "thinking off: a stray </think> stays text"
(#2057's split route): that literal is exactly what #2093 absorbs, so the
case now expects the close absorbed and the text around it kept; the kill
switch keeps the literal (QwenStrayThinkCloseConformanceTests).
Also the review's nits: ToolChoiceEnforcementPolicy's comment and the
changelog's scope wording.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): a native engine that runs token constraints is not refused at submit (refactor pass)
The dedicated refactor pass found the blocker: EngineV2Bridge's
nativeOutputControlRefusal answered every constrained request on a
native-tracked engine with a typed 400 before submit, so with the switch on
an admitted GLM JSON answer was refused instead of constrained. It now
refuses only where the engine does not run constraints
(EngineV2.acceptsTokenConstraints, as logprob rows already key on
acceptsLogprobRows); MiMo and every other native engine still refuse.
NativeOutputControlRefusalTests pins both.
Also from the pass (behavior-preserving): the scheduler reads the JSON flag
once for both bridge queries, the bridge flag's and the launchd key's
comments say exactly when they hold, the GLM tests share one request and
constraint helper. Its notes: protocol-messages and ToolChoiceEnforcement-
Policy no longer say GLM's engine refuses every constraint, and the
DARKBLOOM_JSON_ANSWER_GRAMMAR row says GLM has its own switch.
The real-tokenizer check is GLM's own: the GLM-5.3-Flash template opens a
thought in every generation prompt, so a JSON prompt starts in reasoning
(the shared check expected a thinking-off answer phase and failed on the
real tokenizer locally).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): the exit's continuation takes its stopped row's place in the whole-Mac allowance
The bridge waits for the stopped row's share of the whole-Mac service
allowance to be released before it submits the continuation. On a full Mac
work waiting for a slot takes that share first, and the continuation, a new
submission, was refused for width ("token_budget_exhausted: whole-Mac
service allowance exhausted"): the held `length`, no answer (#2100's GPU
check on Mac A: 2 of 7 exits).
A continuation (`EngineAdmissionPriority` above 0) is no longer refused for
width: `acquireServiceAllowance(takesStoppedRowPlace:)` skips the width
checks and `WholeMacServiceBudget.acquire(overcommit:)` charges it even when
the sum is full. It may exceed the width by itself until it ends; other work
waits meanwhile, and the engine admits it first (#2100). Every other request
is refused as before. Docs and the changelog fragment.
Local: 79/79 (red 2204e67e7f: exactly the new test failed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): apply SDK feature defaults in every process, never persist them
review prov-2109 (delta) SF1/SF2 and nits, before any switch is listed:
- SDKFeatureDefaults.apply() runs in main.swift before any command, so
single-Mac serving, pair members (start --cluster-member / --distributed),
workers and benchmarks agree, instead of only start's single-Mac path;
- keys it injected are remembered and LaunchAgent.passthroughEnvironment
leaves them out, so an installing process never pins today's default into
the service plist (the operator's own value, 0 included, is still
forwarded); test: injectedDefaultsAreNeverWrittenIntoAServicePlist;
- an empty value counts as unset (the LaunchAgent drops empty values), so
foreground and installed service agree; 0 is the kill switch;
- start names the switches it turned on; benchmark prints them on stderr.
The list stays empty: no behaviour change.
* Re-pin the SDK to the phase-D cumulative head with #407
libs/mlx-swift-lm 73dcc01913 = SDK #418: #407 (O5, Gemma reopened
thoughts, opt-in) merged onto #417 (GLM token constraints) and the
cumulative #416 (#409 + #413 + #411 + #408 on SDK main 859f641529).
Gitlink only. #407's parser change is identical to the f96a2ee5f5 pin.
The phase-D pin F re-pins to SDK main once the owner merges #416, #417
and #418 (same tree).
* test(provider): the managed slot's one-image-at-a-time case runs with the kill switch
CI of the default-on flip (61a8fbc88b) failed exactly one test, this
commit's red: NemotronSuperManagedSlotTests
concurrentImageIsRefusedWith429AndInvalidVideoWith400 asserted the old
default (a second image while the first streams gets 429). With concurrent
images on by default the managed slot admits it, so the case now runs with
DARKBLOOM_NEMOTRON_SUPER_CONCURRENT_IMAGES=0 through the fixture's
environment (no process-global state) and keeps its contract: the kill
switch restores 0.10.12's single-media admission, 429 / wait / 400.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(provider): stray think-close scope and the Qwen3-VL exclusion in the architecture doc
Delta review nits (review-2093-on-delta2.md): inference.md still said 'without tools' and did not name the Qwen3-VL exclusion; QwenStrayThinkClose's comment implied both Qwen3-VL types are seeded. Docs and comment only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(provider): HarmonyFinalHeaderFilter comment wording
Delta review nits (review-2092-on.md): the type comment's switch sentence and answerHeader's reflowed doc comment. Comments only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider), docs: GLM JSON grammar review — the factory seam, a serving test, the costs (review)
From the independent review (REQUEST CHANGES; narrow, no code defect):
- ToolConstraintFactory.make takes glmJSONAnswers (default the switch), so
the factory test now proves the engine flag reaches the policy whatever
the process environment.
- GLMJSONAnswerServingTests: a reasoning-first answer, a miss (typed 422
under GLM's name, no content quoted) and a cut at the limit through the
forwarding body with GLM's withheld answer and JSONAnswerOutput both on.
- <|observation|> stops the engine but cannot end an answer (asserted).
- The SDK pin moves to #417's head 5b66768a: a constrained row never chains
on a native-tracked engine.
- Docs say the costs: a lone GLM JSON request loses MTP for its reasoning
and answer, so does a plain request sharing a two-row step (GLM drafts
with at most two rows), and an admitted row donates no prefix
checkpoint. Three sentences fixed (GLM keeps its withheld answer either
way; its 422 carries no content; GLM declines widened schemas). The test
guide, the cli-reference passthrough table and the changelog name GLM.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Move O5's docs and CI step off the shared insertion points
Phase D folds several provider PRs that each appended a section at the
end of the same six docs files, and #2090's O4 conformance step sits
where O5's did. Each O5 docs section moves, unchanged, next to related
content (inference.md: after "Collected and streaming reasoning state";
two headings change level to fit their new parent; anchors are
unchanged). The O5 CI step now follows the desktop control API step,
with the same condition, and the workflow test lists its command there.
No behaviour change; scripts/test-provider-ci-workflow.py gives the same
results before and after.
* fix(provider): the review's findings on the continuation's allowance
The fresh-context review of #2115 (APPROVE WITH NITS):
- Medium: the over-commit can take the allowance's sum past 1. What the
budget reports is capped at 1 (`snapshot`'s `usedFraction`, which goes out
as `whole_mac_service_used`, and the deadline work's `serviceFraction`);
admission keeps the real sum, so other work keeps waiting.
- The bound is stated: each continuation may exceed the width by one row
until it ends, at most one per stopped row.
- No over-commit beside an exclusive (whole-Mac) charge, such as the idle
prefill-evidence recovery.
- The pump task resets the continuation's admission priority (a task
local), so nothing it might start inherits it.
- The test also checks that other work is still refused while the
continuation runs, that the reported fraction stays capped, and that the
share is released when it ends. (The bridge's own width checks apply only
to the real EngineV2, out of a test engine's reach; the GPU check covers
them.)
Local: 79/79.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(provider): check the signed version before the runtime smoke
Refactor-pass follow-up. Read the sealed version right after the deep
signature check, before `verifyRuntimeCapabilities` runs any staged code, so
a mislabelled release is refused without running its smoke test on every
Mac each update cycle. Accept and refuse are unchanged for every input; only
which error is reported changes when several checks fail. Test and changelog
wording now say exactly what they show.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(provider): one SDK default list per feature (still all empty)
Each later default flip (#2101 spans, #409 grammar MTP, #2090 Gemma quoted
numbers, #2099 reasoning budgets) is then a one-line change of its own list,
so any subset of the flips merges without conflicts. No behaviour change.
* docs: list the grammar-MTP switch after the strict tool grammar row
Keeps the DARKBLOOM_CONSTRAINT_SPANS and DARKBLOOM_CBV2_MTP_GRAMMAR rows apart,
so their default flips merge independently. Text unchanged.
* test(provider): require the spans SDK switch on by default
Red until its flip: SDKFeatureDefaults lists no key for spans yet.
* feat(provider): turn the spans SDK switch on by default (kill switch: =0)
SDKFeatureDefaults lists the key, so every darkbloom process turns it on
unless the operator sets it; =0 (shell or LaunchAgent) restores 0.10.12.
Docs: the configuration default column; changelog line. Ships only with its
hardware evidence in its CONFLICTS.md row.
* test(provider): require the o4 SDK switch on by default
Red until its flip: SDKFeatureDefaults lists no key for o4 yet.
* test(provider): require the grammar SDK switch on by default
Red until its flip: SDKFeatureDefaults lists no key for grammar yet.
* test(provider): require the o8 SDK switch on by default
Red until its flip: SDKFeatureDefaults lists no key for o8 yet.
* feat(provider): turn the o4 SDK switch on by default (kill switch: =0)
SDKFeatureDefaults lists the key, so every darkbloom process turns it on
unless the operator sets it; =0 (shell or LaunchAgent) restores 0.10.12.
Docs: the configuration default column; changelog line. Ships only with its
hardware evidence in its CONFLICTS.md row.
* feat(provider): turn the grammar SDK switch on by default (kill switch: =0)
SDKFeatureDefaults lists the key, so every darkbloom process turns it on
unless the operator sets it; =0 (shell or LaunchAgent) restores 0.10.12.
Docs: the configuration default column; changelog line. Ships only with its
hardware evidence in its CONFLICTS.md row.
* feat(provider): turn the o8 SDK switch on by default (kill switch: =0)
SDKFeatureDefaults lists the key, so every darkbloom process turns it on
unless the operator sets it; =0 (shell or LaunchAgent) restores 0.10.12.
Docs: the configuration default column; changelog line. Ships only with its
hardware evidence in its CONFLICTS.md row.
* Re-pin the SDK to #418's head 16aebe836a (F's tree)
libs/mlx-swift-lm 16aebe836a = SDK #418: #407 (O5) merged onto #417's
head e29eeebd8e, which carries #416 c1f8525d04 and SDK main 4342a661ac
(#414). If the owner merges #416, #417 and #418 into main as plain merge
commits, the final pin F has this tree; the last re-pin to F is then
gitlink only. #407's parser files are unchanged from the f96a2ee5f5 pin.
* Undo "Prepare provider 0.10.13" to fold 2040@03826b100a 2042@09ba436cdc 2047@b55ae64d6a 2051@98a9cded8c 2050@f10799abc1 2048@a849c562bf 2049@15f7d676e9 2052@0d2ec9ebfc 2053@42d9add895 2054@854c1ad495 2046@b4cc61883c 2057@220be61dd4 2058@4c5d7d9823 2063@1815e0773e 2065@585133d832 2045@8d7a6b51bd 2072@1542c6357e 2060@5a94d61d60 2061@1a8734918c 2070@dfb14ce00d 2069@5b4d5bc087 2071@3ce6f5cfdb 2075@b6c797c324 2084@7af346143c 2096@7e9378ad65 2088@001996379f 2100@2e241534b5 2098@d76366162a (it is redone on top)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Prepare provider 0.10.13
Version 0.10.13; the 28 changelog.d fragments rendered into CHANGELOG.md
(scripts/changelog.py render --version 0.10.13 --date 2026-11-14, verbatim, in
filename order) under the candidate heading, with the upgrade and rollout
notes; v0.10.12 marked published (2026-11-12); the 0.10.13 section of
docs/operations/provider-release.md. Base: master 5171ade3b6 (the 0.10.13 release branch's squash).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: place #2099's lines and the Gemma switch apart from phase C's and Astra's edits
No behaviour change. #2109 now merges cleanly with every phase-C item
(#2096, #2098, #2088, #2100) and with ASTRA-QUICK's #2104 + #2094, in any
order:
- MultiModelBatchSchedulerEngine: the budget's exitThinking = nil follows
the distributed-pair check instead of the resolve call #2088 edits (both
only clear exitThinking);
- EngineV2Bridge+Submission: reasoningBudget is assigned after
hybridPrefixIdentity instead of beside maxTokens, where #2100 adds priority
(independent fields of the same request);
- the DARKBLOOM_GEMMA_SCHEMA_COERCION passthrough key, configuration row and
inference section move next to the other SDK-read keys / JSON rows / the
Qwen JSON section, away from #2098's Gemma prompt-contract additions.
* changelog: drop the duplicated default line of the o4 flip
* test(provider): by default Qwen 3.5 9B and 35B end a looping thought in an answer (red)
The Qwen exit-ON A/B decides the 0.10.13 default for Qwen 3.5 9B
(`qwen3_5`) and 35B (`qwen3_5_moe`). The same families also serve Qwen 3.6
(`qwen3_5_moe`) and the Qwen 3.8 27B builds (`qwen3_5`), which the A/B does
not cover: they must keep today's `length` by default.
- Serving (the scheduler's text path, the default setting): `Qwen3.5-9B`
and `qwen3.5-35b-a3b` end a looping thought with `\n</think>\n\n` and
answer; `qwen3.6-35b-a3b-vl-mtp-mxfp8` and both Qwen 3.8 27B builds
(`ModelRuntimeRequirements.qwen38ConcreteModelIDs`) keep `length`; a list
set on the Mac (`DARKBLOOM_LOOP_EXIT_THINKING=qwen3_5_moe,qwen3_5`) still
turns the exit on for every build of its families.
- Policy: both families resolve an exit with the default setting.
- The Qwen 3.6 tests now turn the exit on with an explicit list
(`qwenOn` = `qwen3_5_moe`), since the default no longer leaves it off.
Red (local, 85 tests): exactly the two default expectations fail (the
9B/35B serving test, `qwenFamilies`' default lines).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): Qwen 3.5 9B and 35B end a looping thought in an answer by default
`qwen3_5` and `qwen3_5_moe` join the exit's default list, for the builds
the GPU A/B proved only (`defaultBuilds`: `Qwen3.5-9B` and `qwen3.5-35b-a3b`,
each with its own `model_type`, as `EngineV2SamplingDefaults`'
`qwen35CardModelTypes`). The same families serve Qwen 3.6 (`qwen3_5_moe`)
and the Qwen 3.8 27B builds (`qwen3_5`): by default their loops keep ending
as `length` until their own A/B (`keepsLengthByDefault`, one line after each
of the scheduler's `servesDistributedPair` lines, text and media paths). A
list set on the Mac (`DARKBLOOM_LOOP_EXIT_THINKING`) names families and
takes every build of each, as before.
The policy test covers the build table (the 9B and 35B on; Qwen 3.6, both
Qwen 3.8 27B builds and another 9B build off; a build only with its own
`model_type`; Gemma and GPT-OSS untouched; a list takes every build).
Docs and the changelog fragment (the A/B's numbers follow its verdict).
Local: 86/86 (red 0fafa5c30d: exactly the two default expectations failed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): the LaunchAgent must forward the O5 switch (red)
An operator's DARKBLOOM_GEMMA_REOPENED_THOUGHTS (0 or 1) reaches a launchd-managed provider only if the plist carries it; the watchdog never parses. Fails until LaunchAgent forwards the key.
* fix(provider): forward the O5 switch to the launchd provider job
DARKBLOOM_GEMMA_REOPENED_THOUGHTS joins LaunchAgent.inferencePassthroughEnvKeys (not the watchdog's), as #2109 does for its SDK switches, so the operator's 0 or 1 reaches a service Mac too. Placed apart from the other phase-D insertions in the list. Docs and changelog no longer say foreground only.
* test(provider): require the O5 SDK switch on by default
Red until SDKFeatureDefaults lists DARKBLOOM_GEMMA_REOPENED_THOUGHTS: the default projection turns it on, an operator's 0 keeps it off, and the LaunchAgent forwards the operator's value (#2116).
* feat(provider): turn the O5 SDK switch on by default (kill switch: =0)
SDKFeatureDefaults lists DARKBLOOM_GEMMA_REOPENED_THOUGHTS (its own list, so this flip stays one change), so every darkbloom process turns it on unless the operator sets it; =0 (shell or LaunchAgent, forwarded since #2116) restores 0.10.12. Docs: the configuration default and rollback; changelog line. Ships only with its Gemma GPU evidence in its CONFLICTS.md row.
* fix(provider): close UTF-16, tool-call-argument and local-route gaps in the JSON limit
Refactor-pass follow-up to the JSON nesting limit.
- Refuse a body holding a NUL byte. Foundation's JSONSerialization and
JSONDecoder also read UTF-16 and UTF-32 JSON, whose bytes the depth scan
cannot count: a UTF-16 chat body with a 400-level tool schema passed the
scan and still crashed the decoder (SIGBUS on dev). Every UTF-16 or UTF-32
JSON text has a NUL byte; no UTF-8 one does.
- Check each tool call's `arguments` after decoding, on the coordinator path
(refused as `invalid_tool_arguments`) and on the local chat, batch and
Responses paths (400). The body scan skips JSON inside strings, and template
rendering decodes and walks those arguments.
- Cover the SDK's other JSON routes on the local API (completions, tokenizer
utilities, embeddings) with the same 2 MiB collection and check.
- Cleanups from the review: one refusal message constant, `refuses` naming,
shared test builders, a router test, and the deepest accepted body decoding
on a task's stack.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): gate the Qwen default before the pair check, so it merges with #2109
#2109 (via #2099) adds its own line right after the text path's
`servesDistributedPair` check, where this PR's gate was: the same spot, a
merge conflict. The gate now comes just before that check, on both paths
(synchronous and cheap, it also skips the bridge hop for a gated build).
No behaviour change: each check only clears the exit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): pin inherited injections, per-build defaults and the entry order (red)
review prov-2109-d2. New tests, failing by assertion against today's
behaviour (the new API below keeps it):
- MUST-FIX 1: a darkbloom child (DesktopWorker) inherits KEY=1 from its
parent's injection and must not take it for the operator's: no plist
entry, a grandchild still knows, a newer release that drops the key
unsets it, the operator's own value still wins;
- SF2: SDKFeatureDefaults.apply() runs first in main.swift, before every
early branch (the native serving qualification serves a model);
- SF3: per-build MTP defaults (spans, grammar MTP) turn on only for the
listed builds and only when the operator leaves the switch unset;
reasoning budgets follow a per-family default, the release's own
injected 1 is not the operator's; the slot factory applies them.
API added with today's behaviour (no-op / unscoped): SDKFeatureDefaults
.plan, .injectedMarkerKey, .applyMTPDefaults, .matches, .followsDefault,
.summary; NativeReasoningBudget.isEnabled(for:).
* test(provider): width 1, a continuation takes its row's place beside the request that took the slot (red)
The delta review of #2115 (APPROVE WITH NITS; Low): the guard that keeps a
continuation from over-committing beside an exclusive charge reads the
charge's fraction (`>= 1`). On a width-1 profile every ordinary charge is
1, so the continuation is refused beside the request that took its stopped
row's slot: #2115's own failure, back on width-1 Macs. The idle
prefill-evidence recovery (`requiresIdle`) must still keep it out, until
its prompt completes (`reduceExclusiveAllowance`), at any width.
Red (local, 80 tests): exactly the new test fails, at both over-commits
(beside the width-1 charge; after the width-1 recovery's prompt completed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): SDK defaults per build, inherited injections, applied first
review prov-2109-d2:
- MUST-FIX 1: apply() records what it injected in
DARKBLOOM_SDK_DEFAULTS_INJECTED (inherited, never forwarded). A darkbloom
child (the desktop app's DesktopWorker, cluster parts) treats a marked key
whose value is still 1 as unset: its own release list decides it again
and records it as injected, so its LaunchAgent install never persists it;
a release that no longer lists the key unsets it; an operator value wins.
- SF2: main.swift applies the defaults first, before every early branch
(the native serving qualification serves with the shipped defaults).
- SF3: defaults turn on only where they were measured.
DARKBLOOM_CONSTRAINT_SPANS and DARKBLOOM_CBV2_MTP_GRAMMAR are never set
process-wide: the slot factory turns them on in the engine's
CBv2MTPConfig for the listed builds (model_type or model-id part) when the
operator leaves them unset, and logs it; Gemma 4 and Super local MTP keep
the SDK's reading (the operator's value). Reasoning budgets are admitted
per family (NativeReasoningBudget.isEnabled(for:)); with a family listed
the key is set process-wide so every engine accepts budget rows, and the
provider's own 1 does not count as the operator's.
- start/benchmark name the switches and their builds/families; docs describe
operator values as kill switches and the per-build defaults.
All lists stay empty here: no behaviour change until a flip folds.
* test(provider): require the spans SDK default, scoped to its evidence (red)
Red until its flip: SDKFeatureDefaults lists nothing for spans yet.
* feat(provider): turn the spans SDK switch on by default where it was measured
SDKFeatureDefaults lists it (scope in its configuration row and changelog);
an operator value wins everywhere, =0 (shell or LaunchAgent) restores 0.10.12.
Ships only with its hardware evidence in its CONFLICTS.md row.
* test(provider): require the grammar SDK default, scoped to its evidence (red)
Red until its flip: SDKFeatureDefaults lists nothing for grammar yet.
* test(provider): require the o4 SDK default, scoped to its evidence (red)
Red until its flip: SDKFeatureDefaults lists nothing for o4 yet.
* feat(provider): turn the grammar SDK switch on by default where it was measured
SDKFeatureDefaults lists it (scope in its configuration row and changelog);
an operator value wins everywhere, =0 (shell or LaunchAgent) restores 0.10.12.
Ships only with its hardware evidence in its CONFLICTS.md row.
* test(provider): require the o8 SDK default, scoped to its evidence (red)
Red until its flip: SDKFeatureDefaults lists nothing for o8 yet.
* feat(provider): turn the o4 SDK switch on by default where it was measured
SDKFeatureDefaults lists it (scope in its configuration row and changelog);
an operator value wins everywhere, =0 (shell or LaunchAgent) restores 0.10.12.
Ships only with its hardware evidence in its CONFLICTS.md row.
* feat(provider): turn the o8 SDK switch on by default where it was measured
SDKFeatureDefaults lists it (scope in its configuration row and changelog);
an operator value wins everywhere, =0 (shell or LaunchAgent) restores 0.10.12.
Ships only with its hardware evidence in its CONFLICTS.md row.
* fix(provider): the delta review's findings on the continuation's allowance
The delta review of #2115 (APPROVE WITH NITS):
- Low: the over-commit guard read the charge's fraction (`>= 1`), so on a
width-1 profile, whose every ordinary charge is a whole Mac, the
continuation was refused beside the request that took its row's slot:
#2115's own failure. The idle prefill-evidence recovery's charge is now
marked (`Charge.exclusive`, from `requiresIdle`) and cleared when its
prompt completes (`reduceExclusiveAllowance`, at any width); only that
keeps a continuation out.
- The budget's `usedFraction` is capped like `snapshot`'s (only tests read
it; the wire value comes from `snapshot`, `ProviderLoop+Capacity.swift`).
- `shutdown()` awaits every live pump task (`EngineV2Bridge+Lifecycle`), so
the test's release check is deterministic as written.
- #2115's changelog text moves into its own fragment
(`loop-guard-exit-thinking-allowance.md`): #2100's fragment goes back to
its own text, so this PR merges cleanly onto a candidate whose Prepare has
rendered and deleted #2100's.
Local: 80/80 (red dd92fa8e12: exactly the new width-1 test failed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(changelog): keep #2100's fragment as phase C rendered it
Phase C folded #2100 at `2e241534b5`, and its Prepare rendered and deleted
that commit's fragment. #2100's later fragment edit (the engine evicts an
ordinary running request before a continuation) and this PR's text now
live in this PR's own fragment (`loop-guard-exit-thinking-allowance.md`),
so it merges cleanly onto the prepared candidate as well as in a re-fold.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): any list keeps Qwen's exit to proven builds; strict-tool rows keep their length (red)
The fresh-context review of #2125 (REQUEST CHANGES):
- M1: the per-build default applied only when the list equalled the
default set. The docs' own `…,nemotron_h_omni` recipe (the default list
plus Super) then turned Qwen's exit on for Qwen 3.6 and both Qwen 3.8 27B
builds, which the A/B does not cover. The serving test now serves that
list: the 35B answers, Qwen 3.6 and Qwen 3.8 27B keep `length`; a list
that names a build by a part of its id (`Qwen3.6`, `qwen3.8-27b`) turns
it on. The Qwen 3.6 tests name their build (`qwenOn`).
- L1: a row the strict-tool grammar constrains (the 35B takes it by
default) carried the exit, and the continuation is submitted without the
grammar, so its call could miss the schema. The guard policy test: such
a row keeps its guard but not the exit.
Red (local, 87 tests): exactly these two tests fail.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(cluster): show the other Mac's pairing posture as reported, not verified
`ClusterPairingProvider.verifyAttestation` checks that the other Mac's
attestation is signed by the identity key it pairs with, binds this
ceremony's ephemeral key and is fresh. The signing key comes from the same
blob, so this proves possession of the key, not that a Secure Enclave holds
it: a software P-256 key passes with any claimed posture. The posture gates
nothing (it is shown, persisted and never read back), but
`darkbloom cluster pair` stated the other Mac's SIP, Secure Boot and
sealed-volume status and a "Secure Enclave key pin" as facts.
- Add `ClusterPairingTerminal.reportedPosture`, used by the pairing screen
and the onboarding pairing event, which marks the posture "reported by the
other Mac, not verified", and call the other Mac's pin a key pin. This
Mac's own line still names its Secure Enclave key, which it knows.
- Say what is and is not verified in `ClusterPairingProvider`,
`ClusterPairingPeerPosture` and the encryption architecture doc.
Binding the key to Apple hardware (for example App Attest over the ceremony
transcript) is a separate feature.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(cluster): stop calling the other Mac's paired key a Secure Enclave key
Refactor-pass follow-up. The "Paired" summary, the setup wizard and the
ceremony's proof-failure message still described the other Mac's key as a
Secure Enclave key, which pairing cannot know. They now say the key it pairs
with (or proved it holds); this Mac's statements about its own key are
unchanged. Docs and the changelog describe only what is shown: onboarding
drops the peer lines and shows the code alone, so only `cluster pair` and
the setup wizard show the reported posture. `verifyAttestation`'s doc says
`secureEnclaveAvailable` is the other Mac's own claim.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): exact builds, grammar rides on spans, trusted markers, deadline gate (red)
review prov-2109-d4 (APPROVE WITH NITS), tests first, failing by assertion
against today's behaviour (API reshaped, behaviour kept):
- SF1: a per-build default reaches only the exact model id it was measured
on (no 8-bit / fine-tune / local-path substring matches);
- SF2: grammar MTP's default applies only where constraint spans are on
(the measured combination);
- SF3: the deadline-profile gate accepts the release's own injected
defaults and the marker, still refusing operator values;
- NIT 5/6: a marker is trusted only for keys the provider injects, and the
marker alone identifies an injected value;
- NIT 7: an operator value in the process environment wins over a slot
environment that lacks it.
* fix(provider): Qwen's exit keeps to proven builds under any list; strict-tool rows keep their length
The fresh-context review of #2125 (REQUEST CHANGES):
- M1: the build table (`provenBuilds`, was `defaultBuilds`) applies in
every list, not only when a list equals the default set. Another build
of a Qwen family takes the exit only when the list names it by a
case-insensitive part of its id (`qwen3.6`, `qwen3.8-27b`), as
`QwenStrictToolGrammar`'s lists do (`keepsLength`, was
`keepsLengthByDefault`). The docs' `…,nemotron_h_omni` recipe therefore
never turns Qwen's exit on for an unproven build.
- L1: a row the strict-tool grammar constrains keeps its guard but not the
exit (`GenerationLoopGuardPolicy.resolve`): the continuation is submitted
without the grammar, so its call could miss the schema.
- N1: the guard-only serving suite pins `exitThinkingSetting = .off`, so a
runner's DARKBLOOM_LOOP_EXIT_THINKING cannot change it.
- N3/N4: the list test checks content, errors and the guard's telemetry;
the changelog names every other build and the strict-tool rows.
- L2: the media path's gate stays, unreachable by Qwen today (its media
prompts carry M-RoPE positions, so no exit resolves there); it keeps the
rule true if that changes.
Local: 87/87 (red 5eccf91bf9: exactly the two new tests failed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): exact builds, grammar with spans, trusted markers, deadline gate
review prov-2109-d4 (APPROVE WITH NITS):
- SF1: per-build defaults match exact model ids (lowercased), never another
quantization, a fine-tune or a local path;
- SF2: grammar MTP's default applies only where constraint spans are on,
the combination that was measured;
- SF3: DeadlineRuntimeEnvironment accepts the marker and the release's own
injected defaults (profiles are pinned to the provider version), still
refusing operator values;
- NIT 5/6: the marker is trusted only for injectable keys, and identifies an
injected value on its own (isInjected), so NativeReasoningBudget and the
deadline gate agree in any process;
- NIT 7: a switch counts as unset only if unset in the slot's environment
and in the process's (what the SDK read);
- NIT 4/10: docs no longer call the switches opt-ins where a flip would
make that wrong; changelog fragments for the mechanism and for
grammar-aware MTP (opt-in until its flip).
* docs(provider): the second delta review's nits on the continuation's allowance
The fresh-context delta review of #2115 (APPROVE WITH NITS):
- A comment at the over-commit guard: at width 1 a continuation shares the
Mac with a whole-Mac charge, so that charge's sole-occupancy measurements
rely on their overlap tracking from then on (the join invalidates the
evidence guards).
- The changelog fragment: a heading that covers both bullets (the
allowance; #2100's priority in the engine's eviction order, which phase
C's rendered entry lacks), the switch as its own bullet, and no internal
machine name.
No code change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): require the spans SDK default, scoped to its evidence (red)
Red until its flip: SDKFeatureDefaults lists nothing for spans yet.
* test(provider): require the grammar SDK default, scoped to its evidence (red)
Red until its flip: SDKFeatureDefaults lists nothing for grammar yet.
* feat(provider): turn the spans SDK switch on by default where it was measured
SDKFeatureDefaults lists it (scope in its configuration row and changelog);
an operator value wins everywhere, =0 (shell or LaunchAgent) restores 0.10.12.
Ships only with its hardware evidence in its CONFLICTS.md row.
* feat(provider): turn the grammar SDK switch on by default where it was measured
SDKFeatureDefaults lists it (scope in its configuration row and changelog);
an operator value wins everywhere, =0 (shell or LaunchAgent) restores 0.10.12.
Ships only with its hardware evidence in its CONFLICTS.md row.
* test(provider): require the o4 SDK default, scoped to its evidence (red)
Red until its flip: SDKFeatureDefaults lists nothing for o4 yet.
* test(provider): require the o8 SDK default, scoped to its evidence (red)
Red until its flip: SDKFeatureDefaults lists nothing for o8 yet.
* feat(provider): turn the o4 SDK switch on by default where it was measured
SDKFeatureDefaults lists it (scope in its configuration row and changelog);
an operator value wins everywhere, =0 (shell or LaunchAgent) restores 0.10.12.
Ships only with its hardware evidence in its CONFLICTS.md row.
* feat(provider): turn the o8 SDK switch on by default where it was measured
SDKFeatureDefaults lists it (scope in its configuration row and changelog);
an operator value wins everywhere, =0 (shell or LaunchAgent) restores 0.10.12.
Ships only with its hardware evidence in its CONFLICTS.md row.
* test(provider): Super concurrent images' kill switch is forwarded and parsed like the others
Delta review nit (review-2094-on.md): no test asserted the key on LaunchAgent.inferencePassthroughEnvKeys; the off words and empty values are now checked beside GPTOSSForcedToolConstraint.isEnabled's. Test only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): name GPTOSSForcedToolCalls correctly in the kill-switch test
19893d8135 referred to the type as GPTOSSForcedToolConstraint (its file's name); the enum is GPTOSSForcedToolCalls. Test only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): check /apply-template tool-call arguments and test the NUL rule itself
Review follow-up. /apply-template renders its messages' tool calls, decoding each one's arguments, so its body is now decoded and its arguments checked like the chat path. The UTF-16/32 test now holds an escaped quote, so only the NUL rule (not the depth count) can refuse it, and it no longer decodes a body the scan let through. Router comments and the direct-mode doc match what is checked where.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): list entries shaped like a model_type name no Qwen build (red)
The delta review of #2125 (APPROVE WITH NITS), L1: any list entry that is
not a marker family counts as an id part, so `qwen3` (a real model_type),
`qwen`, `mtp` or `4bit`, each part of most catalog ids, would turn Qwen's
exit on for Qwen 3.6 and both Qwen 3.8 27B builds. The policy test: such
entries name no build. Also pinned: a named build without its family stays
off (N1); the default serving test serves the 9B MTP build too (N3); the
wording of `qwenOn`, the docs' "named" Qwen 3.6/3.8 and "its family listed
too" (N1, N4).
Red (local, 88 tests): exactly the policy test fails, at the generic list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): only an id-shaped list entry names a Qwen build
The delta review of #2125 (APPROVE WITH NITS), L1: `keepsLength` counts a
list entry as an id part only when it is shaped like an id (a `.`, `-` or
`/`), never like a `model_type`, so `qwen3`, `mtp` or `4bit` name no build.
The doc comment also says the family must be listed too (N1).
Not changed (N2): the scheduler still opens the splice from its local exit
on a strict-tool row; the guard carries no exit there, so the held `length`
is delivered, as for a loop in the answer (the review verified it).
Local: 88/88 (red 0be4ccd4a9: exactly the policy test failed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(provider): the start line's grammar scope, plist skips marked defaults (red)
review prov-2109-d5 NITs 1, 4, 5 (APPROVE WITH NITS, no must/should-fix):
the start line qualifies grammar MTP's default (it rides on constraint
spans); LaunchAgent.passthroughEnvironment knows a marked value is the
release's even before the process records it; the grammar-with-spans tests
build their configs explicitly (hermetic against a lane's environment).
summary gains an internal overload taking the lists (public default
arguments may reference public declarations only).
* fix(provider): qualify the grammar default on the start line; plist skips marked values
review prov-2109-d5 NITs 1 and 4: the start/benchmark line says grammar
MTP's default applies where constraint spans are on; the LaunchAgent's
passthrough treats a marked value as the release's (isInjected), like
NativeReasoningBudget and the deadline gate.
* test(provider): require the spans SDK default, scoped to its evidence (red)
Red until its flip: SDKFeatureDefaults lists nothing for spans yet.
* feat(provider): turn the spans SDK switch on by default where it was measured
SDKFeatureDefaults lists it (scope in its configuration row and changelog);
an operator value wins everywhere, =0 (shell or LaunchAgent) restores 0.10.12.
Ships only with its hardware evidence in its CONFLICTS.md row.
* test(provider): require the grammar SDK default, scoped to its evidence (red)
Red until its flip: SDKFeatureDefaults lists nothing for grammar yet.
* test(provider): require the o4 SDK default, scoped to its evidence (red)
Red until its flip: SDKFeatureDefaults lists nothing for o4 yet.
* feat(provider): turn the grammar SDK switch on by default where it was measured
SDKFeatureDefaults lists it (scope in its configuration row and changelog);
an operator value wins everywhere, =0 (shell or LaunchAgent) restores 0.10.12.
Ships only with its hardware evidence in its CONFLICTS.md row.
* feat(provider): turn the o4 SDK switch on by default where it was measured
SDKFeatureDefaults lists it (scope in its configuration row and changelog);
an operator value wins everywhere, =0 (shell or LaunchAgent) restores 0.10.12.
Ships only with its hardware evidence in its CONFLICTS.md row.
* test(provider): require the o8 SDK default, scoped to its evidence (red)
Red until its flip: SDKFeatureDefaults lists nothing for o8 yet.
* feat(provider): turn the o8 SDK switch on by default where it was measured
SDKFeatureDefaults lists it (scope in its configuration row and changelog);
an operator value wins everywhere, =0 (shell or LaunchAgent) restores 0.10.12.
Ships only with its hardware evidence in its CONFLICTS.md row.
* test(provider): the delta review's nits on naming a Qwen build
The second delta review of #2125 (APPROVE WITH NITS):
- N2: an id part with only `-` (`35b-a3b-vl`) and one with only `/`
(`EigenLabs/`) each name their build; the generic list (`qwen3`, `qwen`,
`mtp`, `4bit`) also leaves Qwen 3.6 at `length`.
- N1/N3: the doc comment and the docs say that a punctuated part such as
`-4bit` names every build that contains it, and how this differs from
`QwenStrictToolGrammar`'s lists (which take any part).
No behaviour change. Local: 88/88. (Pushed with the A/B's verdict.)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(provider): pin mlx-swift-lm to SDK main f41a5f9a (#416, #417, #418); GLM JSON grammar delta-review nits
The gitlink moves from #417's branch commit 5b66768a to SDK main's merge
commit f41a5f9a (#416 -> #417 -> #418). Since 5b66768a, GLM's path changed
only in comments (CBv2NativeShutdownOutcome, EngineLoopV2) and tests; the
rest is #418's Gemma reopened-thought parsing and #414's CI routing.
From the delta review (APPROVE WITH NITS): the GLM serving test runs with
recordsWithheldOutput as production does, pins the cut policy and asserts
the length finish and a single withheld content delta; the test guide's
command selects the GLM suites; the docs say GLM's two-row drafting limit
is the default rectangular profile's (one row on the serial profile), cite
EngineLoopV2 for the no-chaining rule, and read better.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(provider): pin the SDK to mlx-swift-lm main f41a5f9af3 (#416 + #417 + #418)
The final phase-D SDK pin F: SDK main after the owner merged #416 (the
cumulative SDK this branch pinned at eaed116569, plus main's #414 CI map),
#417 (STRUCTURED: GLM native token constraints) and #418 (AUDIO-407's #407
Gemma reopened-thought conformance), each as a signed merge commit on green.
F's tree equals #418's head tree. eaed116569 and the candidate's pin
859f641529 are both ancestors of F.
SDK library changes since eaed116569 touch only native-tracked engines
(GLM constraint admission; constrained chaining stays off there), Gemma's
reasoning parser behind DARKBLOOM_GEMMA_REOPENED_THOUGHTS (default off) and
a visibility-only GemmaToolFrameScanner change: none of the paths this
branch's switches use (Qwen MTP spans / grammar on untracked engines, the
Gemma argument parser, Super / MiMo reasoning budgets).
* Re-pin the SDK to F: mlx-swift-lm main f41a5f9af3 (#418's merge)
F = SDK main after #416, #417 and #418 (signed merge commits); its tree
2449971832 equals the previous pin 16aebe836a's, so the SDK content is
unchanged. Gitlink only.
* test(provider): require the O5 SDK default in #2109's new shape (red)
Red until SDKFeatureDefaults lists DARKBLOOM_GEMMA_REOPENED_THOUGHTS process-wide and trusts it as injectable: plan() sets it when unset, an operator's 0 stays the kill switch, an injected 1 is never written into a service plist, and an operator's 0 is forwarded.
* feat(provider): turn the O5 SDK switch on by default (kill switch: =0), in #2109's shape
SDKFeatureDefaults: DARKBLOOM_GEMMA_REOPENED_THOUGHTS is a process-wide parser switch with no per-model hook, so it joins onByDefault (its own list, gemmaReopenedThoughts) and injectableKeys (a parent's injection is trusted, never persisted). =0 (darkbloom start re-installs the plist; foreground =0) restores 0.10.12. The #2116 forwarding test now passes injected: [] explicitly. Docs (review of #2127): the configuration default, the service-Mac rollback, the four ordinary-output deltas of the shared state machine (inference.md, changelog), no opt-in wording left. Ships only with its Gemma GPU evidence in #2116's CONFLICTS.md row.
* test(provider): require MiMo reasoning budgets on by default too (red)
Pre-staged: folds only if MiMo is measured in its ON state on Mac B
(budgets 16/128/512 + controls + a pair, off vs on), instead of #2121.
* feat(provider): admit MiMo reasoning budgets by default as well
reasoningBudgetFamilies = [.nemotronSuper, .mimoV26]; docs row and changelog.
Folds only with MiMo's ON-state evidence (instead of #2121).
* Undo "Prepare provider 0.10.13" to fold 2040@03826b100a 2042@09ba436cdc 2047@b55ae64d6a 2051@98a9cded8c 2050@f10799abc1 2048@a849c562bf 2049@15f7d676e9 2052@0d2ec9ebfc 2053@42d9add895 2054@854c1ad495 2046@b4cc61883c 2057@220be61dd4 2058@4c5d7d9823 2063@1815e0773e 2065@585133d832 2045@8d7a6b51bd 2072@1542c6357e 2060@5a94d61d60 2061@1a8734918c 2070@dfb14ce00d 2069@5b4d5bc087 2071@3ce6f5cfdb 2075@b6c797c324 2084@7af346143c 2096@7e9378ad65 2088@001996379f 2100@2e241534b5 2098@d76366162a 2115@69c44ecbfa 2101@acd07059b9 2091@485b0ca973 2092@8bb36c450a 2093@191a07c790 2094@e79d22259c 2089@be1148a798 (it is redone on top)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fold fixes for provider 0.10.13
- changelog.d/native-reasoning-budget.md: topic heading
- changelog.d/qwen-forced-tool-thinking.md: topic heading
- changelog.d/gptoss-commentary-content.md: topic heading
- changelog.d/qwen-stray-think-close.md: topic heading
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Prepare provider 0.10.13
Version 0.10.13; the 39 changelog.d fragments rendered into CHANGELOG.md
(scripts/changelog.py render --version 0.10.13 --date 2026-11-14, verbatim, in
filename order) under the candidate heading, with the upgrade and rollout
notes; v0.10.12 marked published (2026-11-12); the 0.10.13 section of
docs/operations/provider-release.md. Base: master 1b02e28542 (the 0.10.13 release branch's squash).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): bound coordinator requests waiting for admission
`CoordinatorClient` decodes each `inference_request`'s ciphertext and yields
it into an unbounded event stream; the connection reader forwards it into an
unbounded work stream, where it waits for the work FIFO. The coordinator
keeps at most a provider's width pending, but while admission is stalled
behind a serial model load, requests that expire or are cancelled and
retried keep arriving and stay buffered, each up to a 16 MiB body.
The connection reader now charges each request's ciphertext against a
budget (64 requests, 512 MiB) when it reads it (`queueCoordinatorAdmission`),
and the admission returns the charge (`admitInWorkFIFO(requestId:queuedBytes:)`).
A request past the budget is refused on arrival, never queued, as
`refuseInferenceBeforeDispatch` refuses: `queue_full` on a capacity 429, the
status the engine's own queue-full refusal uses, with its service
reservation released. The coordinator retries it elsewhere and counts it as
a capacity reject, unlike `draining`. The reader never waits for room, so
cancels, attestation challenges and trust updates keep flowing (blocking it,
as first proposed, would let the link's liveness check drop the session).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Undo "Prepare provider 0.10.13" to fold 2040@03826b100a 2042@09ba436cdc 2047@b55ae64d6a 2051@98a9cded8c 2050@f10799abc1 2048@a849c562bf 2049@15f7d676e9 2052@0d2ec9ebfc 2053@42d9add895 2054@854c1ad495 2046@b4cc61883c 2057@220be61dd4 2058@4c5d7d9823 2063@1815e0773e 2065@585133d832 2045@8d7a6b51bd 2072@1542c6357e 2060@5a94d61d60 2061@1a8734918c 2070@dfb14ce00d 2069@5b4d5bc087 2071@3ce6f5cfdb 2075@b6c797c324 2084@7af346143c 2096@7e9378ad65 2088@001996379f 2100@2e241534b5 2098@d76366162a 2115@69c44ecbfa 2101@acd07059b9 2118@42e71bb950 2119@c68d19d634 2120@097047d70c 2091@485b0ca973 2092@8bb36c450a 2093@191a07c790 2094@e87386bb2e 2089@be1148a798 (it is redone on top)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Prepare provider 0.10.13
Version 0.10.13; the 39 changelog.d fragments rendered into CHANGELOG.md
(scripts/changelog.py render --version 0.10.13 --date 2026-11-14, verbatim, in
filename order) under the candidate heading, with the upgrade and rollout
notes; v0.10.12 marked published (2026-11-12); the 0.10.13 section of
docs/operations/provider-release.md. Base: master 7e30bf50e3 (the 0.10.13 release branch's squash).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(provider): free TOMLKit's parse trees with a vendored copy (finding 271)
A paired cluster leader can make the other Mac parse its provider.toml
again with each setup it sends (ClusterConfigurationStore
.updatingProviderData), and TOMLKit 0.6.0 frees nothing it allocates:
not the C++ tree a parse builds, not the nodes it makes for Swift
values, not the malloc'ed buffers its value reads and conversions
return. Every parse anywhere in the provider stayed in memory for the
life of the process, 60-78 KB a call for a few-KB provider.toml.
0.6.0 is the latest TOMLKit release and upstream main frees nothing
either, so there is no release to move to. libs/TOMLKit now holds
TOMLKit 0.6.0 (toml++ v3.4.0, unmodified) with the smallest ownership
change, and provider-swift builds it as a local package:
- TOMLNodeOwner owns one root the bridge allocated and deletes it with
the new nodeDelete. Every TOMLTable, TOMLArray and TOMLValue holds the
owner of its node's tree and nested wrappers share their root's, so
no node inside a tree is deleted on its own and a value read from a
table outlives the table, as before.
- The bridge's malloc'ed buffers (value reads, keys, values, convert,
debug descriptions, a parse error's description) are freed once Swift
has copied them; the new dateTimeFree frees a date-time with its
offset.
- TOMLDateTime hands its offset to the bridge from call-scoped storage
instead of allocating it.
The public API and TOMLKit's parsi…
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qwen 3.5, 3.6 and 3.8 parse tool calls after the thinking (0.10.13)
Problem (CONFORMANCE §2, reproduced on CPU with the 0.10.12 output path): on Qwen 3.8 27B, Qwen 3.5 9B
(
qwen3_5), Qwen 3.6 35B VL and Qwen 3.5 35B (qwen3_5_moe), the provider parsed tool calls before it split thethinking off. The tool handler scanned the raw output, thinking included; the service's think parser then split
reasoning from whatever text the handler let through.
<tool_call>once ("I should wrap it in<tool_call>tags.") opens a frame at themention that swallows the real call after
</think>: the call reaches the client ascontentXML, notool_calls,finish_reasonstop. Qwen's own tool system prompt spells the tag twice, which thoughts echo.runs although the answer is text; with
parallel_tool_calls: falsethe turn fails 422).That hits tool-call validity (OpenRouter's Tool Call Error Rate and 2-hour success; the 9B is deranked at 93.1 %) and
Tau2.
Fix: a text request with tools on these builds takes the native split that Bonsai 2, Nemotron 3.5 Lightning, MiMo
and Qwen4 already use.
MultiModelBatchSchedulerEngine.prepareCompletionhandsNativeToolStreamRouterthe prompt'sown think state as its native prefix: the
reasoningPrefixseed (ReasoningPromptProbe:<think>when the promptopens a thought,
<think></think>when thinking is off) that would otherwise seed the downstream think parser.NativeChannelSplitterclassifies reasoning first; only content reaches the tool handler; tool frames in content areopaque (
protectToolFrames,qwenStructuredFrames), so a<think>inside an argument stays an argument.ToolChoiceEnforcementPolicy.splitsQwenReasoningBeforeTools(qwen3_5,qwen3_5_moe, trimmed andlowercased like
Qwen35TemplateFix.applies), taken only with the Qwen tool parser (.qwen35, the default). Theprefix choice is now one
if/else ifchain (behavior-preserving for MiMo, JSON answers, the native and GLMfamilies).
NativeChannelSplitter.promotesTrailingCalls, onfor this route only). Qwen 3.5 sometimes calls from inside its thought without writing
</think>(vLLM #35687,llama.cpp #20837); the raw route served those calls. If the output ends while the thought is open and the thought
ends in complete
<tool_call>frames (whitespace aside), those frames also leave as content at the end of theoutput and parse as calls. Frames are read left to right as the Qwen parser frames content: one opens on a
<tool_call>whose payload starts a call (<function=NAME>and then a parameter or the close, or a JSON objectwith a key,
}or the redundant outer brace the JSON parser accepts; a mention followed by prose is rejected there,at no cost), ends where
Qwen35ToolFrameScannerends it (a tag inside an argument is not a frame), and counts onlyif
Qwen35ToolCallParserparses it with a declared name (an echoed template example stays reasoning). A mentionthat reaches its first
<parameter=cannot be told from a call whose argument spells the tags (as on the rawroute), and a frame that never closes holds the rest of the thought. Only the run of frames at the very end counts:
a frame followed by more thought or by
</think>stays reasoning, and so does an earlier call that text separatesfrom the last ones. A thought the token limit cut off promotes nothing
(
NativeToolStreamRouter.outputReachedTokenLimit, called when the engine stops atlength). The search is boundedby a fixed multiple of the thought's length; past that bound nothing is promoted.
usesNativeTextChannels(it also gatesToolStreamPreparation.exposesCallsWhileGenerated, soautocalls still stream as
tool_callsdeltas while generated);nativeStructuredTarget(forced-call strategy,advertisement, and the thinking-off rule for forced calls); requests without tools; another requested
tool_call_parser; an explicit non-thinkreasoning_parser; a prompt whose think state the probe cannot read on thecoordinator path (no seed: raw route as before); media requests (Qwen 3.6 media has no tool handler); every other
family.
inference.mdand the changelog):required/named) still run with thinking off; a stray<think>…</think>the model writes before thecall is now
reasoning_contentinstead of a 422, and so is a stray thought that never closes and ends in thecall, which is then the call (a 422 before);
stays in
reasoning_content;second real call cannot be told apart; the raw route ran both);
</think>ends it, even inside a drafted call's arguments, as on every native family;stream: false) local API response carries content and reasoning untrimmed, as the streamed onedoes: a call's message keeps the
\n\nafter</think>as its content, and a collected Responsesoutputhas itas a message item before the calls (the coordinator path always streams, so it is unaffected).
Tests (red first):
QwenReasoningBeforeToolsTestsdrives the production text path end to end: a scripted enginerow, the real
EngineV2Bridge, the scheduler, andMLXOpenAIService's streamed SSE frames (the coordinator relay'spath) and collected response.
4 builds × 41 output cases × deltas whole / one character each / threes / cut in the middle of every
<think>,</think>,<tool_call>,</tool_call>,<function=,</function>; streamed and collected.backticks / with
<function=…>, a drafted call then the real one, a call written only in the thought, a draftedcall in a thought cut off by
length) and around it: two calls after a mention,parallel_tool_calls: falsewitha drafted call, a call in a thought that closes with nothing after it, a drafted call in an unclosed thought
followed by more thought, a call at the end of a thought cut off by
length(also a stray one with thinking off),a mention that opens like a call before a call in an unclosed thought, a stray thought that mentions the tag
before a call with thinking off and with
required, arequiredcall at the end of a stray unclosed thought, twocalls on their own lines at the end of an unclosed thought (the raw route sent the newline between them as
reasoning after the first call), and the trade-off (two calls with text between them in an unclosed thought: the
last one).
<function=…>/ only</tool_call>/ both tags mentioned, a text answer after a mention, one or two calls (backto back; XML or a JSON-dialect call whose arguments spell
</tool_call>,<tool_call>and<think>) at the endof an unclosed thought, the same with thinking off after a stray
<think>, a lone tag in an unclosed thought, andreasoning_parser: nonekeeping the raw route.</tool_call>,</think>and<think>, a second thought after an answer, thinking off (a call, a stray thought, a stray</think>),requiredand named calls.before call frames, and
autocalls generated after the thought still leaving in more than onetool_callsfragment.
Differential tests (the forwarder alone, raw route vs split, at every chunking): for the clean outputs, byte-identical
content, reasoning, calls and finish reason (
stoporlength); for calls at the end of an unclosed thought, thesame calls, content and finish reason, with the whole thought as the split's reasoning.
The splitter's trailing-call rule at every chunking (complete frames that parse with a declared name; never a
mention, also thousands that open like a call, a frame with more thought or text after it, a tag inside an argument,
an undeclared template example or an unfinished frame; a mention that reaches its first parameter, pinned; only
while the thought is open; not after a
lengthstop; off by default; bounded on a degenerate output), and thepredicate's scope (the four builds; not Qwen3-VL,
qwen3_next, Bonsai, Qwen4, GLM, MiMo, Gemma, GPT-OSS).ClusterAPIParityTests.streamRejectedMidGenerationEndsWithTheSingleMacFailureFrameBeforeRetirementnow rejects theplain script's text answer: on Qwen a thought before the named call is reasoning now, not a violation.
Red on
dev(local, trimmed package: the four production files atdev, the test file at220be61dd4without the scope and splitter unit tests, which use the new API): 2 test functions fail.
clientReceivesTheRealCallsOnlyfails on 72 of its 164 build × case argument sets, exactly the 18 differing caseson all 4 builds; the 13 clean and 10 unchanged cases pass.
callsFromAnUnclosedThoughtMatchTheRawRoutefails 4/4(no promotion on
dev). The clean differential passes 13/13. Green with the fix: all 5 test functions pass, 0issues. CI on
220be61dd4: green (provider build, both unit-test shards,Provider Tests).The failing cases on
devclientReceivesTheRealCallsOnly, each on all 4 builds:<tool_call> and <function=…> mentioned, then the call;a call at the end of a thought cut off by the token limit;a call drafted in a thought cut off by the token limit;a call drafted in a thought that never closes, then more thought;a call drafted in the thought, then the real call;a call written in a thought that closes, with nothing after it;a call written only in the thought, then a text answer;a lone <tool_call> mentioned in the thought, then the call;a mention that opens like a call, then a call, in a thought that never closes;parallel_tool_calls false: a call drafted in the thought, then the real call;required: a stray thought that mentions the tag, then the call;required: a stray thought that never closes and ends in the call;the tag mentioned in backticks, then the call;thinking off: a call at the end of a stray thought cut off by the token limit;thinking off: a stray thought that mentions the tag, then the call;two calls after a lone mentioned tag;two calls on their own lines at the end of a thought that never closes: no reasoning between them;two calls with text between them in a thought that never closes: the last one.callsFromAnUnclosedThoughtMatchTheRawRoute: the 4 unclosed-thought cases of the unchanged set.GPU check (Mac A, before vs after; Qwen 3.8 27B
EigenLabs/Qwen3.8-27B-4bit-mtp2026-09-03-r1, the storere-hashed against its manifest before each arm). Before: the signed 0.10.12 app (darkbloom
3c0c5ff0…, metallib5b97893c…), run in place in an APFS clone. After: this branch's release build5b09b9b680(darkbloom1b0e3d5e…)in a clone of the same bundle (same metallib). The last commit,
220be61dd4, only widens the trailing-callpre-check, which no output here reached (no thought ended unclosed with frames). Same sandboxed throwaway home, MTP
on, paged KV, T 0, 8 concurrent streamed requests (the coordinator relay's path); before 06:05–06:14Z, after
06:51–07:01Z.
d01,d05,d07): the thought echoes "draft the complete<tool_call>block", and 0.10.12 returns thereal call as
contentXML withfinish_reason: stop. The fix returns the call.inside its thinking (17 in one "show me the call, don't run it" turn, then 2, 1, 1, 1). The fix keeps those frames
in
reasoning_contentand runs none of them. 66 − 22 + 3 = 47 calls.turns where both arms generated the same text, the calls are identical (34/34); the other 13 differ in the
generation itself (0.10.12 vs 0.10.13
dev, 8 concurrent requests at T 0).thought on a lone call, or hit
lengththere, so the trailing-call rule and its exceptions occurred 0 times.answer still runs (content parsing is unchanged).
"show, don't call", parallel calls, a second turn after a tool result. Kit:
gpu/arm.sh,analyze.py.Review: independent fresh-context reviews.
APPROVE WITH NITS, no blockers): confirmed the equivalence for clean output, the streaming and TTFTbehavior, the gating and the interactions (loop-guard exit, stop strings, pairs, Responses). Its nits are addressed
in
e088fb49e8: the readable prefix chain, the normalized predicate, the docs and changelog wording, more tests.REQUEST CHANGES): the split dropped a call written at the end of a thought that never closes, which theraw route served (a known Qwen 3.5 habit). Addressed in
dd5a4f3c10(the trailing-call rule above), with thegating to the
.qwen35parser, the collected-response shapes documented, the test relabelling (cases the raw routealready got right are no longer counted as fix cases) and the differential test's
lengthfinish.APPROVE WITH NITS): addressed infda30287e0: frames must parse (a mention that opens like a call nolonger swallows the real one), one bounded pass instead of a rescan per frame, no promotion after a
lengthstop,the docs and changelog (timing, the text in
reasoning_content, the trade-off), and the tests above. Not done: anend-to-end case for
parallel_tool_calls: falsewith two promoted frames (a 422, as on the raw route; the harnesshas no failure cases) and for
/v1/responses; holding a promoted call's text out ofreasoning_content(afollow-up).
APPROVE WITH NITS; nothing worse than 0.10.12): addressed in5b09b9b680: a mention is rejected at itsprose before any scan, so a few early mentions can no longer spend the search budget (which is also larger, still
linear); frames must parse with the request's declared tools; the docs say what a mention can and cannot do, and
that an unclosed frame holds the rest of the thought; tests for each.
APPROVE WITH NITS): addressed in220be61dd4: the pre-check rejected the redundant-brace JSON call(
{{…}}}}) that the parser accepts; its comment. Left as a follow-up: stopping a candidate that passes thepre-check at its first malformed byte (today such candidates cost up to 3× the thought each, bounded; about six
of them early in one thought spend the budget, and then nothing is promoted, documented).
APPROVE WITH NITS, on220be61dd4, the final head): no blockers; none of the open items should block0.10.13. Its nits: the red/green labels (fixed above) and an optional end-to-end redundant-brace case.
templateAdditionalContext(
+Translation.swift), which belongs to CONFORMANCE-FIX's forced-call PR; a content-free counter for calls inunclosed thoughts (a telemetry contract change; the GPU check measures how often it happens).
Overlap with other open work: none in the same lines;
git merge-treeis clean with #2041, #2045, #2046, #2047,#2048, #2049, #2050, #2051, #2052, #2053, #2054, #2055, #2058 and #2059, and the 0.10.13 fold order (#2047 → #2051 →
#2050 → #2048 → #2049 → #2059 → #2054 → #2046 → #2055 → this) merges cleanly.
ToolChoiceEnforcementPolicy.swift(other functions) anddocs/architecture/inference.md(other sections).</think>): a repeating Qwen thought ends in an answer #2046 (exit-thinking for Qwen) splices\n</think>\n\ninto the same stream; the split handles it as the model's ownclose.
parallel_tool_calls: falsereturns the first call instead of failing mid-stream (0.10.13) #2049, fix(provider): a stray <tool_call> no longer fails a GLM-5.3-Flash response with a 500 (0.10.13) #2052 and 0.10.13: an answer cut at max_tokens ends as length; a strict call after the start returns as generated (LOW-GRADE §5 1–2) #2053 also editNativeToolStreamRouter.swift, and fix(provider):parallel_tool_calls: falsereturns the first call instead of failing mid-stream (0.10.13) #2049, fix(provider): a stray <tool_call> no longer fails a GLM-5.3-Flash response with a 500 (0.10.13) #2052, 0.10.13: an answer cut at max_tokens ends as length; a strict call after the start returns as generated (LOW-GRADE §5 1–2) #2053 and 0.10.13: the loop guard and Gemma's exit-thinking cover image and video requests #2054MultiModelBatchSchedulerEngine.swift(other hunks). Promoted frames reach the router as content fromNativeChannelSplitter.finish()insidefinishText, so in the fold they meet fix(provider):parallel_tool_calls: falsereturns the first call instead of failing mid-stream (0.10.13) #2049's later-call filter and 0.10.13: an answer cut at max_tokens ends as length; a strict call after the start returns as generated (LOW-GRADE §5 1–2) #2053'scutAtLimitlike any content flushed at the end (no promotion happens after alengthstop).ToolConstraintFactory.makecall inprepareCompletion; it needs the closed think block, so forced calls keep thinking off here. CONFORMANCE-FIX (Add hypervisor memory isolation for inference workloads #6,forced-call thinking) may later key on
splitsQwenReasoningBeforeTools. Coordinated inearnings/CAPTESTS.md.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.