Commit Graph
175 Commits
Author SHA1 Message Date
Pavlo Ratushnyi 8b5d5cb281 STRA-338 S23: remove the readers OutputDecoder replaced, move their tests, document the output flow
Removed: decode_generation_noted and DecodedGeneration (gateway-domain), decode_generation_with / decoded_items /
decode_generation (strata-control), ReasoningStream and the drain_utf8 copy (their code lives in output/). The test ids are
kept: reasoning_marker_and_unicode_split_at_every_byte and the unclosed-reasoning test now read through the output decoder,
the utf8 test calls the domain drain_utf8; two unit tests of the moved pieces are added to gateway-domain.
docs/architecture/output-event.md: how output flows for each family, every site that asked for the family (before and after),
the canonical type, the identity proof, the behaviours kept on purpose and what is not done and why; hexagonal.md and
tech-debt.md point to it. architecture-baseline.json tightened with --update-baseline (dyn-trait: gateway-domain 5 to 4,
strata-control 14 to 12; nothing raised).
2026-11-06 21:18:35 +01:00
Pavlo Ratushnyi f1bb0bdb28 STRA-338 S23: the family is a capability of the codec, not a branch of the protocol code
TextCodec gets always_reasons() (gpt-oss: true) and sampling_limit() (gpt-oss: the worker takes temperature, top_p and
seed only; the error message is the family's own). reasoning_enabled(request, codec) and admit.rs (check_live_features,
apply_sampling_defaults) read them instead of comparing Family::GptOss, and text.rs / reasoning.rs / tool_recovery.rs pass
the codec instead of its family. Proof: output_golden (132 captures) identical, strata-control and gateway-domain lib tests
pass, gates green, 0 warnings.
2026-11-06 21:12:53 +01:00
Pavlo Ratushnyi 6149cc7820 STRA-338 S23: the reasoning and structured-output stream reads OutputEvent
responses/stream/buffered.rs holds one reading-at-the-end OutputDecoder for the whole stream: ReasoningDelta events become
the reasoning deltas of the SSE stream, and at DONE the decoder is finished off the async threads (post_decode stage) and
the remaining events become the response with output_items. The stream no longer keeps token ids, no longer runs
ReasoningStream or decode_generation_with, and no longer asks the codec for its family (the decoder plan says whether the
output starts inside a reasoning block). Proof: output_golden (132 captures) identical, strata-control lib tests 317 pass,
gates green. Logging difference: a refused tool call in this stream now also writes the STRATA_DEBUG_FAILED_OUTPUT debug
copy to stderr when that variable is set (the non-stream answer already did); no response byte changes.
2026-11-06 21:09:28 +01:00
Pavlo Ratushnyi 59f0c089a3 STRA-338 S23: the buffered (non-stream) answer reads OutputEvent
responses/create/answer.rs reads the generated ids through a reading-at-the-end OutputDecoder (decode and tool-call parse
errors keep their classes: detokenization_failed and tool_call_parse_failed) and builds the items with output_items,
replacing decode_generation_with / decoded_items. tool_recovery.rs gets the two helpers both buffered sites share
(at_end_plan, finish_output: the notes log, the call-in-reasoning log and the debug copy of a refused call).
Proof: output_golden (132 captures) identical, strata-control lib tests 317 pass, gates green.
2026-11-06 21:05:39 +01:00
Pavlo Ratushnyi da6c080472 STRA-338 S23: the tool-call stream reads OutputEvent
responses/stream/tool_run.rs (the stream of a response whose request declares tools, no reasoning) takes the text and the
whole calls from a live OutputDecoder instead of draining UTF-8 and driving tool_output::Incremental itself;
ToolStream::event_item publishes an OutputEvent. The debug copy of a failed output and the notes log come from the
decoder. Proof: output_golden (132 captures) identical, strata-control lib tests 317 pass, gates green, 0 warnings.
2026-11-06 21:02:02 +01:00
Pavlo Ratushnyi eb003147a6 STRA-338 S23: OutputEvent and per-family OutputDecoder in leleka-gateway-domain; the plain-text stream reads events
New pure module leleka-gateway-domain::output: OutputEvent (reasoning delta, reasoning, text, whole tool call),
OutputError (decode / parse), OutputDecoder (an enum over the families: Qwen3.5 tokenizer bytes, the Harmony decoder),
a live reading (text and tool calls as bytes arrive) and a reading at the end (reasoning split on </think>, batch parse
of the answer, the unclosed-reasoning rules, reasoning token count), and output_items (events to response items).
The Harmony decoder moved from control-plane/src/harmony_family.rs unchanged (it still writes the Qwen-style markup
the readers parse); TextCodec gets output_decoder(plan). The readers are ports of the code in stream/ and tool_calls.rs.

Migrated site: responses/stream/text.rs (plain-text stream) now takes OutputEvent::Text from the decoder instead of
draining UTF-8 itself. Proof: output_golden (132 captures) identical, strata-control and gateway-domain lib tests
pass, check-limits / check-architecture / check-ci-coverage green, 0 new warnings.
2026-11-06 20:56:04 +01:00
Pavlo Ratushnyi 08afbf2160 STRA-338 S23: golden captures of the gateway answers for scripted model output, both families
Adds a test that drives the real create handler with 66 scripted token sequences (33 Qwen3.5, 33 gpt-oss/Harmony) as a
stream and as a buffered answer, and compares the bytes a client would read (status, content type, SSE frames, JSON
body, with ids and timestamps normalised) with tests/fixtures/golden/output_events.json. The cases cover plain text,
tool calls, reasoning, structured output, unclosed reasoning, length cuts, invalid and unknown calls, calls without
declared tools and worker failures. The captures were recorded on cbc1a9587 and are the identity proof of the S23
steps; the test also checks that two runs give the same captures. Synthetic scripts only, nothing from a real session.
2026-11-06 20:42:23 +01:00
Pavlo Ratushnyi b8765786b7 STRA-338 size-fn: fetch_steps within the limits, allowlist 429 -> 133 entries (fixed functions dropped, 18 unfinished desktop-core functions recorded), baselines tightened, size-fn record 2026-11-06 19:16:24 +01:00
Pavlo Ratushnyi ec2dbe54e1 STRA-338 size-fn: rustfmt of the files this batch changed (strata-control, strata-desktop-core, runtime-client, deploy) 2026-11-06 19:11:35 +01:00
Pavlo Ratushnyi 521c3d0d91 STRA-338 size-fn: dyn-trait aliases in desktop-core bins, result_large_err allowed where the error is the HTTP response 2026-11-06 19:11:19 +01:00
Pavlo Ratushnyi 5da74034ef Merge branch 'claude/szfn-cpc' into claude/hexagonal-size-gw 2026-11-06 19:06:55 +01:00
Pavlo Ratushnyi 113231a5df STRA-338 size-fn: strata-control: part_layout and plan_parts within the limits (fn>30 2 -> 0) 2026-11-06 19:03:31 +01:00
Pavlo Ratushnyi 44b428dd9a STRA-338 size-fn: strata-control: stream_parts layout/plan, loopback url, switch begin, run_session split into engine_io (fn>30 8 -> 0) 2026-11-06 19:01:38 +01:00
Pavlo Ratushnyi 00ad202f28 STRA-338 size-fn: strata-control: worker generate and Generation::new within the limits (fn>30 2 -> 0) 2026-11-06 18:53:46 +01:00
Pavlo Ratushnyi 04d945da7a STRA-338 size-fn: strata-control: tensor_export record builder (fn>30 1 -> 0) 2026-11-06 18:53:45 +01:00
Pavlo Ratushnyi f47b501f17 STRA-338 size-fn: strata-control: switch transaction, wait_ready, runtime_config resolve, tokenizer extract within the function limits (fn>30 12 -> 0) 2026-11-06 18:53:09 +01:00
Pavlo Ratushnyi 0c95bca7d1 STRA-338 size-fn: strata-control: stream_parts layout and shard planning split into modules (fn>30 2 -> 0) 2026-11-06 18:52:52 +01:00
Pavlo Ratushnyi a4e6db8a0b STRA-338 size-fn: strata-control: v1_reconfigure, status_value, service_unit render, Vision::spawn split; shared codec/decoder aliases (dyn ratchet), wide lines (fn>30 4 -> 0) 2026-11-06 18:50:13 +01:00
Pavlo Ratushnyi 588221cbd2 STRA-338 size-fn: strata-control: worker generate loop moved into Generation::next_line (fn>30 1 -> 0) 2026-11-06 18:43:36 +01:00
Pavlo Ratushnyi 13d26b9642 Merge claude/szfn-cpt into claude/hexagonal-size-gw 2026-11-06 18:41:53 +01:00
Pavlo Ratushnyi 88da9a6b84 Merge claude/szfn-cpb into claude/hexagonal-size-gw 2026-11-06 18:41:52 +01:00
Pavlo Ratushnyi ac7a1a4817 STRA-338 size-fn: strata-control: create helpers, serve, tensor_export within the function limits (fn>30 7 -> 0) 2026-11-06 18:38:31 +01:00
Pavlo Ratushnyi 85bd2ac8bb STRA-338 size-fn: strata-control: worker generate, wrap-up, run_session within the function limits (fn>30 8 -> 0) 2026-11-06 18:36:15 +01:00
Pavlo Ratushnyi 3e50fd08a1 STRA-338 size-fn: strata-control: kar_writer plan and key_init init within the gate 2026-11-06 18:29:42 +01:00
Pavlo Ratushnyi f72ecd2809 STRA-338 size-fn: strata-control: check_full_stream test helper within 30 lines 2026-11-06 18:28:05 +01:00
Pavlo Ratushnyi ac92cbdb9a STRA-338 size-fn: strata-control: write_archive_inner split into plan, file and publish stages (fn>30 1 -> 0) 2026-11-06 18:20:41 +01:00
Pavlo Ratushnyi b30677001e STRA-338 size-fn: strata-control: kar_* modules within function limits (fn>30 23 -> 0) 2026-11-06 18:19:08 +01:00
Pavlo Ratushnyi a8eae529ae STRA-338 size-fn: strata-control: verify_loaded_unit messages as consts (fn>30 1 -> 0) 2026-11-06 18:15:55 +01:00
Pavlo Ratushnyi 721129621b STRA-338 size-fn: strata-control: kar_writer sections within function limits 2026-11-06 18:14:28 +01:00
Pavlo Ratushnyi 2b47848231 STRA-338 size-fn: strata-control: worker run_session and run_supervised split into session and supervisor stages (fn>30 -2, helpers 5 left) 2026-11-06 18:14:15 +01:00
Pavlo Ratushnyi bda9387b00 STRA-338 size-fn: strata-control: service_switch/service_install (fn>30 11 -> 0) 2026-11-06 18:14:08 +01:00
Pavlo Ratushnyi 9654553e4f STRA-338 size-fn: strata-control: kar_writer tests within function limits (second pass) 2026-11-06 18:13:41 +01:00
Pavlo Ratushnyi 38c7af1b64 STRA-338 size-fn: strata-control: responses create/intake/history (fn>30 6 -> 0) 2026-11-06 18:13:30 +01:00
Pavlo Ratushnyi cbf2cf086b STRA-338 size-fn: strata-control: kar_writer tests within function limits 2026-11-06 18:08:31 +01:00
Pavlo Ratushnyi be9678a31a STRA-338 size-fn: strata-control: responses stream: text, buffered and tool streams as run structs with stage methods (fn>30 4 -> 0) 2026-11-06 18:06:24 +01:00
Pavlo Ratushnyi a18786f38a STRA-338 size-fn: strata-control: worker generate, reload_gate, wait_unloaded within the function limits (fn>30 -3) 2026-11-06 18:05:48 +01:00
Pavlo Ratushnyi 7d1f3d8e74 STRA-338 size-fn: strata-control: mcp within function limits 2026-11-06 18:02:22 +01:00
Pavlo Ratushnyi 50a8fd05ea STRA-338 size-fn: strata-control: messages and key_init within function limits 2026-11-06 18:02:09 +01:00
Pavlo Ratushnyi ce78577d21 STRA-338 size-fn: strata-control: split the long cp_replay request head, keep allowlisted reply_text as it was 2026-11-06 17:58:27 +01:00
Pavlo Ratushnyi 785545b9e0 STRA-338 size-fn: strata-control: responses tests: keep allowlisted test fns from growing (fn>30 40 -> 0) 2026-11-06 17:50:52 +01:00
Pavlo Ratushnyi a0c7efd74c STRA-338 size-fn: strata-control: gate-clean helpers, allowlisted functions do not grow 2026-11-06 17:50:13 +01:00
Pavlo Ratushnyi 0b4c3623e7 STRA-338 size-fn: strata-control: cli, config, backend_worker, app, chat, gguf/ggml streams, derived/misc (fn>30 83 -> 23 listed) 2026-11-06 17:49:28 +01:00
Pavlo Ratushnyi 9e007d293f STRA-338 size-fn: strata-control: native_pack conversion methods named convert_* 2026-11-06 17:49:10 +01:00
Pavlo Ratushnyi d425f1b846 STRA-338 size-fn: strata-control: write_sharded_preview within 30 lines 2026-11-06 17:42:18 +01:00
Pavlo Ratushnyi 958a4e1bb4 STRA-338 size-fn: strata-control: wide lines wrapped, last helpers 2026-11-06 17:39:48 +01:00
Pavlo Ratushnyi f9f89d8651 STRA-338 size-fn: strata-control: worker, service_install, vision, wait_ready tests and three tests-module fns within the function limits (test fns>30 21 -> 0) 2026-11-06 17:38:16 +01:00
Pavlo Ratushnyi 27912564c0 STRA-338 size-fn: strata-control: responses tests and harmony prompt tests within the function limits (fn>30 40 -> 0) 2026-11-06 17:37:57 +01:00
Pavlo Ratushnyi b9d9b910d2 STRA-338 size-fn: strata-control: metrics test helper takes the history by reference 2026-11-06 17:37:24 +01:00
Pavlo Ratushnyi 8622842edb STRA-338 size-fn: strata-control: native_pack, native_model, mtp_pack, mtp_fetch within function limits (fn>30 35 -> 0) 2026-11-06 17:32:17 +01:00
Pavlo Ratushnyi d9d4f7e079 STRA-338 size-fn: strata-control examples and remaining tests (fn>30 64 -> 0) 2026-11-06 17:29:54 +01:00