Commit Graph
1004 Commits
Author SHA1 Message Date
DokterSmol ceb92ea701 docs: lfm3 in the README's model table; libr4d README names the h128/gqa4 window rows
The README's table gains a row for LFM3-1.7B (bf16, converted from the checkpoint as it ships).
libr4d's README said of head_dim 128 at 4 queries a KV head that there is no prefill row; the
window rows added for LFM3 serve that geometry past the decode band, and the line now says so.
2026-11-17 18:12:32 +01:00
DokterSmol 2e0945c106 docs: lfm3 raw prompts and BOS
The checkpoint's tokenizer adds no BOS to a raw prompt, and without it some first tokens put
the model where bf16 departs from float32. Say so among the traps, with the two ways round it.
2026-11-17 18:12:32 +01:00
DokterSmol 6b96295f54 tests: lfm3's config.json through the checkpoint reader
The rotary per attention class with the full layers' partial factor, the
window, the layer list and the booleans arrive as the keys the plugin reads;
the typed rope_theta is the default, which the plugin does not read.
2026-11-17 18:12:32 +01:00
DokterSmol 29057b0c6b lfm3_bf16: the sandwich joins as norm_add_norm where a library serves it
A layer's post norm, residual add and feed-forward norm are one launch, and so
are its feed-forward's post norm, add and the next layer's input norm: 50
launches for the chain's 144 at 24 layers. The op is asked for with
rad_op_declared, as gemma4 does; libref and libavx do not carry it and run the
rmsnorm / add / rmsnorm chain, as does the last layer's feed-forward. The arm's
output has its own buffer, since a join reads it beside x and writes h.
2026-11-17 18:12:32 +01:00
DokterSmol 09ad42e633 libhalo selftest: rope_rows and rmsnorm_rows give rope's and rmsnorm's bytes
At LFM3's shapes: the per-head norm over head_dim-wide rows, and the full
layers' partial rotary (64 of 128 at theta 1e6 on the head ladder) with
positions past 250000.
2026-11-17 18:12:32 +01:00
DokterSmol 1f00224501 libhalo: windowed attention at head_dim 128 with 4 queries per kv head, and the row-form names of rope and rmsnorm
What LFM3 needs on gfx1151 beyond the rows libhalo has. The window kernel is
instantiated at (128, 4) as in libr4d: the decode leg keeps q_len <= 16 and
every longer q_len, windowed or not, lands on the new pair. rope_rows and
rmsnorm_rows are registered under their row-form names and launched as rope
and rmsnorm, as libavx and libref register them, so a plugin written for
libr4d's row forms resolves on this part instead of falling to the host.

Emulator cases as libr4d's (split verify, ragged window, fp8, non-causal with
a missing block, WMMA prefill with and without the window) and selftest
launches.
2026-11-17 18:12:32 +01:00
DokterSmol 21c4544b61 tests: lfm3 resumed from the prefix cache equals a cold run
The full-attention layers resume from cached blocks, the sliding layers from a
window snapshot and the convolutions from the same checkpoint slot; under
--prefix-resume exact and nearest the reply and its probabilities equal a cold
run's.
2026-11-17 18:12:32 +01:00
DokterSmol f5d2d74a20 docs: the lfm3 section of ARCHITECTURES.md
Geometry, the traps (the gate is one sigmoid, two rotaries, the window on the
sliding layers only, four norms a layer), what is refused, and which kernels
serve it.
2026-11-17 18:12:32 +01:00
DokterSmol 6997f8da14 tests, docs: lfm3 in the family tests, with its golden and declare cases
A tiny LFM3 (conv, full attention, conv, sliding attention; window 8, conv
width 7) joins the engine tests every family runs: the golden against the
reference implementation, chunking and batching, libavx against libref,
decode against prefill, concurrent requests and speculation by prompt lookup.
Its golden is made by mklfm3golden.py from the modelling code LiquidAI ships
with the checkpoint, since transformers has no LFM3 class.

arch_test covers what the plugin declares for each layer kind, what it
refuses, and a step through both attention groups.
2026-11-17 18:12:32 +01:00
DokterSmol 6c7bcefefa arch: lfm3_bf16, LiquidAI's LFM3 at bf16
LFM2's hybrid with sliding-window attention layers as a third kind,
sandwich norms, a partial rotary on the head ladder for the full layers
and a sigmoid gate per query head on the attention output. The gate is
computed at the output's width (gate_proj's rows repeated by the name
map), so it needs no op beyond gemm_nt, sigmoid and mul. One rank, bf16
linears; everything else is refused by name.
2026-11-17 18:12:32 +01:00
DokterSmol 660d410196 libr4d: windowed attention at head_dim 128 with 4 queries per kv head
LFM3's attention: 16 query heads over 4 kv heads at head_dim 128, in full
layers and in sliding layers with a 256-token window. The decode leg
(r4d_attn_paged_h128_gqa4.hip) serves q_len <= 16 and ranks above; every
longer q_len had no row at this geometry. A row pair (bf16 and int8
cache), its constraints, selftest launches and emulator cases (split
verify, ragged window, int8 cache, non-causal with a missing block, WMMA
prefill with and without the window).
2026-11-17 18:12:32 +01:00
Victor Ionescu 38c182a2ba chat: a tool-call delimiter is not a turn terminator
A converted checkpoint can name a token end-of-generation that the chat format
itself writes as one of its call delimiters -- Qwen3.8-Flash-Next's
`</tool_call>` is a single added token, and a container that lists it in
generation_config's eos list stops every tool-calling turn the moment the call
closes. The damage is worse than a late stop: a second call is never written,
finish_reason says "stop" on a tool-calling turn, and a reply that quotes the
tag as that token is cut mid-sentence (seen in a coding session where the model
wrote about the template and the turn ended between two tokens).

The bridge already derives the format, so it knows what the model writes as a
call boundary. It now reports the end-of-generation ids whose spelling is one
of those markers, leaves them out of the reply parser's terminators, and the
engine demotes them in the decoder's stop predicate with a warning. The
template's real terminator (<|im_end|>) is untouched, and a model without
tools, or a container that names nothing extra, is unchanged.
2026-11-16 18:03:16 +01:00
Victor Ionescu b988378e70 chat: read a function name that ends at whitespace (Ling 3.0)
Ling-3.0-flash's template writes a call as the opener, the function name, a
newline, and only then the argument tags:

    <tool_call>read
    <arg_key>path</arg_key>
    <arg_value>/a</arg_value>
    </tool_call>

The differential analysis names the function between the opener and the first
argument tag, so its end is the bare newline and name_suffix comes out as
whitespace alone. chat_format_check refused that, so every request carrying
tools answered 501 with "this model's tool calls cannot be read back:
name_suffix must end the function name with something besides whitespace" --
the whole tool-calling surface, for every Ling-3.0 checkpoint.

A suffix with no core of its own is the suffixless ending written out: the
name stops at the whitespace. The reader now takes it that way (name_open keys
on the trimmed core, so the name runs to the first arg_prefix or call_end,
whitespace trimmed), while the grammar still writes the template's newline.
The object family has no such terminator -- its brace ends the name -- and
keeps the refusal, as does the wrapped format whose bare name_prefix would
otherwise read as a call.

Adds the real template as a fixture and a regression test that derives the
format, builds the grammar, and reads a two-call reply built from the derived
fields; a second test pins the object family's refusal.
2026-11-16 18:03:16 +01:00
mici81andClaude Opus 5.5 bd3fa646bc libr4d: hc_read decode forms G, S and kernel B3 back, B3 without a lane branch after its WMMA
2.0.0 dropped #396's hc_read decode forms. With ROCm 7.2.1 (clang 22) they gave NaN logits (#413's report);
ROCm 10.1 was fine. The cause is kernel B3 alone: clang 22's backend sinks its WMMA up product into the
lane-divergent `if (col < RG && col < rows)` around the store of x, so the WMMA runs with part of EXEC off
(an s_and_saveexec right before the first v_wmma). In the IR the WMMA is convergent and outside the branch.
At 16 rows every lane passes the test, which is why form S at 16 rows was right.

- Forms G (1..8 rows) and S (9..16) and kernel B3 at Flash-Next's shape, the bodies of #396, chained in
  2.1's style (r4dchain / R4dUnchained), hc_rot_group<I8>. They take these rows from the fused grid and the
  tiled read; from 17 rows nothing changes.
- B3: a lane past the step's rows takes the last row and every lane stores, bit for bit what that row's own
  lane stores, so there is no branch after the WMMA.
- hc_decode_forms is #396's again (d against fp64, x within rounding up to 16 rows), with 2.1's rq dtype, a
  count of non-finite outputs (the error sums went through std::max and >, which pass NaN) and rows 9 and 12.

r4d_selftest --case hc_read_e4m3: 66 passed with ROCm 7.2.1 and with 10.1; 27 failed with 7.2.1 without
B3's change. Flash-Next on 2x R9700, ABBA, ms per decode step at 1/2/4/8/16 streams: 15.72/20.62/26.83/
37.37/51.89 -> 14.92/18.61/26.67/37.15/50.83; prefill unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 18:02:02 +01:00
Constantin 1d94e416a6 libr4d: keep short IQR verification on the decode path
A speculative verify issues several rows where a plain decode issues one.
Two IQR kernels accumulated those rows differently, so the same weights and
activations could round to different bf16 outputs. A greedy choice near a
tie could therefore diverge even though every draft was accepted.

gemm_iqr_nt_m64: a U5 row-scale trellis (computed trellis, 5-bit, one f32
scale a row) already folds one to four rows as a GEMV in the single-token
order. Above that, through the GEMV's eight-row limit, the multi-row fold
differs. Those rows now run as independent single-row GEMV blocks on
grid.y, including a chained launch. Gated GEMMs and every other form keep
their dispatch.

moe_gemm_iqr: a short token-order gate/up batch (more than one token, at
most eight times top_k, top_k below the one-wave threshold, K at least
eight 128-blocks, and a one-token step inside the decode band) used the
run grid. Several tokens on one expert then took the WMMA tile instead of
the one-row dot. Those batches now give each sorted slot its own block and
the same wide-K dot reduction as a one-token gate/up. Sorted down
projections, longer batches and the prefill map are unchanged.

r4d_selftest checks both against independent single-row launches, bit for
bit, including an untouched output tail on the dense row. The existing
grouped numerical suite still passes.

Measured on an R9700, the dense U5 path at N=8192 K=2560 is 26.5 us at
M=1, 51.2 at M=4 and 105.2 at M=7. A 512-expert Qwen3.8-Flash-Next gate/up
(768:512 x 2560, 5-bit, ten slots a token) is 28.9 us at one token, 52.4
at four and 82.2 at seven. Prefill remains the old kernel.

On the isolated build, Qwen3.8-Flash-Next U5-gate/W5-down matched its
non-speculative token ids at MTP 3 and 6 on arithmetic, writing, code,
explanation and JSON. StillDeadcode's IQR-V4 control matched on the
arithmetic and writing prompts at MTP 3. A layer trace of the previously
divergent writing token was bit-identical between the two schedules.
2026-11-16 17:59:42 +01:00
Constantin ba3ebd380f feat(qwen4exp): support calibrated U5 gate/W5 down recipe 2026-11-16 17:58:41 +01:00
keptn42 157959fd80 server: a control-vector variant, MODEL:NAME, that runs with the vector on
A request turns the control vector on with the `control_vector` body field, or the deployment's
default applies. A client that can only choose a model cannot send the field, and a gateway can
allow or refuse a model by its name but not a field. --control-vector-variant NAME lists
MODEL:NAME as a child of the model, the way an adapter is listed, and a request naming it runs
with the vector on whatever the default; the model's own name keeps the default. Unset, the
default, lists nothing.

The key needs --control-vector off or on. NAME keeps the rule model names keep (no ':' or
whitespace), and may not be a --lora adapter's name or the served model's own. The variant's
name with "control_vector": false is refused, since the request asks for both. With adapters
enabled the variant takes no adapter lookup, and /v1/load_lora_adapter refuses its name.

config_test 68, fleet_config_test 18 and server_test 191 cases pass, and the host suite
(ctest -LE 'gpu|oot') passes. On two R9700s at TP2 (Qwen3.8-Flash-Next IQR-V4 with the shipped
vector), through the front: /v1/models lists MODEL:uncensored and GET /v1/models/MODEL:uncensored
answers; a policy prompt to the variant is answered and to the model's own name refused; the
variant with "control_vector": false is a 400.
2026-11-16 17:57:46 +01:00
keptn42 aadabde0de http: a route's captures replace those the request already carries
Router::dispatch put a route's captures into the request with std::map::insert, which keeps a key
the request already has. The front matches /v1/models/ID itself and hands the request to the
model's router with the path rewritten, an alias as the model's name and base:adapter as the
adapter's, so the model read the front's id: through the front, GET /v1/models/ALIAS and
GET /v1/models/base:adapter answered 404. The captures of the route that matched now replace those
of the same name; nothing sets a request's params before a dispatch otherwise.

server_test: a_request_handed_on_reads_the_capture_of_the_route_that_matched_it fails without the
change and passes with it.
2026-11-16 17:57:46 +01:00
Jintak Han b27f352259 Adapt gemma4_bf16's SWA implementation to gemma4 2026-11-16 17:53:54 +01:00
fl0l0u c9bce68d45 museglimmer: the reply-format table moves to arch/common
chat.h sat in arch/museglimmer/ while the ct plugin and chatparse_test
included it across the directory boundary -- a shared reply-format
table, and the house answer for that already exists twice over:
rad_gemma4_chat.h and rad_deepseek41_chat.h in arch/common. Moved to
rad_museglimmer_chat.h beside them; the three consumers take the same
<arch/...> include the other two already use.

Standards axis of the 2.1.0 review pass, finding 9.
2026-11-15 22:02:30 +00:00
fl0l0u a8d82678fa fp8: the trunk-rotation question lives beside its predicates
"The trunk is rotated int8 (linear_is_w8h or linear_is_wnh), its
activation codes one scale a trunk_g8 columns: 256 for IQ8R, 128 for
the other rotated forms" was written twice, verbatim, in flint's and
bailing_hybrid's field declarations, and the probe that answers it --
weight_enc, the two predicates, linear_w8h_group -- was re-typed at
both arches' layer-0 sites. museglimmer_ct carries the near-variant;
its question is narrower (exactly-IQ8R, not rotated-at-all), so it
keeps its own predicate.

rad_fp8.h now answers it once: trunk_rotation(enc, &g8), beside the
predicates it is made of, so the group-width semantics travel with the
forms that define them instead of with three copies of a comment. The
two call sites shrink to the probe and the named question.

Standards axis of the 2.1.0 review pass, finding 4.
2026-11-15 22:02:30 +00:00
fl0l0u 8ac613ddb9 museglimmer: the two plugins read their text_config through the common helpers
cfg_f/cfg_i/cfg_s -- the "text_config.<key>, else <key>" fallback that a
multimodal config's language half needs -- exist in rad_arch.h as
meta_text_getf/geti/gets, and have since 1.7.0. Both muse plugins grew
a byte-identical private copy in the same commit, the two copies
identical to each other. Deleted; the call sites name the common
helpers. museglimmer_test drives every one of the replaced reads.

Standards axis of the 2.1.0 review pass, finding 2.
2026-11-15 22:02:30 +00:00
fl0l0u 97b4590761 mm+text+tests: three one-line residues the 2.1.0 review pass logged
The ATEM handoff's think_out called touch(0) twice on the hold branch
(harmless -- touch is edge-triggered -- but a merge artifact in an
otherwise surgical state machine); processor.cpp grew a second,
byte-identical Python-rounding helper 700 lines below the one it
already has, renamed only by an underscore; and the rewritten
RAD_TESTS_NO_CORE comment hand-enumerated eight tests while the set
below it names nine -- the comment now points at the set instead of
drifting from it again.

Standards axis of the 2.1.0 review pass, findings 6, 7 and 10.
2026-11-15 22:02:30 +00:00
fl0l0u c256342bc1 tests: the hash-check tests read the shared timeout, not a literal
artifact_sums and vendor_sums each set TIMEOUT 120 outright, where the
tests around them use ${RAD_TEST_TIMEOUT}. In the fast (Release) gate
the variable is 120, so the fast suite is unchanged -- but under ASAN,
TSAN or a Debug build it rises to 600 for every sibling, and these two
shelled-out hash sweeps over the vendor and artifact trees stayed pinned
at 120 there, the one config where a filesystem walk can be slowest.

Same idiom as the neighbours now: one knob, no per-test literal to
forget when the budget moves.
2026-11-15 22:02:30 +00:00
fl0l0u 66b0dcf019 server: the guarded-route set is declared once, at registration
The front kept its own list of which routes answer the local operator
keyless -- guarded_route spelled out the same eight (method, path)
pairs Server::register_routes registers with a local_operator handler,
and its comment admitted the copy ("Kept in step with Server::register
routes"). A new guarded route meant editing the registration AND the
front's list AND the test that pins the list against drift; miss one and
the front wakes a parked model for a stranger who is then refused -- the
exact A-05 bug class -- silently.

Router::add now takes a `guarded` flag, set on the six registrations
that guard (and their DELETE siblings). Router::guarded(method, path)
asks the matcher -- the same split_path + :label match that reaches the
handler -- and the front copies the flag as it mirrors each model route,
so guarded_route is one line reading the front's own copied marks. One
declaration per guarded route, at its registration; the matcher that
decides the wake is the matcher that dispatches, so slash and :label
forms cannot disagree with the handler and the drift risk is gone.

front_test still pins every shape (guarded: slashes, /sessions/:label,
the trailing-slash collapse; not: GET /sessions, /stats, inference,
/sessions/a/b) and transport_test exercises real dispatch through them.
Behaviour unchanged -- the same eight routes wake nothing for a stranger.
2026-11-15 22:02:30 +00:00
fl0l0u 0f011f27e1 fleet: the local-operator rule is one predicate, read twice
add_routes' guard and the front's operator rule computed the same
expression byte for byte -- !c.api_key.empty() || server::local_operator(
q, c.host, c.allow_hosts) -- once to answer a fleet admin route with a
403 and once to decide whether a guarded route may wake a model. The
second-pass audit had to touch both to move them together, which is the
telling.

Fleet::operator_ok(q) owns it now; both callers call it. The two must
agree or the front lets through a request the handler then refuses (or
wakes a model the guard would not have admitted), so a single source is
the point -- keyed deployments pass, keyless ones answer the three-leg
local-operator rule exactly as before. No behaviour change.
2026-11-15 22:02:29 +00:00
fl0l0u c3a4775f54 util: a log_once for the warnings that speak once per process
Three sites -- the kvstream clamp (L-02), the batch overlap guard and
the bidi-plane belt -- each open-coded the same four lines: a function-
local static atomic<bool>, a bool expected, and a compare_exchange to
decide which of the many steps gets to print. The pattern is the point,
not the flag name (said, said2), so it moved to rad_internal.h as
log_once(flag): true on the first call, false after.

No behaviour change -- same first-of-many warnings, same compare-exchange
thread-safety, exactly one winner per flag -- only the idiom is now named
instead of re-typed where a fourth once-warning is ever needed.
2026-11-15 22:02:29 +00:00
fl0l0u b9ecbde0d6 util: one wording for the bounded read's refusal
The refuse sites that read a container file all re-typed the same
two-branch message -- over ? "carries far too many values"
: "nests far too deep" -- six times, and the copies had already
drifted: gen_config said "carries far too many JSON values", xstats
"far too many values", tokenizer_config "it does not parse" for the
discarded case. The bounds themselves (2^24, 256) were also spelled
as literals in tokenizer_json's refusal, so a bound change there
would make its message a lie.

Json::bound_why(over, deep) is the phrase, owned beside the read that
sets the flags, and the two bounds are exported as kContainerBudget /
kContainerDepth so the one message that states them reads them from
the constants. Every refuse site now calls it; the wording is one, the
numbers cannot drift. No behaviour change -- the same flags map to the
same failure paths, only the text they print is unified.
2026-11-15 22:02:29 +00:00
fl0l0u 5e2e596644 format: bound the geometry the bailing layout products are built from
The layer-count cap made the walk safe; the arithmetic was still open.
The rebuild multiplies container-supplied widths in int64 -- heads *
(nope + rope) rows for the q_b split, heads * 256 * latent for the
fused kv -- and hands the products to sized allocations and a
comparison. A wrapped q_b product that coincidentally equalled the
tensor's rows would run the split at a wrong per-head boundary (the
bytes stayed the file's own, but the weights went to the wrong names);
on the 32-bit tier, an overflowed element count truncates through
size_t to a small allocation the copy then overruns.

The family gate now caps what these products are built from -- heads
and the MLA rank at 4096, rope at 256 dimensions, the full query width
at 65536, the layer group within the stack; the shipped geometry is
128/64/512 with tens of heads -- and the q_b row product is computed
with overflow checks instead of trusted. checkpoint_test pins the wide
heads and rank against the honest small stack.

Found by the 2.1.0 review pass (axis: hostile model files); widened
past the reported site to the fused-kv product the same axes cleared
only as file-bounded.
2026-11-15 22:02:27 +00:00
fl0l0u 3bf9dc9593 diag: the report writes take the atomic, link-safe path
diagnose wrote diagnose.json and diagnose.md with plain ofstreams into
the configured report dir. That dir is a shared place in practice -- a
/srv/reports, a fleet peer's mount -- and a local user who can write it
can pre-create DIR/diagnose.json as a symlink: the serving-user process
then truncates and overwrites whatever the link names, with report text
whose category strings a corpus file partly shapes. A reader polling the
dir also sees a half-written report.

This is the hazard xs_write_atomic exists for -- xstats' comment
describes exactly this pre-created-symlink story -- and xstats.h is
what xstats uses to write the very same kind of file. Both report
writes go through it now: temp file, no follow, rename.

Found by the 2.1.0 review pass (axis: hostile sockets / runtime).
2026-11-15 22:02:27 +00:00
fl0l0u d893fd05d1 diag: the baseline and corpus files are read like the reports they are
Both files diagnose consumes are written by other runs and pasted
between people: --diagnose-baseline is an earlier report, the corpus a
forwarded file. Neither was read like a supplied file. The baseline got
the unbounded Json::parse, and compare_outputs then walked it with
throwing accessors -- a member it does not expect throws, and nothing
between run_diagnose and main catches -- so a crafted "earlier report"
aborted a run with std::terminate after hours of benchmarking work. The
corpus got a hand-rolled unbounded fread loop and a raw parser per
line: a deep line recursed the parse to a stack overflow before the
fingerprint check could ever run.

Now: capped read and parse_container on both (the corpus's size refusal
lands before the bytes are read), a per-line over/deep refusal that
names the line, and one try around the comparison so any structure the
comparison does not expect is the refusal it should be -- "the baseline
is not shaped like a report", parity not compared, the run keeps its
own results. diagnose_test pins the deep line.

Found by the 2.1.0 review pass (both security axes, independently).
2026-11-15 22:02:27 +00:00
fl0l0u 5c66eecc8e device: the stuck-exit watchdog does not fire during load
scheduler.stuck-exit (2.1.0, 60 s by default everywhere) turns the stall
verdict into a process exit so a restart policy can act on a hung card.
The verdict watches queue read-indices and the direct-IO counter -- and
a cold load moves neither: a mapped tier faulting its tables through the
page cache is not counted, a barrier-waiting rank parks its index, and
"zero progress for 60 s" is then a description of a big model starting,
not of a hang. Under a restart policy that misfire is a crash loop with
a captive audience: the same load runs on every restart, and the exit
was armed from process start.

The watchdog now reads dev_engine_ready: set when an Engine::start()
completed once, never unset, and the exit fires only after it. A hang
during the very first bringup is what it always was -- dumps, the log
line, /health 503; the supervisor's hammer hits a process that has not
started serving, which is exactly the case the exemption keeps it off.
The verdict's own log line says which of the two futures it has, per
this file's rule that a report never states less than it will do.

No fast-suite test reaches the backend watchdog thread (the exit path
kills the process and the watch ticks in wall-clock seconds); the
config parse stays pinned by fleet_config_test and the exemption is one
flag read at the fatal's gate. Found by the 2.1.0 review pass
(axis: hostile sockets / runtime; the load-phase scenario is the
mapped-tier fault storm the release itself describes).
2026-11-15 22:02:27 +00:00
fl0l0u f4981154fc text: the tool-call arguments probe parses under bounds
bad_arguments names the offending tool_calls[].function.arguments when a
refused conversation reaches it -- and it probed each string with the
plain Json::parse. The HTTP edge depth-caps these strings (its comment
is explicit that the strings could otherwise overflow a worker's stack),
but nothing capped the VALUE COUNT: a client whose conversation had
already failed the template -- exactly the path this refusal exists on
-- could hand the probe a few million flat values, and the probe grew a
DOM no one would ever read, once per request, inside the body's 512 MiB.
Offline callers (fleet, diagnose) reach the same path with no edge at
all.

The probe is parse_bounded now, at the same depth the edge enforces and
a values budget a tool call cannot approach; over, too deep, and not
JSON each name themselves in the refusal, and the honest case still
refuses in the template's own words. chat_test pins all three bounds.

Found by the 2.1.0 review pass (axis: hostile sockets).
2026-11-15 22:02:27 +00:00
fl0l0u 392746da6b museglimmer: the vision tower bounds the config it allocates by
MuseTower::declare read vision_config.num_hidden_layers and the position
grid with only a positive check, then handed them to host vectors --
full.assign(depth), L.assign(depth) -- before any weight was consulted.
A container stating 2^62 layers threw std::length_error (or bad_alloc
just below max_size) out of the declare phase, and nothing between there
and main catches: the process died with a SIGABRT and no report, where
every other bad config in this file says what it dislikes on stderr and
refuses with RAD_E_INVAL. The grid sides were the same story multiplied:
pos_emb_height x pos_emb_width is a signed product of container values
that can overflow before any comparison could see it.

The gate now refuses depth past 128 and a grid side past 512, against
published maxima rather than round numbers: the deepest vision encoder
ever shipped is 48 layers (ViT-22B, InternViT-6B -- this family's towers
are SigLIP-class, tens), and the largest stored position table a side of
92 (SigLIP at 1292 px over patch 14; CLIP 16, SAM 64; native-resolution
towers store no side x side table). The caps sit ~2.6x and ~5.5x past
those, so they never bite an honest container, and at the cap itself the
guarded shapes are harmless: the depth vectors cost KiB and the grid
products top out at 2^18, too small to wrap signed 64 before a
comparison sees them. museglimmer_test pins both caps at their boundary
and far past it -- the grid at both sides together, since one side
alone the height==width rule refuses before the cap is consulted.

Found by the 2.1.0 review pass (axis: hostile model files); caps
sourced against published encoders and tightened at the operator's
request, from the first pass's wide 512/4096 margins.
2026-11-15 22:02:26 +00:00
fl0l0u 4943bba2fb format: a bailing container must promise a walkable layer count
bailingmoe3_layouts rebuilds the release GGUF's layouts by walking every
layer the container claims -- and it runs on the open path, before any
plugin gets a vote. Its gate checked the counts were positive and nothing
more: a GGUF naming 2^62 blocks sends the name-probe loops over centuries
of iterations. The process never listens, never refuses; StallWatch notes
the silence after two minutes and stops there. A negative
first_k_dense_replace opens a second loop of the same order, starting
below zero. This is a hostile container's permanent hang, the same
supply-chain class as the round-two finding on the shard index: the
refusal must land before the walk.

The gate now caps n_layers at 4096 (the family's real models are an order
of magnitude below; 4096 layers is not a slow load either) and requires
the dense prefix to lie inside the stack. checkpoint_test pins all three
shapes -- 2^62 layers refused, negative prefix refused, a small honest
stack opens as before -- and the test GGUF writer gains the INT64 KV type
they are spelled in, which the u32 field could not carry.

Found by the 2.1.0 review pass (axis: hostile model files).
2026-11-15 21:15:23 +00:00
fl0l0u 6e8a2f0a94 engine: the scored step refuses its union before pinning tries it
The scheduler caps one request's scored candidate list at 4096 ids;
nothing bounded the step's UNION. A step packed with maxed scored
requests unions toward the whole vocabulary, the pinned readback
buffer is sized from that union, and its size was discovered by
ATTEMPTING it: a gigabyte-scale page-locked allocation whose only
check was whether the box survived it. Survive it and the bytes stay
pinned forever -- the buffer is grow-only. This was L-04: the
round-one cancel-path invariant held (the engine never died on it),
but the residual was an attacker-sized lever on page-locked memory.

The cap is the step-wide sibling of the per-request one: 65536 unique
candidate rows, sixteen maximally-loaded requests, while real scored
questions name a few dozen ids each. A step past it takes the refusal
the allocation failure already took -- the scored requests cancel,
the engine and every other request on the step keep running -- except
before the box is asked to pin anything to find out. The logits-row
mode needs no sibling cap: its rows are one per scored request,
bounded by the batch's max_seqs by construction.
2026-11-15 20:38:10 +00:00
fl0l0u 9a960c3da9 spec: the dependency table says what HTTP and JSON are now
The table still listed vendor/nlohmann as "lifted, unmodified": the
directory is gone, displaced by core/util/json.{h,cpp} on the yyjson
reader, and vendor/UPSTREAM has recorded the removal since (audit
I-04). And no cell said cpp-httplib carries a local patch -- it has
for as long as 0022 has existed, so "unmodified" sat next to a
directory that is not.

The row now names both facts at the place a reader looks up what is
lifted and what is ours: httplib lifted with the one patch, the DOM
rewritten into core/.
2026-11-15 20:38:10 +00:00
fl0l0u 79cc319db2 vendor: cpp-httplib 0.66.0 -- the thread-creation failure stops aborting
0.64.0's ThreadPool spawns a dynamic worker inside the accept loop with
no guard: when the process runs out of threads, std::thread's
std::system_error escapes the loop and std::terminate takes the whole
server down. A client that opens enough connections makes thread
exhaustion a scheduled event; radiance's socket gate and drain budget
narrowed that window but never closed it. 0.66.0 wraps the spawn in
try/catch and keeps the job queued for an existing worker -- the abort
becomes a queue.

The pair moves to what llama.cpp carries at b8abe41a5 ("vendor: update
cpp-httplib to 0.66.0 (#32049)"), byte for byte; the LICENSE was already
byte-identical. Patch 0022 re-verified, not rewritten: the same hunk at
a +26-line offset with no fuzz, upstream still bounds the keep-alive
drain only by the connection's timeout, so the 5 s budget still stands.
The six CPPHTTPLIB_* defines vendor/CMakeLists.txt passes were each
re-checked as live knobs in the new pair. UPSTREAM carries the new
record and the audit note; the manifest re-hashes in this commit.
2026-11-15 20:38:10 +00:00
fl0l0u 0ff61a19a2 sched: the preemption gate credits only what the recompute adopts
The gate that admits a preempted request back subtracted the raw
attention prefix hit from every paged group's need. Admission does not
adopt that deep: under checkpoints the linear layers replay from the
last checkpoint whatever the attention matched, so the adopted prefix is
clamped to the linear hit, exact mode floors it to its chunk grid, and
one token always stays outside for the logits. Every block of that
difference was a block the recompute would really need and the gate
pretended was free: the request is admitted against a loan it cannot
repay, the next ensure preempts it again -- the exact loop the gate's
own comment describes.

The gate now runs the plain count first, which passes without touching
the cache at all when the pools plainly hold the recompute, and consults
the hash-chain lookup -- request-length CPU, under mu_, per waiting slot
per round -- only when the credit decides, crediting the clamped,
floored, capped depth admission actually adopts. Under-crediting delays
a re-admission by a round; over-crediting, which is what this was,
loops.
2026-11-15 20:38:10 +00:00
fl0l0u b98c2eb13e vendor: the shims that hold lifted code say so in the record
The five files under vendor/shim/ are hashed by the manifest and
tamper-visible, but LIFTED FILES named only one of them
(ryml_impl.cpp, beside the rapidyaml entry). The other four carry
upstream's shape or text -- common.h transcribes llama.cpp's string
helpers unchanged, MIT, at the recorded commit; ggml.h, llama.h and
log.h declare the macros, types and log surface the byte-for-byte lifts
reach for -- and "the manifest hashes it" is tamper detection, not
provenance. A refresh could meet those files with no note of what they
mirror.

They are recorded now, beside the lifts they exist for, with what each
is, what it mirrors, and why it exists rather than the upstream file it
stands in for. The manifest re-hashes with the record, in this commit.
2026-11-15 20:38:10 +00:00
fl0l0u 5736dd11c3 sched: the bidirectional plane trusts its runs no further than it checks them
h_bidi carries one slot per run that intersects the chunk, over a plane
four times the step's token capacity wide -- sound only because
RopeLayout::runs is documented ascending and pairwise disjoint, so every
accepted run can bill at least one real token of the step. Until 2.0 the
layout was built solely from the tokenizer's own placeholder scan;
request-side placement writes it now, and a layout with overlapping runs
would bill one token twice, run n_bidi past the plane, and hand the card
an index plane its shape validation waved through.

The build now checks the promise where it consumes it: a run starting
before the last accepted one's end is dropped -- those media rows simply
lose bidirectionality for the step, which is an ordinary miss -- and a
hard stop guards the plane width itself, unreachable unless the check is
wrong. Both events speak once per process, not per step.
2026-11-15 20:38:10 +00:00
fl0l0u 90b1229bfc place: the profile file is read like the untrusted file it is
--expert-profile read its file with no size cap -- any file, gigabytes,
appended into memory before a single check -- parsed the text with the
unbounded parser, and took n_trunk_layers through int32. That last one
is the quiet one: the loader refuses "this profile is for another
model" by comparing the file's layer count with the live model's, and a
value that wraps past 2^32 lands on exactly the number the comparison
asks for.

The read now caps at 64 MiB while appending -- past it, nothing further
is grown and the file is refused by name -- the parse is the container
helper (parse_container) like every other file input, and n_trunk_layers
is read as int64 and range-checked before it reaches the comparison. An
xstats_test case pins the loader's three refusals -- wrapped trunk
count, negative count, oversized contract -- and the tmp-symlink
refusal of the previous commit: the planted symlink survives untouched
and the profile file still lands.
2026-11-15 20:38:10 +00:00
fl0l0u e5862f3d26 place: the profile's tmp name is created, never overwritten
The stats file is written as "<path>.tmp.<pid>" and renamed, so a
reader never sees half a file. But the name is built from the PID --
public -- and fopen("w") happily follows a symlink planted at that name
and truncates whatever it points at. A local user who guessed the next
PID had the serving process overwrite any file that user could name,
as the serving user.

The tmp file is now opened O_CREAT|O_EXCL|O_NOFOLLOW: no symlink, no
reuse of an existing name. A stale tmp of a crashed run -- whose PID a
reboot can reuse -- is unlinked and the create retried once, exclusive
again; whoever else planted the name wins exactly a refusal.
2026-11-15 20:38:10 +00:00
fl0l0u c2403b2e29 kvstream: a stage run past the host layer says so, once
The stage copies pool ranges of one layer into the mirror row, clamping
each run to min(pool bytes, host_layer_stride) -- the clamp is what makes
the copy memory-safe. But a silent clamp is a wrong answer given quietly:
if pool and host layer ever disagree on the layout, a run naming a block
past the row's end stages nothing there, attention reads stale bytes at
those positions, and the text comes out fluent and wrong with no fault
and no line to point at.

stage_src now notices when it clamps or drops a run and warns once per
process -- the hot path is not the place for a per-step print -- naming
the group, the row's end and the stride. The behaviour is unchanged; what
is new is that it is never silent.
2026-11-15 20:38:10 +00:00
fl0l0u 444b85158b scripts: hfget refuses names curl cannot fetch faithfully
A listing entry named "weights.bin#x" downloaded cleanly, checked clean,
and was the wrong object. curl ends a URL path at '#' and '?': it
requested "weights.bin" while hfget recorded the entry as
"weights.bin#x". An attacker who lists the truncated object's real size
and oid under a decorated name passes the size check, the oid check and
the manifest -- the bytes arrive under a name nobody asked for, and the
directory reads complete. hfget's name screen checked traversal, control
characters and its own manifest, but not curl's path terminators.

The jq screen now refuses any entry whose name carries # or ?. The child
that writes each file re-screens its name too, and its old case missed a
name ending in "a/.." (the parent's regex caught those, the child's did
not) as well as the terminators -- both arms added, the `?` quoted so it
stays literal and not the single-character wildcard. Two hfget tests: a
listing carrying "model.bin#x" is refused whole, and a child handed
model.bin#x, model.bin?y or sub/.. refuses before any request or write.
2026-11-15 20:38:10 +00:00
fl0l0u 965a7caa51 hf: a lone container does not outrank weights beside it
Give --model org/repo and the engine picks what to serve from the fetched
directory: one .rad on the top level won outright, whatever else was
there -- and .rad was not in the skip list a safetensors set imposes on
.bin/.pth/.gguf, so hfget fetched the rival too. A repository that ships
a real safetensors set beside one decoy .rad chose for the operator: the
container wins, the engine loads and serves it in place of the model the
operator named.

hf_served_path no longer resolves that tie by rank -- a container among
safetensors or gguf weights is refused by name and the operator passes the
file they mean -- and hfget skips .rad when a safetensors set is present,
as it skips every other rival. A repo holding only a container still
serves it: the fix is against the silent tie-break, not against .rad.
2026-11-15 20:38:10 +00:00
fl0l0u 4c9a79ca98 tests: the served dashboard bytes get hashed from outside
dashboard_page.h is the Node build of dashboard/, committed because the
engine's build has no Node. The ctest dashboard_page compares dashboard/'s
sources against the digest recorded INSIDE that header -- which proves the
sources and the header's own claim agree, nothing more. Rewrite the header
and its embedded digest together and the check passes while the engine
serves a page nobody built from these sources.

artifact_sums.sh hashes the artifact itself from outside, the mechanical
half vendor/SHA256SUMS is to vendor/UPSTREAM: tests/ARTIFACTS names every
committed built artifact and its hash, and a lone tamper of a served byte
now fails. A rebuild re-records the manifest in the same commit. The
residual gap -- a single commit rewriting an artifact AND the manifest --
is exactly the vendor-tree gap, and documented as such.
2026-11-15 20:38:10 +00:00
fl0l0u 70be48c6fa scripts: the expert report never prints an untrusted string raw
The stats file a colleague hands over is data, not the operator's own:
its model, arch and map strings are printed straight to the terminal, and
a ESC in one starts an OSC sequence that retitles the window, moves the
cursor, or worse in terminals that honour it. Malformed numbers beneath a
well-formed format header crashed the report with a raw Python traceback
the operator has to read past.

Strings for display now pass through safe(), which turns every control
character -- C0, DEL, and the C1 range -- into '?', on model, arch and
the map list alike. The whole run is wrapped so a file that passes the
format check but is malformed underneath exits with one line naming the
fault instead of a stack. --json output is untouched: it is data, not a
terminal.
2026-11-15 20:38:10 +00:00
fl0l0u be09d90c71 libquant: the codebook loader caps as it reads and refuses an infinite unit
vq= is the one codebook path that reads a file; table= caps its values
at 4096 but vq= appended every line to a growing vector and checked the
count only after reading the whole file, so a 10 GB codebook grew 10 GB
of vector before anything said no. And its "# unit X" line parsed X with
sscanf %lf -- which accepts "inf" -- while the fallback guard was
!(unit > 0.0), an infinity passes. A "# unit inf" file set every decoded
value to infinity.

The count is now checked as rows append, at 4096: the widest code the
grid emits is u12, so past 4096 codewords could not be indexed even with
the memory read, and the old code silently mis-indexed the over-4095 case
itself. And only a finite positive names a unit -- "inf" and "nan" fall
back to the entries' own rms, as a malformed value already did. A
quant_test case pins the 4096/4097 boundary and that "# unit inf" now
decodes finite.
2026-11-15 20:38:10 +00:00
fl0l0u 3ac3954fea sample: the schema reaches the converter through the bounded read
grammar.cpp guarded the json-schema-to-grammar converter with a depth
check -- kMaxSchemaDepth, added because a deeply nested schema crashes
the converter -- but it built the tree to measure with Json::parse, the
unbounded read. A schema nested past the guard's own reach was already a
stack overflow by the time json_depth ran: the check sat after the thing
it was written against.

The schema is now read with parse_bounded at exactly the depth the check
promises, plus a 2^20 value cap, so the refusal fires during the read,
before any nested tree exists to be walked, dumped or destroyed. Every
current caller already hands over a bounded body, but this entry point
does not know that -- it takes a string.
2026-11-15 20:38:10 +00:00