Where the split left pub use x::* over items that no outside module can name, the compiler said the glob re-exports nothing pub. The glob now has the visibility its items really have: plain use where they are pub(self), pub(crate) where siblings reach them (model.rs file_download, libc-shim launch_interposers). One glob of backend-api scripted.rs was dead and is deleted. 7 globs of control-plane stay with their allow: the compiler calls them unused in the lib build and the lib test build of control-plane cannot be built on Windows, so a test use cannot be ruled out.
cargo check --all-targets on backend-api, control-plane, gateway-domain, gateway-text and libc-shim: no new warning, no new error (the one control-plane lib test error is the pre-existing std::os::unix use).
The re-exports left by the mechanical module splits carried a blanket allow(unused_imports). 49 of them cover nothing: cargo check --all-targets on backend-api, control-plane, gateway-domain, gateway-text and libc-shim gives no new unused-import or glob-import warning without them. 39 others in those crates still silence a real warning and stay; the 8 in desktop-core (engine-host) could not be checked because that crate needs the engine, which does not build on Windows (STRA-390), and stay too.
The request middleware, the backend worker and the metrics handler now share one RequestMetrics value that Services holds, so the LazyLock registry of request_log.rs and its architecture.json exception are gone. The middleware gets it through Observe, the worker through BackendWorkerConfig, and prometheus::render takes it as an argument; the counters, histograms, labels and log lines are unchanged, and the unit tests now count into a registry of their own instead of one shared by the whole test process.
PromptDate was set once by serve into a process OnceLock and read by harmony_prompt::render.
It is now ModelView::prompt_date, built from the config in build_state, and prepare_input_tokens
hands it to render_prompt/render. The default of a bare AppState is still Utc, as the unset cell was.
One process-global exception deleted.
Rust comments that named scripts/offline/*, gen_goldens.py, oracle/gen_*.{sh,cpp,py}, build_oracle.sh and similar retired generators now say where the data
came from (the Original's code, Strata 41cf05a0) or drop the sentence. The path/generator text of seven generated fixtures (sampler_oracle.json, sampling_keys.json,
memory_plan_golden.json, rope_golden.json, cvec_oracle.json, stra161 fixtures.json, commentary-tool-prompt.json) is reworded; no test reads those fields and no pin
covers their bytes. cmd_time/doc.rs: the two path texts in the format string; its lines are re-broken so they stay within 120 columns (the string is unchanged
otherwise). Comment-only except those data/string spots; no behaviour change.
Owner decision 2026-11-23: the vendored tree is junk. Leleka never builds or runs it (no Cargo.toml or build.rs depends on it), the vanilla benchmark
builds from its own checkout on the server, the comparison measurements are finished and the CUDA ports are frozen. Strata is MIT: its licence text
stays and ships (third_party/strata/LICENSE, `leleka engine license`).
- git rm -r engine: engine/strata (upstream 41cf05a0 plus 25 locally patched files), engine/README.md, engine/upstream.md (its pin record moved to
third_party/strata/UPSTREAM.md) and engine/upstream/ (the two local-patch diffs against the removed tree). They belong to the same vendored mechanism.
- The files Rust and the product still read were moved to third_party/strata and control-plane/tests/mcp_hub in the first commit of this branch.
- The full tree is in git history before this commit; 87e2633af is the last commit that changed it. Restore with `git archive <this commit>^ engine/strata`.
- Four doc-comment lines that the path rewrite made too wide are re-wrapped (check-limits stays at 0 errors).
The vendored Strata tree engine/strata is removed for good (owner decision 2026-11-23): Leleka never builds or runs it, the vanilla
benchmark builds from its own checkout, the comparison measurements are finished and the CUDA ports are frozen. Everything below
compiled or read that tree, so it cannot run without it and is retired (the tree stays in git history, see third_party/strata/UPSTREAM.md).
Checked-in fixtures, golden JSON, sealed PTX, seal plans and MANIFEST hashes are untouched and keep being replayed by the cargo tests.
Drift guard
- crates/experimental-ref/tests/literal_port.rs: include_str! of the Original .cu files compared with the checked-in experimental ports.
Oracle generators and builders (they compile or extract from the Strata C++/Python sources; their outputs are the checked-in goldens)
- crates/experimental-ref/oracle/gen_{cvec,kv,remote,stream}_golden.{cpp,sh}, gen_seal_additions.py and the cuda_runtime stub they used
- crates/sampler-ref/oracle/build_oracle.sh, gen_fixtures.cpp, gen_sampling_keys.py, stub/ (run_port_host_tests.sh and the fixtures stay)
- crates/serving-policy/oracle/ (build_oracle.sh, gen_{host,cvec,vision}_fixtures.cpp)
- crates/context/tests/rope_plan_golden/gen_* (plan, rope, kv pool)
- crates/engine-core/src/conversation/golden/gen*.{sh,cpp} and stub/
- crates/cuda-driver/oracle/gen_prefill_ring_trace.py and drivers/prefill_ring_trace.cpp (extracted prefill.cpp), check_cu_syntax.sh
- crates/engine-qwen35-cuda/tests/stra161_reference/reference.py (fixtures.json and the Rust constants stay)
- control-plane/tests/golden/gen_goldens.py, scripts/offline/ (Python differentials and golden generators against the Strata Python tools)
Source-compiling CUDA oracles and builders
- scripts/build-cuda-{projection-family,q5,q6,qsa}-oracle.sh with scripts/cuda-{projection-family,q5,q6,qsa}-oracle/ (include the Original .cu; sha256 pins of them)
- scripts/build-original-verify-ptx.sh, scripts/q8/rebuild_quantizer_ptx.sh, scripts/decode-sm120/make_iq_prefix.py (needs engine/strata/include)
- scripts/cuda-stubs/ (check-cu.py and literal_diff.py need the strata headers and the Original sources; the stub headers served only them)
- tools/chain-probe/build.sh, tools/kernel-ab/{cpp,aa.sh,smoke.sh,time_smoke.sh} (the C++ comparator is built from the Strata CPU kernels; verify_manifest.py stays)
- scripts/e2e/codex/speed/verify-hc-down-kernel-microbench-vs-upstream/ (compiles the upstream kernel from the tree)
Engine builds and Python smokes that need the tree
- scripts/build-cpu.sh, scripts/build-static-cuda.sh, scripts/check-keyless-gpu.sh, scripts/test-static-cuda-profile.py (CMake of engine/strata)
- scripts/compare-real-tokenizer.py, scripts/smoke-mtp-pack.py (reads src/core/mtp.cpp and a bench manifest), scripts/prepare-keyless-routing.py and its test
- scripts/smoke-native-pack.py became scripts/native-pack-fixture.py: the synthetic GGUF fixtures the four other smokes import stay, the iq_pack.py oracle comparison goes
Gates and CI
- scripts/check-local.sh: no live Python oracle differentials, no literal_port note, no check-cu, no build-cpu, no retired test scripts
- .github/workflows/linux.yml: the keyless-cuda, static-cuda-package and hosted-cuda-package jobs (they built the engine from the tree) and their dispatch
inputs, and the two oracle smoke steps; .github/workflows/port.yml: the Python oracle environment and the llama.cpp fetch of port-oracles
(the sampler host shim still runs)
- limits.json and scripts/check_limits_test.py exclude third_party/strata/ instead of engine/strata/
Documentation and comments: README.md names third_party/strata and the pin; deploy/README.md marks the retired build and smoke commands; comments
in Rust, Python and Markdown that named engine/strata/... now name "Strata 41cf05a0, ..."; the gpu-bringup scratch-copy test no longer copies the
removed include directories. Stale engine/strata paths in sealed .cu, .ptx, seal-plan and MANIFEST files are left as they are (hashes may depend on the bytes).
Owner decision 2026-11-23: the vendored Strata tree engine/strata is removed for good. This first step moves what is still read
at build, test or ship time into one small directory, byte for byte:
- third_party/strata/LICENSE (MIT; `leleka engine license` embeds it, the packagers ship it)
- third_party/strata/ggml/LICENSE, project-maya/LICENSE, project-maya/NOTICE.md (licence texts the release packager ships)
- third_party/strata/serve/chat_template.jinja (one copy, embedded by control-plane server_api.rs and gateway-text prompt.rs)
- third_party/strata/serve/chat_golden.json (gateway-text prompt tests)
- third_party/strata/tests/data/native_experts/*.txt (control-plane native_pack tests)
- control-plane/tests/mcp_hub/mcp_fake_server.py next to its test harness
- third_party/strata/UPSTREAM.md replaces engine/upstream.md: pin 41cf05a0, URL, the 25 locally patched files, where the removed tree is in history
include_str! paths, deploy/build.rs (the `leleka version` Strata pin now reads third_party/strata/UPSTREAM.md), Dockerfile.static-cli,
.dockerignore, .gitattributes, the release packagers (package-5090.sh, package-release.py: the subtree facts of the removed tree are
dropped from PROVENANCE) and the evidence capture scripts follow the move. The tree itself is deleted in a later commit.
env-read strata-control -> 0 outside env_settings.rs (debug_failed_output is read per call instead of cached in a OnceLock; request_log profile and stage trace mode come from env_settings), instant-now strata-control 15 -> 0 and strata-desktop-core 4 -> 0 outside the adapters: tokio-clock deadlines read SystemClock / RuntimeClock (zero-sized adapters, the same Instant::now call inlined), MemoryView and PrefixView hold an AnyClock, the request monitor and GenerationMetrics stamp with leleka-obs SystemClock. No change of order, branching or timing semantics. NOT merged: waits for the two-binary bitwise identity run (hot path: admission, streaming, gRPC client).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
29 more cases (159 cases, 318 captures), recorded on 08afbf216 in a temporary worktree and checked against the new code; none
differs. New cases: the request's max_output_tokens reached (text, reasoning, closed reasoning, tools, structured, gpt-oss);
Qwen reasoning on with json_schema valid and violated; gpt-oss json_schema, tools with structured output, effort none with
tools; Qwen reasoning plus tools at the length limit with calls inside the unclosed reasoning, and without; namespaced tools
through the stream and the buffered reading (Qwen with and without reasoning, gpt-oss); DONE before the first token and an error
after DONE (all four readings); a worker that reports fewer generated tokens than the reasoning took (the reasoning_tokens
clamp, usage output_tokens).
New tests of the binary (15 pass on 08afbf216 and on the new code): the stored response equals the one the client was sent
(streamed and not, six cases); a client that leaves at DONE closes the source (five cases, among them the final preview
flush); what reaches the worker: gpt-oss gets none of the server defaults for the samplers it lacks (top_k 20 and
penalty_last_n 64 included), accepts neutral values, Qwen keeps all five samplers and penalty_last_n, own and default.
In the lib: BufferedRun finishing its generation twice returns the shared GENERATION_ENDED error and fail() sends
response.failed; a token after the end fails the stream.
regenerate_output_golden now refuses unless OUTPUT_GOLDEN_RECORD names the pre-S23 commit and the tree has no output module
(checked: it panics on this tree); output_events.recorded_on names 08afbf216 and a test pins it.
Renames: ReasoningSplit to ReasoningPreview, Bytes to TokenBytes, Split and Cut to the one CutGeneration (the tokens are
counted from its extent by Generation::count_tokens), split_reasoning to cut_reasoning_for_corpus. AtEndDecoder::read_answer
returns the events and the notes, and build_events keeps the notes (two steps). decode_lossy has its doc comment. The
message of a decode error after the generation ended is one constant, output::GENERATION_ENDED, used by the decoders and by
the buffered stream. The sampler types and the admission functions move from codec.rs and effort.rs to sampler_limit.rs
(with their tests); lib.rs no longer names TokenDecoder.
TextCodec::live_decoder returns Option and defaults to None: a model that always reasons is read at its end, so the
gpt-oss live arm and LiveDecoder::harmony are deleted; the two live streams fail the response with NO_LIVE_READING if they
ever get None. harmony_family tests pin reasoning_enabled(effort none, gpt-oss) = true and the missing live reading.
New unit tests: preview off with an unclosed block at the length limit, and the same reasoning tokens with preview on and
off when the marker is split over two multi-byte tokens.
Proof: golden (260 captures recorded on 08afbf216) identical, strata-control lib 316, gateway-domain 36, tool corpus 4.
TextCodec::sampling_limit returns SamplingLimit { unsupported: &[Sampler], message }; gpt-oss lists TopK, MinP,
RepetitionPenalty, FrequencyPenalty, PresencePenalty in the order they were checked. unsupported_sampler and
drop_unsupported_samplers (effort.rs) read the set, so neither admit.rs nor effort.rs names a gpt-oss field any more
(unsupported_gptoss_sampling is gone; clearing penalty_last_n goes with the repetition penalty, as before). Unit tests of
both functions in gateway-domain; a_sampler_the_gptoss_worker_lacks_is_refused_and_named in the golden binary (400, the
param named, the family's message, the first sampler of the list wins) passes on 08afbf216 and on the new code.
Proof: golden (260 captures recorded on 08afbf216) identical, strata-control lib 315, gateway-domain 34, tool corpus pass.
The at-end cut (closed, unclosed at the length limit, unclosed ending on whole calls) is text-level code in output/split.rs
(cut_text); the token count is done on its result. output::split_reasoning exposes the cut and tests/tool_corpus/corpus.rs
calls it instead of its hand-kept copy (which passed natural_stop false where production passes true; calls_at_end sets
it itself, so no specimen changed). With think_marker.rs (previewer, at-end split, reasoning budget) the </think> search
and hold-back now exist once. Proof: the corpus (4 tests, 49 specimens, both lists of known failures unchanged), the golden
(260 captures recorded on 08afbf216) and the lib tests pass.
parse_output_items_with and segment_item (gateway-domain) and parse_output_items, parse_output_items_after and tool_options
(strata-control) are removed. The pure-protocol golden (responses/golden.rs, 'parse' cases) and the custom/console tool
tests build their items with answer_items (tests/fixtures.rs): the Qwen test tokenizer, an AtEndDecoder without reasoning,
output_items. The recorded expectations of the pure golden are unchanged. flat_tools lives in
responses/tool_declarations.rs. Proof: output_golden (260 captures recorded on 08afbf216) identical, strata-control lib
315 and gateway-domain 32 tests pass.
OutputDecoder split into two types over the shared Bytes, so what one reading offers cannot be asked of the other:
LiveDecoder (raw_text, notes) and AtEndDecoder (notes, accepted_call_in_reasoning, split_text) replace the enum with its
mode-specific accessors that returned None or false in the wrong mode. TextCodec gets live_decoder and at_end_decoder.
LiveDecoder::finish now hands the Harmony tail to the reader, so a live reading of gpt-oss would lose nothing.
push and finish after the generation ended return a decode error. AtEndPlan.preview: the non-stream answer no longer runs
the reasoning previewer. The two expect calls of the buffered stream are a response.failed path (DECODER_GONE).
TokenDecoder, QwenDecoder, decode_all and TextCodec::decoder are gone (HarmonyDecoder has push and finish of its own;
its tests drive it directly). AtEndReader::finish is split: Generation::split (split.rs) cuts the bytes and counts the
tokens, the plan flush, the debug copy, the events and the answer reading are functions of their own; the rule 'an
answer has one text event, empty if nothing else' is ensure_text. Names: decode_lossy, convert_segments, build_item,
wrap_reasoning_delta, finish_generation, BufferedRun::build (one result, the initial events are a field).
drain_utf8 is private to the output module (its test reads through the live decoder). The </think> marker search and
hold-back live in think_marker.rs, used by the previewer, the at-end split and the reasoning budget.
Unit tests added: keep_raw/raw_text/split_text, the no-preview plan, finishing twice, a cut character at the end.
Proof: the golden recorded on 08afbf216 (130 cases, 260 captures) passes unchanged; strata-control lib 315 and
gateway-domain 32 tests pass; architecture-baseline.json tightened (dyn-trait gateway-domain 4 to 2, strata-control 12
to 11).
The golden moves from a lib test to control-plane/tests/output_golden (its own process: the cases switch the process-wide
tool-call recovery). 130 synthetic cases, 260 captures. The expected captures in output_events.json were recorded on
08afbf216 (cbc1a9587 plus the first harness) in a temporary worktree and are checked against the new code; none was
recorded on it, and none differs.
What is stronger: ids are numbered by first appearance as <kind>_ID<k> and keep their numeric suffix (call_ID3_1), and
two_calls_of_one_response_have_different_call_ids pins the call ids Codex pairs outputs by; a vocabulary with multi-byte
tokens (a euro sign, an emoji, a token that holds the whole </think> marker, a token that ends in the middle of it) and
raw byte tokens; characters cut at length and at stop in the live text, the live tool stream, the reasoning preview and
the structured stream; a lone continuation byte in reasoning and in the answer; reasoning_tokens pinned for the marker
inside a token and across two tokens; a second </think> in the answer and in a tool argument; reasoning closed and the
answer cut inside a call; the tool-call recovery on and off in the live tool stream, the buffered stream and the
buffered answer; non-ASCII call arguments; a terminal token followed by more tokens with reasoning, tools and
structured output on; an id outside the vocabulary in the middle of the script (the code before S23 fails at DONE, the
new code at the offending token; the failure code, the message and every byte of the response are the same); a source
that closes without DONE; Finish::Cancel. Timing: a gated worker proves the first reasoning delta, text delta and whole
call reach the client before DONE, and a client that leaves closes the source in five stream modes.
Not covered end to end: STRATA_DEBUG_FAILED_OUTPUT (read once per process through a OnceLock; the keep_raw paths get
unit tests in leleka-gateway-domain).
Removed: decode_generation_noted and DecodedGeneration (gateway-domain), decode_generation_with / decoded_items /
decode_generation (strata-control), ReasoningStream and the drain_utf8 copy (their code lives in output/). The test ids are
kept: reasoning_marker_and_unicode_split_at_every_byte and the unclosed-reasoning test now read through the output decoder,
the utf8 test calls the domain drain_utf8; two unit tests of the moved pieces are added to gateway-domain.
docs/architecture/output-event.md: how output flows for each family, every site that asked for the family (before and after),
the canonical type, the identity proof, the behaviours kept on purpose and what is not done and why; hexagonal.md and
tech-debt.md point to it. architecture-baseline.json tightened with --update-baseline (dyn-trait: gateway-domain 5 to 4,
strata-control 14 to 12; nothing raised).
TextCodec gets always_reasons() (gpt-oss: true) and sampling_limit() (gpt-oss: the worker takes temperature, top_p and
seed only; the error message is the family's own). reasoning_enabled(request, codec) and admit.rs (check_live_features,
apply_sampling_defaults) read them instead of comparing Family::GptOss, and text.rs / reasoning.rs / tool_recovery.rs pass
the codec instead of its family. Proof: output_golden (132 captures) identical, strata-control and gateway-domain lib tests
pass, gates green, 0 warnings.
responses/stream/buffered.rs holds one reading-at-the-end OutputDecoder for the whole stream: ReasoningDelta events become
the reasoning deltas of the SSE stream, and at DONE the decoder is finished off the async threads (post_decode stage) and
the remaining events become the response with output_items. The stream no longer keeps token ids, no longer runs
ReasoningStream or decode_generation_with, and no longer asks the codec for its family (the decoder plan says whether the
output starts inside a reasoning block). Proof: output_golden (132 captures) identical, strata-control lib tests 317 pass,
gates green. Logging difference: a refused tool call in this stream now also writes the STRATA_DEBUG_FAILED_OUTPUT debug
copy to stderr when that variable is set (the non-stream answer already did); no response byte changes.
spawn_engine turned the spawn error into StartupFailed with map_err, which cannot await, so the worker status stayed at Starting
(the original run_session set WorkerState::Failed before returning). The Err arm awaits the update again; same log text, same exit.
New test a_failed_engine_spawn_marks_the_worker_failed spawns a nonexistent executable and asserts StartupFailed and WorkerState::Failed.
responses/create/answer.rs reads the generated ids through a reading-at-the-end OutputDecoder (decode and tool-call parse
errors keep their classes: detokenization_failed and tool_call_parse_failed) and builds the items with output_items,
replacing decode_generation_with / decoded_items. tool_recovery.rs gets the two helpers both buffered sites share
(at_end_plan, finish_output: the notes log, the call-in-reasoning log and the debug copy of a refused call).
Proof: output_golden (132 captures) identical, strata-control lib tests 317 pass, gates green.