Skip to content

Provider: a refused request's inference_error frame names its reason - #2016

Merged
jonathan308 merged 344 commits into
devfrom
fix/refusal-reason-on-error-frame
Nov 12, 2026
Merged

jonathan308 merged 344 commits into
devfrom
fix/refusal-reason-on-error-frame

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Draft for the 0.10.12 fold (FOLD-A §1). Stacked on #1970 (0e6ac37885, Prepare provider 0.10.12): the diff against dev includes #1970 until it lands; this PR's own commits are the last 2+.

Why

A Mac answers a malformed request with 400 "Invalid inference request." and never says why. OR-REFUSALS §1: OpenRouter's Qwen 3.6 tool conversations (141 × 400 on 11-11, 4,280 on 11-05) are refused in the provider's Qwen message checks before the template renders, by one of two checks (missingUserQuery, or a tool message with no preceding call) that the coordinator cannot tell apart: the frame carries only status, reason client_error and code invalid_request, and InferenceRefusalReason was log-only.

What

  • The inference_error frame of a client refusal names its reason: refusal_reason (the closed InferenceRefusalReason, the same reason darkbloom logs names) and refusal_message (one fixed sentence per reason, InferenceRefusalReason.clientMessage, derived from the reason alone). No request text in either. Omitted when nil, so every other frame keeps its legacy bytes; the legacy error text is unchanged. Unknown reasons decode to nil; refusal_message is never decoded.
  • InferenceFailure.refusal carries it: the handler's reject() stamps it (sealed request, body decode, native controls, unsupported content, audio), and sanitizedInferenceFailure sets it for an invalid_request failure whose typed error names one (the in-task prompt-preparation and admission refusals; replaces ProviderLoop.promptRefusal). The logger reads it from the failure; CapacityRejectionEnrichment carries it through.
  • New reason missing_user_query (Qwen 3.5/3.6/3.8, Bonsai 2: no user turn beyond a <tool_response> wrapper, e.g. system-only). The generic tool-history check (every model) now names unmatched_tool_result (a tool message with no assistant tool_calls before it) and invalid_tool_history (a call without function.name); GPT-OSS's split-call checks and Gemma 4's turn structure name unmatched_tool_result / invalid_tool_history / unanswered_tool_call; the multimodal forced tool_choice refusal names unsupported_forced_tool_choice.

For the coordinator (separate platform PR later)

Read refusal_reason on inference_error (closed string, the values in InferenceRefusalReason.swift; tolerate unknown values) and store it, e.g. on request_rejections.limit_kind or a new column. Optionally forward refusal_message to the requester. Today's coordinator ignores both keys (sanitizeProviderInferenceError copies named fields only), so nothing changes for requesters until then.

Commits (signed, fast-forward only)

  • Red 5676edefe3: the tests and the API (fields exist, not set, encoded or decoded) — handler, prompt-time, audio and sealed refusals expect the reason on the frame; Qwen tool-conversation shapes through ChatTemplateFixes.normalizeMessages expect missing_user_query / unmatched_tool_result / invalid_tool_history; GPT-OSS history shapes; wire round trip and legacy bytes; every reason has a distinct message.
  • Green c60dd66592: the change, docs (protocol-messages.md, cli-reference.md refusal lines, inference.md), changelog fragment.
  • Refactor pass da8a573fe8: InferenceFailure.refusal is internal(set), so reject() sets it on its copy instead of a refusing() helper rebuilding every field (no behaviour change).
  • 37320cbf41: the capacity enrichment left untouched (it rebuilds only 503/429 failures, never a 400 refusal; it had pulled a capacity source into docs-impact). No behaviour change.

Evidence (CPU, Mac A, one debug build folder)

  • Red on 5676edefe3: 11 Swift Testing tests + 1 XCTest fail, exactly the new expectations (131 issues: the frame carries no refusal_*, missing_user_query unnamed, the Qwen/GPT-OSS history checks unnamed, the logger ignores failure.refusal).
  • Green: c60dd66592 220 tests / 15 suites + 24 XCTest pass; head 37320cbf41 245 tests / 15 suites + 24 XCTest, and a wider run (GLM5Next, Gemma 4, GPT-OSS, Qwen 3.5, Harmony, MediaIngest, ProviderLoop suites) 474 tests / 72 suites pass.
  • Transcript (the real codec on the real checks, prompt text nowhere):
    system + tools, no user turn:
    {"error":"Invalid inference request.","error_reason":"client_error","failure_code":"invalid_request","refusal_message":"The conversation needs a user message that is more than a tool result.","refusal_reason":"missing_user_query","request_id":"req-1","status_code":400,"type":"inference_error"}
    tool message without a preceding call:
    {"error":"Invalid inference request.","error_reason":"client_error","failure_code":"invalid_request","refusal_message":"A tool message does not answer a preceding assistant tool call.","refusal_reason":"unmatched_tool_result","request_id":"req-1","status_code":400,"type":"inference_error"}
    any other failure (unchanged bytes):
    {"error":"Provider capacity is temporarily unavailable.","error_reason":"queue_full","failure_code":"capacity","request_id":"req-1","status_code":503,"type":"inference_error"}
    
  • docs-impact (vs 0e6ac37885), docs-check (212 files), changelog check: pass. git merge-tree clean onto dev 420a5123c4 and with Provider: darkbloom status shows the answers in progress #2017.

Status

  • CI (dev) green on the head 37320cbf41: run 43132460538, success (27 checks pass, 2 skipped as planned). Earlier, the run on c60dd66592 passed every test job; only the non-blocking Cluster GPU shard 1 failed at actions/checkout.
  • Refactor pass: self-review (no subagent in this session), the two commits above; an independent pass is still owed.
  • Real-Mac check (FOLD-A §5, fold-a-evidence/proof/folda-proof.sh, ~5 min on Mac A): the two Qwen 3.6 shapes through DevNet; darkbloom-dev logs names missing user query / unmatched tool result; the client text stays "Invalid inference request.".

jonathan308 and others added 30 commits November 9, 2026 12:40
…recovery (red)

Tests first, from the independent review of #1609 (review-1609-1671.md,
section 1.6). Each fails on this commit; the next commit makes them pass.

- F2: aPauseThatBeginsDuringTheLastEvictionStopsTheLoad. A me-first pause,
  a drain or a live Autopilot lease that begins while the attempt's last
  victim unloads (GLM's engine shutdown) must stop the load, as it stops the
  next eviction. Today the attempt goes straight from the eviction loop to
  the load: Super loads and leaves the queue.
- F3: theOwnersLocalRequestBlocksTheRelease. The owner's own local request
  on an adopted model must block the release, with me first off too.
  adoptionReleaseTime counts .localRequest as serving, so today the adoption
  is released under the request and the owner's next one fails
  model_not_selected.
- F4: postLoadMemoryRefusalsStopTheChecksUntilAnUnloadOrAConfigurationChange.
  A memory refusal after the weights loaded (the KV headroom guard) costs a
  whole load. After three such refusals the model must wait for an unload or
  a configuration change, not the backoff; today it is retried every 10
  minutes for ever. retryingSelectedModelAfterRefusalsAfterLoading (CLI):
  status must say what makes the next check due; today it prints "check
  pending".

Fixture: UnreclaimableLoadMemoryFixture.duringNextShutdown runs a hook inside
a stub's engine shutdown, i.e. while that unload is in progress;
setLocalRequestForTesting takes or returns a local reservation.

Local, CPU only: the CLI test fails ("check pending"); the provider suites
need Metal, so their red run is CI's on this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ne table and names the refusal

Independent refactor pass of this port (#1944).

- The two parameterized tests take their arguments from `shapes` itself
  instead of a second list of labels that had to match it, so a new shape
  can't go untested.
- A null for a non-nullable integer must be refused by the schema check
  (`toolChoiceViolation("tool call arguments do not satisfy the declared
  schema")`), not by any error.

Still red on SDK 67110e7b (dev's pin), locally: exactly
`xmlNullForANullableParameterIsJSONNull`, all four shapes
(`toolChoiceViolation`); the other two tests pass. Green on SDK 04940f55
(next commit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ameter takes XML null

Moves libs/mlx-swift-lm from 67110e7b to 04940f55, the head of
Layr-Labs/mlx-swift-lm `fix/nullable-tool-arguments` (84222bcf red test,
04940f55 fix, on 67110e7b; nothing else moves). The SDK's
ToolArgumentNormalization adds null to a node's types when it carries
`nullable: true`, and its ToolSchemaValidator lets null through that node's
type check, so a Qwen XML `null` for a nullable integer, boolean or object
parameter becomes JSON null instead of the string "null" a client got a tool
error for.

NullableToolArgumentTests passes (3 tests, 9 cases), with the tool suites
(ToolSchemaNormalization*, GemmaToolConstraintTests, Gemma4ToolCall*,
StructuredForcedToolAdmissionTests, ToolChoiceViolationErrorTests,
NativeModelToolChoiceTests: 145; NativeToolStreamRouterTests,
StreamedToolCallTests, GLM5ToolFailureTests: 43), locally (Xcode 27.2, CPU
sandbox). inference.md documents the argument reading; changelog fragment
nullable-tool-arguments.md.

The pin moves to mlx-swift-lm `main` once the SDK PR merges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1932 makes a pipeline stage's memory refusal end only that request. One
conflict, docs/architecture/inference.md's Gemma pipeline bullet (Gemma 4
native context on a pair): this branch's text (65,536 tokens with prompts up
to 32,768, the release facts' prompt limit, no release version, no incident
story), with its "known limit of every pipeline" bullet replaced by dev's fact:
a stage's refusal ends that request alone, on both ranks, as tensor
parallel's do, linked to dev's new section. direct-mode.md and
StandaloneServer+HTTP.swift merged on their own (different hunks). No test
and no Swift line of this branch changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…model the owner uses, caps refusals after loading

The independent review's follow-ups for #1609 (review-1609-1671.md, 1.6);
the previous commit's tests now pass.

- F2: attemptSelectedModelRecovery rechecks selectedModelRecoveryPauseReason
  after the eviction loop, before the load. A me-first pause, drain, update,
  live Autopilot lease or other residency change that began while the last
  victim unloaded (or before the task started, with no victims) now stops
  the load and reschedules the check after pauseRecheck, without a backoff
  step, as it already stopped each eviction.
- F3: adoptionReleaseTime returns nil while a local request uses the
  adoption (.localRequest: the owner's request or the startup self-test),
  with me first off too. Released, the model would refuse the owner's next
  request as model_not_selected. Only Darkbloom requests in flight make an
  adoption releasable.
- F4: a memory refusal that comes after the weights loaded (the KV headroom
  guards, the re-slice checks, MiMo's grant; every load-gate refusal begins
  "Insufficient memory") costs a whole load. After
  SelectedModelRecovery.postLoadRefusalLimit (3, a policy value the owner
  may change) such refusals, counted since the model was queued or last made
  due, the entry is no longer due on the backoff; makeAllDue (any unload,
  and now a configuration change the policy refresh reads: the saved
  enabled_models or Autopilot settings) makes it due and restarts the count.
  The daemon state gives it no next check, its blocker says it stopped, and
  status prints "next check after an unload or a configuration change"
  instead of "check pending".
- F6 (docs): the queue lives in memory and a restart rebuilds it from the
  startup preload only, so with startup_preload = false or a preload_models
  list that omits a model, a model that waited is not queued again
  (hardware-support.md, model-autopilot.md, changelog). Also documented: the
  pause recheck before the load, the cap, the config-change trigger, and when
  a released adoption is evicted (15 s after the release, or the first
  backoff check after its requests finish).

New guard: refusalsAfterLoadingStopTheChecksUntilEveryEntryIsMadeDue (the
queue alone, no loop). Local, CPU only: StatusResidencyTests 5/5 and both
queue tests pass; the provider suites need Metal, so CI runs them.

The two policies the owner has not ruled on (the 10-minute adoption release,
the 15 s shutdown bound per unload) are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…efactor pass)

changelog.d/gemma-pair-native-context.md is #1930's fragment, which
0.10.11 rendered (master 34c4a10, with a render override for this very
sentence) and master no longer carries. This PR edited it, and #1935
undid the edit again, so the stack changed nothing in the end. Merged on
its own, though, this PR would leave dev with a released fragment that
differs from master's deletion: a modify/delete conflict in the next
master-to-dev merge, and text that 0.10.11 never shipped.

The file is dev's again. 0.10.12's words are elsewhere: #1932's
pipeline-stage-memory-abort.md (every pair mode ends such a request
alone) and #1933's gemma-pair-pipeline-whole-context.md (the cap's
lift). No code changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ate (refactor pass)

This PR gave MiMo V2.6's stage gate (MiMoResidentRequestAllowance.requireLive)
the shape of GPT-OSS's, so the two were the same twenty lines apart from the
family's name: power and thermal first, a fresh host sample, the entry
floor, the allocator limit, and memory judged only inside the typed block.
D6's own cause was a running gate whose shape drifted from the others', so
the two now call one function, ClusterLiveMemory.requireStageRequest, with
their own watch and charges. The refusal sentences keep each family's name.

ClusterLiveMemory, with the tensor-parallel gate and the stop rule's abort,
moves from ClusterMemoryFault.swift to ClusterLiveMemory.swift: the file
named for the dev fault held the gates real requests take, and now holds
only the fault and its reading.

Behaviour is unchanged, except that MiMo checks its charges' signs before
asking power, as GPT-OSS did (both refusals there are untyped; a negative
charge is a caller's bug). RealMemoryRefusalTests, the MiMo and GPT-OSS
lane tests and PipelineStageAbortTests' real MiMo and GPT-OSS refusals run
both families through the shared gate.

inference.md names the shared gate where it lists MiMo's and GPT-OSS's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (refactor pass)

The paragraph this PR extends in inference.md ("A pipeline stage's memory
refusal ends that request alone") still said "Before 0.10.11", from #1932.
0.10.11 shipped without D6's fix and lists D6 as a known issue; the fix
ships in 0.10.12. #1935 makes the same one-word change, so its merge of
this head stays clean.

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

#1934's refactor pass: 0.10.11's Gemma pair fragment as it shipped (this
PR already had it so), MiMo's and GPT-OSS's stage gates as one running
gate in ClusterLiveMemory.swift, and "Before 0.10.12" (this PR's own
9bca5dd made the same change). No conflicts; the tests this PR adds
for MiMo's and GPT-OSS's real refusals now run through the shared gate.

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

#1935 now carries #1934's refactor pass (MiMo's and GPT-OSS's stage gates
as one running gate, in ClusterLiveMemory.swift). No conflicts: this PR
touches none of those files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the first time, not "again" (refactor pass)

No release served it: 0.10.10's Gemma pairs served 65,536 tokens in both
modes, and 0.10.11 serves the whole context in tensor parallel only
(#1930's cap). Only dev between them served it in the pipeline, so this
PR's fragment, which 0.10.12's notes render, says "now", not "again", and
names the 65,536 tokens the pipeline served before.

inference.md, the same section:
- "again" goes there too; the 128K failure is dev's before 0.10.11, which
  the paragraph no longer said once the lift took out its history line;
- the pair serves the smaller of its two stages' serving contexts (it read
  as the smaller of READY's capacity and the context);
- the provider holds a Gemma request to the whole profile in both modes
  (it named only the pipeline's);
- no PR number in the text.

No code changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s host bound is read once

The refactor pass (AGENTS.md "Required Refactor Pass"). Behaviour-preserving;
no assertion and no test name changed.

- ResidentAdmissionGemma4Tests.eachStageHoldsAndCoversTheLongestRequestItServes:
  its doc named #1930 and #1932 (AGENTS.md: no ticket names in files), and
  #1932 merged into dev without lifting the cap. It now says the memory plan's
  request (32,768 + 32,768) and points at
  ClusterRuntimeAdapter.pipelineServesWholeProfile for when the bound becomes
  262,144.
- Gemma4TensorParallelResidentRuntime.load reads charge.hostBound once, and
  its comment points at hostBound's doc instead of repeating it.
- inference.md: "both hosts' bounds" named neither host. A stage's READY
  capacity and host bound come from stageRequestCapacity and
  stageKVHostBound, a tensor-parallel rank's from capacityBytes and hostBound.

CPU, Xcode 27.2, the GPU denied: ResidentAdmissionGemma4Tests 14,
Gemma4NativeContextTests 6 (their five Metal tests are CI's),
ResidentAdmission27BTests 8, QwenTensorParallelNativeContextTests +
LongContextLimitsTests + ContextAdmissionTests 21: pass. docs-check (211
files) and docs-impact-check --base origin/dev: OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… Gemma 4's

Independent refactor pass of this port (#1941). The fix is the smallest
correct change; this tightens its regression test only.

- `aThoughtCannotCarryAToolCall`: after `<|channel>` the automaton is back at
  its neutral state, so the tool-call token stays out of the mask and
  `<|tool_call>` spelled byte by byte inside the thought is still refused.
  It pins the fix's other half: opening a thought grants no tool syntax.
- The fake tokenizer's role marker is Gemma 4's `<|turn>`, not Gemma 3's
  `<start_of_turn>`, as its comment says. Both decode to no piece, so the
  assertion means the same.

Local (Xcode 27.2, CPU sandbox): GemmaNoToolReasoningRegressionTests 4 (the
real-tokenizer test skipped, no fixture), GemmaToolConstraintTests,
Gemma4ToolSchemaEnforcementTests, Gemma4ToolCallArgumentsTests 85: pass. With
dev's two source files back (the red state), exactly
`reasoningChannelsRemainAvailableButToolAndRoleMarkersDoNot` (4 issues, as in
CI run 42678893950) and the new test fail; the splice test passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it in CI

The replay talks only to a bare loopback http:// endpoint, without
environment proxies or redirects, but no test held any of the three: the
reviewer's mutants that accept a remote URL, follow redirects or use a proxy
all passed the suite.

- test_only_a_bare_loopback_http_endpoint_is_contacted: remote hosts,
  https, credentials, a path, a query or a fragment are refused before
  anything is written or opened; 127.0.0.1, localhost and [::1] are used
  as given.
- test_an_environment_proxy_never_carries_the_traffic and
  test_a_redirect_stops_the_run_unfollowed drive run() through the opener
  it builds, with an in-memory HTTP handler instead of a socket: with
  http_proxy set every request still goes to 127.0.0.1, and a 307 stops
  the run without a second request.

Each fails against its mutant: the loopback check removed whole or one
clause at a time (scheme, host, credentials, path, query, fragment), the
opener without NoRedirect, and the opener without ProxyHandler({}).

The suite needs Python 3.11+ (hashlib.file_digest, TestCase.enterContext)
and passes on 3.11, 3.12 (CI's) and 3.14. The ci-plan-checks job, which
runs on every CI run and which the Provider Tests gate requires, now runs it
on ubuntu-24.04's Python 3.12; test-provider-ci-workflow.py pins the step.
The guide, test.md and build.md state the minimum, and the guide states the
loopback-only rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit restamps docs/developer/build.md, whose stamp dev also
moved (2026-11-08), so the branch no longer merged cleanly. Resolved to the
newer 2026-11-09 stamp; both sides' content kept. On the merge (Python
3.12): the 42 GPT-OSS tests and every Check the CI plans self-test pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nt's widths; LOAD's reservation is the prefix tier's charge

Refactor pass on the Gemma 4 tensor-parallel width (behaviour unchanged):

- ClusterPlacementTensorWidth: one function, `widths`, decides how the
  singleton's wider widths are priced (a Qwen TP row's native quotes where
  its singleton quote priced it; a family's lane charge where nothing else
  priced it; none otherwise), and `widest` only searches them. The `sizes`
  flag and the second guard in `plan` are gone; a placement with no width
  to try is planned once, as before.
- Gemma4TensorParallelRequestBudget.chargeBytes(lanes:) is gone: the
  allowance is `requestBytes` plus `rankBytes`, so it equalled
  `reservedBytes(lanes:)` at every width. The prompt-prefix tier's room is
  measured beside the figure LOAD reserved.
- PlacementChecks pins what the runtime relies on: one lane reserves the
  allowance alone and plans as no width; every width reserves every lane's
  request and the rank's reserve once; LOAD and the planner refuse 0 and 9
  lanes; a layout whose lane charge is nothing, or more than its
  allowance's request part, is refused where it is read.
- The changelog fragment says what a further request is charged (all one
  request holds, about 2.6 GB on each Mac), and configuration.md's date
  follows its edit.

Mutants of the lane arithmetic, its bounds and the width search are killed
by these checks and by ClusterPlacementTensorWidthTests' Gemma cases (run
through `decide` in a scratch harness); the survivors are equivalent here
(the leader and split are already held, Gemma has no native quote).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Takes the parent's one-rule width search (`ClusterPlacementTensorWidth.widths`),
the Gemma budget without its duplicate `chargeBytes(lanes:)` and the
stronger Gemma lane checks. No conflict: the GLM lane charge's planner and
layout rules hold for those checks (a lane charge of nothing, or above a
stated allowance's request part, is still refused).

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

Independent refactor pass of this port (#1943). No behavior change.

- `buildCoordinatorDoctorChecks` asked for the last reported authorization
  only when no current decision was shown (`authorization == nil ? … : nil`).
  `lastReportedStatus` already returns nil whenever `displayedStatus` shows
  one, and the row is used only below the current decision's early return, so
  the call stays beside the other two decisions from the same snapshot and
  time, without the ternary.
- `lastReportedPaths` is private: only this file reads it.

Local (Xcode 27.2, CPU sandbox): ProviderAuthorizationReadinessTests 23,
DoctorCommandRunTests 14, DoctorOperatorDiagnosisTests and
StatusCommandRunTests 11: pass.

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

Three cases the independent review asked for, so the tests hold what this
change is about (tests only; no source change):

- ranks by the typical Mac of this chip before the average one: Qwen 3.5 9B
  ($0.05 typical, $0.06 average) ranks above GPT-OSS 20B ($0.04, $0.20);
  the existing fixture sorted the same by either figure.
- ranks the models with per-chip rows when another model has none, unless a
  row is malformed: a row without by_chip (how the coordinator omits a model
  with no published class) leaves the others ranked per chip, while
  by_chip: null voids the per-chip view, so the totals rank.
- recommended models in onboarding: StartServing with chipNetwork() shows
  the per-chip header, order and amounts; nothing rendered it before.

Each fails against the reviewer's matching mutant, confirmed by two full
runs: M2 and M3 (ranking by the mean), M4 and M5 (partial and null
by_chip), M10 and M13 (onboarding ignores the ranking or its copy); all six
passed the suite before. 13 of the 17 mutants now fail it (was 7).

The fixture's network rewrites share one mapModels helper, and the view tests
one firstUse snapshot and cardNames reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lways one.sse

test_invalid_cohort_has_no_throughput_or_completion_receipt asserted that
case "one" kept its raw stream, but both cases fail. When "two" releases the
cohort barrier and fails before "one" has woken from it, its
barrier.abort() makes "one" raise BrokenBarrierError before it sends, so
one.sse never exists. The replay fails closed either way; only the
assertion was too strict. Under load it failed 5 of 40 runs of the module on
Python 3.11 and 1 of 40 on 3.12, and the previous commit makes this suite a
required CI check. The case that released the barrier never waits on it and
always streams, so the test now requires a raw stream from either case:
0 of 100 runs fail on 3.11 and 3.12.

Found by the refactor pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The malformed-row case wrote out by hand the network rewrite that
mapModels already does; it now uses the exported helper. Same assertions;
M4 and M5 still fail the test, and the suite passes (103 files, 680 tests).

From the refactor pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erminal (red)

Tests first, from the independent review of #1671 (review-1609-1671.md,
2.3 and 2.5). Both fail on this commit; the next commit makes them pass.

- G3: LaunchAgentRestartTests.forwardsTerminalBeforePublicationOptInToProviderJob.
  launchd does not inherit the installing shell, so an installed provider
  can take DARKBLOOM_PREFIX_CACHE_SSD_TERMINAL_BEFORE_PUBLICATION only if
  darkbloom start writes it into the provider plist, as it does for the
  sibling SSD flag DARKBLOOM_PREFIX_CACHE_SSD_INCREMENTAL_CHECKPOINTS (the
  watchdog job never carries it). Today the key is not in
  LaunchAgent.inferencePassthroughEnvKeys and the plist drops it.
- G4: EngineV2EarlyTerminalMarkerTests. With the opt-in, a request whose
  retirement (its complete-checkpoint publication, then the rows' release)
  comes after the client's terminal must be marked once it retires, with
  how long that took (an engine_health event, operation
  ssd_terminal_before_publication, retired_after_terminal_ms). A seeded
  request, a request retired with its terminal and the opt-in off are not
  marked. A deadline-admitting test engine returns a retirement the test
  releases 50 ms after the answer; today nothing marks the request.

Local, CPU only (no Metal needed): the G3 test fails with 7 issues (its 37
neighbours pass); the G4 test fails in the one marked case (the other three
pass).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… terminal is marked with its write time

The independent review's G3 and G4 for #1671 (review-1609-1671.md, 2.3 and
2.5); the previous commit's tests now pass. The opt-in stays off by default.

- G3: DARKBLOOM_PREFIX_CACHE_SSD_TERMINAL_BEFORE_PUBLICATION joins
  LaunchAgent.inferencePassthroughEnvKeys, beside the sibling SSD flag
  DARKBLOOM_PREFIX_CACHE_SSD_INCREMENTAL_CHECKPOINTS. Set in the shell for
  darkbloom start, it is written into the provider plist, so the launchd
  job (and every launchd restart, watchdog recovery included) reads it; an
  ordinary darkbloom restart reuses the saved plist, as for every forwarded
  setting. The watchdog job never carries it. configuration.md no longer
  says it is not forwarded; cli-reference.md lists it with the other
  forwarded variables.
- G4: the event pump now knows whether the request asked for the early
  terminal (runPump's terminalPrecedesPublication, from the engine request)
  and times it from the client's terminal to its retirement (the
  complete-checkpoint publication, then the rows' release). A request that
  retires at least 1 ms after its answer (retirementAfterTerminalMarkFloor;
  one that retires with its terminal had nothing left to publish) gets one
  provider-log line ("Early terminal: request ... retired N ms after its
  answer ...", darkbloom.EarlyTerminal) and one engine_health event
  (operation ssd_terminal_before_publication, request_id,
  retired_after_terminal_ms). The profile is unchanged: it goes out with the
  terminal, before the write ends, and its fields are a cross-repo contract;
  a measurement joins the log line with the request's profile by request ID.
  telemetry-schema.md documents the event (the TelemetryClient facade
  discards it, so the log line is what reaches a provider's log);
  inference.md, ssd-kv-cache.md and the changelog say so.

Local, CPU only: LaunchAgentRestartTests 38/38, EngineV2EarlyTerminalMarkerTests
(4 cases), EngineTransferredRetirementWorkTests, EngineV2TranslationTests and
SSDPrefixCacheFactoryTests pass; docs-check, docs-impact-check and the
changelog check pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… again every 30 s for ever

Inside the absence grace the leading Mac keeps its part wanted, so the pair re-forms when the other Mac
is back. A part that can't form the pair ends and the cluster service starts it again after a backoff
that stops growing at 30 s, so a MiMo leader whose follower slept started its part every 48 s, each
start reading its share of the model again and registering again (d2b0f2f5, 2026-11-09).

Red now: aLeaderWhoseOtherMacIsAwayWaitsLongerToStartItsPartAgainAndStartsItAtOnceWhenItAnswers
(the first restart waits 6 s, not 30 s, and the other Mac's answer doesn't start it at once).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The served-requests line said every request that ended early "may be
unpaid". The coordinator pays for the tokens sent when the requester left
mid-answer (holdForSettlement parks the record; the provider's partial
inference_complete settles it), and pays nothing when another Mac answered
first (a hedge loser) or the provider's connection dropped. The test now
expects the status line to say so; it fails until the wording changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…families; GLM's lane charge reuses LOAD's page arithmetic

Refactor pass on the GLM tensor-parallel width (behaviour unchanged):

- DistributedInstalledPlan.tensorParallelLaneAdapters is a set: with GLM's
  fixed eight gone, every value was `defaultBatchLanes`. One predicate,
  `servesTensorParallelLanes` (GLM, Gemma 4 and a Qwen TP row without
  private images), now decides both a tensor-parallel pair's default and
  whether its lanes retire alone, which had each spelled it out.
- GLM5NextTensorParallelRequestCharge.laneBytes (the planner's and LOAD's
  lane charge) re-derived the history length and the paged-history bytes
  that `historyTokens` and `pagedHistoryBytes` already compute for a
  request. Both now have a static form that the lane charge, the request
  charge and `reserveLane` share, so the page arithmetic lives in one place.
- GLM5NextPlacementFamily.tensorParallelPlan takes the lane charge without
  a default: its one caller always states it.
- ClusterPlacementTensorWidthTests: the lane-charge helpers serve GLM as
  well as Gemma, so they are named for what they do (`laneChargeFixture`,
  `decideLaneCharged`, `savedLanes`).

Mutants of the planner's GLM growth (request need, GPU-resident bytes, the
growth hidden under the state estimate), the lane charge's bounds, the
setup's GLM width and the installed GLM lanes are killed by PlacementChecks,
ConfigurationCheck and InstalledBatchLanesCheck.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…omotion counts as a failed start

A single Mac: `darkbloom restart` (or `start`, or `stop` and then `start`, or a reboot) while the
release is still a candidate replaces the provider, and the re-armed watchdog's first check reads the
replaced process's daemon state. Timed from the update's launch, that is a start without a heartbeat:
a failed start, and with two before it a rollback and quarantine (4ae0976c, 085f602d and a9e55a63 on
0.10.11; 662f2d50 on every release since 0.9.16).

A pair: a clean stop of the candidate's cluster service that its supervisor did not ask for (exit 0
after SIGTERM: `ClusterService.stopDetached`, Ctrl-C, a `kill`) counts as a failed start.

Red now: requestedRestartIsNotAFailedStart, requestedRestartWithoutAHeartbeatIsAFailedStart,
requestedRestartDefersTheDownPathInsideItsOwnWindow, aCleanStopTheSupervisorDidNotAskForIsNotAFailedStart.
Guards that pass now and must keep passing: a crash still counts (single Mac and pair), and a service
its liveness guard stops is still a failed start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…factor pass)

QwenDenseStageLoadWatch.admits tries a reclaim when only uncounted file
cache keeps a sample short: it touches real pages
(QwenDenseStageLoadReclaim.makeRoom), then judges a fresh sample of the
kernel's counters, which no fault changes. The dev fault's taken reading
has no file cache (fileBackedPages 0, so fileCacheAboveReserveBytes 0),
so that branch never runs on it and the fault's refusal stands. Nothing
said so; a later reading that kept some file cache would make an armed
fault reclaim real memory and then admit. withMemoryTaken's comment now
says it. No code changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ken reading's reclaim note

A comment in ClusterMemoryFault.swift only. No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…too (refactor pass)

This PR's ci commit (beb195c) added a third runner to
cluster-release-checks, libs/darkbloom-cluster-worker/Tests/LifecycleChecks/
run.sh, but the pages that list what each job runs still named two:
- test.md ("Cluster logic that needs no model or GPU"): the job runs the
  capability and prefill schedule checks, and now says it runs the worker
  package's request lifecycle tests too (WorkerTests and WorkerLaneTests,
  a debug build with DARKBLOOM_WORKER_TEST_JOBS jobs, 4 by default and 12
  in CI), D6's no-exit path among them, and that no other job runs them;
- build.md's job table, the same.

No code or workflow changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 and others added 13 commits November 11, 2026 12:42
… not Serve locally only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverts 47415fd: the version, the CHANGELOG render and the fragment removal come back, so the
folds below add and drop fragments, and one new Prepare renders the final set. The tree equals
the master sync dc934f9's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y and typical MTP acceptance

NO-GO (2026-11-11): under two or more batched penalty-free 9B rows, live Metal shared events grow
about one per decode step until the provider crashes (10-60 min of sustained concurrency). The 9B
returns to 0.10.11's behaviour (presence_penalty 1.5, typical acceptance).

Reverses #1961's code, tests and docs (76ea981, 194be63, ca8697d) against the candidate:
EngineV2SamplingDefaults drops qwen35NineBCardDefaults; MTPAcceptancePolicy.builtInIsExact drops the
9B (Bonsai 9B, Gemma QAT and Qwen 3.8 stay exact); the tests expect typical for the 9B; the docs
(inference.md's defaults table, prefix-cache.md, cli-reference, configuration, ProviderConfig) name
the 9B with the 35B builds. Its changelog fragment is removed, and #1965's fragment says the penalty is
still these builds' default. #1965 (prompt-history checkpoints for rows that cannot speculate), #1974
and #1999 stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Version 0.10.12; the 48 changelog.d fragments rendered into CHANGELOG.md
(scripts/changelog.py render --version 0.10.12 --date 2026-11-11, verbatim, in
filename order) under the candidate heading, with the upgrade and rollout
notes; v0.10.11 marked published (2026-11-09); the 0.10.12 section of
docs/operations/provider-release.md. Base: master c13f7e0 (the 0.10.12 release branch's squash).

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

The revert (17627f1) also undid #1961's call-site change in MTPAcceptancePolicy.resolve, so the
built-in rule read only Bonsai 9B again and Gemma 4 QAT (#1974) and Qwen 3.8 (#1999) lost their exact
default (MTPAcceptanceConfigTests: 6 issues in CI run 43098442611). resolve calls builtInIsExact again;
the 9B stays typical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er (0.10.12 final fold; head b250f13)

quickstart.md: #2008's "Switch later" bullet and #2007's "Two Macs" bullet.
Version 0.10.12; the 50 changelog.d fragments rendered into CHANGELOG.md
(scripts/changelog.py render --version 0.10.12 --date 2026-11-11, verbatim, in
filename order) under the candidate heading, with the upgrade and rollout
notes; v0.10.11 marked published (2026-11-09); the 0.10.12 section of
docs/operations/provider-release.md. Base: master fdd3d79 (the 0.10.12 release branch's squash).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tests, and the API they need, with today's behaviour:
- InferenceFailure.refusal, ProviderMessage.InferenceError.refusalReason
  (not copied, encoded or decoded yet);
- InferenceRefusalReason.missingUserQuery (not mapped yet), its public
  log line, and clientMessage: one fixed sentence per reason.

The handler, prompt-time and Qwen tool-conversation refusals expect the
reason and its message on the frame (refusal_reason, refusal_message),
the legacy error text unchanged, and the Qwen/Harmony/generic history
checks to name which check refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Mac answered a malformed request with 400 "Invalid inference request."
and never said why (OR-REFUSALS §1: Qwen 3.6's tool conversations were
refused before rendering by one of two checks the coordinator couldn't
tell apart).

- InferenceFailure.refusal carries the closed InferenceRefusalReason:
  the handler's reject() stamps it, and sanitizedInferenceFailure sets it
  for an invalid_request failure whose typed error names one (replacing
  ProviderLoop.promptRefusal). The logger reads it from the failure.
- The inference_error frame sends it as refusal_reason, with
  refusal_message: one fixed sentence per reason (clientMessage). Both are
  omitted when nil, so every other frame keeps its legacy bytes; the
  legacy error text is unchanged. Unknown reasons decode to nil.
- New reason missing_user_query (Qwen 3.5/3.6/3.8, Bonsai 2: no real user
  turn); the generic tool-history check names unmatched_tool_result (a
  tool message with no preceding call) and invalid_tool_history (a call
  without function.name); GPT-OSS's and Gemma 4's history checks and the
  multimodal forced tool_choice refusal name theirs.

The coordinator ignores both keys today (sanitizeProviderInferenceError
copies named fields only); recording refusal_reason is a platform change.

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

vercel Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Nov 12, 2026 1:10am UTC
darkbloom-status Ready Ready Preview Nov 12, 2026 1:10am UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 12, 2026 1:10am UTC

Request Review

InferenceFailure.refusal is internal(set), so the handler's reject()
sets it on its copy instead of InferenceFailure.refusing() rebuilding
every field (a copy that each new field would have to remember). No
behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CapacityRejectionEnrichment rebuilds only 503/429 failures, and a
refusal is only ever a 400, so carrying it there was a no-op (and put a
capacity source in this change's docs-impact scope). No behaviour change.

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

This branch was successfully deployed

3 active deployments
Preview – d-inference-landing — 37320cbf Deployed Nov 12, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — 37320cbf Deployed Nov 12, 2026 by vercel[bot]
Preview – darkbloom-status — 37320cbf Deployed Nov 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant