Key findings
The mechanism is small and in the right place: the encoder decides placement once before submission (helios/src/server/http.rs:387-389), the worker copies the request's instants onto the terminal event without reading a clock (helios/src/server/runtime.rs:100-108), and with the option off the encoder never allocates a Timing. Most of the diff is not this PR's core — helios/src/server/metrics.rs +548, latency.rs +24, scheduler.rs +4 and the docs/api.md:305-386 histogram block arrive through stacked #548.
What can go is mostly duplication: ~160 lines in 6 places, ~125 of them this PR's own (of ~1180 added source/test/doc lines once #548's contribution is set aside) — about 100 of that in a single test file. Nothing needs to be added, and no finding asks to remove the option itself: issue #551 is a reproducible client gap (llama-swap reports -1 rates) and the charter merges PRs that fix a reproducible bug (charter line 35), so the feature is warranted; the shape is one branch and one boolean end to end, which is the smallest form consistent with #551.
Size: pr_files reports 22 files, +1757/−77 at head 046aaef.
Findings, ranked by lines saved
1. Should fix, ~100 lines — helios/src/server/runtime/phase_tests.rs:4730-4850
Two new phase tests re-assert rules that are already decided and pinned at the encoder, and re-implement the HTTP-to-worker plumbing to do it.
Already asserted by per_request_metrics_follow_vllm_placement_and_null_rules (helios/src/server/protocol/tests.rs:2346-2449): the six exact values per protocol and the carrier frame (:2375-2389), top-level JSON placement (:2391-2398), no carrier without include_usage (:2400-2406), Messages omitted (:2408-2414), n>1 → null and several prompts → omitted (:2416-2430), single-token and no-instant nulls (:2432-2448).
per_request_metrics_reach_completions_and_responses_where_vllm_places_them (:4730-4777) re-asserts exactly those: usage chunk choices == [] (:4762), response.incomplete (:4764), body placement (:4765), content TTFT null (:4774), mean_itl == generation for two tokens (:4773). Its only timing claim, generation >= 3.0 (:4771), is made rigorously by the test kept at :4719-4721.
per_request_metrics_are_absent_without_the_option_and_null_for_several_choices (:4779-4850): the first loop (:4782-4794, ~13 lines) is the one genuinely new fact — state.per_request_metrics reaches Encoder::enable_request_metrics. The second half (:4795-4849, ~55 lines) hand-drives the channel, builds GenerationEvent::Finished with hand-written RequestTimes (:4822-4835) and asserts "metrics": null for n=2 — the rule at protocol/tests.rs:2416-2430, reached through ~30 lines of plumbing (http_state_for, Arc::get_mut, spawn_blocking, SSE line splitting).
Smaller version (~125 → ~25 lines): delete both; keep the flag's reach with one test over the existing helper (:4563-4610):
#[tokio::test]
async fn per_request_metrics_reach_the_encoder_only_when_enabled() {
for enabled in [false, true] {
let (_, values) = served_through_worker(
|| Fixture::new().text_inputs(), enabled, "/v1/completions",
json!({"model":"qwen-worker-phases","prompt":"a","max_tokens":2}), &[1, 2]).await;
assert_eq!(values[0].get("metrics").is_some(), enabled);
}
}
Keep performance_reports_the_first_scheduled_model_step (:4612-4644) and per_request_metrics_report_the_runtime_instants_of_a_stopped_reasoning_answer (:4690-4728): those are the only tests proving the instants land in the right worker step. Nothing lost — placement and null rules stay where they are decided (encode.rs:232-275).
2. Should fix, ~35 lines, shared with #548 — docs/api.md:305-386
Four paragraphs walk every histogram series (flare_request_queue_seconds, flare_request_prefill_seconds, flare_request_inference_seconds, flare_inter_token_latency_seconds, the token histograms, flare_request_preemptions, flare_model_step_tokens …) with the same populations the Prometheus HELP strings already ship on every scrape (helios/src/server/metrics.rs:1548-1642, e.g. request_queue_seconds at :1557, request_prefill_seconds at :1562, inter_token_latency_seconds at :1591) and that the new correspondence table maps one-to-one (docs/api.md:475-517). Reduce to ~8 lines naming the groups plus the single exclusion rule ("successful completions only; only flare_time_to_first_response_seconds can observe a response that later fails"), and let the HELP strings and the table carry the per-series text. Because the block arrives with #548, this is one cut for the stacked pair, not two.
3. Nit, ~7 lines — docs/api.md:1040-1050
:1040-1043first sentence ("All six fields are always present, and a field is null when…such asmean_itl_ms…") restates the table rows at:1020and:1022. Keep the second sentence (ngreater than one →null; several prompts → omitted) — that is the only placement of this rule in prose — ~3 lines.:1045-1050re-describesperformancefields defined normatively athelios/model-contract.md:344-355, which the same paragraph links. Replace with one pointer sentence — ~4 lines.
The placement paragraph (:1031-1038) and the step/queue-arrival paragraph (:1025-1029) are the only place in the docs stating those boundaries: keep them.
4. Nit, ~9 lines — helios/src/server/protocol/encode.rs:67-79, :232-241
RequestMetrics::Suppressed (:69-70) exists only so metrics_value can return Some(Value::Null) (:252-255); absent/suppressed/single are equally expressible as Option<Timing> plus a suppressed: bool, dropping the two-variant enum and both match arms (:244, :252-255). enable_request_metrics(&mut self, streaming: bool) (:233) takes the same value already stored in Encoder::streaming (:91, set from decoded.stream), and http.rs:375-379 passes decoded.stream immediately before :387-389 passes it again — drop the parameter and read the field. Flattening the three Timing fields onto Encoder removes the wrapper struct (:73-79) and its single constructor site (:239).
5. Nit, ~12 lines, marginal — helios/src/server/config.rs:734-739
The for invalid in [json!(1), json!("true"), json!(null)] rejection loop guards a key whose only writer passes a literal boolean (flare-cli/src/main.rs:355-357 (not opened)). The parse at :353-357 and the absent→false assertion at :727 remain, and the CLI flag is covered by flare-cli/src/cli.rs tests. Marginal because this is the only place the error text is exercised — cut it if the test file is being trimmed anyway (finding 1) and keep it otherwise.
6. Nit, ~5 lines — helios/src/server/runtime/phase_tests.rs:61-73
Fixture::text_inputs is a builder helper called only from Fixture::new (:31?) and Fixture::reasoning; folding the retain loop into with_template and deleting the helper and its call sites saves ~5 lines without losing the comment.
Verified minimal — no cuts proposed
helios/src/server/http.rs:387-389(the singleif state.per_request_metrics),:410-412,:536-539,:613-615— four short hunks, each the only writer of what it sets.helios/src/server/runtime.rs:100-108and the four emit sites (:302-307,:1891-1899,:2070-2078) — fields copied ontoFinished, no clock read;RequestRecordisDefault, so the option-off path allocates nothing.flare-cli/src/cli.rs(+41) — one flag onRunandOrbitRunplus one forwarding line, the same shape as the neighbouring--bypass-performance-check; the two structs are clap's, so there is nothing to collapse.flare-cli/src/config.rs:73-75,flare/src/configuration.rs:34,flare/src/settings.rs:32(not opened)/:224,flare/src/controller.rs:2566(not opened),flare-cli/src/main.rs:355-357(not opened) — one field per layer, following an existing setting exactly.helios/src/server/config.rs:353-357— theBootstrapkey is reachable (main.rs (not opened) writes it;Bootstrap::loadparses it on both serve paths), so it must stay.helios/model-contract.md:344-355,docs/cli-design.md(not opened) — one row/paragraph each, no repetition beyond finding 3.
Left behind
Nothing. The change adds an option and an event field; it removes no path, no other code becomes dead, and no flag or doc elsewhere is superseded. The option-off path costs one branch (http.rs:387) and no allocation.
Open questions and limits
- Finding 2's block ships with stacked #548, so if the pair is reviewed separately the cut belongs to whichever lands the paragraphs; the reviewer should not double-count it.
- I grounded the rules in the charter only (smallest-footprint and no-per-model-flag lines, plus "PRs that … a reproducible bug" for scope). I did not read
docs/design-review.md(not opened) or a CONTRIBUTING file, and the charter mandates no minimum test count — finding 1 rests on visible duplication betweenprotocol/tests.rs:2346-2449andphase_tests.rs:4730-4850, not on a stated rule. - An earlier revision of this review flagged
generate_many_observedas a pass-through wrapper; it is pre-existing on main (helios/src/server/runtime.rs:841-843) and outside this diff, so that finding is withdrawn. - The PR states multi-GPU cores and the Windows build were not run; that is outside the subtraction lens and is not counted against it here.