Skip to content

feat: Control Panel redesign, Chat/Work, Flash Next fixes, Qwen3.5 scheduler on by default - #384

Merged
Brooooooklyn merged 23 commits into
mainfrom
feat/app-redesign-uiarc
Nov 15, 2026
Merged

Brooooooklyn merged 23 commits into
mainfrom
feat/app-redesign-uiarc

Conversation

@Brooooooklyn

@Brooooooklyn Brooooooklyn commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

One branch with 23 commits, on main after #378 (the DFlash2 state disk tier) and #383. Replaces #382 (closed).

Area What
packages/server Turn traces and runtime samples (metadata only), measured prefill (prefillMs / prefillTokens), POST /v1/models/unload, GGUF model naming with quantization variants, a turn reports where it waits (queued / slot / prepare / prefill / decode), a tool call that misses its one object argument gets it rebuilt, a thinking budget with a cycle guard and an end text on the agent hosts, a reload of the same model closes the old model's state cache first
packages/desktop Control Panel host changes: folder dialog for Work, endpoint file fields, bundled skills. MAIN judges Control Panel liveness by ping; a slow page call no longer restarts the Control Panel
packages/dashboard Control Panel redesign on the free Arc components (MIT) plus own components; Chat / Work over ACP; permission modes Ask / Auto / Bypass; Web Search providers (keys in the macOS Keychain); Agent timeline; waiting orb; load card with the kernel warm-up; a Work turn continues once after a length stop; the Cache page lists the model caches under prefix-cache/ and can delete an idle one
qwen4_exp Flash Next: tool calls parse (tokenizer special flags), the prefill window stays 1,024 rows on a partial expert store, a follow-up turn reuses its prefix to a message boundary, drafts after a restore. Its stored states live in a per-model SSD tier as fixed-span state records and are taken back at load
qwen3_5 The scheduler is on by default for Qwen3.5 dense and MoE with no env; the lane count comes from the memory plan (up to 4, up to 8 from 256 GB); MoE MTP lanes keep their lone tokens; MTP norm shift rule; stateTierNamespace()
engine Thinking cycle guard and end text; the thinking cut is a row of a full-depth speculative verify; load-time warm-up of the scheduler's pipelines with start-class memory claims; stream progress phases and wait timers; the paged-attention metallib loads from memory (no temp file)

Behaviour changes

  • MLX_CONTINUOUS_BATCHING is gone. MLX_SERVE_FORCE_SERIAL=1 is the one rollback.
  • Qwen3.5 lanes: plan one lane, then grant the most lanes that keep that context window. Lanes give way before the window. The lane table is pinned with the state tier off and on; with the tier on, one GDN cell of staging moves five memory-bound rows (for example 9B AR at 16 GB: 2 lanes to 1).
  • Qwen3.5 0.8B: the MTP norms were read as shifted and the MTP head accepted no draft. One decision for the whole MTP module from four norms. Only the 0.8B checkpoints change their decision.
  • Load warm-up (Qwen3.5 dense / MoE loads that serve chat turns on the scheduler):
    • Scratch turns per lane count and row class run before the load serves. The model state, the block pool and the state tier read as before, and the model's governor books are put back.
    • A warm-up claim is a Floor claim that tries once. A required step (MaxPrefill, each row class, width 1, and the width-1 draft step on a drafting model) that the engine limit refuses fails the load at once with memory plan: the load's warm-up (<step>) could not be allocated: <cause>; a host-pressure refusal runs the warm-up again every second for up to 30 s, then fails the load. Before a start claim is refused, MLX's free pool is cleared once. A KV block shortage still counts the step as skipped.
    • mlx eval, FP8 calibration and CLEF loads run no warm-up.
  • Thinking cut under speculation (MTP, DSpark, DFlash / DFlash2, scheduled lanes): a cycle keeps its depth near the budget. The cut is one row of the verify; rows from the cut take the end tokens, and end tokens replace the first proposals once no thinking token is left. Output equals plain decoding at T=0; tokens before the cut do not depend on where the cut is. There is no seed on the chat API, so sampled output is not repeatable (docs/vllm-speculative-alignment.md, X8).
  • Disk cache: the desktop engine, mlx agent and mlx serve use the mechanism of main. Qwen3.5 persists DFlash2 states in the per-model state tier. The whole-prompt capture of this PR (persistWholePrompt, on for the desktop engine and mlx agent) applies to the per-turn families only (Qwen3, Gemma4, Muse-Glimmer, LFM2). The refused-rung booking of an earlier head is dropped, because main deleted refused rungs.
  • A Qwen3.5 or Flash Next trace row carries stateTier (persistent / temp / off); the Cache page counts such a turn by it. coldEnabled keeps its meaning (the process tier).
  • Flash Next: <tool_call>, </tool_call>, <think>, </think> are no longer special tokens; the asset cache identity is bumped, so the tokenizer sidecar is rebuilt once.
  • Flash Next disk cache, now on the per-model tier ~/.mlx-node/cache/prefix-cache/<ns> (lock, quota, 14-day rule, --max-cache-disk, --cache-dir, the persist switch, closeCache):
    • Persistent by default on every host. A load with the switch off, with no GGUF identity, or whose namespace another process holds for 20 s gets a temporary tier; --max-cache-disk 0 gets none.
    • Only states of 2,048 tokens or more are written, 10 s after publication, as one fixed-span record (format qwen4-prefix-v3; older objects and objects under paged/v1 are not read: one cold start). A state is durable only when its whole KV and draft chain is on disk.
    • States share the tier's one quota; a reopen under a lower limit trims before the tier serves. At load a persistent tier adopts every whole state as a disk-only entry that a turn reads back and promotes.
    • closeCache resolves true only when every waiting state and queued copy landed. After a failed state write the row reports the tier as off.
    • Staging: one state plus the block queues (about 240 to 260 MiB) is set aside on every load that opens a tier.
    • Flash Next and Qwen3.5 share the root limit under prefix-cache/: a load can remove another model's idle cache.
  • Same-model reload in one engine (A → B → A): the host awaits the old model's closeCache (up to 6 s) before the new load, so the new load opens the persistent namespace instead of a temporary tier.
  • Cache page: one panel per cache root (the configured root and each running engine's --cache-dir). A folder is a model cache only when it holds a regular lock file. Rows show size, files, last use and lock state, and the model name when a running engine reports that namespace (stateNamespace in the heartbeat). The walk is bounded by count and time. Delete: confirmed at the button, only an idle cache, refused when an engine holds the lock or opened the cache after the listing; the directory is held open and re-checked before every unlink; steps leave a 300 ms gap for an engine's lock retry.
  • New napi surface: ChatConfig.thinkingCycleGuard / thinkingEndText; reasoningClose / reasoningCutAt / reasoningCyclePeriod / reasoningStrayCloses on the result and the done chunk; ChatStreamProgress.phase (6 values) with waitMs / slotMs / prepareMs; WarmupReport, LoadProgress, loadProgress(path), pipelineStats(), the warmup getter; Qwen4ExpModel.closeCache / stateTierMode (persistent / temp / off), prefixDiskAdopted, Qwen4ExpLoadOptions.cacheDisk / cacheDir; stateTierNamespace() on the Qwen3.5, Qwen3.5 MoE and Flash Next models.
  • Control Panel recovery: the page can no longer ask for a restart; a call with no reply fails alone with E_TIMEOUT. MAIN pings every 5 s and restarts the panel after 30 s of silence (120 s when a turn runs). A stuck database worker restarts alone. Each recovery writes metadata rows to ~/.mlx-node/ledger/.

Test plan

  • cargo test -p mlx-core --lib (scoped: engine, model_thread, tokenizer, tools, paged KV adapter, sampling, qwen3, qwen3_5, qwen4_exp, gemma4, lfm2, nemotron_h, muse_glimmer, clef, memory_plan, disk_tier, cold_tier, quality, calibration): 3064 passed; 0 failed; 119 ignored
  • cargo test -p mlx-paged-attn --lib: 223 passed; 0 failed; 8 ignored; cargo test -p mlx-metal --lib: 6 passed
  • cargo clippy -p mlx-core -p mlx-metal -p mlx-paged-attn --all-targets -- -D warnings, cargo fmt --all -- --check
  • yarn build:native (full profile), both index.d.cts copies in sync
  • yarn build:ts, yarn typecheck, vp lint --type-aware --type-check on the touched files, UI build, pack test
  • vp test (dashboard, server, desktop, agent, lm, cli, __test__/server, __test__/cli): Test Files 317 passed | 3 skipped, Tests 7126 passed | 15 skipped
  • Qwen3.5 0.8B, real weights, persistent state tier in a throwaway cache dir, one process:
    • warm-up 56 steps, 0 skipped, on the first load and on the reload;
    • T=0, thinking budget 64, no cached prefix: MTP off (80 decode batches for 80 tokens), scheduled MTP (23 batches, 23 cycles), whole-turn adaptive MTP (23 cycles); all close by budget at 64 with the end text; thinking and answer equal across the three;
    • a 5,691-token prompt, closeCache true, reload from the same cache dir: 1 state adopted, the next turn restores 5,680 tokens from disk and gives the same answer.
  • Flash Next (Qwen3.8 Flash Next UD-Q4_K_XL GGUF), real weights, host defaults, throwaway home and cache dir, two processes:
    • load: stateTierMode persistent, the namespace directory and its lock exist;
    • a 6,087-token turn (cold), a tool turn (finishReason: tool_calls, one call with the right arguments), a follow-up turn that reuses 6,080 tokens from memory;
    • the state is durable 10 s after publication (one 115.8 MB state record plus its block chain); closeCache resolves true;
    • reload: prefixDiskAdopted 1; the same follow-up turn restores 6,080 tokens from disk (prefixDiskRestored 1, first token after 353 ms) and its answer is identical at T=0; one more follow-up turn; closeCache true.
  • Not run: the warm-up on real 27B / MoE geometry, MoE parity on a real checkpoint, the Control Panel recovery on a real Electron process, __test__/cli/agent-e2e

Known limits

  • MoE scheduled MTP with 2 or more lanes is not bit-exact against one lane alone (batch-shape rounding). AR is exact.
  • The first turn can still compile a pipeline that takes the prompt length as a build-time constant (qwen4_window_conv, qwen4_gdn_prepare under 64 rows).
  • A load that came up with skipped warm-up steps can now fail when memory is short (see the warm-up rule above).
  • The first Flash Next turn after a load takes about 6 s to its first token (also for a 19-token prompt); later turns do not.
  • Flash Next state write: one 121.9 MiB state takes about 16 ms on the model thread (two copy passes), once per stored state. On a temporary tier the first state that memory drops is lost.
  • A load that does not get its namespace lock within 20 s keeps a temporary tier for its life. A Qwen3.5 closeCache waits behind a running turn, so a same-model reload during a long turn can still land there.
  • stateTierMode() and stateTierNamespace() take the tier's hold lock; the JS thread can wait for one remove (milliseconds).
  • Cache page: a cache of a stopped engine shows its short hash (the tier writes no model metadata); a --cache-dir root of a stopped engine is not listed; an engine that runs only Flash Next reports no limit; the delete keeps a microsecond window between its directory check and each unlink (Node has no unlinkat), usable only by a process of the same user.
  • The Auto /tmp rule ships as built by owner decision.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LJdkgMbCXHf4khtrZCVNPB

Brooooooklyn and others added 17 commits November 15, 2026 10:04
…nload, whole-prompt cache capture

The inference process records each dispatched turn and samples its own
state to files under ~/.mlx-node/metrics. All fields are metadata
(numbers, small enums, identifiers).

- turn trace gains prefillMs / prefillTokens; streamed /v1/messages
  usage gains prefill_ms / prefill_tokens
- runtime sampler writes live-<pid>.json and daily runtime traces
- POST /v1/models/unload (409 while a turn, a load or a lease is active)
- a dropped model forces one V8 collection
- count_tokens skips the model-load gate for a resident model
- `mlx agent` and the desktop engine ask for whole-prompt capture
  (`persistWholePrompt`, `--persist-whole-prompt` on `mlx serve`) for
  the cold tier families
- engine policy env for the desktop engine
- lm: a GGUF model is named by its stem and listed with its
  quantization variants; qwen4_exp samples at 1.0 / 0.95 / 20

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Window policy, broker and sidecar changes that the new Control Panel
needs: the folder dialog for Work, the endpoint file fields, the
packaging of the bundled skills, the whole-prompt cache capture and the
engine policy env of the sidecar.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
… providers

Redesign of the Control Panel SPA on the free Arc (uiarc.dev, MIT)
components plus own components, with more charts and detail pages:
Overview, Models, Sessions (Agent timeline), Metrics, Engine, Cache.

Chat/Work: the Control Panel process runs mlx-agent over ACP. Chat has
the app web tools only (no shell). Work runs in a folder the user picks,
behind permission cards, with a permission mode per conversation:
Ask, Auto (allow-only command gate; known commands and edits in the
Work folder and in folders the user owns under /tmp) and Bypass (allow
every request). A Work turn has no time limit.

Web Search: Exa / DeepSeek / Brave / Firecrawl keys in the macOS
Keychain, one search provider selected, pinned provider skills bundled.

A dotted orb (MIT thinking-orbs subset) shows while a turn waits.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
… on a partial store, a follow-up turn reuses its prefix

Tool calls: the GGUF tokenizer marked <tool_call>, </tool_call>, <think>
and </think> as special, so every output decode dropped them and the
parsers never saw a call. Only CONTROL rows are special now (the Splash
rule); the asset cache identity is bumped and the load checks that the
tags survive a decode.

Prefill: on a partial expert store the window fell to 1 token (about
10 tok/s). It is a fixed 1,024 rows; a store the load gate refused
halves a pass only when its scratch is larger than the gate reserved.
The device-route cooldown is per request. residencyInfo gains
slotHits, slotMisses, checkpointBytesRead and routeReplays.

Prefix reuse: a turn stores the state outside the KV pool at pass
borders (a replay point and a checkpoint each 4,096 rows) and registers
the KV blocks below it; a later turn restores the deepest matching
state and prefills only the rest. Block keys carry their whole pass, so
two conversations share a block only when they ran the same pass.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…chine's memory

Qwen3.5 dense and MoE run on the continuous-batching scheduler with no
env variable; MLX_SERVE_FORCE_SERIAL=1 is the only rollback, and
MLX_CONTINUOUS_BATCHING is gone (the desktop engine policy no longer
sets it).

- The memory plan computes the lane count at load: plan one lane, then
  grant the most lanes whose cost keeps that window. The ceiling is 4,
  and 8 on a machine with 256 GB of physical memory or more. Lanes give
  way before the context window. The granted count sets the recurrent
  state table width, the scheduler capacity, admission and
  maxConcurrentSequences().
- The MTP state is charged once in the memory plan; a speculative turn
  may fill the max pool on the ledger path (it was refused below the
  planned window).
- The batched decode loop submits each layer as the single-row path
  does.
- A MoE decode row prices its expert work.
- MTP norms: one shift decision for the whole MTP module from four
  norms. The 0.8B checkpoint read as shifted (mean 0.5052) and its MTP
  head accepted no draft.
- Tests that share the process-wide memory governor run in their own
  process.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…olumn

The orb and the status dot now use one 20 px leading column, so the title
and the model name start at the same x in every state of the card.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The qwen3-generate-batch load hook used the 10 s default and timed out on
a slow CI runner (12.5 s); the test timeout was already 120 s.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…rebuilt

A local model can write a wrapper tool call flat: use_tool with tool_name
and url side by side, where the schema wants url inside tool_input. The
agent refuses that form before any permission request, so the web fetch
never ran. The Messages endpoint now moves the undeclared keys into the
one missing required object property, only when the schema has no union,
its root admits no extra keys, and no other tool shares the name. Text
arguments are never touched, and the agent's arguments-file form passes
unchanged.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…; the composer row never clips Send

A new Work conversation can raise its permission mode before the first
message, with the same confirm steps. The Control Panel holds the pick in
memory against a draft id and the checked folder; the first message
carries only that id, and the mode's history line is written before the
first turn starts. A move down during the start reaches the draft that
was sent.

The Send button has its own column. Each part of the key legend is drawn
whole or not at all, and it gives way first, then the folder and web
labels, then the quantization badge, then the model name.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…e MTP norm rule

Scheduled MTP on MoE verified all owners in one forward, so a lane's
tokens changed with the number of lanes. The verify now runs once per
owner; AR decode stays fused. The real-model wave test compares each MTP
lane with the same prompt scheduled alone.

mlx convert decides the MTP norm shift with the loader's rule.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…shows the kernel warm-up

A turn record, the live file and the progress ping gain waitMs (dispatch
to pickup), slotMs and prepareMs, with the phases slot and prepare. The
page says 'Waiting, model busy' while the model thread runs another
step, 'Waiting for a slot' only for a real lane wait, and 'Preparing'
while a cached prefix is restored. Setup time no longer counts slot and
prepare time twice.

The live file (v2) lists every load in progress with its phase and step
count, and the load card shows 'Preparing GPU kernels, n of m'. All new
native fields are read as not known when an addon does not send them.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…r a restore, and restores after a restart

Prefill passes now also end at the block before each assistant message, so
a warm turn reuses its prefix up to the block before the previous turn's
generation prompt instead of the last 1,024 grid line, and its output at
temperature 0 still equals a cold prefill of the same prompt. A turn
restored from a prefix state carries the draft history, so an MTP load
drafts on it.

Prefix states and the KV blocks they need are written behind the turn to
the paged disk cache (same switch: on by default for every host) and
restored after an engine restart. Files are written
to a temp name and renamed, carry a checksum and the checkpoint identity,
and a truncated, foreign or orphaned file is refused and removed. The
memory plan books the staging copies.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…continues once after a length stop

The desktop engine and the server that mlx agent starts now set a
thinking budget of 12,000 tokens, the cycle guard and the thinking end
text for Messages requests that set no budget of their own. mlx serve by
hand keeps no cap; it gains --thinking-cycle-guard and
--thinking-end-text. The turn record gains the budget, its source, the
output cap and the engine's reasoning outcome.

The app's output cap is answer room plus the budget (Work 28,384, Chat
20,192). After a length stop in Work the app waits for the agent's own
end line and sends one visible continue; a second length stop in a row
with no tool call between ends the turn and says so. No timer ends or
continues a turn.

A thought shows its time only when the app saw it live; a thought read
from disk shows none, because the agent keeps one time stamp for it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Staging copied only dist and web of a workspace package, so a packaged
app had no dashboard skills folder and Chat stopped with
skill-bundle-corrupt. The copy now follows the package's own files list
(without src, which only the source export condition uses), and refuses
a package with no list or with an entry that is not a plain top-level
name. A test stages the real dashboard list and runs the dashboard's own
bundle check on the copy.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A Qwen3.5 dense or MoE load persists its states in the per-model state tier,
not in the process tier that `coldEnabled` reports. The Cache page counted
each such turn as "disk cache off".

- A qwen3_5 / qwen3_5_moe trace row carries `stateTier`
  (`persistent` / `temp` / `off`).
- The dashboard stores it as `state_tier` (schema 13).
- The Cache page counts such a turn by that tier: `persistent` is on.
  `coldEnabled` keeps its meaning (the process tier).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LJdkgMbCXHf4khtrZCVNPB
…MAIN judges liveness by ping

The page had a 35 s deadline on each call. A call with no reply made MAIN
stop and restart the Control Panel, which cancelled every agent turn in
flight. Under high machine load one slow read ended a long Work turn.

- The page can no longer ask for a restart. A call with no reply fails alone
  with `E_TIMEOUT`.
- MAIN pings the Control Panel every 5 s. Any message from the panel counts
  as life. MAIN restarts it only after 30 s of silence with no turn, or
  120 s when a turn runs. A late MAIN tick is skipped, so a sleep or a
  stalled MAIN causes no restart.
- A stuck or dead database worker restarts alone, with back-off. The agent
  host and its turns are not touched.
- Each recovery writes metadata rows to `~/.mlx-node/ledger/main-*.jsonl`
  (trigger, silence, exit code, turns in flight). The thread states that
  the app stopped the turn, and why.
- Turns that the agent starts by itself count as running turns.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LJdkgMbCXHf4khtrZCVNPB
…urn phases and wait timers; metallib from memory

Thinking: a turn can enable a cycle guard that cuts a thought which repeats
itself, and an end text that is fed before the close tag when the budget or
the guard ends the thought. The result reports why the thought closed
(`reasoningClose`), where the cut began, the cycle period and stray closes.

Warm-up: a Qwen3.5 dense or MoE load on the scheduler runs scratch turns for
each lane count and row class before it serves, so the first real turn does
not compile those pipelines. It runs a ragged row class beside each class of
64 rows or more, and a stored state's restore copy on a live scratch cell.
A failed step fails the load with its reason, and the final barrier fails
the load on a GPU error. `MLX_SERVE_FORCE_SERIAL=1` warms one lane. The
scratch scheduler moves no governor counter. `loadProgress(path)` and the
`warmup` getter report it.
Scratch turns reuse and publish no cache entry, also on a replay after a
preemption, and the model's SSD state tier, with the states it took back at
load, is set aside while they run: no scratch turn stages, writes, adopts or
evicts a state there.

Progress: a stream reports the phases queued / slot / prepare / prefill /
decode / done with `waitMs`, `slotMs` and `prepareMs`. A wait is frozen at
pickup and when the stream ends before pickup. A Qwen3.5 turn's restore
from the state store or the SSD tier reads `prepare`.

Metal: the paged-attention library loads its metallib from memory and writes
no temp file. A pipeline counter (`pipelineStats()`) is off unless
`MLX_PIPELINE_COUNTER` is set.

Tests: the MTP turn tests pin the chained-cycle mode through the mock
stepper, not through a process-wide env write.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LJdkgMbCXHf4khtrZCVNPB
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f3e5bc91-16fb-4921-bbdf-e7e189bb9d65

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T05:04:09.102807Z 086e87b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Brooooooklyn and others added 6 commits November 15, 2026 15:58
…oads skip it

The load warm-up now puts the model's governor books back as they were
before it ran, republishes the memory accounts and stored-state totals of
the serving model, and runs no control pass, so it writes no process-wide
book that other loaded models read. A warm-up that leaves a memory claim
open fails the load. A moved book no longer sets `reset` in the warm-up
report.

`mlx eval`, FP8 calibration and CLEF load with no warm-up: only a load that
serves chat turns warms up. They load through `load_for_tool`, with the
same defaults as before.

A test pins that a cycle-guard hit cuts thinking as a budget of that size,
and docs/vllm-speculative-alignment.md states the contract of the thinking
cut for sampled output: there is no seed, so T>0 output is not repeatable.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LJdkgMbCXHf4khtrZCVNPB
Flash Next's prefix states and their block chains move off the shared
process cold tier onto a persistent tier of the model's own, in a namespace
directory keyed by the checkpoint fingerprint, with a lock, a quota and the
14-day rule. The tier is persistent or off: the paged cache switch, which
every host turns on by default, opens it; --max-cache-disk, --cache-dir and
--no-persist-cache apply to it as to Qwen3.5. A second process on the same
checkpoint keeps its states in memory. The load and the context estimate
decide the tier through one function.

`closeCache(deadlineMs)` hands every queued copy and every parked state
whose chain landed to the writer and closes the tier, off the model thread.
Dispose does the same within 2 s and frees the parked states at once; the
JS object keeps only a weak handle. `stateTierMode()` reports the tier, and
turn traces read it, so a Flash Next row shows `stateTier: "persistent"`.

The drain hooks on the process cold tier and Flash Next's entry on its
restore allowlist are removed; objects left under paged/v1 are not read.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LJdkgMbCXHf4khtrZCVNPB
Speculative turns no longer lower their draft depth to stay short of the
thinking budget. The cut is one row of a full-depth verify: the rows from
the cut take the end tokens without a draw, and once no thinking token is
left, the end tokens replace the first proposals. A 64-token end now takes
at most 12 MTP cycles at depth 5 and 9 DSpark cycles at block 7, instead of
one target step per token. End tokens are not counted as drafts and do not
feed the depth policy. Output equals plain decoding for every budget, depth
and block tested.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LJdkgMbCXHf4khtrZCVNPB
A warm-up claim is a Floor claim that tries once, and a refused claim fails
its row in the same pass instead of waiting. Only critical macOS pressure
and the engine limit refuse it. A required step that the host or the driver
refuses runs the whole warm-up again every second, for up to 30 s, and then
fails the load. A refusal by the engine budget fails the load at once, with
"memory plan: the load's warm-up (<step>) could not be allocated: <cause>".
A KV block shortage still counts the step as skipped.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LJdkgMbCXHf4khtrZCVNPB
…ack at load

Flash Next keeps its stored states in a tier of its own like Qwen3.5: a
load with the switch off, or with its namespace held, gets a temporary
tier, and only states of 2,048 tokens or more are written. A state is due
10 s after its publication, is encoded by the model thread into one staging
buffer as one fixed-span record (format v3; older objects are not read),
and counts as durable only once its whole KV and draft chain is on disk.
States share the tier's one quota, and a reopen under a lower limit trims
at once. A model with no turn is woken for a due state. `closeCache` and
dispose write the waiting states newest first on the model thread; two
closes share one outcome. At load a persistent tier takes back every state
whose chain is whole, as a disk-only entry that a turn reads back and
promotes. Memory pressure drops only the RAM copy of a durable state, and
evicted objects leave the store. `stateTierNamespace()` on the Qwen3.5,
Qwen3.5 MoE and Flash Next models names the open persistent cache
directory.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LJdkgMbCXHf4khtrZCVNPB
The Cache page lists the stored-state caches under `prefix-cache/`, one
panel per root: the configured root and the `--cache-dir` of each running
engine. Each row shows its size, files, last use and lock, and the name of
the model when a running engine reports that namespace in its heartbeat
(`stateNamespace`, with `stateCache` giving the root and its limit). The
walk is bounded and continues on the next call. An idle cache can be
deleted after a confirm, in steps, never through a link or into a
subfolder. The delete is refused while an engine holds the lock or opened
the cache after the listing, where the lock cannot be checked, and for a
root the runtime does not list. The JS size cap rises by the new section's
7.6 KB.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LJdkgMbCXHf4khtrZCVNPB
@Brooooooklyn
Brooooooklyn merged commit e234d44 into main Nov 15, 2026
10 checks passed
@Brooooooklyn
Brooooooklyn deleted the feat/app-redesign-uiarc branch November 15, 2026 15:22
Brooooooklyn added a commit that referenced this pull request Nov 20, 2026
…#390)

## Summary

Fixes the deterministic failure and remaining flake sources in the `e2e
qwen3_5-dense` CI leg on 7 GB `macos-26` runners:

1. **Deterministic failure since #384
(`qwen3_5_concurrent_batched_parity`)**:
- On GitHub's 7 GB `macos-26` VM (`working_set ≈ 4.67 GiB`),
`Qwen/Qwen3.5-0.8B` bf16 + MTP at its native `262,144` context window is
memory-bound at 1 lane, so `evaluate_qwen35_plan` rejects `count = 2` to
preserve the single-lane window (`MLX_SCHED_MAX_NUM_SEQS=2` only clamps
downward).
- Clones the checkpoint into an RAII-cleaned temp dir (canonicalizing
source paths for symlinks) with `max_position_embeddings = 8192` and no
`paged_cache_memory_mb` override so both
`asymmetric_finish_and_cross_owner_warm_wave_match_serial` and
`waves_of_one_two_four_and_eight_match_serial` genuinely plan `lanes >=
2` on 7 GB CI VMs while still scaling to 4/8 lanes on larger Macs.
- Tightens `waves_of_one_two_four_and_eight_match_serial` to assert
`(2..=8).contains(&lanes)` so CI cannot silently degrade back to 1 lane.
- Adds
`load_plan::tests::small_runner_0_8b_mtp_grants_two_lanes_when_context_is_capped`
pinning the 7 GB runner memory-plan math.

2. **`join_all` + `decode_debt_ms` occupancy race
(`qwen3_5_concurrent_batched_parity`)**:
- Raises `asymmetric_finish_and_cross_owner_warm_wave_match_serial`'s
concurrent pair from `(7, 15)` to `(32, 48)` tokens so `batch-0` still
finishes well before `batch-1` while having enough decode steps to
reliably overlap even if `batch-0` prefills solo first and charges
`decode_debt_ms`.

3. **Wall-clock TTFT flake (`qwen3_5_delta_chat`)**:
- Replaces the wall-clock TTFT ratio assertions in
`stream_session_path_keeps_ttft_flat_across_turns` with the same
deterministic `cached_tokens` / `uncached` accounting assertions already
used in `session_path_keeps_ttft_flat_across_turns`, plus checks that
every streamed turn emits at least one non-empty incremental chunk
before `done: true`.

4. **Blocking sleep & tight poll window
(`qwen3_5_state_tier_restart`)**:
- Switches `status_once` from `std::thread::sleep` to
`tokio::time::sleep` inside `async fn` and raises its polling ceiling
from 12s to 30s (matching `close_cache`'s 30s deadline).

## Verification

- `cargo test --locked -p mlx-core --lib
small_runner_0_8b_mtp_grants_two_lanes_when_context_is_capped` — passed
- `QWEN35_STAGE2_MODEL_PATH=... MLX_SCHED_MAX_NUM_SEQS=2 cargo test
--locked -p mlx-core --test qwen3_5_concurrent_batched_parity --
--ignored --test-threads=1 --nocapture` (tested with both relative and
absolute paths, plus unthrottled) — passed (`planned lanes: 2`,
`max_batch_occupancy: 2`; unthrottled `planned lanes: 4`,
`max_batch_occupancy: 4`)
- `MLX_TEST_MODEL_PATH=... cargo test --locked -p mlx-core --test
qwen3_5_delta_chat -- --ignored --test-threads=1 --nocapture` — 6 passed
- `MLX_TEST_MODEL_PATH=... cargo test --locked -p mlx-core --test
qwen3_5_state_tier_restart -- --ignored --test-threads=1 --nocapture` —
3 passed
- `cargo fmt --all -- --check` & `cargo clippy --locked -p mlx-core
--tests -- -D warnings` — passed
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