Commit Graph
82 Commits
Author SHA1 Message Date
Pavlo RatushnyiandClaude Sonnet 5.5 ab54ae208f feat: experimental tool_call_recovery for drifted tool-call forms (default OFF)
Adds Options::recovery to tool_output and an opt-in setting, `tool_call_recovery` (config key) / STRATA_TOOL_CALL_RECOVERY=1
(environment, wins over the file; 0/false turns it off; anything else stops the start). It is off unless set, is read once at
start, logs "tool_call_recovery is ON (experimental)" at start, and logs every call it accepts. It is NOT part of the default
contract and has not passed a quality gate (docs/api-contract.md, "Tool-call recovery (experimental)").

With it on, a call for a DECLARED tool written next to the template form is read as the call (upstream 3fcb2106, #3441):
* <parameter=NAME> where <function=NAME> belongs; <=NAME>, <function:NAME>, <function =NAME> or <NAME> after <tool_call>;
* {"name": ..., "arguments": {...}} inside <tool_call>, also in a Markdown fence, arguments possibly a JSON string;
* a bare <function=NAME> ... </function> at the start of a line outside a code fence and inline code (a stray </tool_call>
  after it is dropped); the Markdown state is tracked over the text that has left the stream buffer, so streamed and whole
  readings agree;
* a second call in the same <tool_call>;
* for array/object arguments, brackets left open at the end and a bare string where an object member belongs (dropped).
An undeclared name stays an error in every form. Streaming: a batch is delivered when its </tool_call> arrives, a bare call when
the text after it shows it is over or at the end.

With the option off the reading is byte for byte the step-3 reading. The corpus test now reads every specimen twice (off and on)
and lists the failures of each; every streamed cut agrees with the whole reading in both. Recovery rate on the 41 Qwen specimens:
off 24/41 (58.5 %), on 30/41 (73.2 %); the 6 specimens that need recovery: off 0/6, on 6/6. That is code reach on upstream's
failure corpus, not a rate for real sessions. strata-control lib 339 passed (new: 3 recovery tests, 1 config test), corpus and the
quoted-value shapes pass with the option on and off.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 03:54:39 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 f528844ff9 fix: read the recoverable tool-call cases instead of failing the response
Four shapes that ended in response.failed (or 502 tool_call_parse_failed) are now calls, each logged on stderr as
"tool call accepted beyond the template form (closers supplied: N, arguments repaired: M, ...)":

* </function> left out: a </parameter> followed by </tool_call> ends the value and the call, but only when no </parameter>
  followed by <parameter= or </function> ends the value (upstream d7113273, #4427/#4077). A streamed response delivers such
  a call when the generation ends, not at its </tool_call>: only the end can tell it from </parameter></tool_call> quoted
  inside a value.
* </tool_call> left out: the call is whole when the next <tool_call><function=NAME> follows its </function>, or when its
  </function> ends a generation that stopped by itself (finish stop). A generation cut by the token limit never gets this.
* A call inside the reasoning (no </think>): a normal stop whose text ends on whole calls of declared tools, the first at
  the start of a line outside a code fence and inline code, is reasoning (completed) followed by those calls (upstream
  805ebe17/d7113273, #804). The calls' markup was already streamed as reasoning deltas; the final reasoning item ends before it.
* Damaged array/object arguments of a parameter declared array or object (not a union with string): a trailing or doubled
  comma, single quotes, Python True/False/None, extra closing brackets, and an array written as a JSON string of itself are read
  as written (upstream _Lenient, A4). Nothing is invented or dropped; open brackets and bare strings are not repaired here.

Undeclared tool names: upstream returns the call as text and counts it. That is NOT adopted. Text without a call ends an
agent's turn as if it were the answer, while a failed response is retried by the client (docs/e2e-run.md records a session that
survived one such failure), and native_tools_sdet / backend_worker_http pin the refusal. An undeclared tool is still an error;
it is never run and never published.

API: tool_output::{Options, Notes, Parsed, parse_with, calls_at_end}, Incremental::{with_options, finish_after, notes};
parse_complete and Incremental::new keep their strict default reading. Documented in docs/api-contract.md ("Tool-call
parsing") and docs/tool-call-corpus.md.

Corpus: 24 of 41 specimens read as upstream expects (13 before this commit). New unit tests cover each shape whole and
streamed; strata-control lib 334 passed, native_tools_sdet 14 passed, existing tests unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 03:48:29 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 9b07fdd995 fix: a string argument that quotes a tool call is no longer cut at the quoted text
tool_output::find_parameter_end ended a value at the first </parameter> followed by <parameter= or </function>, so a write
whose content quoted a whole call (a file that documents the format, a heredoc, a test) was published with content cut at the
quote and the rest as plain text, whole and streamed, without any error (upstream #4078, fixed there in 77794e34 and b72f56e0).
It now follows upstream's quote rule: a close inside a call the value itself quotes (more quoted <function=NAME> openers
followed by <parameter= or </function> than </function> closers before it) is part of the value. One forward pass over the
value. Incremental also stops re-trying candidate call ends it has already rejected.

A call whose value quotes an opener and never closes it is now unterminated (an error) instead of being cut at the first
plausible close, so a long write that quotes a call and is itself cut by the token limit is not published truncated.

Deliberately not taken from upstream: a value that reopens its own parameter (</parameter><parameter=content> inside content).
Upstream reads it as text; here it is byte for byte a parameter written twice, which desktop-core's
native_tools_sdet::unknown_incomplete_duplicate_or_late_invalid_call_refuses_entire_output requires to be refused, and merging
the two into one argument would hide a malformed call. It stays an error (duplicate tool parameter), listed as known failure.

Regression tests: specimens 4078-nested-call and 4078-heredoc and the quoted-value shapes "quoted call", "quoted call at the
end" and "heredoc" of the ported corpus failed on the previous commit and pass here (13 of 41 specimens, 5 of 6 shapes), plus a
unit test for the cut outer call. The 8 existing tool_output tests and the 14 native_tools_sdet tests pass unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 03:45:24 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 c5c60ac66a test: port the upstream tool-call corpus and record which specimens the parser reads
Adds the 49 specimens of Strata upstream's serve/test_tool_corpus.py (MIT, provenance and licence in
control-plane/tests/fixtures/tool_corpus/NOTICE.md; reporter handles removed) and the six quoted-call value shapes of
serve/test_quoted_call_values.py as control-plane/tests/tool_corpus.rs. 41 specimens are Qwen-form and run against
tool_output (whole through parse_complete, streamed through Incremental in pieces of 1/3/7 and cut at every character);
the 8 DSML specimens are skipped, there is no DSML parser here.

On main 11 of 41 specimens and 2 of 6 quoted value shapes are read as upstream expects. The rest are listed in
KNOWN_FAILURES / KNOWN_QUOTED_FAILURES (strict both ways: a listed specimen that starts passing fails the test) and in
docs/tool-call-corpus.md. No parser change in this commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 03:23:24 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 3bedec6107 test: mcp unknown-block text keeps key order (serde_json preserve_order via leleka-harmony)
Linux / keyless-cuda-gate (push) Skipped
Rust port / port-typecheck (push) Failing after 9s
Rust port / port-oracles (push) Failing after 10s
Rust port / port-linux-tests (push) Failing after 15s
Rust port / port-fast (push) Failing after 9s
Linux / verify (push) Failing after 18s
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
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 08:36:02 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 b3274c1130 Merge claude/port-gpu-bringup (CUDA runtime port, upstream sync) into main
Linux / keyless-cuda-gate (push) Skipped
Rust port / port-typecheck (push) Failing after 8s
Desktop foundation / core (ubuntu-latest) (push) Failing after 11s
Rust port / port-oracles (push) Failing after 11s
Rust port / port-linux-tests (push) Failing after 14s
Rust port / port-fast (push) Failing after 9s
Linux / verify (push) Failing after 17s
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
Brings the Rust/CUDA port of the Strata mode17 serve path together with the
CPU/iGPU/NPU gpt-oss runtime that main gained meanwhile.

Control plane: the Qwen tokenizer is the implementation behind the Qwen35
variant of codec::TextCodec (qwen(), encode_prompt() widen the trait; QwenCodec
derefs to the tokenizer), so control-token marks, images, chat template, the
runtime backend and vision keep their behavior, while the gpt-oss/Harmony path
and the worker pool keep main's. Config carries the union of fields; extra_workers
is rejected together with runtime, lazy_load, idle_unload_s and vision; the
gpt-oss family refuses top_k/min_p/penalties (its GEN line has no such keys).
leleka-kar-codec takes f16_bits_to_f32 from leleka-quant-core (identical code).
Workspace members and default-members are the union of both sides.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 08:32:33 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 f7ab3fd59c Control-token text inside messages is ordinary text (plan 0.1; upstream c16f31f8, 98b7ea94, 0d613031)
leleka_tokenizer::LiteralMarks swaps every special literal (GGUF token type 3 and 4) in a client string for a plane-15 private-use mark
before the chat template runs (a forged mark is escaped); Tokenizer::encode_marked parses the template's own literals as special tokens and
encodes each mark's literal as ordinary text. render_request marks instructions, message text, reasoning, call arguments, tool outputs and
tool descriptions/schemas; the gateway's own tool markers stay literal. Generation and /input_tokens share the one encoding; the text
contract carries the marked string and leleka-runtime reads it with encode_marked.

Not covered: strata-desktop-core still renders unmarked text; live Codex session (gate L) not run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 23:31:05 +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 e64a3da1b7 Merge branch 'claude/platform' into claude/port-gpu-bringup
# Conflicts:
#	crates/deploy/src/app.rs
#	crates/deploy/src/cli.rs
2026-10-25 14:06:50 +01:00
Pavlo Ratushnyi 4965126d14 Merge branch 'claude/windows' into claude/port-gpu-bringup
Rust port / port-fast (push) Failing after 10s
Rust port / port-typecheck (push) Failing after 10s
Rust port / port-oracles (push) Failing after 16s
Rust port / port-linux-tests (push) Failing after 22s
2026-10-25 13:15:34 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 da6f8f2f48 metrics: empty hardware blocks and a null telemetry member while the engine publishes nothing
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 13:05:12 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 1a77b2805c metrics: history is the last 60 health-tick samples, documented as such
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 12:57:51 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 1bbb9d1b8e desktop-core and control-plane build and test natively on Windows: api-key init (hard-link publish, user profile ACL), atomic no-replace directory publish via MoveFileExW, tokenizer export without directory fsync, MSVC link stubs for the ggml bridge, Unix-only shell-script tests gated
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 12:45:21 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 4d28f0a250 reconfigure: kv_resident is fixed per process and cpu_workers is 1..=15 (found by live job 9r1); reconfigure takes 7 s and waits for the request in flight
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 12:42:33 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 02abdddf70 tests: real nvidia-smi output as fixtures; /api/requests is behind the API key
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 12:42:04 +01:00
Pavlo Ratushnyi 75e7e47dcc control-plane: /api/requests monitor, the Python Monitor members of /metrics, Prometheus text exposition
Opt-in api_monitor keeps the last 100 requests of the chat, messages and responses dialects; /metrics gains engine, live, requests, totals, hardware, history; ?format=prometheus (or a scraper Accept) renders the same document as gauges and counters. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 12:18:32 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 60b48d8225 runtime reconfiguration: reopen the serve stack with new context/cache/resource settings without reloading the model
serve_tuning (settings document, validation, effective settings), Command::Reconfigure in the Original serve loop with rollback,
Backend::reconfigure, gRPC Runtime.Reconfigure, POST /v1/reconfigure, telemetry.settings; tests for each layer.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:01:53 +01:00
Pavlo RatushnyiandClaude Sonnet 5.5 9e0914df26 gateway: an undeclared apply_patch function call runs through the declared shell tool instead of failing the stream
The model sometimes calls apply_patch as a function although Codex declares only exec_command/write_stdin; the stream
failed, Codex retried into the same call and the turn died (live job 9e1 after 6 requests).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 22:22:28 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 08e2c78761 runtime telemetry: GPU load/VRAM (NVML), RAM, CPU cores, prefill/decode tok/s, cache hits, context
leleka-memory::telemetry (sampler + per-request records) -> Backend::telemetry_report -> Snapshot.telemetry_json
(gRPC) -> control plane /v1/status machine -> leleka status.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 19:58:28 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 254425d4b0 cp-latency: results and method (docs/cp-latency.md), run-ab.sh, replay --store
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 01:59:27 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 e820b95556 cp-latency: tokenizer kill switches (LELEKA_TOKENIZER_REFERENCE, LELEKA_TOKENIZER_SEGMENT_CACHE_MIB), prompt-text pass-through test, drop dead tokenizer fields
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 01:49:38 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 ea80310017 cp-latency: schema-validation memo, live A/B client and report, live job 9f1 (real engine, baseline and current API servers on one engine)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 01:45:54 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 6bbb26f67a cp-latency: native chat rendering for text conversations (verified against the template), log writes off the response path, replay --verify (captured Codex prompt ids)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 01:30:26 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 95340330ac cp-latency: fast tokenizer (scanner + id BPE + segment cache), pass the prompt text through, TCP_NODELAY on the runtime gRPC server, gRPC replay example
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 01:13:50 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 dbf487b207 cp-latency: env-gated stage spans on the host request path, offline session synthesizer, instant-engine replay driver (baseline for the host-side latency work)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 01:04:49 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 92cbffdfe8 feat: Windows runtime packaging: Docker cross-build, Start-Leleka launcher, zip packager, docs (STRA-220)
- deploy/Dockerfile.windows-build cross-compiles the six executables (mingw, no Visual Studio needed)
- control-plane/build.rs: the ggml link stubs are used for every Windows target, not only MSVC
- scripts/windows/Start-Leleka.ps1 (igpu | cpu | npu modes, speculation and cache slots on by default) and Package-Windows.ps1
- docs/windows-runtime.md; stale statements in docs/cpu-runtime.md corrected

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 13:30:37 +02:00
Pavlo Ratushnyi 0790ba6ec9 Merge branch 'claude/memory-safety' into claude/port-gpu-bringup 2026-10-18 05:09:13 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 505f3ee70f fix(runtime): output cap 4096 -> 32768 (one shared constant); /v1/status omits a null prefix_cache
The Codex tic-tac-toe run (job 943) ended after 4 minutes: the model wrote the whole index.html in one tool call, hit the
runtime's 4096-token output cap three times (tool call unterminated -> response.failed 'tool parameter is incomplete', then
'incomplete: max_output_tokens' -> turn.failed -> Codex exit 1). The Original server has no such cap (max_tokens 0 = the rest
of the context). RuntimeServer, the engine request check, strata-next's runtime default, the leleka-deploy generated config
and the examples now use leleka_backend_api::MAX_OUTPUT_TOKENS = 32768. /v1/status keeps the Python server's key set when no
prefix cache exists (http_surface golden regressed with the prefix-cache merge).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 04:36:37 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 f53d54d122 test(control-plane): http_surface golden ignores the Rust-only status keys prefix_cache and memory; docs results
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 04:04:37 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 e4f4e1e9a9 fix(control-plane): chat completions keeps Retry-After on a memory_pressure 503; gate test covers chat and messages
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 02:35:27 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 0b10800141 fix(control-plane): memory_view test deadlocked on its own read guard
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 02:33:29 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 713235d8ed feat(memory): residency guard on its own thread, read-only remap of the archive, dead-sampler recovery, cgroup v1, swap A/B tool, lint fixes
- guard_archive maps a private read-only reopen of the descriptor (a write-sealed memfd refuses a shared mapping that could become writable on
  kernels up to 5.15); the residency read runs on its own thread; the sampler survives a panic and a stale level is re-evaluated by the
  requests themselves; cgroup v1 memory controller limits (WSL2 hybrid, old container hosts) are honoured.
- examples/swap_ab + scripts/memory/swap_ab.sh: A/B (unlocked, heal, mlock) of the memfd under real pressure fenced into one cgroup.
- Miri: procfs/host/plan/pressure/inventory/census/ledger/governor run clean (61 tests).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 01:51:29 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 5ebd939b6f feat(memory): wire the governor into the runtime, the gRPC status and the control plane
- leleka-runtime: memory_governor glue (startup plan with refusal, KAR memfd lock/residency guard, VRAM check, load-ledger stages,
  inventory classes), prefix budget from the governor (auto/explicit clamped), shed directive applied per request and per prefill chunk,
  engine-side admission (503 memory_pressure text), page-cache release of the shards after the resident bank load, cgroup-aware
  available_memory.
- backend-api: Backend::memory_report (default None) and ScriptedEngine support; proto Snapshot.memory_json; desktop-core runtime_rpc and
  runtime-client carry it.
- control-plane: MemoryView, /v1/status `memory`, /metrics `memory`, 503 memory_pressure + Retry-After gate before queueing, engine-side
  refusal text mapped to the same 503; tests incl. a 600-request model-free soak (threads/fds/RSS flat).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 01:33:34 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 29cfd8378e e2e: session analysis, status writer, CUPTI hook, timestamps, Codex job scripts; merge of 7330ddb
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 01:08:04 +02:00
Pavlo Ratushnyi 1cd52bc388 Merge branch 'claude/port-gpu-bringup' into claude/e2e 2026-10-18 00:59:49 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 8af18396b8 feat(prefix-cache): pool protocol (summary through runtime gRPC, /v1/status, /v1/prefix_match), --prefix-cache-mib/--prefix-cache-block, laptop profile in the smoke, docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 19:47:53 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 da187a9b36 e2e: Codex CLI job tooling (config, prompts, checkers, report), env sampler, one log line per generation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 18:42:46 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 af3beab76e fix(api): text-level-only features are 400s, generation failures are logged; e2e: xlong scenario and failure notes
reasoning_budget_tokens, strata_tune, experimental_speed_projection and sampling finer than the
text contract's fixed point were queued and then refused as 502 generation_failed; the HTTP layer
now answers 400 unsupported_request_field / invalid_sampling_precision for a text-level engine.
Every failed generation logs its client-visible message; STRATA_DEBUG_FAILED_OUTPUT=1 also logs
the generated text of a failed tool turn (operator debugging only).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 17:35:29 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 856d538a83 wip: HTTP-layer 400 for context/output-cap errors, fake-engine tooling for the e2e client
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 15:45:13 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 6c26ccdbcd feat: prompt_date (utc | none | YYYY-MM-DD) for the gpt-oss system message; none is experimental (STRA-220)
The gpt-oss template writes "Current date: <UTC today>" into the system message, which is part of
the prefix a worker's KV cache is matched on, so every cache missed once a day at midnight UTC.
prompt_date in the config (STRATA_PROMPT_DATE) now selects: utc (default, unchanged), a fixed
YYYY-MM-DD, or none, which leaves the line out (RenderOptions::omit_date; the blank line after it
stays) for clients that give the date as a function tool. The control plane does not host tools;
the client supplies the tool.

Teacher-forced on four 770-957 token prompts the model is not indifferent: dropping the line
moves the next-token distribution by mean KL 0.034-0.056 (best token same at 89-90%), changing
only the date value by 0.023-0.040 (92-93%), numerical noise 0.005-0.023 (93-97%). Task quality
was not measured, so none is opt-in. Checked end to end through the control plane: 68 input
tokens for "Hi" with the date, 57 without, 68 with a fixed date; a bad value is refused at start.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 10:43:28 +02:00
Pavlo RatushnyiandClaude Opus 5.5 4821fc464b feat: worker pool in the control plane; two concurrent agent episodes on an iGPU and an NPU worker (STRA-220, experimental)
engine.extra_workers starts further supervised workers behind the one request channel
(control-plane/src/pool.rs). A dispatcher hands each request to an idle, ready worker,
preferring the one whose last prompt shares the longest prefix with it, so each conversation
keeps its cached prefix. It learns completion by relaying the result channel, so the worker
and its tests are unchanged. /ready and /status need every member ready. 4 dispatcher tests;
the 13 failing control-plane tests fail identically at 3ebcb3f (Windows).

Paired A/B, two scripted 4-turn episodes sent at once (Compare-ConcurrentEpisodes.ps1, 3
alternating pairs each), time until both are done:
- one iGPU worker, interleaved: 686-713 s; pool: 254-306 s, 2.33-2.73x. Mostly the second
  KV cache: the single worker re-prefilled every turn.
- one iGPU worker running the episodes in sequence: 317-342 s; pool: 292-303 s,
  1.05-1.14x. This is the second device's own share. Per-turn latency in the pool is higher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 20:56:46 +02:00
Pavlo RatushnyiandClaude Opus 5.5 f3c4e122d8 experiment: real KAR codec quality on gpt-oss-20b and concurrent iGPU+NPU prefill (STRA-220)
The KAR codec moves unchanged from control-plane/src/kar_codec.rs into crates/kar-codec
(re-exported there, so the control plane's KAR tests are unchanged and pass). Probes, off
unless set: LELEKA_EXPERIMENTAL_KAR_LEVELS / _KAR_TENSORS for attention and output weights,
and LELEKA_EXPERIMENTAL_KAR_EXPERT_LEVELS / _KAR_EXPERT_LAYERS for the MXFP4 experts
(level 0 is a storage-only control). Teacher-forced against llama.cpp, baseline KL 0.016:
attention+output at 6.5/5.5/4.5 bits give KL 0.063/0.095/0.213 (uniform rounding was
0.071/0.112/0.270), and every tensor group fails alone; experts of 6 of 24 layers at 3.5
bits give KL 0.081 (control 0.018). No KAR rate passes the gate on this model. Corrects the
earlier doc claim that a KAR layout is the same as uniform rounding.

iGPU and NPU prefill run at the same time give 93-98 tok/s in total against 73-77 for the
faster device alone (2048 tokens each, two rounds).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 13:55:44 +02:00
Pavlo Ratushnyi 7b833d552a chore: clippy-clean the new code (unused import, map_or identity, ptr_arg) 2026-10-16 03:16:18 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 6b34f0101d test: wait for a flock to be released after a dropped handle instead of flaking
flock belongs to the open file description. A child that another test forks while the handle
is open keeps the description until it execs, so a lock can outlive drop() by milliseconds in a
parallel run. The journal and history tests now retry the reopen for up to 10 s; production keeps
refusing a held lock at once. 12 of 12 consecutive parallel runs of the desktop-core lib suite
pass (3 of 5 failed before). Also: documented runtime config example, validated by a test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 03:13:38 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 edb2d49687 feat(control-plane): accept the harmless Codex hints (service_tier, user, text.verbosity, reasoning.effort minimal, summary none)
text.format becomes optional so a text object may carry only a verbosity. concise/detailed
summaries, max_tool_calls and other include values stay refused. New HTTP tests run a Codex-shaped
two-turn exchange with stateless replay and the tool_choice / parallel_tool_calls enforcement
through the runtime stack.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 03:06:03 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 0ca493be04 test: run the scripted-engine HTTP smokes through the runtime stack (fake_runtime over real gRPC)
fake_runtime is a leleka.runtime.v1 server (the real RuntimeServer) whose engine is the same
engine.sh the smokes already use; fixture.runtime_stack() swaps strata-next's engine child for
it when STRATA_TEST_FAKE_RUNTIME is set, otherwise nothing changes. scripts/test-api-over-runtime.py
runs the ten smokes whose assertions do not depend on strata-next owning the engine process.

The HTTP layer clamps reasoning_tokens to the engine-reported output total, which a text-level
engine's re-tokenized pieces can otherwise exceed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 03:00:55 +02:00
Pavlo Ratushnyi d358a80cd9 test(control-plane): output cap and sampling fixed point reach the engine 2026-10-16 02:47:08 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 c8601d0b2c feat(control-plane): runtime block selects the runtime backend; strata-next serves in front of leleka-inference
runtime.{address,token_env,tokenizer_dir,model,mode,max_context} are validated at load
(loopback only, credential from the environment and never printed, exclusive with
engine/native_model/mtp_pack/vision/gpu). serve spawns backend_worker over GrpcBackend.
The worker carries the runtime's output-token cap in WorkerStatus; a default budget never
exceeds it, an explicit request above it is refused. Request ids are UUIDs, as the
runtime contract requires.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 02:46:22 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 a4259d8f2b feat(control-plane): worker for a text-level engine behind the existing HTTP API
backend_worker drives any leleka_backend_api::Backend through the GenerationCommand
channel strata-next already uses. It maps the rendered prompt to the engine contract
(verified round trip of the ids), re-tokenizes text deltas with a byte-equality check,
recognises the stop literals, maps finish reasons, cancels on client disconnect,
guarantees a terminal event when the engine dies, and re-attaches by itself. What the
text contract cannot carry is refused. 23 HTTP tests over a scripted engine cover
Responses (JSON/SSE), Chat, tools, text.format, cancellation and engine faults.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 02:33:45 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 e74376430f fix(control-plane): a failing log sink can no longer kill the worker supervisor mid-request
eprintln! panics when stderr is unwritable (consumer gone: EPIPE, disk full:
ENOSPC). worker.rs logged before it marked the worker Failed, so with a dead log
consumer the supervisor task died, readiness stayed true and later requests hit a
dead worker (charter M1 / Gate A). All diagnostics now go through the
non-panicking elog! macro.

tests/log_failure_sse.rs starts the real strata-next binary with a scripted
engine, drops the stderr consumer after startup and provokes a protocol failure
inside a streamed Responses request: the stream must end with response.failed and
readiness must drop (the control case with a live sink passes before and after;
the dead-sink case failed before). A source scan keeps eprintln! out of the crate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 01:59:26 +02:00