Commit Graph
81 Commits
Author SHA1 Message Date
Pavlo Ratushnyi a4ceeab69c STRA-338 S22: the Qwen3.5 CUDA engine moves to the adapter crate leleka-engine-qwen35-cuda (L3, edges to cuda-driver, model-format, native-cpu-expert declared); leleka-runtime is a one-line facade over it; scripts, CI and the baseline follow the path. Test fixes found on the way: the digest pin test reads backend/config.rs, the bring-up print gate understands rustfmt-split cfg attributes and the settings snapshot guards 2026-11-06 11:34:15 +01:00
Pavlo Ratushnyi 5aec7c2c5f STRA-338: integrate the kar-off-ab branch (GGUF-PLE profile, replay smoke) into the hexagonal base so backend.rs can be split on top of it 2026-11-05 18:24:17 +01:00
Pavlo Ratushnyi 95f768cfbf STRA-338 S12c: fns and impl blocks of 162 hot-path modules move into child modules (leleka-runtime, cuda-driver, deploy, cpu-sys)
The same lexer-based splitter as S12b, now with explicit re-exports: every moved free fn comes back to its module under its old name and old visibility (cfg attributes carried), so a name can never clash with another glob import. 162 module files of leleka-runtime (68), cuda-driver (84), deploy (10), cpu-sys, igpu and leleka-memory are split into groups of about 250 lines; types, constants, macros, nested modules and tests stay. Not touched: the files kar-off-ab edits, crate roots (lib.rs, main.rs, bin/*), and giant single impl blocks (next). This changes codegen-unit placement of engine code, so it is covered by the bitwise replay and the paired A/B on the 5090, not by a binary comparison.
2026-11-05 15:52:18 +01:00
Pavlo Ratushnyi 84880a1a6d STRA-338 S12a (fix): rustfmt the moved test files of the format-gated crates
The dedent by four spaces changed how rustfmt wraps some test lines; the 25 affected tests.rs files (strata-control, desktop-core, runtime-client, deploy, gateway-text and the strict crates) are formatted so cargo fmt --check stays clean for the crates that CI gates on. Only test files change.
2026-11-05 15:00:36 +01:00
Pavlo Ratushnyi f78b89757c STRA-338 S12a: inline unit-test modules move to sibling tests.rs files in 118 oversize files
scripts/dev/extract_tests.py moves a trailing cfg(test) mod tests block into foo/tests.rs for 118 files of leleka-runtime, cuda-driver, control-plane, gateway-text, deploy and nine smaller crates (31,000 lines), leaving production code and test ids untouched; 22 files that are themselves loaded through a path attribute carry an explicit path to their tests file. Not touched: the files the kar-off-ab branch edits (backend.rs, backend_original_serve.rs, backend_original_serve_replay.rs, qwen4exp_resident_expert_source.rs and seven deploy files).

Verified: cargo check --all-targets for the whole workspace on x86_64 Linux and on the Windows host; the 2429 library unit-test ids of the workspace are identical before and after (Linux listing diff empty); the loadable sections of leleka-inference, leleka-daemon, leleka-cli and strata-next are byte-identical between a release build before and after (scripts/dev/elf-sections-equal.sh), so the shipped code is the same. The architecture ratchets exclude tests.rs from the path-include count; the baseline drops from 329 to 311 oversize files and from 302,000 to 273,600 lines.
2026-11-05 15:00:09 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 dc988dc53b engine: opt-in Original serve without a KAR archive (LELEKA_ORIGINAL_SERVE_GGUF_PLE=1, set by rtx5090-32g-gguf-ple); install script takes the engine binary
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 10:48:41 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 c8501da9d8 deploy: the low-RAM fallback keeps kar_source none (no archive to map)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 10:31:38 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 98effcdabd deploy: experimental kar_source none and profile rtx5090-32g-gguf-ple (Leleka without the KAR archive, PLE rows from the GGUF shard)
kar_source none passes no --kar-archive-*/--kar-provenance, loads qwen4exp-native-mtp-v1, skips the kar step and the archive checks, rejects --kar-fd.
Engine env of the new profile: LELEKA_PLE_DIRECT=0 (page cache instead of O_DIRECT). Default profiles unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 10:21:01 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 731f060b74 style: cargo fmt on leleka-deploy (no functional change; fmt --check is clean, 173 lib tests pass)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 11:16:13 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 4cbbd2729c Merge claude/window-policy: draft-floor ceiling default 0.60 (LELEKA_SPEC_POLICY=legacy restores 0.9), replay-arm policy tooling, spec-trace bar/slope, run-e2e ATTN_DAILY_MTP default
Paired A/B 245k (8 blocks): +1.09% tok/s, se 1.86 (not resolved); replay screening +0.35..+1.72 tok/s; argmax flips 1.9-2.0% vs A/A 1.3-1.55% (<2.8% bound). Not claimed as a speedup.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 05:57:14 +01:00
Pavlo Ratushnyi 0111c3dc62 Merge claude/single-copy: sparse memfd (PLE extents only) is the rtx5090-32g default; O_DIRECT loading, page-cache release; file source kept as experimental
Identity PASS (2057/2057 rows, 1036/1036 draft traces); 245k A/B +0.58% (n.s., 5/6 blocks); MemAvailable +36.6 GiB; seal 79-97 s -> 28 s.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

# Conflicts:
#	desktop-core/src/bin/leleka-inference.rs
2026-11-03 02:15:19 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 72fc3b0820 style: cargo fmt on strata-control, strata-desktop-core, leleka-runtime-client; clear Clippy lints and two red tests on main
Mechanical rustfmt (control-plane, desktop-core and the runtime client had 360 hunks of drift; the CI format steps for control-plane and
desktop-core were red), plus, found by running `cargo clippy -D warnings` and the tests on Linux:
* control-plane/tests/log_failure_sse.rs `no_panicking_log_macros_in_the_serving_crate` was red on main since the observability merge: two
  test-only `eprintln!` samples (prometheus.rs, request_log.rs) trip its source scan. They now write to stderr with `write_fmt` and
  ignore a failed write, which is what the test asks for; the output is the same.
* tool_output.rs `is_multiple_of(2)`, an unneeded `mut` in a control-plane test, a collapsible `if` in leleka-inference.rs,
  `#[allow(dead_code)]` on observer_adaptive_slots (compiled into leleka-inference-evaluation too).
* crates/deploy/src/facts.rs: `lab_holder_running` moved above `mod tests` (clippy::items_after_test_module); code moved, not changed.
Kept as its own commit so it can be redone with `cargo fmt` if other branches touch these crates first. No behaviour change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 00:30:27 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 4ca30c9e1c ci: build and test what ships (check-local --product, Product workflow, coverage gate) and repair the red checks
The existing workflows never built the `leleka` binary (crates/deploy) or ran the tests of leleka-deploy, leleka-memory,
leleka-runtime-client, leleka-runtime or leleka-cuda-driver (docs/ci-audit.md). New: scripts/check-local.sh --product and
.github/workflows/product.yml (default-member build, release build of the six shipped binaries, cargo check of the CUDA-feature
crates, tests, rustfmt/Clippy), scripts/check-ci-coverage.py + scripts/ci-coverage.json (fail when a workspace member has no CI
coverage entry), scripts/ci/nvidia-smi (hermetic stand-in for the deploy end-to-end tests).

Repairs found by running every step: check-local --fast failed on rustfmt in leleka-backend-api/leleka-context and on Clippy
type_complexity in leleka-tokenizer (formatting and a local type alias only); `cargo test -p leleka-cuda-driver` does not compile without
its cuda-driver feature (script now passes it); the desktop.yml hardware smoke step had no --bin (six binaries, no default-run);
the stale 8192 context assertion in crates/deploy/tests/e2e.rs (the laptop profile is 262144 since 621d35276); five trivial Clippy
lints in leleka-memory and leleka-deploy; the literal_port drift guard (red since the 2026-10-25 upstream sync) is reported as debt;
control-plane Clippy no longer lints its path dependencies; the sampler host-shim script works under Git Bash; worktree.sh creates
worktrees with core.autocrlf=false and .gitattributes marks the sealed PTX -text (a CRLF checkout makes the binary refuse to start).
No kernel, engine numeric or runtime behaviour is changed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 23:32:24 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 92fd4c636c observability: middleware test, display scrub in leleka logs, engine line fields in leleka-memory, keep "fatal:" in the supervisor's message
* request_log: a test drives the real `observe` layer over HTTP (id header, session header hashed, rejection counted).
* leleka logs scrubs credentials once more on display (lines written by other programs or older builds).
* the engine's per-request line is built by leleka_memory::telemetry::request_line_fields (pure, tested for content and size: 313 bytes);
  the tier share of one request is tier_shares().
* the supervisor's fatal event keeps the "fatal: " text in its message, which crates/deploy/tests/e2e.rs and operators' greps rely on
  (crates/deploy e2e on Linux: an_engine_that_cannot_start_fails_the_service_and_names_the_log passes again).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 23:30:32 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 fb10bf0e70 observability: structured bounded logs, per-request record, metrics, leleka logs / report
* crates/obs (leleka-obs, std only): one event per line (JSON under `leleka run`, key=value on a terminal, the lab's plain lines when a
  binary is started by hand into a file), UTC ms timestamp, level, component, event, flat fields; prompt/completion text and credentials
  never appear (key classes + value scrub + registered secrets), per-event token buckets with a `suppressed` count, value and line caps,
  histogram with Prometheus exposition, size-capped file sink for requests.log.
* control-plane: `observe` middleware gives every generation request an id (x-leleka-request-id header) and a session tag (hash of the
  client's session header); the worker marks engine start / first token / terminal / error on it and one record is written at request end
  (tokens, cached prefix, queue wait, TTFT, prefill/decode tok/s, finish, error class, engine restart, GPU clock/temp/throttle). All
  elog! lines go through the log layer (sampled per call site). /metrics?format=prometheus gains request counters and histograms, engine
  lost/attached counters, uptime and supervisor restarts, PCIe, memory clock, throttle reasons, speculative tokens per round, expert-tier
  entries by tier and hit ratio.
* engine: one structured line per request with the same id (rounds, tokens per round, expert-tier share served from VRAM/PCIe/CPU for that
  request); telemetry gains spec / expert_tier / last_request; NVML sampler reads PCIe throughput, memory clock, throttle reasons.
* supervisor: structured events (engine exit, health, restarts), secrets registered with the log layer, children get LELEKA_REQUEST_LOG,
  LELEKA_STATUS_FILE, LELEKA_PROFILE and JSON logging; runtime-client and gateway log connect/probe failures as sampled events.
* leleka logs (--tail/--since/--level/--component/--source/--request/--follow), leleka report (sanitized support bundle, written only with
  --yes, nothing sent anywhere), request statistics in leleka status / verify --quick.
* generation, sampling and kernels are untouched; the lab scripts keep their plain lines (LELEKA_LOG_FORMAT=legacy or a hand-started binary).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 23:25:24 +01:00
Pavlo Ratushnyi 9f1b6baa07 rtx5090-32g: sparse memfd (memfd_extents ple_only) is the profile's form; tests describe the full copy explicitly 2026-11-02 22:41:13 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 478f0c4812 Merge claude/unattended: O_DIRECT bulk model load, supervision/hang detector/log rotation, leleka status/verify --quick, service unit + installer scripts (owner-run), soak harness
Identity gate (legacy vs new bank read, 256k replay): 2057/2057 rows, 1036/1036 draft traces identical. Soak not yet run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 22:21:46 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 5f1822d5eb Merge main (embedded expert profile) into single-copy
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 22:17:46 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 a53311d2e1 sealed: an empty extent list is a valid empty sparse copy; file profile env follows rtx5090-32g; A/B script, inventory
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 22:13:10 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 2a23976c55 Pin PLE_EXTENTS_SHA256 (measured on the real archive); exact sparse memfd size; ram-inventory script; KAR decode cost probe
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 22:06:02 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 48a3811c89 Merge claude/unattended into single-copy (O_DIRECT bulk reads for the sealed copy, extents sealed through the same reader)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 21:53:29 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 eddb78e6e0 deploy: embed the upstream expert profile in leleka; first start installs it offline
The owner asked to ship the 196,632-byte table instead of depending on a download.

* crates/deploy/data/expert-profile.bin: Strata data/expert-profile.bin unchanged (MIT, sha256 8f59b4aa...388975baf), the one
  *.bin exception in .gitignore (every other *.bin stays ignored); .gitattributes pins it `-text binary` so no platform can
  alter the bytes. crates/deploy/data/expert-profile.NOTICE carries the Strata MIT notice and provenance.
* expert_profile.rs: `include_bytes!` of the table; provisioning order is --expert-profile-file, the embedded bytes, then the
  https download as fallback. The embedded bytes are digest-checked before the atomic install like any other source, and only
  offered to a profile that pins the same digest. The plan shows "install the ... table embedded in this binary (no network
  needed)" even with --no-fetch and without curl/wget.
* digest verification, status/verify/summary ON/OFF reporting and --no-expert-tier are unchanged.
* attribution: docs/release licence audit (Strata row), docs/deploy.md, docs/windows.md, docs/upstream.md, and the 5090
  packager ships the NOTICE as licenses/strata-expert-profile-NOTICE.txt.
* tests: embedded == pinned file, offline install before any download, explicit file wins, a corrupted embedded copy falls
  back to the download, plan states, e2e first start with no network tool.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 21:52:58 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 97ceb120a9 Merge claude/kar-file-source into single-copy (conflicts resolved: sparse + file source coexist)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 21:50:41 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 e059a1cf08 Merge claude/sparse-memfd (experimental sparse memfd, prefix cap) into single-copy
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 21:49:38 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 957196fddb deploy: provision the ranked expert profile on first start (leleka up), report the expert tier ON/OFF
data/expert-profile.bin (upstream Strata routing table, sha256 8f59b4aa...388975baf, 196,632 B) is not in Git, so a new
user silently lost the VRAM expert tier. It is a routing statistic of the model, not derivable from the weights, and a
locally generated table changes expert placement (docs/original-serve.md control: 0/6 identical outputs, 43 flips in 1,660
rows), so the product pins the upstream bytes.

* new step `expert-profile` in `leleka up`, planned before the large downloads: https download (curl/wget, https only,
  1 MiB cap) from the Strata commit 41cf05a0 (raw.githubusercontent.com, then jsDelivr, then the old pin d9ab8435), sha256
  checked, installed by rename; any other digest fails closed with both ways out. A wrong file in the way is moved aside
  (.rejected-<unix>), never deleted.
* `--expert-profile-file PATH` (offline install, same digest required, forwarded through the WSL bridge) and
  `--no-expert-tier` (explicit opt-out, persisted as `expert_tier: false` in leleka.json only when set).
* the configuration names the table whenever the tier is intended; the supervisor re-checks the digest at every engine
  start, logs ON/OFF and drops the switches when the file is gone or changed.
* `leleka status` (also through the WSL bridge), `verify` (fails when the configured table is missing or wrong), the ready
  summary, preflight and `doctor` report `expert tier ON (path sha256 ...)` or `WARNING expert tier OFF: reason`.
* tests: provisioning (download, fallback source, mismatch, offline file, moved aside, no source), plan states, gather env,
  cli flags, preflight, report/start environment, e2e flow with a fixture-digest profile; ignored live tests against the
  pinned sources. Flow tests that are not about the tier now run with the tier off on purpose.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 21:48:24 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 b70538dd3f Supervisor: gateway and API restart counters are forgotten after a stable period (a service that runs for weeks is not ended by the sixth crash); test that a killed API or gateway is restarted in place
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 21:17:37 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 61a0eb7375 Unit: a valid Documentation URL (systemd-analyze verify on the server flagged the old one)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 21:14:20 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 12d1d71d8d One-command start: status and verify report health, preflight names the lab holder, seal-probe
`leleka up` already prepares, installs, starts the supervisor (which seals the archive, starts the gateway and the engine, loads the model and
starts the API in that order) and waits for /ready; nothing in it touches gpu.lock or the job queue (those are lab shell scripts). What was
missing for a host nobody watches:

* `leleka status`: uptime of the supervisor, engine restarts in total and in a row, the last restart with its reason and age, the hang
  detector's judgement, the log volume, and a WARNING when the status file is minutes old while its phase says the service runs (a supervisor
  that crashed or was killed). `--json` carries the same members. Exit 0 only when ready (container health check, unchanged).
* `leleka verify --quick`: the health of the installation without reading a byte of the model: each shard and the archive as stamped
  (verified in its present state: not hashed again at a start), missing or wrong-size files, the service answering /ready, its age and
  restarts, the log volume. Exit 0 only when no problem. (`leleka verify` without the flag is the full parallel hash, as before.)
* preflight: when the GPU is taken and the lab KAR holder (kar_holder*.py) is running, the fix text says so and points at lab mode instead
  of the generic "stop the other GPU users" (Facts.lab_holder, /proc scan).
* `leleka seal-probe FILE` (hidden): the archive copy of `leleka run` on any file, then SHA-256 of the memfd against SHA-256 of the file.
  Measurement/identity tool for the cold-load work.

Tests: render_supervisor (age, restarts, dead supervisor), `verify --quick` before and while the service runs, the lab-holder hint, cli
parsing. The e2e suite has the same six environment failures as the base commit f9003b7ce on this laptop (profiles_and_usage_commands expects
the 3080 profile at context 8192 but the profile file says 262144; the others read the real GPU of this machine) and one flaky lifecycle test
that also flaked on the base; both checked by running the base commit's suite.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 20:59:14 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 55413eba07 Supervision for an unattended host: engine restarts with backoff, a hang detector, bounded logs, API limits, a hardened unit
`leleka run` restarted a crashed engine twice after a fixed 5 s and then ended the service; a hung engine, a growing log and a client
waiting on a dead engine had no answer. All of it is now in the supervisor and in what `leleka up` writes:

* Restart with backoff (config.rs RestartPolicy backoff_initial_s 5 / backoff_max_s 300, max_engine_restarts 6 in a row, reset after 600 s
  of ready): recover_engine() waits 5, 10, 20 ... s, counts a restart that fails (load refused, port taken) as an attempt and retries it
  instead of ending the service; only after the last attempt does the supervisor exit 1 and let systemd start everything afresh.
* Hang detector (watchdog.rs, pure and tested; HealthPolicy in leleka.json: interval 10 s, fail 120 s, max_request 3900 s): every 10 s the
  supervisor reads GET /metrics of the API (the control plane's own view; the engine's telemetry is not used, the API refreshes it only
  between requests). API unreachable 120 s: restart the API. Worker not ready 120 s (the API lost the engine): SIGKILL and restart the
  engine. A request active longer than 3900 s (generation_timeout 3600 + 300): the same. A stopped (SIGSTOP) or deadlocked engine ends this way.
* Requests get an error, not a hang: strata.json now carries runtime.stall_timeout_s 600 (no engine event for 10 min during a request cancels
  it with an error to the client) and generation_timeout_s 3600 (RequestLimits in leleka.json).
* Bounded logs (logs.rs): every 10 s the supervisor copy-truncates any STATE/logs/*.log past 16 MiB, keeps 3 generations (children keep
  their O_APPEND descriptors, nothing is told); <= 16 x 4 x 6 files; one 16 MiB copy per rotation. tail_of reads only the last 256 KiB.
* Status file: started_unix, restarts_total, last_restart_unix/reason, health, log_bytes; rewritten every 30 s as a heartbeat.
* units.rs (and scripts/ops/leleka.service, a test pins the file to the generator for the server layout): StartLimitIntervalSec=0 with
  RestartSteps/RestartMaxDelaySec (30 s growing to 10 min), LimitCORE=0 (a 100 GB core dump must not hit the root NVMe), LimitNOFILE,
  TasksMax, OOMScoreAdjust=-500 (system scope), journal rate limit, RequiresMountsFor, TimeoutStopSec 180, and ConditionPathExists=!STATE/lab-mode
  so the unit stays down while the GPU belongs to the lab queue.
* Tests (fake runtime, no GPU): a reported hang kills and replaces the engine; restarts back off, a start that fails twice and then works is
  just a slower restart, three failures in a row end the service with a message; an oversize log is rotated while the service runs; the
  existing lifecycle tests (SIGKILL of the engine, SIGTERM drain) still pass. 134 unit tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 20:55:25 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 40fc3eab2b Fast cold load: large-block, deep-queue reads for the sealed archive copy, the expert bank and the hash passes
The cold start of the 5090 server is dominated by reading two things: the 55 GB KAR archive (copied into the sealed memfd) and the 50 GB of
routed-expert tensors of shard 0 (copied into the page-locked bank). A plain read() loop asks the NVMe for one 128 KiB readahead window
at a time (queue depth 1-2; the drive's max_sectors_kb is 128): 8-35 MB/s after a reboot, 2003.8 s for the first holder
(docs/experiments/baseline-pair-5090.md section 9).

* model-format/bulk_read.rs (new, no unsafe): N threads each read blocks of 8 MiB. Direct (default): O_DIRECT through the open file's
  /proc/self/fd entry (no path lookup) into 4 KiB-aligned bounce buffers, so the page cache is never touched and nothing has to be evicted;
  Advise: buffered pread with POSIX_FADV_WILLNEED ahead and DONTNEED behind (a bounded window); Plain: large pread + DONTNEED. Direct falls
  back to Advise where O_DIRECT is refused. Memory is threads x 8 MiB. Switches for A/B in one binary: LELEKA_LOAD_READ=direct|advise|plain,
  LELEKA_LOAD_THREADS, LELEKA_LOAD_CHUNK_MIB, LELEKA_LOAD_AHEAD_MIB; LELEKA_LOAD_READ=legacy keeps the old sequential loop for the bank.
* deploy/sealed.rs: the memfd fill uses it (seal_file_report also returns how the file was read; seal_file_with_identity is unchanged).
* gguf.rs read_file_span_into: spans of 64 MiB and more (the expert tensors) use it; smaller spans and every failure mode are as before.
* readahead.rs (the SHA-256/CRC passes of a first verification): WILLNEED 512 MiB ahead of the reader thread.
* examples/bulk_read_bench.rs + bulk_read_digest.py: offline cold-read measurement with a reproducible digest (SHA-256 over the SHA-256 of
  consecutive blocks), device-level read/write accounting so a shared disk shows.

Measured on rnr5090 (Lexar NM610PRO, DRAM-less, HMB; kernel 7.0.0-38; another agent's jobs share the drive, so every figure carries its
"other" volume; page cache of the span evicted first with posix_fadvise(DONTNEED), never drop_caches):
* whole KAR file, 51.5 GiB, new default (direct, 32 x 8 MiB): 152.9 s (362 MB/s) and 159.8 s (346 MB/s, with the digest), nothing else on the
  drive; Cached 62 -> 59 GiB (no cache growth). Target < 5 min met.
* old patterns, same day: one thread, 16-32 MiB reads (the holder's pattern) 65, 86, 105, 154 MB/s on 2-8 GiB cold slices (55 GB in 6-14 min);
  8 threads x 32 MiB buffered (the old sealed.rs pattern) 240 MB/s while sharing the drive; the recorded cold-after-reboot holder 2003.8 s.
* strategy matrix (4 rounds x 7 configs, fresh 2 GiB regions, MB/s per round, median of 4): advise 16x16 MiB 230 574 194 1126 (402);
  direct 32x8 185 554 1133 113 (369); advise 32x8 277 454 229 510 (365); plain 16x16 385 257 979 207 (321); direct 16x8 180 311 351 174 (245);
  direct 8x32 149 317 271 138 (210); one thread 65 201 123 86 (105). The drive's speed varies 10x between regions and moments whatever the
  strategy, so the multi-thread configs are indistinguishable here; every one of them beats one thread. Direct is the default because it
  leaves the page cache untouched (nothing to evict, the machine's free-memory state is not changed), not because it is faster.
* identity: an 8 GiB slice read with the new code has the same block-digest chain as a plain sequential pass in Python
  (8b8b21b830cf938b1f0cec60a5a8127d2489e33e1f853cd792b18497b2b081a6, both); unit tests compare every strategy with the source for aligned and
  ragged spans. The engine's own SHA-256/CRC check of the sealed memfd and the replay gate are in the GPU run recorded in docs/unattended.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 20:54:28 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 dcf6e8bf5a window-policy: replay-arm policy options, floor options (default off), A/B and replay tools, harness ATTN_DAILY_MTP default, deploy env test
- AdaptiveConfig::set_option and the LELEKA_SPEC_ARMS suffix ~key=value (adaptive@0~step=0.3): policy variants inside one replay process on the same forced text
- options rowq / smooth / measured for the draft floor rule (defaults reproduce the earlier rule exactly, unit test against the kept reference)
- windowpolicy-replay.sh, -ab.sh (three arms), -analyze.py, -id.sh, -install.sh
- run-e2e.sh: LELEKA_SM120_ATTN_DAILY_MTP defaults to 1 like the rtx5090-32g profile
- deploy: the profile's engine_env reaches engine_environment() through the saved config (test)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 20:39:34 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 fe34d883d0 release 5090 v0.1, phase A: checklist, notes draft, licence/secrets audit, packager (check/stage-source/build/package/verify), leleka version identity, *.ptx -text
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 20:25:09 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 f9003b7ced Re-enable LELEKA_SM120_ATTN_DAILY_MTP=1 in the rtx5090-32g profile: defaults must be the best lossless variant (bitwise identical, round -0.366 ms 12/12)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 19:47:47 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 0612991e6c Revert profile default for LELEKA_SM120_ATTN_DAILY_MTP: keep opt-in until tok/s gain is resolved (round time -0.366 ms, tok/s +0.5% n.s.)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 19:45:03 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 5378b226dd profile rtx5090-32g: LELEKA_SM120_ATTN_DAILY_MTP=1 (MTP draft attention = upstream chunk + merge v2); engine_env may carry LELEKA_SM120_* keys
Bitwise identical on the replay gate (2057/2057 rows, 1036/1036 draft traces, docs/experiments/draft-round-5090.md); at 245k the round is 0.37 ms (2.7 %) shorter in 12 of 12 paired blocks, the draft round
0.29 ms; end-to-end tok/s +0.5 % +- 0.6 % under the adaptive window (the policy answers with narrower windows), +3.0 % (5 of 5 blocks) with the window held fixed. Separate commit so it can be dropped
without touching the engine; the fused commit (LELEKA_DRAFT_FUSED_COMMIT) stays opt-in: neutral in speed. The laptop profile is unchanged (no sm_86 companion for these kernels).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 18:56:52 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 c864204e45 KAR file source for the 5090: startup read report, per-read identity check, profile rtx5090-32g-file, A/B script
* model-format: VerifiedKarPleArtifact records how the archive was vouched for (full pass / stamp / attested memfd) and what start-up read
  (KarStartupRead); an ordinary archive file keeps the device/inode/size/mtime/ctime it was verified in and every row read compares the open file
  with it (one fstat, the length check already did it); LELEKA_KAR_IDENTITY_RECHECK=off disables. Sealed memfds are unchanged.
* leleka-runtime: one engine log line per load, leleka-kar-startup source=.. verify=.. total_read_bytes=..
* deploy: built-in experimental profile rtx5090-32g-file (kar_source file, resident bank, explicit 6144 MiB prefix cache, never auto-selected);
  the resource planner charges a file archive with a resident bank the engine only.
* scripts: run-e2e.sh accepts E2E_KAR_FILE / E2E_ASSETS; scripts/e2e/decode/kar-file-ab.sh is the paired memfd vs file A/B (not run).
* docs/kar-file-source.md: what the file form reads, guarantees, risks with the measured random-read figures, the A/B command.

Not a performance claim: nothing was run on a GPU.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 15:11:06 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 b856b615d3 sparse memfd (experimental, default OFF): seal, verify, lock and heal only the extents the serve path reads
Profile field memfd_extents: ple_only (needs kar_source memfd and an explicit prefix_cache_mib; default full, not serialized).
The sealed memfd keeps the archive's length and file offsets but holds only the ~16 GB the serve path reads (PLE rows, header,
directory, books); everything else is a hole, so readers need no change.

- deploy: sealed::seal_extents (parallel copy restricted to the extents, holes elsewhere, same seals; st_blocks test),
  leleka seal-exec [--sparse-ple] (Rust form of leleka-seal-exec for A/B runs outside leleka run), supervisor seals sparse,
  passes --kar-sparse-extents-sha256 to every engine, never attests or stamps the archive from a sparse copy, refuses to start
  without a pinned digest (PLE_EXTENTS_SHA256, or LELEKA_KAR_EXTENTS_SHA256 while that is unmeasured); resource planner,
  preflight RAM minimum and the inherited-descriptor credit use the memfd's real size.
- engine: --kar-sparse-extents-sha256, InheritedKarArchive::open_sparse, verify_sparse, extents handed to the governor.
- leleka-memory: FdMapping::lock_ranges, compact-space heal walk, guard_archive_extents. Locking or populating a hole allocates a
  zero page: tested with a negative control next to the extents-only test that asserts st_blocks does not move.
- scripts/e2e/decode/sparse-memfd-ab.sh (paired 5-turn 245k A/B + teacher-forced identity gate; NOT queued, not a holder job),
  docs/kar-sparse-memfd.md.

Not run on a GPU or against the real archive.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 12:28:52 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 2d7a5d8863 5090 profile: explicit prefix_cache_mib 6144 so freed host RAM cannot grow the prefix store
`auto` is 75 % of the memory that is elastic when the stack opens (ceiling 96 GiB), so it grows whenever RAM is freed
elsewhere (a sparse memfd frees ~36.6 GiB: auto would become ~30 GiB). 6144 MiB is what auto resolves to on this host
today (5.7-6.1 GiB, docs/memory-safety.md section 8); a 245k session needs about 4 GiB (14,208 B/token + ~4 nodes), so
behaviour at 245k is unchanged.

- deploy/rust-runtime/profiles/rtx5090-32g.json: memory.prefix_cache_mib "6144".
- leleka-memory: plan::explicit_prefix_budget (the explicit wish clamped to the host, never above the wish); tests that
  an explicit cap does not grow with +37 GiB available while auto does (startup plan and open-time budget).
- leleka-runtime memory_governor: the explicit arm uses it, and the engine now logs "prefix cache budget: N MiB (...)" for
  auto, explicit and off.
- leleka-deploy: MemoryBudget::prefix_cache_cap_mib and a test that every memfd profile carries an explicit cap.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 12:06:18 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 b63a91b2fa deploy: rtx5090-32g gpu_budget_bytes 30 GiB -> 32,819,404,800 (31,299 MiB) so the dense-slab slot gain reaches the product
Needed for the slot gain: the slabs save physical bytes the Context never charged, so the
budget must rise by about that much. Smoke with this budget: ~11,568 slots, lowest free VRAM
1,035 MiB. Also the systemd unit template, the config and reconfigure tests, and the docs.
Preflight now needs 31,299 MiB free at start (was 30,720; idle 5090 reports 32,110).
Revert by restoring 32212254720. Owner confirmation required before merge.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 11:59:55 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 fcb4f02ba9 deploy: RTX 5090 profile sets LELEKA_ORIGINAL_SERVE_SEED=off (placement class, owner confirmation required)
Seed OFF is a profile setting only: the engine default (seed on) and the laptop profile are unchanged. Placement-class change, NOT bit-identical; it does not fit the strict Original
envelope (p99 <= 0.22, max <= 0.43) and neither does the control; it meets the relative criterion on 1,717 teacher-forced rows (p99 0.2500 vs control 0.2278, max 0.7567 vs 0.6751,
flips 2.10 % vs 2.59 %; limits 1.5x control and 2.8 %). Gain: 108.1 -> 137.2 tok/s decode over turns 1-4 of the frozen 245k session (3 runs per arm). Revert: remove the key or set
LELEKA_ORIGINAL_SERVE_SEED=on in the operator environment. Test: only_the_server_profile_turns_the_prompt_routing_seed_off; leleka-deploy tests 125 passed in WSL.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 10:09:44 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 621d35276d laptop profile and workstation preset: ship the measured defaults (chunk 6144, grid 6144, tail prompt, context 262144), clamp the chunk to the GPU budget
Paired 256k sessions on this laptop (docs/laptop-vs-vanilla.md sections 4, 10, 11, 12): prefill 110 -> 176-290 tok/s, TTFT sum about
2,100 s -> 998-1,083 s. Gates: 6144 changes the rounding order of the prompt path and has NO quality gate yet (q_pair / residual-hash arms
2048 vs 6144 not run); the tail mode and the context move no number. prefill_capacity_for_budget lowers the chunk when the budget cannot
lend it (14+ GiB 8192, 13 6144, 12 3072, else 2048). Tests updated; leleka-deploy 120 unit + e2e pass. Also: section 11 (vanilla with
STRATA_ROUTE_TAIL_SKIP=0: 9.0-13.0 tok/s, wall 1,417 s).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 23:57:39 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 66cc34f850 rtx5090-32g profile: prefill chunk and prefix-cache grid 8192 by default
Linux / keyless-cuda-gate (push) Skipped
Rust port / port-fast (push) Failing after 16s
Rust port / port-typecheck (push) Failing after 19s
Linux / verify (push) Failing after 33s
Linux / keyless-cuda (push) Skipped
Linux / static-cuda-package (push) Skipped
Linux / hosted-cuda-package (push) Skipped
Linux / linux-static-cli (push) Skipped
Linux / linux-cli-container (push) Skipped
Linux / release-cli (push) Skipped
Rust port / port-oracles (push) Failing after 24s
Rust port / port-linux-tests (push) Failing after 28s
The shipped profile left both at 2048. Paired 256k session on the 5090 (same text, 5 turns): TTFT sum 131 s at 2048, 55-60 s at 8192
(night5 / night6 / rest-full / tune-A), decode unchanged. Tests and docs follow the new default.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 23:44:13 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 449b7a1784 deploy: CPU workers never exceed the physical cores but the host's (Windows)
The workstation preset counted logical processors: 12 workers on the 8-core laptop, 5 spinning unpinned. Now 7 (as vanilla).
The 16-core server stays at 15.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 20:13:10 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 36863df394 deploy: Windows workstation keeps 8 GiB available instead of 12 (a 12 GiB floor left the prefix cache no budget)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 01:02:28 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 2d704e3126 deploy: Windows workstation preset plans a larger desktop share and a smaller hot expert set
The laptop is a work machine (agent, IDE, browser): in the file-backed form the workstation preset leaves 18 GiB to the desktop (12 for dedicated),
keeps its raised memory floors instead of the lowered Windows ones, and sets LELEKA_MAPPED_WORKING_SET_GIB=8 so that the engine's start check can pass
on a 48 GB host. Estimates, to be measured on the first workstation run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 23:11:54 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 3fcbd901aa Windows file-backed form: lower memory floors (3072/1536) — no OOM killer, the start check needs fixed footprint + soft floor + reserve
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 22:41:07 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 d2386f12d7 native Windows fixes from the evening run: resident expert budget sized from the free RAM, LOCALAPPDATA fallback for the cuBLAS lookup, reconfigure refuses up front when the host cannot hold the reopened stack and ends the engine process when reopen and rollback both fail
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 21:02:51 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 c5be696205 Windows: stop the children with Ctrl-Break in their own process groups (the engine, gateway and API handle it), so leleka down takes seconds instead of three grace periods; hidden mode hides the console instead of freeing it; no readiness summary after up --mode none
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 16:58:41 +01:00
Pavlo Ratushnyi 7fa275c12c Merge branch 'claude/windows' into claude/port-gpu-bringup
Rust port / port-fast (push) Failing after 8s
Rust port / port-typecheck (push) Failing after 9s
Rust port / port-oracles (push) Failing after 10s
Rust port / port-linux-tests (push) Failing after 17s
2026-10-25 15:54:31 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 8623932c98 Windows round 2: leleka service (Task Scheduler / user unit), doctor names what is missing and the fix, stage-model.ps1 and fetch-cublas.ps1, native supervisor end-to-end test with the fake runtime, WSL find-binary fix, docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 15:53:31 +01:00