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.
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.
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.
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.
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.
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.