Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
32 KiB
Leleka on Windows 11 (RTX 3080 Laptop 16 GB)
Branch claude/windows. Two routes, both started by the same leleka.exe:
- Route A, the WSL2 bridge. The engine runs inside WSL2 exactly as
docs/laptop-profile.mdanddocs/deploy.mddescribe;leleka.exeis the Windows front end: it starts the Linuxlelekathroughwsl.exe, translates paths, checks%UserProfile%\.wslconfig, and reads status / sendsreconfigure/ stops the service from Windows over the loopback HTTP that WSL2 forwards. - Route B, the native engine. No WSL:
leleka-inference.exe(engine),leleka-daemon.exe(gateway) andstrata-next.exe(API) run as Windows processes underleleka.exe run. The Windows primitives replace the Linux ones:nvcuda.dllforlibcuda.so.1, read-only file mappings formmap,VirtualLockformlock,GlobalMemoryStatusEx/GetProcessMemoryInfofor/proc, Ctrl-C and a stop file for signals.
No performance claim is made anywhere in this document; nothing here has a quality gate beyond what the Linux path has.
What works and what does not (honest state)
| Milestone | State | Evidence |
|---|---|---|
| A. WSL2 bridge, real | Works with the model (2026-10-25): up to ready, one request, status, reconfigure --prefix-cache-tail prompt, a second request, down |
section "Measured on this laptop" |
| B. native engine, real | Works with the model (2026-10-25): staged volume, pins verified, up --native --foreground to ready (engine load 80-128 s), requests answered, status, reconfigure, down. Needed two fixes (MTP ranged reads, child shutdown), both committed |
section "Measured on this laptop" |
| Whole tree builds and tests natively | leleka-deploy 116 unit + 2 Windows end-to-end + 5 recipe tests, control-plane, leleka-runtime, strata-desktop-core, leleka-memory, leleka-model-format and the rest of the workspace pass. Failures, also on Linux: experimental-ref literal_port (4 tests; kernel sources moved with the upstream sync), arch_ptx (chain_window.ptx has no sm_86 record) |
cargo test --workspace on Windows; Linux cargo check --release --workspace --tests and cargo test -p leleka-deploy --features test-fakes in WSL |
| native supervisor, test doubles | start, readiness, status, reconfigure (HTTP and engine restart), Ctrl-Break drain, stop-file shutdown |
crates/deploy/tests/e2e_windows.rs |
leleka service (Task Scheduler / user unit) |
Task XML generated, unit-tested and reviewed from service install --dry-run on this machine; never registered (not authorized) |
service.rs tests |
stage-model.ps1, fetch-cublas.ps1 |
Both run for real: the cuBLAS download (524 MiB, 18 s) matched the SHA-256 pin; the staging copied 138 GB in 614 s; the refusal path of fetch-cublas.ps1 was also verified with wrong archives |
measured section |
| C. this document | updated with the measurements | - |
Known limits (all of them apply to route B unless stated):
- Model volume is not built or downloaded on Windows.
strata-next model fetch/ archive preparation /service-installare Unix-only. Prepare the shards, the KAR archive, the MTP pack and the expert profile on the WSL disk (or copy a finished volume), then copy them to a Windows disk (section "Model files"). - Only the file-backed form: the profile must be
rtx3080-16g(kar_source=file,expert_source=mapped). The sealed-memfd form (55 GB in RAM) and the 50 GB resident expert copy do not exist on Windows;rtx5090-32gis refused by the preflight. - cuBLAS 12 DLLs:
leleka upnever downloads them;scripts\windows\fetch-cublas.ps1does, when you run it, with a SHA-256 pin. - No systemd on Windows:
--mode system/userare refused; the service runs in the terminal that started it (--foreground, the default); closing that terminal stops it.leleka service install(Task Scheduler, at logon, hidden, restart on failure) removes that limit. It is not a Windows Service: it runs while the user is logged on. - Memory governor on Windows:
MemAvailableis the available physical memory, swap is commit limit minus RAM, thread count,VmLck/VmPin, cgroup and PSI are unknown (the governor fails closed on unknown figures that it needs).RLIMIT_MEMLOCKis reported as unlimited, soVirtualLockand the working-set quota decide; the laptop profile haslock: off. - The key file (
api-key) andruntime.envhave no mode bits on Windows: they inherit the ACL of their folder. The defaults are under%LOCALAPPDATA%\leleka(other users cannot read it). Do not point--state-dirat a shared folder. - CPU
expf/powfcome from the Windows C runtime instead of glibc: last-bit differences in the CPU SiLU / RoPE theta are possible and were not measured. Compare greedy output against the Linux run before trusting numbers (the charter's rule for non-lossy changes). arch_ptx::every_sealed_sm120_file_has_a_companion_or_a_documented_reasonfails on Linux and Windows alike (chain_window.ptxhas no sm_86 companion record); on the 3080 that PTX loads as sm_120 code. Pre-existing, not touched here.- GPU safety (
project-laptop-gpu-freeze-bsod): the laptop took 0x19C BSODs under long GPU load in the OEM 30 W profile. Runnvidia-smi -q -d PERFORMANCE,POWERbefore a long test and prefer the Turbo mode (docs/laptop-profile.md, "Machine state is the dominant variable").
Prerequisites
- Windows 11, NVIDIA driver >= 595 (this laptop: 617.42). Nothing else from NVIDIA is needed for route A; no CUDA toolkit and no
nvccfor either route (every PTX image is sealed in the repository). - Rust 1.99 for
x86_64-pc-windows-msvc(the repository pins it inrust-toolchain.toml) and the Visual Studio Build Tools (MSVC linker andcl.exe;strata-nextcompiles a small C bridge). - Route A: WSL2 with an Ubuntu distribution that has Rust 1.99 and a C toolchain (
gcc), the NVIDIA Windows driver (WSL2 gets the GPU from it),%UserProfile%\.wslconfigwithmemory=40GBandswap=8GB(what this laptop has;leleka doctorjudges it). - Route B: the two CUDA 12 cuBLAS DLLs (below).
Build
Windows binaries (leleka.exe and the five native programs)
cd C:\Users\pavel\work\leleka-windows
powershell -ExecutionPolicy Bypass -File scripts\windows\build-release.ps1 # -> dist\bin\*.exe, with the sm86 companions
# only the front end, for route A:
cargo build --release --locked -p leleka-deploy --bin leleka # -> target\release\leleka.exe
dist\bin gets leleka.exe, strata-next.exe, leleka-inference.exe, leleka-daemon.exe, leleka-cli.exe and a stub
leleka-seal-exec.exe (prints "requires Linux"; nothing runs it). The first full release build takes a while (leleka-inference.exe is ~140 MB).
Linux binaries for route A (inside WSL)
The Linux leleka needs its five sibling programs next to it; build them in WSL from a copy of the tree on the WSL disk
(building under /mnt/c works but is slow):
wsl -d Ubuntu -- bash -lc "mkdir -p ~/leleka-src && cd /mnt/c/Users/pavel/work/leleka-windows && git ls-files -co --exclude-standard -z | tar --null -T - -cf - | tar -xf - -C ~/leleka-src"
wsl -d Ubuntu -- bash -lc "cd ~/leleka-src && source ~/.cargo/env && cargo build --release --locked -p strata-desktop-core --features sm86 --bin leleka-inference --bin leleka-daemon --bin leleka-cli --bin leleka-seal-exec && cargo build --release --locked -p strata-control --bin strata-next && cargo build --release --locked -p leleka-deploy --bin leleka"
The result is ~/leleka-src/target/release/ (six programs). leleka.exe finds leleka there (it also looks in
~/.local/share/leleka/bin, ~/leleka/target/release, ~/leleka-bin, ~/.cargo/bin and PATH), or you pass --wsl-bin.
(On this laptop an older Linux build is in /home/para/deploy-rel-target/release/; it works for preflight/up --dry-run but
predates the laptop strata.json fix below, so rebuild.)
Model files
leleka expects one assets directory:
ASSETS\model\Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf 54,817,524,224 bytes
ASSETS\model\Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf 28,800,138,432 bytes
ASSETS\qwen-iq3-s-l2-v4.kar 55,295,529,472 bytes (at the root, not in model\)
ASSETS\qwen-iq3-s-l2-v4.kar.provenance.json
ASSETS\data\mtp-rt\{dense.bin,dense.txt,draft_vocab.bin,experts.bin}
ASSETS\data\expert-profile.bin (sha256 8f59b4aa...8975baf; optional but it is the VRAM expert tier)
ASSETS\tokenizer-assets\ (made by `up`)
Route A: the volume must be on the WSL ext4 disk (not /mnt/c: 9p is far too slow for mapped reads; leleka.exe refuses
--assets under /mnt/<drive>/). This laptop's existing ~/laptop volume has the archive inside model/, and the tools want real regular files
at the leleka layout: strata-next model fetch refuses symlinks ("refusing symlink") and the engine admits only a regular, single-link archive,
so neither a symlink nor a hard link is a substitute. What was done (nothing in ~/laptop was touched; needs 140 GB free on the WSL disk, 578 GB were):
wsl -d Ubuntu -- bash -lc "A=~/leleka-assets; S=~/laptop; mkdir -p $A/model $A/data && cp --reflink=never $S/model/*.gguf $A/model/ && cp --reflink=never $S/model/qwen-iq3-s-l2-v4.kar $S/model/qwen-iq3-s-l2-v4.kar.provenance.json $A/ && cp --reflink=never -r $S/data/mtp-rt $A/data/ && cp --reflink=never $S/data/expert-profile.bin $A/data/ && chmod 400 $A/qwen-iq3-s-l2-v4.kar && chmod 444 $A/model/*.gguf"
(The two shards took about 7 minutes to copy. If you prefer not to keep two copies, mv the files instead; then ~/laptop no longer works for the older bench scripts.)
Route B: the volume must be on a Windows disk with ~150 GB free (the NVMe on C: or D:). scripts\windows\stage-model.ps1 -Dest D:\leleka-assets
copies it from the WSL volume above (about 140 GB over the 9p share; expect tens of minutes), lays it out, and verifies the pins (section "Route B").
By hand, the equivalent copy is:
$src = '\\wsl.localhost\Ubuntu\home\para\leleka-assets'; $dst = 'D:\leleka-assets'
robocopy "$src\model" "$dst\model" *.gguf /J
robocopy $src $dst qwen-iq3-s-l2-v4.kar qwen-iq3-s-l2-v4.kar.provenance.json /J
robocopy "$src\data" "$dst\data" /E /J
(dist\bin etc. are not part of the volume. Nothing of the model goes into Git.)
Route A: WSL2 bridge
cd C:\Users\pavel\work\leleka-windows
$L = "target\release\leleka.exe" # or dist\bin\leleka.exe
& $L doctor # GPU, RAM, .wslconfig advice, distributions, the Linux leleka, DLLs for route B
& $L preflight --assets '\\wsl.localhost\Ubuntu\home\para\leleka-assets' --wsl-bin /home/para/leleka-src/target/release/leleka
& $L up --assets '\\wsl.localhost\Ubuntu\home\para\leleka-assets' --wsl-bin /home/para/leleka-src/target/release/leleka --trust-archive
--assetsmay be a Linux path (/home/para/leleka-assets), a\\wsl.localhost\Ubuntu\...path or~/...; Windows paths are translated to/mnt/c/...and refused for--assets. The same translation applies to--state-dir,--prefix,--bin-src,--cublas-dir,--mtp-pack,--profile FILE.--wsl-distro NAME/$env:LELEKA_WSL_DISTROchoose the distribution (default: the default WSL2 one that is not Docker's).upfirst prints the.wslconfigadvice (memory below ~32 GB or no swap), then runs the Linuxleleka upwith its output forwarded. Without systemd in the distribution it runs in the foreground in this window (Ctrl-C drains and stops); with systemd (this laptop has it) it installs and starts a user unit and returns when/readyanswers. Keep a WSL session alive (any openwslwindow) so the VM is not shut down while idle.leleka service installautomates that (section "Keeping it running without a terminal").--trust-archiveaccepts the existing archive without the hours-long strict re-derivation (the engine still checks its SHA-256 and every CRC at each load) and makes it read-only, which the file form requires. The firstupalso verifies the shards (about 3 min with hash reuse; a cold cache is 5-7 min) and unpacks cuBLAS 12.9.1.4 from NVIDIA's pinned redistributable inside WSL (download ~890 MiB; or pass--cublas-dir).- When it is ready,
leleka.exeprints (and the foreground form prints whileupis still running):
Leleka (WSL2 route) is reachable from Windows:
endpoint http://127.0.0.1:8081
api key \\wsl.localhost\Ubuntu\home\para\.local\state\leleka\api-key (WSL: /home/para/.local/state/leleka/api-key)
try $k=(Get-Content -Raw '...api-key').Trim(); Invoke-RestMethod -Method Post -Uri http://127.0.0.1:8081/v1/responses ...
leleka.exe remembers the distribution, the Linux binary, the state directory and the API address of the last up in
%LOCALAPPDATA%\leleka\wsl-bridge.json (no secret in it), so status, reconfigure and down need no flags afterwards.
Route B: native engine
The first command to run on any state of the machine is leleka doctor; it prints what is missing and the one command that fixes the first
missing thing (programs, then cuBLAS, then the model volume, in that order):
cd C:\Users\pavel\work\leleka-windows
.\target\release\leleka.exe doctor --assets D:\leleka-assets
# MISSING native programs ... fix: powershell -ExecutionPolicy Bypass -File ...\scripts\windows\build-release.ps1
# MISSING CUDA 12 cuBLAS DLLs fix: powershell -ExecutionPolicy Bypass -File ...\scripts\windows\fetch-cublas.ps1
# MISSING model volume fix: powershell -ExecutionPolicy Bypass -File ...\scripts\windows\stage-model.ps1 -Dest D:\leleka-assets
# next (native route): <the first of those> (or `leleka up --native --foreground --assets ...` when nothing is missing)
The steps, in order (each is one command; each can be rerun):
# 1. the five programs -> dist\bin
powershell -ExecutionPolicy Bypass -File scripts\windows\build-release.ps1
# 2. cuBLAS 12 -> %LOCALAPPDATA%\leleka\cublas\bin (found automatically afterwards; no --cublas-dir needed).
# Downloads libcublas 12.9.1.4 windows-x86_64 (549,755,186 bytes) from NVIDIA with curl.exe and REFUSES (and deletes the file) unless
# length and SHA-256 equal the pin d534d98b0b453a98914dbf3adf47d7e84b55037abf02f87466439e1dcef581ed (from NVIDIA's own
# redistrib_12.9.1.json). -ZipPath FILE checks and unpacks an archive you downloaded yourself. The NVIDIA licence in the archive applies.
powershell -ExecutionPolicy Bypass -File scripts\windows\fetch-cublas.ps1
# 3. the model volume: copy from WSL (\\wsl.localhost\Ubuntu\...), lay it out, verify the pins (about 140 GB; tens of minutes + 5-10 min of hashing)
powershell -ExecutionPolicy Bypass -File scripts\windows\stage-model.ps1 -Dest D:\leleka-assets
# 4. start (engine + gateway + API in this window; Ctrl-C drains and stops)
.\dist\bin\leleka.exe up --native --foreground --bin-src dist\bin --assets D:\leleka-assets --trust-archive
stage-model.ps1 reads the volume through the \\wsl.localhost share without changing anything in the distribution (default source ~/leleka-assets,
else ~/laptop; both layouts are understood), copies with robocopy (a percentage per file; files that already match are skipped, so an interrupted copy
resumes), puts the archive at the volume root, checks that it is a regular single-link file and makes it read-only, then runs
leleka.exe up --native --mode none (installs the programs, tokens, tokenizer, configuration; starts nothing) and leleka.exe verify --native (hashes
both shards and the archive in full against the pinned digests). Options: -Distro, -Source, -BinSrc, -LelekaExe, -CublasDir, -SkipVerify.
It needs steps 1 and 2 first. It was run for real (138 GB, 614 s, layout checks passed); when the output is redirected it passes /NP to robocopy.
What up --native does: preflight with Windows facts (nvidia-smi.exe, GlobalMemoryStatusEx, GetDiskFreeSpaceEx, DLL search for
nvcuda.dll / cublas64_12.dll), checks that the two shards and the archive are on the volume with their pinned sizes (it never downloads or
builds), installs the five .exe files into %LOCALAPPDATA%\leleka\bin, generates the tokens and the API key (strata-next api-key init),
extracts the tokenizer from shard 1, writes leleka.json / daemon.json / strata.json / runtime.env in %LOCALAPPDATA%\leleka\state,
and runs the supervisor (leleka.exe run): gateway, engine, typed load-mtp, API, /ready. Logs are in ...\state\logs\{leleka,engine,gateway,api}.log.
The cuBLAS directory reaches the engine through LELEKA_DLL_DIRS (the loader flags used by the engine do not search PATH).
If the engine does not come up, read engine.log first; the first thing to check is the load line for nvcuda.dll, then the mapped-expert and archive
admission messages.
What was exercised on this laptop without a GPU or a model
crates/deploy/tests/e2e_windows.rs (cargo test -p leleka-deploy --features test-fakes --test e2e_windows, two tests, about 75 s) runs the real
leleka.exe run with test doubles named like the four other programs (leleka-fake-runtime.exe, the same double the Linux end-to-end tests use, extended with
/v1/status and /v1/reconfigure). Passing on Windows 11:
- the supervisor starts the gateway, the engine (file-backed archive form,
--expert-source mapped), the typed load, the API, and reaches phaseready;/readyand/healthanswer; leleka status(and--json) reads the status file and the API and prints the engine-load block;leleka reconfigure --context-tokens 4096 --cpu-workers 3goes over HTTP;leleka reconfigure --gpu-budget-gib 12goes through the supervisor's request files, restarts only the engine process (new pid, restart counter stays 0, gateway and API pids unchanged);- Ctrl-Break sent to the supervisor's console process group drains the API, then the gateway and the engine: exit code 0, phase
stopped, engine process gone, API port closed; leleka downfrom another process (the stop file) does the same; a seconddownsays nothing runs;statusthen exits 1.
Not covered by it: a real Ctrl-C typed in a console (the handler is the same code path as Ctrl-Break; it cannot be aimed at a new process group from a test), the real engine's
own shutdown on Ctrl-C, --hidden, and everything that needs the GPU or the model.
Measured on this laptop (2026-10-25, RTX 3080 Laptop 16 GB in Turbo mode, driver 617.42, 48 GB RAM, WSL2 memory=40GB swap=8GB)
Single runs, no repetitions, no baseline, no quality comparison: these are outcomes of "does it work", not performance claims. Every GPU-active stretch was
under 12 minutes, one at a time, with nvidia-smi checked before and a 5 s poll of temperature during (stop at 85 C; for the WSL run also scripts/laptop/monitor.sh
on the supervisor). Highest GPU temperature seen: 57 C; no throttling, no P5 under load, power 12-50 W; no instability. Request: POST /v1/responses, the same
59-token prompt ("Name three colors of the rainbow.", chat-templated), thinking on (the model spends its first tokens on reasoning), max_output_tokens 48/64.
| Route A (WSL2 bridge, Linux engine) | Route B (native Windows engine) | |
|---|---|---|
| volume | ~/leleka-assets on ext4: shards and archive copied (cp, 83 GB + 55 GB; symlinks are refused by strata-next model fetch: "refusing symlink"), MTP pack copied, expert profile copied. ~/laptop untouched |
C:\leleka\assets, 138 GB copied by stage-model.ps1 in 614 s (about 0.22 GB/s over the 9p share), layout checks passed |
| pinned digests | leleka up --mode none --trust-archive (installs, verifies both shards with strata-next model verify): 600 s cold |
leleka.exe verify --native: both shards and the archive hashed in parallel in 46 s (the files had just been written, so partly cached) |
| start to ready | leleka.exe up (user unit, stamps current): 266 s wall (engine load not printed separately) |
leleka.exe up --native --foreground: engine load 127.7 s (first start), 79.9 s (second start, warm file cache); model loaded in 82 s |
| request 1 | 59 in / 31 out (22 reasoning): 47.8 s (first request after start) | 59 in / 48 out (all reasoning, hit the cap): 18.4 s; run 3: 17.1 s |
reconfigure --prefix-cache-tail prompt |
worked; settings echo shows tail prompt |
worked, 17.1 s to reopen the serve stack |
| request 2 | 59 in / 31 out: 10.2 s | 59 in / 57 out (53 reasoning), different prompt: 14.3 s |
telemetry (leleka status) |
idle: VRAM 14.3 of 16.0 GiB, RAM 32.6 of 39.2 GiB available (WSL VM), engine 11.7 GiB resident; after a request: engine 28.3 GiB resident; prefill 2 tok/s, decode 3 tok/s (first request) | idle: VRAM 14.3 of 16.0 GiB; after the first request VRAM 14.8, RAM 9.6 of 47.7 GiB available (it was 25.8 at idle), engine 27.6 GiB resident (mapped file pages included), whole system 97 % busy during decode; the prefill/decode lines stayed - (see "Known measurement gaps") |
down |
2 s (systemctl --user stop) |
94 s with the first build (the children were never signalled and each waited out its 30 s grace); 6 s after the fix below |
| peak (monitor.sh, WSL run) | VRAM 14,995 MiB, min MemAvailable 31.9 GB, max 57 C, mean power 23 W | - |
What broke on the way and what was done (each is a commit on claude/windows with a test where one is possible):
- Native load stopped at
SelectedBinding / UnsupportedKindafter the archive bind and before any CUDA call: the MTP pack's ranged reads (read_exact_rangeinqwen4exp_mtp.rs) had only a Unixread_exact_at; the Windows arm returnedUnsupportedKind. Fixed withseek_read(53a7666). Everything after it loaded: the mapped 83 GB shards (file mappings), the 55 GB archive read throughseek_read,nvcuda.dll, the sm_86 PTX companions, the expert tier (13,162 VRAM slots + profile fill), the MTP draft, the serve stack. leleka down --nativetook 94 s: the supervisor stopped its children with SIGINT, which does not exist on Windows (interrupt()was a no-op), so each of the API, the gateway and the engine was killed after its 30 s grace. Now the children run in their own process groups and are stopped in order with Ctrl-Break;leleka-inference,leleka-daemonandstrata-nexthandle Ctrl-Break like Ctrl-C (tokio::signal::windows::ctrl_break).downtakes 6 s with the real engine; the Windows end-to-end test now asserts it finishes in under 25 s.leleka up --mode noneprinted the "reachable from Windows" summary although nothing was started: fixed.stage-model.ps1: with the output redirected, robocopy wrote a line per percent point (thousands of lines): it adds/NPthen.
Findings about this machine that the owner should know:
- WSL2 and native compete for the same 48 GB. After the Route A run the
vmmemWSLprocess held 22.5 GB of host RAM although the VM reported 38 GB free inside; Windows reported 4.9-9.7 GiB available and the native preflight failed (memory: ... below the 10.0 GiB needed).wsl --shutdown(nothing else was running in the distribution) gave 38 GiB available at once. Do not run both routes at the same time; runwsl --shutdownbetween them. Right after a large copy the figure can read near 0 for a few seconds (pages being written back); rerun the command. - The native engine's RAM: 27 GiB resident at the end of a request, most of it mapped shard pages; Windows available RAM drops to ~10 GiB while it decodes.
Known measurement gaps (not fixed):
- The telemetry's
prefill/decodelines stayed-on the native route (on the WSL route they showed 2 and 3 tok/s). The engine reports them to the gateway, so either the Windows engine's counters are not reaching it or they are filled later; not investigated. statusshowsmemory bus 100%at idle andswap in use 17.8 GiBon Windows: the swap figure is the commit limit minus RAM (an approximation, stated inwinproc.rs), the bus figure is NVML's as read throughnvml.dll; do not read either as a measurement.- The streaming response delivers all text events at the end (first text event time = total time) on both routes; the first-token time therefore cannot be read from the stream.
Keeping it running without a terminal: leleka service
leleka service install # native: a Task Scheduler task "Leleka": at logon (30 s delay) run `leleka.exe run --config ...\leleka.json --hidden`,
# interactive token of the installing user, least privilege, no time limit, restart up to 3 times a minute apart on failure
leleka service start # schtasks /Run (starts it now)
leleka service status # the task (status, last run, last result) and whether the supervisor runs
leleka service stop # graceful: the stop file, the API drains first (up to 120 s)
leleka service uninstall # stop, then delete the task
leleka service install --dry-run # print the task XML and change nothing
--hidden makes leleka.exe hide its console window (the console itself stays, because the supervisor stops its children through it), so no window stays on the desktop; a window can flash for a moment at logon. Prepare the state
first (leleka up --native --mode none ... or one foreground up); service install refuses when leleka.json or the installed leleka.exe is missing. Logs are the same
files in state\logs. The task runs only while the user is logged on (the GPU needs the interactive desktop session; it is not a Windows Service).
For the WSL route the same commands (--wsl, chosen automatically after a WSL up) do two things: systemctl --user enable|start|stop|disable leleka.service inside the
distribution, and a second task Leleka-WSL that runs leleka.exe service hold --wsl-distro NAME --hidden at logon: it starts the unit and keeps a hidden wsl.exe ... sleep infinity
open, because WSL2 shuts its VM down when no wsl.exe process is left and the unit would die with it. service install needs the unit file, i.e. one leleka up in a distribution with systemd.
State of this feature: the task XML is generated by tested code (crates/deploy/src/service.rs: well-formed, escaping, quoting, UTF-16 file); no task was registered on this machine and
schtasks.exe was not run by me (the owner's constraint); service install --dry-run printed the XML below the line --dry-run: nothing is registered and it was reviewed (user PARA-GAME\pavel, logon trigger with a 30 s delay, leleka.exe run --config ...\leleka.json --hidden, 3 restarts a minute apart). First use: run leleka service install --dry-run, look at the XML, then leleka service install; if schtasks rejects
the file the message is printed verbatim. --hidden and hold are untested for the same reason.
Reading leleka status
leleka status (add --json for a machine-readable form; exit code 1 when not ready) prints:
ready: true
supervisor: phase ready (pid 1234), engine restarts 0, updated 2026-10-25T13:00:00Z
engine load (decode):
gpu 91% busy (memory bus 40%), VRAM 14.1 of 16.0 GiB, 98 W, 1800 MHz
cpu 6.4 of 16 cores busy in the engine (whole system 52%)
ram 9.3 of 39.0 GiB available, engine 22.0 GiB resident (0.5 GiB pinned), swap in use 1.2 GiB
prefill 310 tok/s last, ...
decode 9 tok/s last, ... average, ... lifetime, ... now
cache 87% of requests hit, 91% of prompt tokens reused (last request ... of ...)
context 1200 of 8192 tokens (14.6%)
settings in force:
context_tokens 8192 ...
The numbers above are the layout, not measurements. phase is the supervisor's state (starting, loading, ready, engine_restarting, draining,
stopped, failed). gpu is the engine's GPU as NVML reports it, cpu the engine's busy cores, ram the host figures and the engine's resident /
page-locked memory (on Windows these come from Win32 and are approximations; see the limits), prefill/decode tokens per second of the last request, the
running average and since start, cache the cross-session prefix cache, context the live tokens against the ceiling. Route A reads the same
document from Windows over HTTP; if the distribution is stopped it says so instead of booting it.
leleka reconfigure
Changes the inference settings of the running engine without reloading the model (it reopens its serve stack in tens of seconds; requests wait; a refused value keeps the previous settings; the VRAM budget and the preset need a restart):
leleka reconfigure --context-tokens 8192 --prefill-capacity 2048 --kv-resident 32768
leleka reconfigure --prefix-cache-mib 4096 --prefix-cache-tail reply --cpu-workers 7 --spec-min-p 0.5
All flags: --context-tokens 1..262144, --prefill-capacity 256..8192, --kv-resident N (0 = all, else >= 20480), --prefix-cache-mib auto|off|N,
--prefix-cache-tail off|prompt|reply, --prefix-cache-block N, --prefix-retention-min N, --cpu-workers 1..64, --spec-min-p 0..1. On the
16 GB laptop the context is capped by the VRAM left for the KV window; a value that does not fit is refused by the engine, not applied.
Stopping
- Route A: Ctrl-C in the
upwindow (foreground), orleleka downfrom any window (stops the user unit if there is one, else sends SIGINT to the supervisor and waits up to 120 s).wsl --shutdownalso kills it, but not gracefully. - Route B: Ctrl-C in the window, or
leleka down --nativefrom another one (a stop file instate\runthat the supervisor polls every 0.5 s).
Troubleshooting
| Symptom | Cause / fix |
|---|---|
the Linux leleka was not found in Ubuntu |
build it in WSL (above) and pass --wsl-bin, or put it in ~/.local/share/leleka/bin |
--assets ... is a Windows drive seen from WSL |
move the volume to the WSL disk (section "Model files") |
preflight cuBLAS 12 ... not found (native) |
scripts\windows\fetch-cublas.ps1 (or --cublas-dir with cublas64_12.dll and cublasLt64_12.dll) |
the profile rtx5090-32g holds the archive in a sealed memfd |
native Windows serves the file form only: --profile rtx3080-16g |
step kar is blocked ... must already be on the model volume (native) |
scripts\windows\stage-model.ps1 -Dest ... (puts the archive and its .provenance.json at the root of the volume); leleka doctor --assets DIR names each missing file |
status says ready: false and the distribution is stopped |
start the service again with leleka up; keep a wsl window open |
native up fails the preflight with memory: 0.0 GiB available / below 10 GiB |
WSL2 still holds the RAM (vmmemWSL): wsl --shutdown, or wait a few seconds after a big copy, then rerun |
strata-next model fetch: refusing symlink (WSL volume) |
the shards must be real files in model/; copy them (cp), do not link them |
strata-next doctor fails on Windows ("requires Linux") |
expected: that check is Linux-only |
the API refuses with max_output_tokens |
fixed on this branch: strata.json now uses min(32768, context-1) (8191 on the laptop); rerun up to rewrite the config |
Where the code is
crates/deploy/src/wsl.rs (parsers, path translation, .wslconfig), winfront.rs (the Windows commands and doctor), doctor.rs (what is missing and the fix), service.rs / winservice.rs (leleka service), winsys.rs (Win32 calls), facts.rs (Windows probe),
crates/libc-shim (dlopen -> LoadLibrary, mlock -> VirtualLock, read-only file views), crates/leleka-memory/src/winproc.rs (Win32 rendered as /proc text),
scripts/windows/build-release.ps1. WSL check used during development: tar the tree with git ls-files -co --exclude-standard, then
cargo check --offline --release --workspace --tests and cargo test -p leleka-deploy in WSL.