bots-garden/razorbillpublic Fork
⑂ 8892e29
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/razorbill.git
git clone ssh://git@rickub.com/bots-garden/razorbill.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

mlx-swift-lm 3.33.0 (Mellum, newer models); reasoning events; 400 for unknown architectures (#64)

Bump mlx-swift-lm to upToNextMinor 3.33.0 and mlx-swift to 0.33.0. No
source break; 3.33.0 now sends the reasoning of families it knows as
Generation.reasoning (delimiters removed): mapped to .thinking, the
ThinkingSplitter starts outside a thought for those models and
generateTask gets reasoningPrimedInside from razorbill's own detection.
Raw completions keep that text. An unknown model_type is a 400
model_not_supported naming the type instead of a 500 load failure.
Linux 335, Mac 361 (real Qwen3 smoke tests), quality run #43 PASS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
k33g committed 2026-11-27T07:33:29+01:00 Browse files
8892e29 parent: 3780f1a
modified .memory/handoffs/2026-11-27-v0-3-tui-foundation.md +5 -0
@@ -32,3 +32,8 @@
3232 - #26 and #56 closed, #28 open only for checking the GPU key on the Mac. All v0.3 tickets otherwise closed. Linux 327 / Mac 353, gate PASS run #41.
3333 - **Manual test list for the user** (they said "on fera les tests après"): rzb tui Chat (Esc, Ctrl-P, Ctrl-R, /set), Dashboard (u, Machine line, gpu % while generating), Models (p download, d+y remove), Settings (Enter saves tui.yaml; Ctrl-O with a real editor: no stolen keys, screen comes back, reload result), the tutorial as written (docs/*/tutorials/chat-from-the-terminal / discuter-depuis-le-terminal).
3434 - Then: close #28 (or note the key is absent), release 0.3.0 the way 0.2.0 was done (version string in Core, release notes EN/FR in release-notes/, CLI reference header, diagram title, milestone v0.3 closed, scripts/release.sh on the Mac, tag at the user's OK). The `release` skill in .claude/skills is for "mini-me (mm)", not razorbill — do not use it as is.
35+
36+## Update (later): user testing; mlx-swift-lm 3.33.0
37+- Fixed from the user's tests: reverse-video overflow on selected rows (ANSI-aware truncate), Enter on Models → Chat, answers under the model's name.
38+- mlx-swift-lm 3.33.0 in (#64): Mellum supported; reasoning now comes as `Generation.reasoning` (handled). Mac 361 green.
39+- Open: the TUI download failure the user saw (message not known yet); #63 (reasoning colour, v0.3); #28 task 1 (GPU key); #62 (HF token spike, no milestone); user to run `scripts/compat.sh` on the Mac after the bump and to try Mellum.
@@ -32,3 +32,8 @@
32 - #26 and #56 closed, #28 open only for checking the GPU key on the Mac. All v0.3 tickets otherwise closed. Linux 327 / Mac 353, gate PASS run #41.32 - #26 and #56 closed, #28 open only for checking the GPU key on the Mac. All v0.3 tickets otherwise closed. Linux 327 / Mac 353, gate PASS run #41.
33 - **Manual test list for the user** (they said "on fera les tests après"): rzb tui Chat (Esc, Ctrl-P, Ctrl-R, /set), Dashboard (u, Machine line, gpu % while generating), Models (p download, d+y remove), Settings (Enter saves tui.yaml; Ctrl-O with a real editor: no stolen keys, screen comes back, reload result), the tutorial as written (docs/*/tutorials/chat-from-the-terminal / discuter-depuis-le-terminal).33 - **Manual test list for the user** (they said "on fera les tests après"): rzb tui Chat (Esc, Ctrl-P, Ctrl-R, /set), Dashboard (u, Machine line, gpu % while generating), Models (p download, d+y remove), Settings (Enter saves tui.yaml; Ctrl-O with a real editor: no stolen keys, screen comes back, reload result), the tutorial as written (docs/*/tutorials/chat-from-the-terminal / discuter-depuis-le-terminal).
34 - Then: close #28 (or note the key is absent), release 0.3.0 the way 0.2.0 was done (version string in Core, release notes EN/FR in release-notes/, CLI reference header, diagram title, milestone v0.3 closed, scripts/release.sh on the Mac, tag at the user's OK). The `release` skill in .claude/skills is for "mini-me (mm)", not razorbill — do not use it as is.34 - Then: close #28 (or note the key is absent), release 0.3.0 the way 0.2.0 was done (version string in Core, release notes EN/FR in release-notes/, CLI reference header, diagram title, milestone v0.3 closed, scripts/release.sh on the Mac, tag at the user's OK). The `release` skill in .claude/skills is for "mini-me (mm)", not razorbill — do not use it as is.
35+
36+## Update (later): user testing; mlx-swift-lm 3.33.0
37+- Fixed from the user's tests: reverse-video overflow on selected rows (ANSI-aware truncate), Enter on Models → Chat, answers under the model's name.
38+- mlx-swift-lm 3.33.0 in (#64): Mellum supported; reasoning now comes as `Generation.reasoning` (handled). Mac 361 green.
39+- Open: the TUI download failure the user saw (message not known yet); #63 (reasoning colour, v0.3); #28 task 1 (GPU key); #62 (HF token spike, no milestone); user to run `scripts/compat.sh` on the Mac after the bump and to try Mellum.
modified .memory/history.md +7 -0
@@ -538,3 +538,10 @@ open, a comment on each. main fast-forwarded.
538538 - **Quality**: PASS run #41.
539539 - **Docs**: EN+FR HTTP reference (system fields, example), TUI reference (status bar, Machine line).
540540 - **Tickets**: #26 and #56 closed; #28 open for task 1 (check the IOKit key on the Mac). v0.3 milestone: only #28 left. main fast-forwarded.
541+
542+## 2026-11-27 — TUI fixes from the user's tests, tickets #62–#64, mlx-swift-lm 3.33.0
543+
544+- **User feedback while testing**: list selection turned the whole screen reverse → the frame cut lines counting ANSI codes, losing the reset; `TextLayout.truncate`/`fit` now count visible characters and close styles (802366e). Asked how to pick a model for the chat → Enter on the Models screen opens the Chat with it (declared name first), and answers now start under the model's name at full width (2c18fab). The download "did not work": not reproduced; asked the user for the message shown.
545+- **Tickets**: #62 spike — is a Hugging Face token worth it (swift-huggingface's `HubClient()` already reads `HF_TOKEN` and the `hf auth login` file; questions on gated/private repos, rate limits, logging). #63 — reasoning in a colour of its own in the TUI chat (v0.3). #64 — mlx-swift-lm 3.33.0, done and closed.
546+- **#64**: Mellum (`model_type` `mellum`) failed with 500 `unsupportedModelType`; it arrived in mlx-swift-lm 3.33.0. Bumped mlx-swift-lm (upToNextMinor 3.33.0) and mlx-swift (0.33.0); no source break, but the Mac smoke tests caught a behaviour change: the library now splits reasoning into `Generation.reasoning`, which razorbill ignored (Qwen3 lost reasoning_content) — fixed (see summary's version-trap section). Unknown architectures now answer 400 `model_not_supported` naming the type. Linux 335, Mac 361, gate PASS run #43 (run #42 failed on a 3-member tuple I introduced).
547+- **Still to check by the user**: Mellum itself loads and answers; `scripts/compat.sh` on the Mac; the TUI download error message.
@@ -538,3 +538,10 @@ open, a comment on each. main fast-forwarded.
538 - **Quality**: PASS run #41.538 - **Quality**: PASS run #41.
539 - **Docs**: EN+FR HTTP reference (system fields, example), TUI reference (status bar, Machine line).539 - **Docs**: EN+FR HTTP reference (system fields, example), TUI reference (status bar, Machine line).
540 - **Tickets**: #26 and #56 closed; #28 open for task 1 (check the IOKit key on the Mac). v0.3 milestone: only #28 left. main fast-forwarded.540 - **Tickets**: #26 and #56 closed; #28 open for task 1 (check the IOKit key on the Mac). v0.3 milestone: only #28 left. main fast-forwarded.
541+
542+## 2026-11-27 — TUI fixes from the user's tests, tickets #62–#64, mlx-swift-lm 3.33.0
543+
544+- **User feedback while testing**: list selection turned the whole screen reverse → the frame cut lines counting ANSI codes, losing the reset; `TextLayout.truncate`/`fit` now count visible characters and close styles (802366e). Asked how to pick a model for the chat → Enter on the Models screen opens the Chat with it (declared name first), and answers now start under the model's name at full width (2c18fab). The download "did not work": not reproduced; asked the user for the message shown.
545+- **Tickets**: #62 spike — is a Hugging Face token worth it (swift-huggingface's `HubClient()` already reads `HF_TOKEN` and the `hf auth login` file; questions on gated/private repos, rate limits, logging). #63 — reasoning in a colour of its own in the TUI chat (v0.3). #64 — mlx-swift-lm 3.33.0, done and closed.
546+- **#64**: Mellum (`model_type` `mellum`) failed with 500 `unsupportedModelType`; it arrived in mlx-swift-lm 3.33.0. Bumped mlx-swift-lm (upToNextMinor 3.33.0) and mlx-swift (0.33.0); no source break, but the Mac smoke tests caught a behaviour change: the library now splits reasoning into `Generation.reasoning`, which razorbill ignored (Qwen3 lost reasoning_content) — fixed (see summary's version-trap section). Unknown architectures now answer 400 `model_not_supported` naming the type. Linux 335, Mac 361, gate PASS run #43 (run #42 failed on a 3-member tuple I introduced).
547+- **Still to check by the user**: Mellum itself loads and answers; `scripts/compat.sh` on the Mac; the TUI download error message.
modified .memory/summary.md +11 -5
@@ -299,7 +299,8 @@ compat on Linux 48 pass / 20 skip. After #49: Linux 172, Mac 198, compat Linux 5
299299 not re-run since #44). After #53: Linux 217, Mac 243 (host-runner; `sighupReloadsTheFile` runs on
300300 macOS only), compat on Linux `-k docs_curl` 22 pass (whole compat suite not re-run). After #54:
301301 Linux 277, Mac 303. After #55/#56: Linux 300, Mac 326, compat on Linux 59 pass / 20 skip. After #57–#59: Linux 323,
302-Mac 349, compat Linux 59/20. After #26/#28: Linux 327, Mac 353.
302+Mac 349, compat Linux 59/20. After #26/#28: Linux 327, Mac 353. After #64 (mlx-swift-lm 3.33.0):
303+Linux 335, Mac 361 (Mac compat not re-run).
303304
304305 Sampling (#49, user's rule: only what mlx-swift-lm implements): temperature, top_p, max_tokens,
305306 stop, seed, presence/frequency_penalty (mlx window: last 20 tokens incl. prompt), plus extensions
@@ -310,10 +311,15 @@ penalty active, the prompt cache recomputes at least the penalty window (`Prompt
310311
311312 ## mlx-swift-lm API version trap
312313
313-Code must match the **resolved tag** (3.32.3, see `Package.resolved`), not `main`: main has
314-`progress: .download {}` and `Generation.reasoning`, 3.32.3 has `progressHandler:` and no
315-reasoning event (thinking arrives inline in `.chunk`). Read the API from the SwiftPM checkout
316-of the resolved version.
314+Code must match the **resolved tag** (3.33.0 since 2026-11-27, #64; see `Package.resolved`), not
315+`main`. Read the API from the SwiftPM checkout of the resolved version (`.build/linux/checkouts`
316+after `swift package --scratch-path .build/linux update`). 3.33.0 sends the reasoning of families
317+with a resolved `ModelConfiguration.reasoningConfig` as `Generation.reasoning` (delimiters
318+removed); razorbill maps it to `.thinking`, starts `ThinkingSplitter` outside a thought in that
319+case and passes `reasoningPrimedInside` (its own prompt-opens-`<think>` detection) to
320+`generateTask`. Models without a reasoning config still go through `ThinkingSplitter`. An unknown
321+`model_type` becomes `ModelResolutionError.unsupportedType` → 400 `model_not_supported`. A version
322+bump must be verified with the Mac smoke tests (real Qwen3): Linux cannot compile RazorbillMLX.
317323
318324 ## Not yet established
319325
@@ -299,7 +299,8 @@ compat on Linux 48 pass / 20 skip. After #49: Linux 172, Mac 198, compat Linux 5
299 not re-run since #44). After #53: Linux 217, Mac 243 (host-runner; `sighupReloadsTheFile` runs on299 not re-run since #44). After #53: Linux 217, Mac 243 (host-runner; `sighupReloadsTheFile` runs on
300 macOS only), compat on Linux `-k docs_curl` 22 pass (whole compat suite not re-run). After #54:300 macOS only), compat on Linux `-k docs_curl` 22 pass (whole compat suite not re-run). After #54:
301 Linux 277, Mac 303. After #55/#56: Linux 300, Mac 326, compat on Linux 59 pass / 20 skip. After #57–#59: Linux 323,301 Linux 277, Mac 303. After #55/#56: Linux 300, Mac 326, compat on Linux 59 pass / 20 skip. After #57–#59: Linux 323,
302-Mac 349, compat Linux 59/20. After #26/#28: Linux 327, Mac 353.302+Mac 349, compat Linux 59/20. After #26/#28: Linux 327, Mac 353. After #64 (mlx-swift-lm 3.33.0):
303+Linux 335, Mac 361 (Mac compat not re-run).
303 304
304 Sampling (#49, user's rule: only what mlx-swift-lm implements): temperature, top_p, max_tokens,305 Sampling (#49, user's rule: only what mlx-swift-lm implements): temperature, top_p, max_tokens,
305 stop, seed, presence/frequency_penalty (mlx window: last 20 tokens incl. prompt), plus extensions306 stop, seed, presence/frequency_penalty (mlx window: last 20 tokens incl. prompt), plus extensions
@@ -310,10 +311,15 @@ penalty active, the prompt cache recomputes at least the penalty window (`Prompt
310 311
311 ## mlx-swift-lm API version trap312 ## mlx-swift-lm API version trap
312 313
313-Code must match the **resolved tag** (3.32.3, see `Package.resolved`), not `main`: main has314+Code must match the **resolved tag** (3.33.0 since 2026-11-27, #64; see `Package.resolved`), not
314-`progress: .download {}` and `Generation.reasoning`, 3.32.3 has `progressHandler:` and no315+`main`. Read the API from the SwiftPM checkout of the resolved version (`.build/linux/checkouts`
315-reasoning event (thinking arrives inline in `.chunk`). Read the API from the SwiftPM checkout316+after `swift package --scratch-path .build/linux update`). 3.33.0 sends the reasoning of families
316-of the resolved version.317+with a resolved `ModelConfiguration.reasoningConfig` as `Generation.reasoning` (delimiters
318+removed); razorbill maps it to `.thinking`, starts `ThinkingSplitter` outside a thought in that
319+case and passes `reasoningPrimedInside` (its own prompt-opens-`<think>` detection) to
320+`generateTask`. Models without a reasoning config still go through `ThinkingSplitter`. An unknown
321+`model_type` becomes `ModelResolutionError.unsupportedType` → 400 `model_not_supported`. A version
322+bump must be verified with the Mac smoke tests (real Qwen3): Linux cannot compile RazorbillMLX.
317 323
318 ## Not yet established324 ## Not yet established
319 325
modified .quality/history.jsonl +2 -0
@@ -39,3 +39,5 @@
3939 {"branch": "feature/v0.3-tui", "breaches": ["code smells: 1 (max 0)"], "commit": "0c75ccb", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": false, "metrics": {"classes": 366, "complex": 906, "cyclo": 1049, "fields": 1938, "funcs": 968, "lcom": 175, "lines": 17068, "loc": 13574}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 39, "smells": 1, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:12:36Z"}
4040 {"branch": "feature/v0.3-tui", "breaches": [], "commit": "0c75ccb", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 367, "complex": 890, "cyclo": 1053, "fields": 1938, "funcs": 970, "lcom": 175, "lines": 17092, "loc": 13589}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 40, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:13:16Z"}
4141 {"branch": "feature/v0.3-tui", "breaches": [], "commit": "1dea285", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 373, "complex": 915, "cyclo": 1079, "fields": 1985, "funcs": 985, "lcom": 179, "lines": 17449, "loc": 13886}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 41, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:27:09Z"}
42+{"branch": "feature/v0.3-tui", "breaches": ["warning-level issues: 1 (max 0)"], "commit": "3780f1a", "counts": {"warning": 1}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": false, "metrics": {"classes": 374, "complex": 945, "cyclo": 1101, "fields": 1998, "funcs": 997, "lcom": 181, "lines": 17665, "loc": 14066}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 42, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T06:31:51Z"}
43+{"branch": "feature/v0.3-tui", "breaches": [], "commit": "3780f1a", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 375, "complex": 945, "cyclo": 1101, "fields": 2000, "funcs": 997, "lcom": 181, "lines": 17671, "loc": 14069}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 43, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T06:32:10Z"}
@@ -39,3 +39,5 @@
39 {"branch": "feature/v0.3-tui", "breaches": ["code smells: 1 (max 0)"], "commit": "0c75ccb", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": false, "metrics": {"classes": 366, "complex": 906, "cyclo": 1049, "fields": 1938, "funcs": 968, "lcom": 175, "lines": 17068, "loc": 13574}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 39, "smells": 1, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:12:36Z"}39 {"branch": "feature/v0.3-tui", "breaches": ["code smells: 1 (max 0)"], "commit": "0c75ccb", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": false, "metrics": {"classes": 366, "complex": 906, "cyclo": 1049, "fields": 1938, "funcs": 968, "lcom": 175, "lines": 17068, "loc": 13574}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 39, "smells": 1, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:12:36Z"}
40 {"branch": "feature/v0.3-tui", "breaches": [], "commit": "0c75ccb", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 367, "complex": 890, "cyclo": 1053, "fields": 1938, "funcs": 970, "lcom": 175, "lines": 17092, "loc": 13589}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 40, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:13:16Z"}40 {"branch": "feature/v0.3-tui", "breaches": [], "commit": "0c75ccb", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 367, "complex": 890, "cyclo": 1053, "fields": 1938, "funcs": 970, "lcom": 175, "lines": 17092, "loc": 13589}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 40, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:13:16Z"}
41 {"branch": "feature/v0.3-tui", "breaches": [], "commit": "1dea285", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 373, "complex": 915, "cyclo": 1079, "fields": 1985, "funcs": 985, "lcom": 179, "lines": 17449, "loc": 13886}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 41, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:27:09Z"}41 {"branch": "feature/v0.3-tui", "breaches": [], "commit": "1dea285", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 373, "complex": 915, "cyclo": 1079, "fields": 1985, "funcs": 985, "lcom": 179, "lines": 17449, "loc": 13886}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 41, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:27:09Z"}
42+{"branch": "feature/v0.3-tui", "breaches": ["warning-level issues: 1 (max 0)"], "commit": "3780f1a", "counts": {"warning": 1}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": false, "metrics": {"classes": 374, "complex": 945, "cyclo": 1101, "fields": 1998, "funcs": 997, "lcom": 181, "lines": 17665, "loc": 14066}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 42, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T06:31:51Z"}
43+{"branch": "feature/v0.3-tui", "breaches": [], "commit": "3780f1a", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 375, "complex": 945, "cyclo": 1101, "fields": 2000, "funcs": 997, "lcom": 181, "lines": 17671, "loc": 14069}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 43, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T06:32:10Z"}
added .quality/report-20261127T063151Z.md +83 -0
new file mode 100644
@@ -0,0 +1,83 @@
1+# Quality report — 2026-11-27T06:31:51Z
2+
3+- **Gate**: ❌ **FAIL**
4+- **Commit**: `3780f1a` on `feature/v0.3-tui`
5+- **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
6+- **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7+- **Run**: #42 (previous: 2026-11-27T05:27:09Z)
8+
9+## Gate violations
10+
11+- warning-level issues: 1 (max 0)
12+
13+## Lint issues (`qlty check`)
14+
15+| level | count | vs previous |
16+|---|---|---|
17+| warning | 1 | — |
18+
19+### Top rules
20+
21+| rule | count |
22+|---|---|
23+| swiftlint:large_tuple | 1 |
24+
25+### Most affected files
26+
27+| file | issues |
28+|---|---|
29+| Sources/RazorbillMLX/MLXSession.swift | 1 |
30+
31+## Code smells (`qlty smells`)
32+
33+Total: **0** (vs previous: ±0)
34+
35+_none_
36+
37+## Metrics (`qlty metrics`)
38+
39+| metric | total | vs previous |
40+|---|---|---|
41+| funcs | 997 | +12 |
42+| classes | 374 | +1 |
43+| fields | 1998 | +13 |
44+| cyclo | 1101 | +22 |
45+| complex | 945 | +30 |
46+| lcom | 181 | +2 |
47+| lines | 17665 | +216 |
48+| loc | 14066 | +180 |
49+
50+### Most complex files
51+
52+| file | complex | cyclo | loc |
53+|---|---|---|---|
54+| Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 |
55+| Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |
56+| Sources/RazorbillTUI/ChatScreen.swift | 31 | 41 | 230 |
57+| Sources/RazorbillTUI/TextLayout.swift | 28 | 15 | 63 |
58+| experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |
59+| Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 |
60+| Sources/RazorbillTUI/DashboardScreen.swift | 25 | 23 | 132 |
61+| Sources/RazorbillMLX/MLXEngine.swift | 23 | 37 | 251 |
62+| Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 158 |
63+| tools/host-runner/host_runner.py | 23 | 23 | 144 |
64+| Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 |
65+| Sources/RazorbillTUI/TUIApp.swift | 21 | 35 | 228 |
66+| Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |
67+| Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 |
68+| Sources/RazorbillTUI/Terminal.swift | 20 | 18 | 139 |
69+
70+## Trend
71+
72+| run | timestamp | error | warning | smells | complex | gate |
73+|---|---|---|---|---|---|---|
74+| 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS |
75+| 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS |
76+| 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS |
77+| 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS |
78+| 37 | 2026-11-27T04:12:05Z | 0 | 0 | 0 | 717 | PASS |
79+| 38 | 2026-11-27T04:37:14Z | 0 | 0 | 0 | 815 | PASS |
80+| 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL |
81+| 40 | 2026-11-27T05:13:16Z | 0 | 0 | 0 | 890 | PASS |
82+| 41 | 2026-11-27T05:27:09Z | 0 | 0 | 0 | 915 | PASS |
83+| 42 | 2026-11-27T06:31:51Z | 0 | 1 | 0 | 945 | FAIL |
new file mode 100644
@@ -0,0 +1,83 @@
1+# Quality report — 2026-11-27T06:31:51Z
2+
3+- **Gate**: ❌ **FAIL**
4+- **Commit**: `3780f1a` on `feature/v0.3-tui`
5+- **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
6+- **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7+- **Run**: #42 (previous: 2026-11-27T05:27:09Z)
8+
9+## Gate violations
10+
11+- warning-level issues: 1 (max 0)
12+
13+## Lint issues (`qlty check`)
14+
15+| level | count | vs previous |
16+|---|---|---|
17+| warning | 1 | — |
18+
19+### Top rules
20+
21+| rule | count |
22+|---|---|
23+| swiftlint:large_tuple | 1 |
24+
25+### Most affected files
26+
27+| file | issues |
28+|---|---|
29+| Sources/RazorbillMLX/MLXSession.swift | 1 |
30+
31+## Code smells (`qlty smells`)
32+
33+Total: **0** (vs previous: ±0)
34+
35+_none_
36+
37+## Metrics (`qlty metrics`)
38+
39+| metric | total | vs previous |
40+|---|---|---|
41+| funcs | 997 | +12 |
42+| classes | 374 | +1 |
43+| fields | 1998 | +13 |
44+| cyclo | 1101 | +22 |
45+| complex | 945 | +30 |
46+| lcom | 181 | +2 |
47+| lines | 17665 | +216 |
48+| loc | 14066 | +180 |
49+
50+### Most complex files
51+
52+| file | complex | cyclo | loc |
53+|---|---|---|---|
54+| Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 |
55+| Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |
56+| Sources/RazorbillTUI/ChatScreen.swift | 31 | 41 | 230 |
57+| Sources/RazorbillTUI/TextLayout.swift | 28 | 15 | 63 |
58+| experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |
59+| Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 |
60+| Sources/RazorbillTUI/DashboardScreen.swift | 25 | 23 | 132 |
61+| Sources/RazorbillMLX/MLXEngine.swift | 23 | 37 | 251 |
62+| Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 158 |
63+| tools/host-runner/host_runner.py | 23 | 23 | 144 |
64+| Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 |
65+| Sources/RazorbillTUI/TUIApp.swift | 21 | 35 | 228 |
66+| Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |
67+| Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 |
68+| Sources/RazorbillTUI/Terminal.swift | 20 | 18 | 139 |
69+
70+## Trend
71+
72+| run | timestamp | error | warning | smells | complex | gate |
73+|---|---|---|---|---|---|---|
74+| 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS |
75+| 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS |
76+| 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS |
77+| 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS |
78+| 37 | 2026-11-27T04:12:05Z | 0 | 0 | 0 | 717 | PASS |
79+| 38 | 2026-11-27T04:37:14Z | 0 | 0 | 0 | 815 | PASS |
80+| 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL |
81+| 40 | 2026-11-27T05:13:16Z | 0 | 0 | 0 | 890 | PASS |
82+| 41 | 2026-11-27T05:27:09Z | 0 | 0 | 0 | 915 | PASS |
83+| 42 | 2026-11-27T06:31:51Z | 0 | 1 | 0 | 945 | FAIL |
added .quality/report-20261127T063210Z.md +75 -0
new file mode 100644
@@ -0,0 +1,75 @@
1+# Quality report — 2026-11-27T06:32:10Z
2+
3+- **Gate**: ✅ **PASS**
4+- **Commit**: `3780f1a` on `feature/v0.3-tui`
5+- **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
6+- **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7+- **Run**: #43 (previous: 2026-11-27T06:31:51Z)
8+
9+## Lint issues (`qlty check`)
10+
11+| level | count | vs previous |
12+|---|---|---|
13+| warning | 0 | -1 |
14+
15+### Top rules
16+
17+_none_
18+
19+### Most affected files
20+
21+_none_
22+
23+## Code smells (`qlty smells`)
24+
25+Total: **0** (vs previous: ±0)
26+
27+_none_
28+
29+## Metrics (`qlty metrics`)
30+
31+| metric | total | vs previous |
32+|---|---|---|
33+| funcs | 997 | ±0 |
34+| classes | 375 | +1 |
35+| fields | 2000 | +2 |
36+| cyclo | 1101 | ±0 |
37+| complex | 945 | ±0 |
38+| lcom | 181 | ±0 |
39+| lines | 17671 | +6 |
40+| loc | 14069 | +3 |
41+
42+### Most complex files
43+
44+| file | complex | cyclo | loc |
45+|---|---|---|---|
46+| Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 |
47+| Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |
48+| Sources/RazorbillTUI/ChatScreen.swift | 31 | 41 | 230 |
49+| Sources/RazorbillTUI/TextLayout.swift | 28 | 15 | 63 |
50+| experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |
51+| Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 |
52+| Sources/RazorbillTUI/DashboardScreen.swift | 25 | 23 | 132 |
53+| Sources/RazorbillMLX/MLXEngine.swift | 23 | 37 | 251 |
54+| Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 158 |
55+| tools/host-runner/host_runner.py | 23 | 23 | 144 |
56+| Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 |
57+| Sources/RazorbillTUI/TUIApp.swift | 21 | 35 | 228 |
58+| Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |
59+| Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 |
60+| Sources/RazorbillTUI/Terminal.swift | 20 | 18 | 139 |
61+
62+## Trend
63+
64+| run | timestamp | error | warning | smells | complex | gate |
65+|---|---|---|---|---|---|---|
66+| 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS |
67+| 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS |
68+| 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS |
69+| 37 | 2026-11-27T04:12:05Z | 0 | 0 | 0 | 717 | PASS |
70+| 38 | 2026-11-27T04:37:14Z | 0 | 0 | 0 | 815 | PASS |
71+| 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL |
72+| 40 | 2026-11-27T05:13:16Z | 0 | 0 | 0 | 890 | PASS |
73+| 41 | 2026-11-27T05:27:09Z | 0 | 0 | 0 | 915 | PASS |
74+| 42 | 2026-11-27T06:31:51Z | 0 | 1 | 0 | 945 | FAIL |
75+| 43 | 2026-11-27T06:32:10Z | 0 | 0 | 0 | 945 | PASS |
new file mode 100644
@@ -0,0 +1,75 @@
1+# Quality report — 2026-11-27T06:32:10Z
2+
3+- **Gate**: ✅ **PASS**
4+- **Commit**: `3780f1a` on `feature/v0.3-tui`
5+- **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
6+- **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7+- **Run**: #43 (previous: 2026-11-27T06:31:51Z)
8+
9+## Lint issues (`qlty check`)
10+
11+| level | count | vs previous |
12+|---|---|---|
13+| warning | 0 | -1 |
14+
15+### Top rules
16+
17+_none_
18+
19+### Most affected files
20+
21+_none_
22+
23+## Code smells (`qlty smells`)
24+
25+Total: **0** (vs previous: ±0)
26+
27+_none_
28+
29+## Metrics (`qlty metrics`)
30+
31+| metric | total | vs previous |
32+|---|---|---|
33+| funcs | 997 | ±0 |
34+| classes | 375 | +1 |
35+| fields | 2000 | +2 |
36+| cyclo | 1101 | ±0 |
37+| complex | 945 | ±0 |
38+| lcom | 181 | ±0 |
39+| lines | 17671 | +6 |
40+| loc | 14069 | +3 |
41+
42+### Most complex files
43+
44+| file | complex | cyclo | loc |
45+|---|---|---|---|
46+| Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 |
47+| Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |
48+| Sources/RazorbillTUI/ChatScreen.swift | 31 | 41 | 230 |
49+| Sources/RazorbillTUI/TextLayout.swift | 28 | 15 | 63 |
50+| experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |
51+| Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 |
52+| Sources/RazorbillTUI/DashboardScreen.swift | 25 | 23 | 132 |
53+| Sources/RazorbillMLX/MLXEngine.swift | 23 | 37 | 251 |
54+| Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 158 |
55+| tools/host-runner/host_runner.py | 23 | 23 | 144 |
56+| Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 |
57+| Sources/RazorbillTUI/TUIApp.swift | 21 | 35 | 228 |
58+| Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |
59+| Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 |
60+| Sources/RazorbillTUI/Terminal.swift | 20 | 18 | 139 |
61+
62+## Trend
63+
64+| run | timestamp | error | warning | smells | complex | gate |
65+|---|---|---|---|---|---|---|
66+| 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS |
67+| 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS |
68+| 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS |
69+| 37 | 2026-11-27T04:12:05Z | 0 | 0 | 0 | 717 | PASS |
70+| 38 | 2026-11-27T04:37:14Z | 0 | 0 | 0 | 815 | PASS |
71+| 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL |
72+| 40 | 2026-11-27T05:13:16Z | 0 | 0 | 0 | 890 | PASS |
73+| 41 | 2026-11-27T05:27:09Z | 0 | 0 | 0 | 915 | PASS |
74+| 42 | 2026-11-27T06:31:51Z | 0 | 1 | 0 | 945 | FAIL |
75+| 43 | 2026-11-27T06:32:10Z | 0 | 0 | 0 | 945 | PASS |
modified .quality/report-latest.md +19 -17
@@ -1,14 +1,16 @@
1-# Quality report — 2026-11-27T05:27:09Z
1+# Quality report — 2026-11-27T06:32:10Z
22
33 - **Gate**: ✅ **PASS**
4-- **Commit**: `1dea285` on `feature/v0.3-tui`
4+- **Commit**: `3780f1a` on `feature/v0.3-tui`
55 - **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
66 - **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7-- **Run**: #41 (previous: 2026-11-27T05:13:16Z)
7+- **Run**: #43 (previous: 2026-11-27T06:31:51Z)
88
99 ## Lint issues (`qlty check`)
1010
11-_none_
11+| level | count | vs previous |
12+|---|---|---|
13+| warning | 0 | -1 |
1214
1315 ### Top rules
1416
@@ -28,14 +30,14 @@ _none_
2830
2931 | metric | total | vs previous |
3032 |---|---|---|
31-| funcs | 985 | +15 |
32-| classes | 373 | +6 |
33-| fields | 1985 | +47 |
34-| cyclo | 1079 | +26 |
35-| complex | 915 | +25 |
36-| lcom | 179 | +4 |
37-| lines | 17449 | +357 |
38-| loc | 13886 | +297 |
33+| funcs | 997 | ±0 |
34+| classes | 375 | +1 |
35+| fields | 2000 | +2 |
36+| cyclo | 1101 | ±0 |
37+| complex | 945 | ±0 |
38+| lcom | 181 | ±0 |
39+| lines | 17671 | +6 |
40+| loc | 14069 | +3 |
3941
4042 ### Most complex files
4143
@@ -43,11 +45,12 @@ _none_
4345 |---|---|---|---|
4446 | Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 |
4547 | Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |
46-| Sources/RazorbillTUI/ChatScreen.swift | 28 | 38 | 219 |
48+| Sources/RazorbillTUI/ChatScreen.swift | 31 | 41 | 230 |
49+| Sources/RazorbillTUI/TextLayout.swift | 28 | 15 | 63 |
4750 | experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |
4851 | Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 |
4952 | Sources/RazorbillTUI/DashboardScreen.swift | 25 | 23 | 132 |
50-| Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 |
53+| Sources/RazorbillMLX/MLXEngine.swift | 23 | 37 | 251 |
5154 | Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 158 |
5255 | tools/host-runner/host_runner.py | 23 | 23 | 144 |
5356 | Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 |
@@ -55,14 +58,11 @@ _none_
5558 | Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |
5659 | Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 |
5760 | Sources/RazorbillTUI/Terminal.swift | 20 | 18 | 139 |
58-| Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 |
5961
6062 ## Trend
6163
6264 | run | timestamp | error | warning | smells | complex | gate |
6365 |---|---|---|---|---|---|---|
64-| 32 | 2026-11-26T07:29:39Z | 0 | 0 | 0 | 547 | PASS |
65-| 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS |
6666 | 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS |
6767 | 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS |
6868 | 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS |
@@ -71,3 +71,5 @@ _none_
7171 | 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL |
7272 | 40 | 2026-11-27T05:13:16Z | 0 | 0 | 0 | 890 | PASS |
7373 | 41 | 2026-11-27T05:27:09Z | 0 | 0 | 0 | 915 | PASS |
74+| 42 | 2026-11-27T06:31:51Z | 0 | 1 | 0 | 945 | FAIL |
75+| 43 | 2026-11-27T06:32:10Z | 0 | 0 | 0 | 945 | PASS |
@@ -1,14 +1,16 @@
1-# Quality report — 2026-11-27T05:27:09Z1+# Quality report — 2026-11-27T06:32:10Z
2 2
3 - **Gate**: ✅ **PASS**3 - **Gate**: ✅ **PASS**
4-- **Commit**: `1dea285` on `feature/v0.3-tui`4+- **Commit**: `3780f1a` on `feature/v0.3-tui`
5 - **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)5 - **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)
6 - **swiftlint**: 0.65.1 (run directly, merged into lint issues)6 - **swiftlint**: 0.65.1 (run directly, merged into lint issues)
7-- **Run**: #41 (previous: 2026-11-27T05:13:16Z)7+- **Run**: #43 (previous: 2026-11-27T06:31:51Z)
8 8
9 ## Lint issues (`qlty check`)9 ## Lint issues (`qlty check`)
10 10
11-_none_11+| level | count | vs previous |
12+|---|---|---|
13+| warning | 0 | -1 |
12 14
13 ### Top rules15 ### Top rules
14 16
@@ -28,14 +30,14 @@ _none_
28 30
29 | metric | total | vs previous |31 | metric | total | vs previous |
30 |---|---|---|32 |---|---|---|
31-| funcs | 985 | +15 |33+| funcs | 997 | ±0 |
32-| classes | 373 | +6 |34+| classes | 375 | +1 |
33-| fields | 1985 | +47 |35+| fields | 2000 | +2 |
34-| cyclo | 1079 | +26 |36+| cyclo | 1101 | ±0 |
35-| complex | 915 | +25 |37+| complex | 945 | ±0 |
36-| lcom | 179 | +4 |38+| lcom | 181 | ±0 |
37-| lines | 17449 | +357 |39+| lines | 17671 | +6 |
38-| loc | 13886 | +297 |40+| loc | 14069 | +3 |
39 41
40 ### Most complex files42 ### Most complex files
41 43
@@ -43,11 +45,12 @@ _none_
43 |---|---|---|---|45 |---|---|---|---|
44 | Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 |46 | Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 |
45 | Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |47 | Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 |
46-| Sources/RazorbillTUI/ChatScreen.swift | 28 | 38 | 219 |48+| Sources/RazorbillTUI/ChatScreen.swift | 31 | 41 | 230 |
49+| Sources/RazorbillTUI/TextLayout.swift | 28 | 15 | 63 |
47 | experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |50 | experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 |
48 | Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 |51 | Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 |
49 | Sources/RazorbillTUI/DashboardScreen.swift | 25 | 23 | 132 |52 | Sources/RazorbillTUI/DashboardScreen.swift | 25 | 23 | 132 |
50-| Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 |53+| Sources/RazorbillMLX/MLXEngine.swift | 23 | 37 | 251 |
51 | Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 158 |54 | Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 158 |
52 | tools/host-runner/host_runner.py | 23 | 23 | 144 |55 | tools/host-runner/host_runner.py | 23 | 23 | 144 |
53 | Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 |56 | Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 |
@@ -55,14 +58,11 @@ _none_
55 | Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |58 | Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 |
56 | Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 |59 | Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 |
57 | Sources/RazorbillTUI/Terminal.swift | 20 | 18 | 139 |60 | Sources/RazorbillTUI/Terminal.swift | 20 | 18 | 139 |
58-| Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 |
59 61
60 ## Trend62 ## Trend
61 63
62 | run | timestamp | error | warning | smells | complex | gate |64 | run | timestamp | error | warning | smells | complex | gate |
63 |---|---|---|---|---|---|---|65 |---|---|---|---|---|---|---|
64-| 32 | 2026-11-26T07:29:39Z | 0 | 0 | 0 | 547 | PASS |
65-| 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS |
66 | 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS |66 | 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS |
67 | 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS |67 | 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS |
68 | 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS |68 | 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS |
@@ -71,3 +71,5 @@ _none_
71 | 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL |71 | 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL |
72 | 40 | 2026-11-27T05:13:16Z | 0 | 0 | 0 | 890 | PASS |72 | 40 | 2026-11-27T05:13:16Z | 0 | 0 | 0 | 890 | PASS |
73 | 41 | 2026-11-27T05:27:09Z | 0 | 0 | 0 | 915 | PASS |73 | 41 | 2026-11-27T05:27:09Z | 0 | 0 | 0 | 915 | PASS |
74+| 42 | 2026-11-27T06:31:51Z | 0 | 1 | 0 | 945 | FAIL |
75+| 43 | 2026-11-27T06:32:10Z | 0 | 0 | 0 | 945 | PASS |
added .tickets/issues/0064-mlx-swift-lm-3-33.yaml +53 -0
new file mode 100644
@@ -0,0 +1,53 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 64
3+title: "mlx-swift-lm 3.33.0 (Mellum and newer models) and a clear error for unknown architectures"
4+state: closed
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-27T09:00:00.000Z
9+updatedAt: 2026-11-27T09:30:00.000Z
10+closedAt: 2026-11-27T09:30:00.000Z
11+labels:
12+ - "kind::chore"
13+ - "area::engine"
14+ - "mac-only"
15+ - "priority::high"
16+milestone: "v0.3 — TUI"
17+epic: "Inference engine"
18+related:
19+ - 61
20+body: |
21+ Asked by the user (2026-11-27): `mlx-community/Mellum2-12B-A2.5B-Thinking-8bit` failed with `500 model_load_failed: … unsupportedModelType("mellum")`. razorbill pinned mlx-swift-lm `.upToNextMinor(from: "3.32.3")`; `mellum` (JetBrains Mellum 2.1) arrived in 3.33.0 (2026-11-17, with Qwen 3.8, LFM3, Nemotron 3.5…).
22+
23+ ## Done
24+ - `Package.swift`: mlx-swift-lm `.upToNextMinor(from: "3.33.0")`, mlx-swift `from: "0.33.0"`; `Package.resolved` 3.33.0 / 0.33.0 (nothing else moved).
25+ - API check: no source break for razorbill (removed `compile(shapeless:)` overloads, `ChatSession.respond/synchronize` and `GenerationConfigFile` are not used; `ModelContainer` / `EmbedderModelContainer` only gained `ModelMemoryReporting`; `canTrimPromptCache(_:)` kept; `generateTask` gained `reasoningPrimedInside:` with a default).
26+ - Behaviour change caught by the Mac smoke tests: 3.33.0 splits the reasoning of families it knows (`ModelConfiguration.reasoningConfig`, resolved at load) and sends it as `Generation.reasoning`, delimiters removed. razorbill ignored that event, so Qwen3 lost its `reasoning_content`. Now `.reasoning` → `EngineEvent.thinking`; when the library reasons, `ThinkingSplitter` starts outside a thought and `generateTask` gets `reasoningPrimedInside` (razorbill's own detection of a prompt that opens `<think>`, e.g. Qwen3.5); raw completions keep that text as text.
27+ - Unknown `model_type`: `ModelFactoryError.unsupportedModelType` is turned into `ModelResolutionError.unsupportedType(model:type:)` (chat and embedding loads) → 400 `model_not_supported` naming the type, instead of 500 `model_load_failed`.
28+ - Tests: Linux 335 (+2: the error passes through the manager, the route answers 400), Mac 361 including the real Qwen3 smoke tests (reasoning apart, streamed reasoning first, thinking budget). Gate PASS run #43. Docs: errors reference EN+FR.
29+
30+ ## Not checked yet
31+ - Loading Mellum itself on the Mac (the user's test), and `scripts/compat.sh` on the Mac with real models.
32+tasks:
33+ - id: 1
34+ title: "Bump to 3.33.0, check the API, fix the reasoning events"
35+ state: closed
36+ priority: high
37+ author:
38+ name: k33g
39+ email: ph.charriere@gmail.com
40+ createdAt: 2026-11-27T09:00:00.000Z
41+ updatedAt: 2026-11-27T09:30:00.000Z
42+ closedAt: 2026-11-27T09:30:00.000Z
43+ - id: 2
44+ title: "400 model_not_supported for an unknown model_type"
45+ state: closed
46+ priority: medium
47+ author:
48+ name: k33g
49+ email: ph.charriere@gmail.com
50+ createdAt: 2026-11-27T09:00:00.000Z
51+ updatedAt: 2026-11-27T09:30:00.000Z
52+ closedAt: 2026-11-27T09:30:00.000Z
53+comments: []
new file mode 100644
@@ -0,0 +1,53 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 64
3+title: "mlx-swift-lm 3.33.0 (Mellum and newer models) and a clear error for unknown architectures"
4+state: closed
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-27T09:00:00.000Z
9+updatedAt: 2026-11-27T09:30:00.000Z
10+closedAt: 2026-11-27T09:30:00.000Z
11+labels:
12+ - "kind::chore"
13+ - "area::engine"
14+ - "mac-only"
15+ - "priority::high"
16+milestone: "v0.3 — TUI"
17+epic: "Inference engine"
18+related:
19+ - 61
20+body: |
21+ Asked by the user (2026-11-27): `mlx-community/Mellum2-12B-A2.5B-Thinking-8bit` failed with `500 model_load_failed: … unsupportedModelType("mellum")`. razorbill pinned mlx-swift-lm `.upToNextMinor(from: "3.32.3")`; `mellum` (JetBrains Mellum 2.1) arrived in 3.33.0 (2026-11-17, with Qwen 3.8, LFM3, Nemotron 3.5…).
22+
23+ ## Done
24+ - `Package.swift`: mlx-swift-lm `.upToNextMinor(from: "3.33.0")`, mlx-swift `from: "0.33.0"`; `Package.resolved` 3.33.0 / 0.33.0 (nothing else moved).
25+ - API check: no source break for razorbill (removed `compile(shapeless:)` overloads, `ChatSession.respond/synchronize` and `GenerationConfigFile` are not used; `ModelContainer` / `EmbedderModelContainer` only gained `ModelMemoryReporting`; `canTrimPromptCache(_:)` kept; `generateTask` gained `reasoningPrimedInside:` with a default).
26+ - Behaviour change caught by the Mac smoke tests: 3.33.0 splits the reasoning of families it knows (`ModelConfiguration.reasoningConfig`, resolved at load) and sends it as `Generation.reasoning`, delimiters removed. razorbill ignored that event, so Qwen3 lost its `reasoning_content`. Now `.reasoning` → `EngineEvent.thinking`; when the library reasons, `ThinkingSplitter` starts outside a thought and `generateTask` gets `reasoningPrimedInside` (razorbill's own detection of a prompt that opens `<think>`, e.g. Qwen3.5); raw completions keep that text as text.
27+ - Unknown `model_type`: `ModelFactoryError.unsupportedModelType` is turned into `ModelResolutionError.unsupportedType(model:type:)` (chat and embedding loads) → 400 `model_not_supported` naming the type, instead of 500 `model_load_failed`.
28+ - Tests: Linux 335 (+2: the error passes through the manager, the route answers 400), Mac 361 including the real Qwen3 smoke tests (reasoning apart, streamed reasoning first, thinking budget). Gate PASS run #43. Docs: errors reference EN+FR.
29+
30+ ## Not checked yet
31+ - Loading Mellum itself on the Mac (the user's test), and `scripts/compat.sh` on the Mac with real models.
32+tasks:
33+ - id: 1
34+ title: "Bump to 3.33.0, check the API, fix the reasoning events"
35+ state: closed
36+ priority: high
37+ author:
38+ name: k33g
39+ email: ph.charriere@gmail.com
40+ createdAt: 2026-11-27T09:00:00.000Z
41+ updatedAt: 2026-11-27T09:30:00.000Z
42+ closedAt: 2026-11-27T09:30:00.000Z
43+ - id: 2
44+ title: "400 model_not_supported for an unknown model_type"
45+ state: closed
46+ priority: medium
47+ author:
48+ name: k33g
49+ email: ph.charriere@gmail.com
50+ createdAt: 2026-11-27T09:00:00.000Z
51+ updatedAt: 2026-11-27T09:30:00.000Z
52+ closedAt: 2026-11-27T09:30:00.000Z
53+comments: []
modified Package.resolved +5 -5
@@ -1,5 +1,5 @@
11 {
2- "originHash" : "92f3106d62067122d14e4428e04555ccc2e8192241fcedc5b5f8a135948998e8",
2+ "originHash" : "5777caaaa2508a7df79a68885c9977982e5d4fb9a0217bf2ad45aaa295b07112",
33 "pins" : [
44 {
55 "identity" : "async-http-client",
@@ -33,8 +33,8 @@
3333 "kind" : "remoteSourceControl",
3434 "location" : "https://github.com/ml-explore/mlx-swift",
3535 "state" : {
36- "revision" : "19601207e9a0de51e03ee6ec0c3c5f3784275075",
37- "version" : "0.32.3"
36+ "revision" : "7ede4fd6d05f63305c1c0ebf4f8c1909a637c574",
37+ "version" : "0.33.0"
3838 }
3939 },
4040 {
@@ -42,8 +42,8 @@
4242 "kind" : "remoteSourceControl",
4343 "location" : "https://github.com/ml-explore/mlx-swift-lm",
4444 "state" : {
45- "revision" : "3b339ad6e3b3f44c8121ecff5131c7fd55e075e6",
46- "version" : "3.32.3"
45+ "revision" : "ca661dc6885f8603e911746838b60d312439a368",
46+ "version" : "3.33.0"
4747 }
4848 },
4949 {
@@ -1,5 +1,5 @@
1 {1 {
2- "originHash" : "92f3106d62067122d14e4428e04555ccc2e8192241fcedc5b5f8a135948998e8",2+ "originHash" : "5777caaaa2508a7df79a68885c9977982e5d4fb9a0217bf2ad45aaa295b07112",
3 "pins" : [3 "pins" : [
4 {4 {
5 "identity" : "async-http-client",5 "identity" : "async-http-client",
@@ -33,8 +33,8 @@
33 "kind" : "remoteSourceControl",33 "kind" : "remoteSourceControl",
34 "location" : "https://github.com/ml-explore/mlx-swift",34 "location" : "https://github.com/ml-explore/mlx-swift",
35 "state" : {35 "state" : {
36- "revision" : "19601207e9a0de51e03ee6ec0c3c5f3784275075",36+ "revision" : "7ede4fd6d05f63305c1c0ebf4f8c1909a637c574",
37- "version" : "0.32.3"37+ "version" : "0.33.0"
38 }38 }
39 },39 },
40 {40 {
@@ -42,8 +42,8 @@
42 "kind" : "remoteSourceControl",42 "kind" : "remoteSourceControl",
43 "location" : "https://github.com/ml-explore/mlx-swift-lm",43 "location" : "https://github.com/ml-explore/mlx-swift-lm",
44 "state" : {44 "state" : {
45- "revision" : "3b339ad6e3b3f44c8121ecff5131c7fd55e075e6",45+ "revision" : "ca661dc6885f8603e911746838b60d312439a368",
46- "version" : "3.32.3"46+ "version" : "3.33.0"
47 }47 }
48 },48 },
49 {49 {
modified Package.swift +2 -2
@@ -22,10 +22,10 @@ let package = Package(
2222 // Traits disabled: the FoundationModels bridge needs the macOS 27 SDK and is not used.
2323 .package(
2424 url: "https://github.com/ml-explore/mlx-swift-lm",
25- .upToNextMinor(from: "3.32.3"),
25+ .upToNextMinor(from: "3.33.0"),
2626 traits: []
2727 ),
28- .package(url: "https://github.com/ml-explore/mlx-swift", from: "0.32.0"),
28+ .package(url: "https://github.com/ml-explore/mlx-swift", from: "0.33.0"),
2929 .package(url: "https://github.com/huggingface/swift-huggingface", from: "0.9.0"),
3030 .package(url: "https://github.com/huggingface/swift-transformers", from: "1.3.0"),
3131 .package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),
@@ -22,10 +22,10 @@ let package = Package(
22 // Traits disabled: the FoundationModels bridge needs the macOS 27 SDK and is not used.22 // Traits disabled: the FoundationModels bridge needs the macOS 27 SDK and is not used.
23 .package(23 .package(
24 url: "https://github.com/ml-explore/mlx-swift-lm",24 url: "https://github.com/ml-explore/mlx-swift-lm",
25- .upToNextMinor(from: "3.32.3"),25+ .upToNextMinor(from: "3.33.0"),
26 traits: []26 traits: []
27 ),27 ),
28- .package(url: "https://github.com/ml-explore/mlx-swift", from: "0.32.0"),28+ .package(url: "https://github.com/ml-explore/mlx-swift", from: "0.33.0"),
29 .package(url: "https://github.com/huggingface/swift-huggingface", from: "0.9.0"),29 .package(url: "https://github.com/huggingface/swift-huggingface", from: "0.9.0"),
30 .package(url: "https://github.com/huggingface/swift-transformers", from: "1.3.0"),30 .package(url: "https://github.com/huggingface/swift-transformers", from: "1.3.0"),
31 .package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),31 .package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),
modified Sources/RazorbillCore/Models/ModelCatalog.swift +5 -0
@@ -35,6 +35,8 @@ public enum ModelResolutionError: Error, Sendable, Equatable, CustomStringConver
3535 case unknown(String)
3636 /// The repository is in the cache but not in MLX format (GGUF only, for instance).
3737 case notMLX(String)
38+ /// The model's `model_type` (its architecture) is not one this build's engine can run.
39+ case unsupportedType(model: String, type: String)
3840
3941 public var description: String {
4042 switch self {
@@ -42,6 +44,9 @@ public enum ModelResolutionError: Error, Sendable, Equatable, CustomStringConver
4244 "the model '\(name)' does not exist (not declared, and not a Hugging Face id org/name)"
4345 case .notMLX(let id):
4446 "the model '\(id)' is not in MLX format (no .safetensors weights)"
47+ case .unsupportedType(let model, let type):
48+ "the model '\(model)' is of type '\(type)', which this build of razorbill cannot run"
49+ + " (its engine does not know that architecture); a newer razorbill may"
4550 }
4651 }
4752 }
@@ -35,6 +35,8 @@ public enum ModelResolutionError: Error, Sendable, Equatable, CustomStringConver
35 case unknown(String)35 case unknown(String)
36 /// The repository is in the cache but not in MLX format (GGUF only, for instance).36 /// The repository is in the cache but not in MLX format (GGUF only, for instance).
37 case notMLX(String)37 case notMLX(String)
38+ /// The model's `model_type` (its architecture) is not one this build's engine can run.
39+ case unsupportedType(model: String, type: String)
38 40
39 public var description: String {41 public var description: String {
40 switch self {42 switch self {
@@ -42,6 +44,9 @@ public enum ModelResolutionError: Error, Sendable, Equatable, CustomStringConver
42 "the model '\(name)' does not exist (not declared, and not a Hugging Face id org/name)"44 "the model '\(name)' does not exist (not declared, and not a Hugging Face id org/name)"
43 case .notMLX(let id):45 case .notMLX(let id):
44 "the model '\(id)' is not in MLX format (no .safetensors weights)"46 "the model '\(id)' is not in MLX format (no .safetensors weights)"
47+ case .unsupportedType(let model, let type):
48+ "the model '\(model)' is of type '\(type)', which this build of razorbill cannot run"
49+ + " (its engine does not know that architecture); a newer razorbill may"
45 }50 }
46 }51 }
47 }52 }
modified Sources/RazorbillMLX/MLXEmbedder.swift +14 -5
@@ -54,6 +54,19 @@ public final class MLXEmbedder: InferenceEngine, @unchecked Sendable {
5454 public func load(
5555 _ model: ModelReference, offline: Bool, progress: @escaping @Sendable (Double) -> Void
5656 ) async throws {
57+ let loaded = try await MLXSupport.loading(model) {
58+ try await loadContainer(model, offline: offline, progress: progress)
59+ }
60+ let limit = Self.maxTokens(in: try await loaded.modelDirectory)
61+ lock.withLock {
62+ container = loaded
63+ maxTokens = limit
64+ }
65+ }
66+
67+ private func loadContainer(
68+ _ model: ModelReference, offline: Bool, progress: @escaping @Sendable (Double) -> Void
69+ ) async throws -> EmbedderModelContainer {
5770 let tokenizerLoader = #huggingFaceTokenizerLoader()
5871 let loaded: EmbedderModelContainer
5972 switch model {
@@ -70,11 +83,7 @@ public final class MLXEmbedder: InferenceEngine, @unchecked Sendable {
7083 if !cached { progress(fraction.fractionCompleted) }
7184 })
7285 }
73- let limit = Self.maxTokens(in: try await loaded.modelDirectory)
74- lock.withLock {
75- container = loaded
76- maxTokens = limit
77- }
86+ return loaded
7887 }
7988
8089 public func download(
@@ -54,6 +54,19 @@ public final class MLXEmbedder: InferenceEngine, @unchecked Sendable {
54 public func load(54 public func load(
55 _ model: ModelReference, offline: Bool, progress: @escaping @Sendable (Double) -> Void55 _ model: ModelReference, offline: Bool, progress: @escaping @Sendable (Double) -> Void
56 ) async throws {56 ) async throws {
57+ let loaded = try await MLXSupport.loading(model) {
58+ try await loadContainer(model, offline: offline, progress: progress)
59+ }
60+ let limit = Self.maxTokens(in: try await loaded.modelDirectory)
61+ lock.withLock {
62+ container = loaded
63+ maxTokens = limit
64+ }
65+ }
66+
67+ private func loadContainer(
68+ _ model: ModelReference, offline: Bool, progress: @escaping @Sendable (Double) -> Void
69+ ) async throws -> EmbedderModelContainer {
57 let tokenizerLoader = #huggingFaceTokenizerLoader()70 let tokenizerLoader = #huggingFaceTokenizerLoader()
58 let loaded: EmbedderModelContainer71 let loaded: EmbedderModelContainer
59 switch model {72 switch model {
@@ -70,11 +83,7 @@ public final class MLXEmbedder: InferenceEngine, @unchecked Sendable {
70 if !cached { progress(fraction.fractionCompleted) }83 if !cached { progress(fraction.fractionCompleted) }
71 })84 })
72 }85 }
73- let limit = Self.maxTokens(in: try await loaded.modelDirectory)86+ return loaded
74- lock.withLock {
75- container = loaded
76- maxTokens = limit
77- }
78 }87 }
79 88
80 public func download(89 public func download(
modified Sources/RazorbillMLX/MLXEngine.swift +9 -1
@@ -50,7 +50,9 @@ public final class MLXEngine: InferenceEngine, @unchecked Sendable {
5050 public func load(
5151 _ model: ModelReference, offline: Bool, progress: @escaping @Sendable (Double) -> Void
5252 ) async throws {
53- let loaded = try await loadContainer(model, offline: offline, progress: progress)
53+ let loaded = try await MLXSupport.loading(model) {
54+ try await loadContainer(model, offline: offline, progress: progress)
55+ }
5456 let format = await loaded.configuration.toolCallFormat
5557 lock.withLock {
5658 container = loaded
@@ -117,6 +119,8 @@ public final class MLXEngine: InferenceEngine, @unchecked Sendable {
117119 if Task.isCancelled { break }
118120 switch generation {
119121 case .chunk(let text): continuation.yield(.text(text))
122+ // A raw completion is text only: reasoning the library split off stays in it.
123+ case .reasoning(let text): continuation.yield(.text(text))
120124 case .info(let info): continuation.yield(.stats(MLXConversion.stats(info)))
121125 default: break
122126 }
@@ -240,6 +244,10 @@ enum MLXConversion {
240244 switch generation {
241245 case .chunk(let text):
242246 return splitter.feed(text)
247+ case .reasoning(let text):
248+ // Since mlx-swift-lm 3.33, families with a known reasoning protocol get their
249+ // thinking split off by the library, delimiters removed.
250+ return [.thinking(text)]
243251 case .toolCall(let call):
244252 let arguments = ConfigMap(call.function.arguments.mapValues(value))
245253 let toolCall = RazorbillCore.ToolCall(
@@ -50,7 +50,9 @@ public final class MLXEngine: InferenceEngine, @unchecked Sendable {
50 public func load(50 public func load(
51 _ model: ModelReference, offline: Bool, progress: @escaping @Sendable (Double) -> Void51 _ model: ModelReference, offline: Bool, progress: @escaping @Sendable (Double) -> Void
52 ) async throws {52 ) async throws {
53- let loaded = try await loadContainer(model, offline: offline, progress: progress)53+ let loaded = try await MLXSupport.loading(model) {
54+ try await loadContainer(model, offline: offline, progress: progress)
55+ }
54 let format = await loaded.configuration.toolCallFormat56 let format = await loaded.configuration.toolCallFormat
55 lock.withLock {57 lock.withLock {
56 container = loaded58 container = loaded
@@ -117,6 +119,8 @@ public final class MLXEngine: InferenceEngine, @unchecked Sendable {
117 if Task.isCancelled { break }119 if Task.isCancelled { break }
118 switch generation {120 switch generation {
119 case .chunk(let text): continuation.yield(.text(text))121 case .chunk(let text): continuation.yield(.text(text))
122+ // A raw completion is text only: reasoning the library split off stays in it.
123+ case .reasoning(let text): continuation.yield(.text(text))
120 case .info(let info): continuation.yield(.stats(MLXConversion.stats(info)))124 case .info(let info): continuation.yield(.stats(MLXConversion.stats(info)))
121 default: break125 default: break
122 }126 }
@@ -240,6 +244,10 @@ enum MLXConversion {
240 switch generation {244 switch generation {
241 case .chunk(let text):245 case .chunk(let text):
242 return splitter.feed(text)246 return splitter.feed(text)
247+ case .reasoning(let text):
248+ // Since mlx-swift-lm 3.33, families with a known reasoning protocol get their
249+ // thinking split off by the library, delimiters removed.
250+ return [.thinking(text)]
243 case .toolCall(let call):251 case .toolCall(let call):
244 let arguments = ConfigMap(call.function.arguments.mapValues(value))252 let arguments = ConfigMap(call.function.arguments.mapValues(value))
245 let toolCall = RazorbillCore.ToolCall(253 let toolCall = RazorbillCore.ToolCall(
modified Sources/RazorbillMLX/MLXSession.swift +25 -10
@@ -60,13 +60,16 @@ final class MLXSession: EngineSession, @unchecked Sendable {
6060 history += messages
6161 return history
6262 }
63- var splitter = ThinkingSplitter(startsInsideThinking: startsInsideThinking)
6463 var text = ""
65- let (generations, reused) = try await start(conversation)
66- for await generation in generations {
64+ let started = try await start(conversation)
65+ // When the library splits the reasoning itself, the chunks carry no delimiters: the
66+ // splitter then only sees answer text and must not start inside a thought.
67+ var splitter = ThinkingSplitter(
68+ startsInsideThinking: startsInsideThinking && !started.libraryReasons)
69+ for await generation in started.generations {
6770 try Task.checkCancellation()
6871 let events = MLXConversion.events(
69- generation, splitter: &splitter, cachedPromptTokens: reused)
72+ generation, splitter: &splitter, cachedPromptTokens: started.reused)
7073 text += Self.yield(events, to: continuation)
7174 }
7275 return text + Self.yield(splitter.finish(), to: continuation)
@@ -84,13 +87,21 @@ final class MLXSession: EngineSession, @unchecked Sendable {
8487 return text
8588 }
8689
90+ /// A generation just started.
91+ private struct Started: Sendable {
92+ let generations: AsyncStream<Generation>
93+ /// Prompt tokens taken from the prompt cache.
94+ let reused: Int
95+ /// The library splits the reasoning off (`.reasoning` events) for this model.
96+ let libraryReasons: Bool
97+ }
98+
8799 /// Renders `conversation`, takes what the prompt cache already holds of it, and starts the
88- /// generation. Returns its events and the number of prompt tokens taken from the cache.
89- private func start(
90- _ conversation: [ChatMessage]
91- ) async throws -> (AsyncStream<Generation>, Int) {
100+ /// generation.
101+ private func start(_ conversation: [ChatMessage]) async throws -> Started {
92102 let request = request
93103 let cache = cache
104+ let primed = startsInsideThinking
94105 return try await container.perform(values: conversation) { context, conversation in
95106 let input = try await context.processor.prepare(
96107 input: UserInput(
@@ -106,12 +117,16 @@ final class MLXSession: EngineSession, @unchecked Sendable {
106117 // Models that carry state between calls (positions of multimodal models) cannot
107118 // resume from the cache alone.
108119 let reusable = iterator.state == nil
120+ // The library parses the reasoning of families it knows; it must be told when the
121+ // prompt already opened the thought (Qwen3.5), as the tokens it sees start inside it.
122+ let libraryReasons = context.configuration.reasoningConfig != nil
109123 let (stream, task) = generateTask(
110124 promptTokenCount: fed.text.tokens.size, modelConfiguration: context.configuration,
111125 tokenizer: context.tokenizer, iterator: iterator, tools: request.tools,
112- toolCallPolicy: request.parameters.toolCallPolicy)
126+ toolCallPolicy: request.parameters.toolCallPolicy,
127+ reasoningPrimedInside: libraryReasons && primed)
113128 cache.started(task, prompt: prompt, reusable: reusable)
114- return (stream, reused)
129+ return Started(generations: stream, reused: reused, libraryReasons: libraryReasons)
115130 }
116131 }
117132 }
@@ -60,13 +60,16 @@ final class MLXSession: EngineSession, @unchecked Sendable {
60 history += messages60 history += messages
61 return history61 return history
62 }62 }
63- var splitter = ThinkingSplitter(startsInsideThinking: startsInsideThinking)
64 var text = ""63 var text = ""
65- let (generations, reused) = try await start(conversation)64+ let started = try await start(conversation)
66- for await generation in generations {65+ // When the library splits the reasoning itself, the chunks carry no delimiters: the
66+ // splitter then only sees answer text and must not start inside a thought.
67+ var splitter = ThinkingSplitter(
68+ startsInsideThinking: startsInsideThinking && !started.libraryReasons)
69+ for await generation in started.generations {
67 try Task.checkCancellation()70 try Task.checkCancellation()
68 let events = MLXConversion.events(71 let events = MLXConversion.events(
69- generation, splitter: &splitter, cachedPromptTokens: reused)72+ generation, splitter: &splitter, cachedPromptTokens: started.reused)
70 text += Self.yield(events, to: continuation)73 text += Self.yield(events, to: continuation)
71 }74 }
72 return text + Self.yield(splitter.finish(), to: continuation)75 return text + Self.yield(splitter.finish(), to: continuation)
@@ -84,13 +87,21 @@ final class MLXSession: EngineSession, @unchecked Sendable {
84 return text87 return text
85 }88 }
86 89
90+ /// A generation just started.
91+ private struct Started: Sendable {
92+ let generations: AsyncStream<Generation>
93+ /// Prompt tokens taken from the prompt cache.
94+ let reused: Int
95+ /// The library splits the reasoning off (`.reasoning` events) for this model.
96+ let libraryReasons: Bool
97+ }
98+
87 /// Renders `conversation`, takes what the prompt cache already holds of it, and starts the99 /// Renders `conversation`, takes what the prompt cache already holds of it, and starts the
88- /// generation. Returns its events and the number of prompt tokens taken from the cache.100+ /// generation.
89- private func start(101+ private func start(_ conversation: [ChatMessage]) async throws -> Started {
90- _ conversation: [ChatMessage]
91- ) async throws -> (AsyncStream<Generation>, Int) {
92 let request = request102 let request = request
93 let cache = cache103 let cache = cache
104+ let primed = startsInsideThinking
94 return try await container.perform(values: conversation) { context, conversation in105 return try await container.perform(values: conversation) { context, conversation in
95 let input = try await context.processor.prepare(106 let input = try await context.processor.prepare(
96 input: UserInput(107 input: UserInput(
@@ -106,12 +117,16 @@ final class MLXSession: EngineSession, @unchecked Sendable {
106 // Models that carry state between calls (positions of multimodal models) cannot117 // Models that carry state between calls (positions of multimodal models) cannot
107 // resume from the cache alone.118 // resume from the cache alone.
108 let reusable = iterator.state == nil119 let reusable = iterator.state == nil
120+ // The library parses the reasoning of families it knows; it must be told when the
121+ // prompt already opened the thought (Qwen3.5), as the tokens it sees start inside it.
122+ let libraryReasons = context.configuration.reasoningConfig != nil
109 let (stream, task) = generateTask(123 let (stream, task) = generateTask(
110 promptTokenCount: fed.text.tokens.size, modelConfiguration: context.configuration,124 promptTokenCount: fed.text.tokens.size, modelConfiguration: context.configuration,
111 tokenizer: context.tokenizer, iterator: iterator, tools: request.tools,125 tokenizer: context.tokenizer, iterator: iterator, tools: request.tools,
112- toolCallPolicy: request.parameters.toolCallPolicy)126+ toolCallPolicy: request.parameters.toolCallPolicy,
127+ reasoningPrimedInside: libraryReasons && primed)
113 cache.started(task, prompt: prompt, reusable: reusable)128 cache.started(task, prompt: prompt, reusable: reusable)
114- return (stream, reused)129+ return Started(generations: stream, reused: reused, libraryReasons: libraryReasons)
115 }130 }
116 }131 }
117 }132 }
modified Sources/RazorbillMLX/MLXSupport.swift +13 -0
@@ -2,6 +2,7 @@ import RazorbillCore
22
33 #if canImport(MLXLLM)
44 import MLX
5+import MLXLMCommon
56 #endif
67
78 /// Whether this build of razorbill contains the MLX engine, and how to register it.
@@ -33,6 +34,18 @@ public enum MLXSupport {
3334 }
3435
3536 #if canImport(MLXLLM)
37+ /// Runs a model load, turning mlx-swift-lm's "unknown `model_type`" into razorbill's own
38+ /// error, which the server answers as 400 `model_not_supported` instead of a load failure.
39+ static func loading<T>(
40+ _ model: ModelReference, _ body: () async throws -> T
41+ ) async throws -> T {
42+ do {
43+ return try await body()
44+ } catch ModelFactoryError.unsupportedModelType(let type) {
45+ throw ModelResolutionError.unsupportedType(model: model.description, type: type)
46+ }
47+ }
48+
3649 /// MLX's allocator counters, read on each call.
3750 static func currentMemory() -> ProcessMemory {
3851 ProcessMemory(
@@ -2,6 +2,7 @@ import RazorbillCore
2 2
3 #if canImport(MLXLLM)3 #if canImport(MLXLLM)
4 import MLX4 import MLX
5+import MLXLMCommon
5 #endif6 #endif
6 7
7 /// Whether this build of razorbill contains the MLX engine, and how to register it.8 /// Whether this build of razorbill contains the MLX engine, and how to register it.
@@ -33,6 +34,18 @@ public enum MLXSupport {
33 }34 }
34 35
35 #if canImport(MLXLLM)36 #if canImport(MLXLLM)
37+ /// Runs a model load, turning mlx-swift-lm's "unknown `model_type`" into razorbill's own
38+ /// error, which the server answers as 400 `model_not_supported` instead of a load failure.
39+ static func loading<T>(
40+ _ model: ModelReference, _ body: () async throws -> T
41+ ) async throws -> T {
42+ do {
43+ return try await body()
44+ } catch ModelFactoryError.unsupportedModelType(let type) {
45+ throw ModelResolutionError.unsupportedType(model: model.description, type: type)
46+ }
47+ }
48+
36 /// MLX's allocator counters, read on each call.49 /// MLX's allocator counters, read on each call.
37 static func currentMemory() -> ProcessMemory {50 static func currentMemory() -> ProcessMemory {
38 ProcessMemory(51 ProcessMemory(
modified Sources/RazorbillServer/ModelManager.swift +1 -1
@@ -195,7 +195,7 @@ public actor ModelManager {
195195 }
196196
197197 private func loadError(_ error: any Error, model: ResolvedModel) -> any Error {
198- if error is CancellationError { return error }
198+ if error is CancellationError || error is ModelResolutionError { return error }
199199 if case .huggingFace(let id, _) = model.source, catalog.store.lacksMLXWeights(id: id) {
200200 return ModelResolutionError.notMLX(id)
201201 }
@@ -195,7 +195,7 @@ public actor ModelManager {
195 }195 }
196 196
197 private func loadError(_ error: any Error, model: ResolvedModel) -> any Error {197 private func loadError(_ error: any Error, model: ResolvedModel) -> any Error {
198- if error is CancellationError { return error }198+ if error is CancellationError || error is ModelResolutionError { return error }
199 if case .huggingFace(let id, _) = model.source, catalog.store.lacksMLXWeights(id: id) {199 if case .huggingFace(let id, _) = model.source, catalog.store.lacksMLXWeights(id: id) {
200 return ModelResolutionError.notMLX(id)200 return ModelResolutionError.notMLX(id)
201 }201 }
modified Sources/RazorbillServer/OpenAIError.swift +1 -1
@@ -156,7 +156,7 @@ extension OpenAIError {
156156 switch error {
157157 case .unknown(let name):
158158 self = .modelNotFound(name)
159- case .notMLX:
159+ case .notMLX, .unsupportedType:
160160 self.init(
161161 .badRequest, message: error.description, param: "model",
162162 code: "model_not_supported")
@@ -156,7 +156,7 @@ extension OpenAIError {
156 switch error {156 switch error {
157 case .unknown(let name):157 case .unknown(let name):
158 self = .modelNotFound(name)158 self = .modelNotFound(name)
159- case .notMLX:159+ case .notMLX, .unsupportedType:
160 self.init(160 self.init(
161 .badRequest, message: error.description, param: "model",161 .badRequest, message: error.description, param: "model",
162 code: "model_not_supported")162 code: "model_not_supported")
modified Tests/RazorbillServerTests/ModelManagerTests.swift +20 -0
@@ -289,6 +289,26 @@ struct LoadBroke: Error, CustomStringConvertible {
289289 }
290290 }
291291
292+ @Test func anArchitectureTheEngineDoesNotKnowIsNotALoadFailure() async throws {
293+ let unsupported = ModelResolutionError.unsupportedType(model: "org/new", type: "mellum")
294+ engines.failLoading("org/new", with: unsupported)
295+ await #expect(throws: unsupported) { try await manager().acquire("org/new") }
296+ #expect(unsupported.description.contains("of type 'mellum'"))
297+ }
298+
299+ @Test func unsupportedTypeIsA400ModelNotSupported() async throws {
300+ let engines = TestEngines()
301+ engines.failLoading(
302+ "org/new", with: ModelResolutionError.unsupportedType(model: "org/new", type: "mellum"))
303+ try await withLiveServer(engines: engines) { client in
304+ let response = try await post(client, simpleRequest("org/new"))
305+ #expect(response.status == .badRequest)
306+ let body = try ErrorBody(response)
307+ #expect(body.error.code == "model_not_supported" && body.error.param == "model")
308+ #expect(body.error.message.contains("'mellum'"))
309+ }
310+ }
311+
292312 @Test func unknownNamesAreRejectedBeforeLoading() async throws {
293313 await #expect(throws: ModelResolutionError.unknown("gpt-4o")) {
294314 try await manager().acquire("gpt-4o")
@@ -289,6 +289,26 @@ struct LoadBroke: Error, CustomStringConvertible {
289 }289 }
290 }290 }
291 291
292+ @Test func anArchitectureTheEngineDoesNotKnowIsNotALoadFailure() async throws {
293+ let unsupported = ModelResolutionError.unsupportedType(model: "org/new", type: "mellum")
294+ engines.failLoading("org/new", with: unsupported)
295+ await #expect(throws: unsupported) { try await manager().acquire("org/new") }
296+ #expect(unsupported.description.contains("of type 'mellum'"))
297+ }
298+
299+ @Test func unsupportedTypeIsA400ModelNotSupported() async throws {
300+ let engines = TestEngines()
301+ engines.failLoading(
302+ "org/new", with: ModelResolutionError.unsupportedType(model: "org/new", type: "mellum"))
303+ try await withLiveServer(engines: engines) { client in
304+ let response = try await post(client, simpleRequest("org/new"))
305+ #expect(response.status == .badRequest)
306+ let body = try ErrorBody(response)
307+ #expect(body.error.code == "model_not_supported" && body.error.param == "model")
308+ #expect(body.error.message.contains("'mellum'"))
309+ }
310+ }
311+
292 @Test func unknownNamesAreRejectedBeforeLoading() async throws {312 @Test func unknownNamesAreRejectedBeforeLoading() async throws {
293 await #expect(throws: ModelResolutionError.unknown("gpt-4o")) {313 await #expect(throws: ModelResolutionError.unknown("gpt-4o")) {
294 try await manager().acquire("gpt-4o")314 try await manager().acquire("gpt-4o")
modified docs/en/reference/errors.md +1 -0
@@ -40,6 +40,7 @@ During a stream, an error after the first chunk is sent as a last event, `data:
4040 | `model_not_found` | 404 | `The model 'qwen9' does not exist.` | Neither a declared `id` nor a Hugging Face id `org/name` |
4141 | `unknown_url` | 404 | `Invalid URL (GET /v1/nothing)` | No such endpoint. On `/`, `/v1` and `/v1/` the message adds that `/v1` is the base URL, with `GET /v1/models` and `POST /v1/chat/completions` as examples. |
4242 | `model_not_supported` | 400 | `the model 'org/name' is not in MLX format (no .safetensors weights)` | The cached repository has no MLX weights (GGUF…) |
43+| `model_not_supported` | 400 | `the model 'org/name' is of type 'mellum', which this build of razorbill cannot run …` | The model's architecture (`model_type` in its `config.json`) is unknown to this build's engine; a newer razorbill may run it |
4344 | `queue_full` | 429 | `too many requests waiting for 'qwen3' (max_queue: 16); retry later` | More than `limits.max_queue` requests waiting |
4445 | `server_busy` | 503 | `cannot load 'qwen3': every loaded model is busy (max_loaded_models reached); retry later` | Every loaded model is answering and `max_loaded_models` is reached |
4546 | `insufficient_memory` | 503 | `'org/big' needs about 40.0 GB of memory, only 24.0 GB can be freed for it` | The weights exceed what can be freed within 75 % of the memory |
@@ -40,6 +40,7 @@ During a stream, an error after the first chunk is sent as a last event, `data:
40 | `model_not_found` | 404 | `The model 'qwen9' does not exist.` | Neither a declared `id` nor a Hugging Face id `org/name` |40 | `model_not_found` | 404 | `The model 'qwen9' does not exist.` | Neither a declared `id` nor a Hugging Face id `org/name` |
41 | `unknown_url` | 404 | `Invalid URL (GET /v1/nothing)` | No such endpoint. On `/`, `/v1` and `/v1/` the message adds that `/v1` is the base URL, with `GET /v1/models` and `POST /v1/chat/completions` as examples. |41 | `unknown_url` | 404 | `Invalid URL (GET /v1/nothing)` | No such endpoint. On `/`, `/v1` and `/v1/` the message adds that `/v1` is the base URL, with `GET /v1/models` and `POST /v1/chat/completions` as examples. |
42 | `model_not_supported` | 400 | `the model 'org/name' is not in MLX format (no .safetensors weights)` | The cached repository has no MLX weights (GGUF…) |42 | `model_not_supported` | 400 | `the model 'org/name' is not in MLX format (no .safetensors weights)` | The cached repository has no MLX weights (GGUF…) |
43+| `model_not_supported` | 400 | `the model 'org/name' is of type 'mellum', which this build of razorbill cannot run …` | The model's architecture (`model_type` in its `config.json`) is unknown to this build's engine; a newer razorbill may run it |
43 | `queue_full` | 429 | `too many requests waiting for 'qwen3' (max_queue: 16); retry later` | More than `limits.max_queue` requests waiting |44 | `queue_full` | 429 | `too many requests waiting for 'qwen3' (max_queue: 16); retry later` | More than `limits.max_queue` requests waiting |
44 | `server_busy` | 503 | `cannot load 'qwen3': every loaded model is busy (max_loaded_models reached); retry later` | Every loaded model is answering and `max_loaded_models` is reached |45 | `server_busy` | 503 | `cannot load 'qwen3': every loaded model is busy (max_loaded_models reached); retry later` | Every loaded model is answering and `max_loaded_models` is reached |
45 | `insufficient_memory` | 503 | `'org/big' needs about 40.0 GB of memory, only 24.0 GB can be freed for it` | The weights exceed what can be freed within 75 % of the memory |46 | `insufficient_memory` | 503 | `'org/big' needs about 40.0 GB of memory, only 24.0 GB can be freed for it` | The weights exceed what can be freed within 75 % of the memory |
modified docs/fr/reference/erreurs.md +1 -0
@@ -40,6 +40,7 @@ Pendant un flux, une erreur survenue après le premier morceau est envoyée comm
4040 | `model_not_found` | 404 | `The model 'qwen9' does not exist.` | Ni un `id` déclaré, ni un identifiant Hugging Face `org/nom` |
4141 | `unknown_url` | 404 | `Invalid URL (GET /v1/nothing)` | Endpoint inexistant. Sur `/`, `/v1` et `/v1/`, le message précise que `/v1` est l'URL de base, avec `GET /v1/models` et `POST /v1/chat/completions` en exemples. |
4242 | `model_not_supported` | 400 | `the model 'org/name' is not in MLX format (no .safetensors weights)` | Le dépôt du cache n'a pas de poids MLX (GGUF…) |
43+| `model_not_supported` | 400 | `the model 'org/name' is of type 'mellum', which this build of razorbill cannot run …` | L'architecture du modèle (`model_type` dans son `config.json`) est inconnue du moteur de cette version ; une version plus récente de razorbill pourra peut-être le faire tourner |
4344 | `queue_full` | 429 | `too many requests waiting for 'qwen3' (max_queue: 16); retry later` | Plus de `limits.max_queue` requêtes en attente |
4445 | `server_busy` | 503 | `cannot load 'qwen3': every loaded model is busy (max_loaded_models reached); retry later` | Tous les modèles chargés répondent et `max_loaded_models` est atteint |
4546 | `insufficient_memory` | 503 | `'org/big' needs about 40.0 GB of memory, only 24.0 GB can be freed for it` | Les poids dépassent ce qui peut être libéré dans les 75 % de la mémoire |
@@ -40,6 +40,7 @@ Pendant un flux, une erreur survenue après le premier morceau est envoyée comm
40 | `model_not_found` | 404 | `The model 'qwen9' does not exist.` | Ni un `id` déclaré, ni un identifiant Hugging Face `org/nom` |40 | `model_not_found` | 404 | `The model 'qwen9' does not exist.` | Ni un `id` déclaré, ni un identifiant Hugging Face `org/nom` |
41 | `unknown_url` | 404 | `Invalid URL (GET /v1/nothing)` | Endpoint inexistant. Sur `/`, `/v1` et `/v1/`, le message précise que `/v1` est l'URL de base, avec `GET /v1/models` et `POST /v1/chat/completions` en exemples. |41 | `unknown_url` | 404 | `Invalid URL (GET /v1/nothing)` | Endpoint inexistant. Sur `/`, `/v1` et `/v1/`, le message précise que `/v1` est l'URL de base, avec `GET /v1/models` et `POST /v1/chat/completions` en exemples. |
42 | `model_not_supported` | 400 | `the model 'org/name' is not in MLX format (no .safetensors weights)` | Le dépôt du cache n'a pas de poids MLX (GGUF…) |42 | `model_not_supported` | 400 | `the model 'org/name' is not in MLX format (no .safetensors weights)` | Le dépôt du cache n'a pas de poids MLX (GGUF…) |
43+| `model_not_supported` | 400 | `the model 'org/name' is of type 'mellum', which this build of razorbill cannot run …` | L'architecture du modèle (`model_type` dans son `config.json`) est inconnue du moteur de cette version ; une version plus récente de razorbill pourra peut-être le faire tourner |
43 | `queue_full` | 429 | `too many requests waiting for 'qwen3' (max_queue: 16); retry later` | Plus de `limits.max_queue` requêtes en attente |44 | `queue_full` | 429 | `too many requests waiting for 'qwen3' (max_queue: 16); retry later` | Plus de `limits.max_queue` requêtes en attente |
44 | `server_busy` | 503 | `cannot load 'qwen3': every loaded model is busy (max_loaded_models reached); retry later` | Tous les modèles chargés répondent et `max_loaded_models` est atteint |45 | `server_busy` | 503 | `cannot load 'qwen3': every loaded model is busy (max_loaded_models reached); retry later` | Tous les modèles chargés répondent et `max_loaded_models` est atteint |
45 | `insufficient_memory` | 503 | `'org/big' needs about 40.0 GB of memory, only 24.0 GB can be freed for it` | Les poids dépassent ce qui peut être libéré dans les 75 % de la mémoire |46 | `insufficient_memory` | 503 | `'org/big' needs about 40.0 GB of memory, only 24.0 GB can be freed for it` | Les poids dépassent ce qui peut être libéré dans les 75 % de la mémoire |