Files
leleka/docs/e2e-run.md
T
2026-10-17 22:11:40 +02:00

21 KiB

End-to-end run of the production stack on the RTX 5090

Branch claude/e2e (cut from claude/port-gpu-bringup, merged with 0b0d128 = integrated head incl. claude/deploy), runs of 2026-10-17 on rnr5090 (Ubuntu 26.04, kernel 7.0.0-38, RTX 5090, driver 595.99.02, 121 GB RAM). Everything below is a functional and stability result of the current code, one sample per cell; it is not a performance or quality claim (charter rules: no paired A/B, no quality gate).

Stack under test, all four processes started inside a holder job (sealed KAR memfd inherited, MODEL.lock held by the holder):

python3 e2e_client.py (Codex-shaped Responses requests)   -- HTTP, Bearer test key -->  strata-next serve (runtime block)  127.0.0.1:8081
strata-next                                               -- gRPC, runtime token ---->  leleka-inference --backend-mode original  127.0.0.1:18766
leleka-cli load-mtp (through leleka-daemon 127.0.0.1:18080) loads the model; strata-next only attaches.

1. Binaries (built in WSL, never on the server)

cargo build --release --locked -p strata-desktop-core --bin leleka-inference --bin leleka-daemon --bin leleka-cli -p strata-control --bin strata-next -p leleka-deploy --bin leleka from tree da187a9 (the later commits only touch the client scripts; rustc 1.99.0, WSL2 Ubuntu 24.04, CARGO_TARGET_DIR outside the tree). Only the first four were copied to rnr5090:~/work/leleka-e2e/bin-sm120/ (scp, mode 0755). The sm86 binaries were built, run with --help in WSL (RTX 3080 Laptop, cc 8.6, ldd: libc, libm, libgcc_s) and not run against a model here.

binary sm_120 (default) bytes sm_120 sha256 --features sm86 bytes sm86 sha256
leleka-inference 68,432,360 2506b49ca2576a7c24220481cfb96a9d51224da8230a1b803114e83b38cae059 119,298,624 02cbbce483977e43abd22e8610b14757dda25b9c9221ffa995a2ef7233273d52
leleka-daemon 23,295,656 5d113eb8404fbe06f9a0f53ee9ce7fd01fe03f39d5d1e08e3bf0a0799833ba9b 23,295,240 0162f9088265b6cd3385c6fc263468a2dd0c9daa26910b5293500374ef9e8ae0
leleka-cli 10,431,080 f465280ed9c730cd313b481cc62efbeb6d049d90f805e69a09f3f12d814f2ba0 10,431,040 bdaa1ca5f9eec1178345e09be8c03f84fb67f38f6466e3fb40e4b2a5596e4c7c
strata-next 28,747,720 5eb6238e72b416f0deb945c32d9de5939b75cb6cb97b3ade3c35a97425363a4c 28,747,816 23ce07613392014dbed90bcddf166f7a41f17a065d3d0536b0b09765255178a9
leleka (deploy, not copied) 2,892,048 db4ce35308bdf427b062c161ebd0049e01c358a0bab6ec8252c465e775aaf6c8 2,892,048 same

(The strata-next sm_120 file differs from the sm86 one although the feature does not touch it: Cargo unifies features per build, byte identity across the two builds is not expected.) The leleka supervisor (native sealed memfd) is not used by these jobs: inside a holder job a second 55 GB memfd would not fit, so scripts/e2e/run-e2e.sh starts the same processes with the holder's descriptor (--kar-archive-fd $LELEKA_STRA169_KAR_FD), the flags of deploy/rust-runtime/profiles/rtx5090-32g.json (--gpu-budget 25769803776, --context-tokens 262144, resident expert source) and the bring-up expert-tier environment of the 98x jobs.

2. How to rerun

# on the laptop: build (WSL), copy the four binaries and scripts/e2e to rnr5090:~/work/leleka-e2e/ (see section 1)
# on the server: drop a holder job, e.g. ~/work/gpu-runs/holder2/jobs/942-e2e-full.sh (template: section 8)
E2E_BIN=$HOME/work/leleka-e2e/bin-sm120 E2E_OUT=$HOME/work/leleka-e2e/runs/NAME \
E2E_CLIENT_ARGS="--soak-n 40 --burst 20 --xlong-tokens 24000" bash ~/work/leleka-e2e/scripts/e2e/run-e2e.sh

run-e2e.sh refuses to start unless it inherited a sealed memfd and MODEL.lock exists, nothing else holds the GPU and no stack process is running; it generates the two service tokens and the API key into mode-0600 files (never printed), extracts the tokenizer assets, starts leleka-inference, leleka-daemon, runs leleka-cli load-mtp and fails fast on a leleka-load phase= line, starts strata-next, waits for /ready, runs scripts/e2e/e2e_client.py (or E2E_RUN_CMD, used by the Codex jobs), samples RSS/VRAM every 30 s (env.tsv), then stops with SIGINT and reports left-over processes and GPU applications. Logs and results.json are written under E2E_OUT (inference.log, strata-next.log, daemon.log, client.log, results.json, env.tsv); they stay out of Git. scripts/e2e/run-fake.sh + fake_llm_engine.py run the identical client against a scripted engine without GPU (465 checks pass); that is how the client's own checks were debugged.

3. Runs

job what result
940 first stack start load failed: new_original_prompt_arena: InputRead (defect 1); job aborted by me after 10 min (the runner then had no fail-fast)
941 after fix 1, LELEKA_BRINGUP_TRACE=1 load 390 s, all scenarios ran in 2 min, 11 checks failed (tool-call format of the model, test expectations, defects 3-5)
942 after fixes 3-6, soak 40, burst 20, xlong 24k load 371 s, 13 scenarios, 459 checks, 9 failed, 0 errors; all 9 are the model's malformed tool calls (section 5); no leaked process, GPU back to 2 MiB
946 queued: long scenario with tools off pending in the serial queue when this was written (section 9)

4. Results (job 942 unless noted; sm_120, --backend-mode original, prompt cache on (6), expert tier 2048 slots, adaptive)

Model load through leleka-cli load-mtp: 371 s (942), 390 s (941). After load: leleka-inference RSS 53.6 GB (49.6 anon + 3.8 shmem), VRAM 13.2 GB, host MemAvailable 14.3 GB (the sealed memfd holds 52 GB of shmem outside the process RSS).

scenario checks measured
endpoints (/health unauthenticated, /ready, /status, /metrics, /v1/models[/id], /api/health, /admin/lifecycle, 401 without or with a wrong key, 404 stored id) 12/12 all as specified; /status answers in < 2 s while a generation runs
simple (Codex-shaped: instructions + developer + environment + user items, 4 function tools, reasoning, include, text.verbosity, prompt_cache_key) 37/37 980-token prompt: TTFT 2.95 s first request (cold, graph capture), 0.36 s when repeated (973 reused); max_output_tokens: 24 -> response.incomplete, max_output_tokens, output_tokens == 24; /v1/responses/input_tokens equals usage.input_tokens exactly (tokenizer agreement with the engine; no the engine counted N input tokens, the control plane M line in any log)
tools (3 tools, stream + stateless replay of the output items and function_call_output) 99/102 all three first calls valid JSON, names declared, arguments schema-valid; continuation after the tool result produced prose (59 tok/s decode); turn 2 re-prefilled 170 / 88 / 108 of 1150 / 1070 / 1100 tokens (980-992 reused); the 3 failures: forced tool_choice, tool_choice: none (section 5)
multiturn (previous_response_id and full replay) 82/82 turn 2/3 of 329/358 prompt tokens: 294/322 reused, 35/36 re-prefilled, TTFT 0.69/0.72 s; replay path identical numbers; GET, input_items, DELETE, 404 after delete, continuing from a deleted id 404
long (8.5k tokens, tools declared) 28/34 the model answered with a malformed shell call 3 of 3 times -> response.failed (section 5); the cache numbers come from xlong, the tools-off rerun is job 946
xlong (23,331-token prompt) 25/25 prefill 18.0 s = 1,295 tok/s, one SSE : keep-alive comment during the prefill; follow-up turn: 23,324 reused, 53 re-prefilled, TTFT 0.88 s
cancel 42/42 disconnect mid-decode: engine idle again after 0.05 s, metrics.generation.cancelled +1, next request fine; disconnect during a 6,036-token prefill: idle after 1.6 s (cancel is polled per prefill chunk); re-sending the cancelled prompt re-prefills all 6,036 tokens (cached 0, TTFT 4.8 s)
parallel 35/35 the engine serves one generation at a time: B (stream) and C (JSON) sent while A (420 tokens, 5.3 s) ran were queued (/metrics: active=true, queue_used=2, queue_capacity=16), answered correctly in order, B's first text 1.26 s after A ended; a burst of 20 simultaneous requests gave 17 x 200 and 3 x 429 runtime_overloaded with Retry-After (max_in_flight_requests 17), all admitted ones completed (21.7 s)
invalid (24 bad requests) 52/52 400 with error.{message,type,code,param} for malformed JSON, missing/empty/mistyped fields, unknown field, zero/negative/above-cap max_output_tokens, sampling out of range, bad tool (no name, bad name, duplicate, undeclared tool_choice, hosted), image, reasoning_budget_tokens, bad effort, json_schema without schema, context overflow; 404 for unknown model and previous_response_id; no half-open SSE for an invalid streaming request
compat (Chat Completions, Messages, tool call over Chat) 3/3
determinism 2/2 greedy x3 identical; the seeded sampled pair matched in 942 and differed in 941 (C++ vs C): documented envelope of the adaptive expert tier (original-serve.md), recorded as a note, not a failure
reasoning (Codex default effort: medium, summary: auto) 26/26 reasoning item + message, reasoning_tokens 14 of 19, replay of the reasoning item accepted (981 of 1027 reused)
soak (40 consecutive requests, alternate stream/JSON, every 4th a tool call) 7/7 all 40 ok (10 tool calls schema-valid), latency 1.69 / 1.87 / 2.09 s (min/p50/max), decode 60.7 tok/s mean; leleka-inference RSS +0 MiB, strata-next +0, daemon +0, VRAM +0 MiB after warm-up; /metrics delta started 40 = completed 40

Whole job 942: 98 generations seen by strata-next (log line generation done:), 145,787 prompt tokens of which 30,878 reused (21 %; the low share comes from the soak and invalid-input requests, whose ~980-token system prefix is below the cache's --prompt-cache-root 2048 threshold and therefore never reused across unrelated prompts), TTFT median 1.63 s (p90 1.68 s, max 18.0 s), decode median 68.4 tok/s per request (10th-90th percentile 48.9-89.0), sum-weighted 68.5 tok/s over 1,791 tokens. Memory over the job (7 samples): inference VmRSS 53,611 -> 54,347 MiB (+0.7 GB while the 24k prompt was served, flat in the soak), VRAM 13,192 -> 13,424 MiB, MemAvailable 14.3 -> 13.5 GB, no growth trend.

Teardown (every job): SIGINT to strata-next, daemon, engine: all exited, pgrep empty, no GPU compute applications, free -m back to avail 68.8 GB; the one forced abort (job 940) also left nothing behind.

5. Findings

Defects fixed on this branch (each with a test)

# defect repro fix
1 leleka-inference --backend-mode original could not load: MoeWeightCache::new_original_prompt_arena: InputRead (the retained routed-expert bank was never admitted on the Original path; only the serve smoke did it) job 940 9b56aec; the integrated branch carried an equivalent fix (`--expert-source resident
2 at most 256 generations per runtime epoch, then every request failed with generation_capacity until the engine was restarted and loaded again (RuntimeServer request ledger and the engine Proxy.seen) api_over_runtime::documents_the_256_generations_per_runtime_epoch_limit (old test) b4d12bd: leleka_backend_api::RecentIds, a FIFO window of the 16,384 most recent ids; test serves_more_than_256_generations_in_one_runtime_epoch (300 requests) + 4 unit tests + the rewritten RPC test
3 client errors surfaced as server errors: a context overflow or max_output_tokens above the runtime cap was queued and refused by the worker as 502 generation_failed (SSE: response.failed after a 200) invalid[...] rows of job 941 f5925f3: 400 context_length_exceeded / invalid_output_limit before queueing; tests a_prompt_that_cannot_fit_the_context_is_a_400..., the_runtimes_output_cap_...
4 the default output budget (context - prompt) ignored the engine's 8-token margin, so a prompt close to the context failed at the worker same f5925f3 (default leaves the margin)
5 reasoning_budget_tokens, strata_tune, experimental_speed_projection and sampling finer than the fixed point were 502 after queueing invalid[reasoning_budget_tokens] = 502 in job 941 af3beab: 400 unsupported_request_field / invalid_sampling_precision for a text-level engine; test text_the_contract_cannot_carry_is_refused_not_dropped
6 no operator-visible trace of why a generation failed or how a request went strata-next.log had one line af3beab, da187a9: generation failed: <client-visible message> and one generation done: finish= prompt_tokens= reused= generated= prompt_ms= decode_ms= line per request; STRATA_DEBUG_FAILED_OUTPUT=1 additionally logs the generated text of a failed tool turn (operator debugging only)

All of cargo test -p strata-control (274 lib + integration, 28 in backend_worker_http), -p strata-desktop-core, -p leleka-runtime-client, -p leleka-backend-api and the 10 runtime-stack HTTP smokes (scripts/test-api-over-runtime.py) pass on Linux after these changes.

Model-origin tool-call failures (not fixed, repro below)

Every failed generation of job 942 (4 of 98) was a malformed tool call produced by the model, correctly refused by the server (the full stream is response.failed with the message; nothing partial is published as a call):

  • <function=shell> with <command>["ls"]</command> instead of <parameter=command> -> tool call has an invalid parameter or is incomplete (forced-choice test).
  • shell with command a plain string (ls /workspace/leleka, grep -rn "tools" ... | head -50) where Codex's schema wants an array of strings -> function call arguments violate schema: "..." is not of type "array" (3 of 3 attempts in the 8.5k-token long scenario; the same tool with a short context was called correctly 5 of 5 times in tools and the soak).
  • forced tool_choice to update_plan: the model called another tool -> generated tool does not match forced tool choice; there is no constrained decoding anywhere in the stack, so forcing is only validated afterwards.

This is the quality risk for a real Codex session (the model may emit the string form of shell.command once the context grows). The stack has no repair step: a daemon-side "one regeneration on invalid output" exists only in leleka-daemon's experimental tool adapter. Candidate fixes (not implemented, need the quality gate of AGENTS.md): schema-driven constrained decoding for tool arguments, or a bounded retry in backend_worker.

Observations for other workstreams

  • Prefix reuse works across turns of one conversation (294/329, 322/358 tokens; 23,324 of 23,377 on the 24k prompt; engine reused= agrees) and across a stateless replay. It does not help unrelated requests that share a ~1k-token system prefix (root checkpoint needs 2048 tokens), nor a re-sent prompt whose first attempt was cancelled in prefill.
  • Cancel during prefill takes up to one prefill chunk (1.6 s here, chunk 2048).
  • MemAvailable stays at 13-14 GB while serving (52 GB sealed memfd + 54 GB engine RSS on a 121 GB host): no headroom for a second large process.
  • A job costs 6 min of model load before the first request; the serial holder queue (stale per-pass snapshot) delayed every job of this branch by 1-4 hours.
  • The golden fixtures in control-plane/tests/fixtures/golden hold Python-server HTTP-surface and GEN line goldens produced with a fake engine, no model-generated tool calls, so model tool-call output could not be compared with the Original server through them; tool-call integrity is checked by parsing (JSON arguments, declared name, schema validation), by delta == done == item equality in the stream, and by the 216-case tool-policy smoke.

6. Contract checks (what is verified where)

requirement check result
tool-call JSON integrity every call: name in the declared set, arguments parses as an object, schema-valid, call_id present; streamed argument deltas == arguments.done == final item pass for all successful calls (3 + 1 forced-none excluded + 10 in soak + chat)
streaming event order first response.created, strictly increasing consecutive sequence_number, event: name == data.type, every added item done, exactly one terminal event and it is last, text deltas == output_text.done == final message pass for every stream of the runs (about 60 streams)
usage counts usage.total == input + output, input_tokens == /input_tokens endpoint, output_tokens == engine count (24 for a 24-token limit), cached_tokens == engine reused= pass
stop reasons stop -> completed; length -> incomplete + max_output_tokens; cancelled -> no terminal for the closed client, cancelled metric pass
cache reuse across turns usage.input_tokens_details.cached_tokens per turn, table above pass
cancel frees the engine /metrics active=false after 0.05 s (decode) / 1.6 s (prefill) pass
no leaked processes pgrep, nvidia-smi --query-compute-apps after every job none
memory stable over 40+ requests env.tsv, soak samples +0 MiB RSS, +0 MiB VRAM

7. Not done: the real Codex CLI runs (three.js tic-tac-toe, CRM)

The coordinator asked for two long Codex CLI sessions (Three.js tic-tac-toe, then a CRM) against this stack. They were not run: both need files to be downloaded (the Codex release binary, the pinned three.js build and a Playwright chromium for the browser checks; the CRM needs only the Codex binary, it is specified as Python-stdlib + SQLite so the agent needs nothing else offline), and a download needs the user's explicit confirmation in chat, which a relayed message does not replace. Nothing was fetched. Neither the server nor the laptop (Windows or WSL) has codex, node or a browser.

What is ready (scripts/e2e/codex/, committed; the job templates are jobs/943-e2e-codex-ttt.sh and jobs/945-e2e-codex-crm.sh):

  • config.toml.tmpl: isolated CODEX_HOME, custom provider (wire_api = "responses", base_url of strata-next, env_key = E2E_API_KEY filled from the job's freshly generated test key), approval_policy = "never", sandbox_mode = "workspace-write", no network in the sandbox. The flags of codex exec (--json --skip-git-repo-check -C) must be checked against codex --help of the downloaded version.
  • fixed prompts: prompt-threejs.txt (sha256 f57248412f69b4a6a76aab00c2ff33ee3ce676849768f847d412c7e9e9d8a074; same shape as the 2026-10-03 A/B prompt, without the LeaseVibe part) and prompt-crm.txt (sha256 7def656ae6a717105cd1eb26cb7f19b9adbc6ca5c26b44935a26514b879894a8; fixed REST API, stages, python3 server.py, python3 -m unittest discover -s tests).
  • check_ttt.mjs (the six shared browser checks with real clicks, Playwright) and crm_acceptance.py (starts the server with a fresh SQLite file, drives create/list/search/update/filter/notes/pipeline/delete, runs the app's own tests).
  • run-codex.sh (renders the config, runs the agent with a bounded timeout, runs the acceptance, writes the report) and codex_report.py (Codex events: tokens, command exits, errors; strata-next.log: per request TTFT / decode tok/s median and sum-weighted, prompt / reused / re-prefilled tokens per request and per 10 % bucket of the session, failure causes; env.tsv: RSS / VRAM / MemAvailable first-max-last). Verified on the fake-engine run; untested with Codex's JSON events (the event names are read defensively).

To run them, the operator must approve and provide (each into its own new empty directory, out of Git, checksums recorded here):

  1. the Codex CLI Linux x86_64 musl release binary from github.com/openai/codex/releases -> rnr5090:~/work/codex-e2e/bin/codex (record file name, URL, size, sha256 and the published checksum);
  2. for the game: a pinned three.module.min.js -> ~/work/codex-e2e/vendor/, and Node + playwright + chromium -> ~/work/codex-e2e/node (CODEX_NODE_DIR).

Then cp scripts/e2e/codex/jobs/943-e2e-codex-ttt.sh ~/work/gpu-runs/holder2/jobs/ (and 945 for the CRM). If Codex cannot talk to the stack, the first things to look at are the Responses features it sends beyond what the simple scenario already exercises (all of reasoning, include, parallel_tool_calls, prompt_cache_key, text.verbosity, service_tier, reasoning-item replay and function_call_output replay were accepted), custom/freeform tools (a Lark apply_patch is rejected with 400, delivery-gap-audit.md section 4) and local_shell/hosted tools (rejected).

8. Job template

set -uo pipefail
export E2E_BIN=$HOME/work/leleka-e2e/bin-sm120 E2E_OUT=$HOME/work/leleka-e2e/runs/942-full
export E2E_CLIENT_ARGS="--soak-n 40 --burst 20 --xlong-tokens 24000"
rm -rf $E2E_OUT; sha256sum $E2E_BIN/*
bash $HOME/work/leleka-e2e/scripts/e2e/run-e2e.sh; echo "run-e2e rc=$?"

9. Open at the time of writing

  • Job 946 (E2E_SCENARIOS=long, tools off, plus one informational tools-on request) is queued behind other agents' jobs; its table row (8.5k-token turn-1 TTFT, suffix and shared-prefix reuse) is not in section 4.
  • The Codex runs of section 7.
  • Daemon-side items from delivery-gap-audit.md not exercised here: SIGTERM drain, engine restart/re-attach under load, leleka up.