Subtractive scratchpad · NVIDIA/hyperflare-inference #560

Raw Markdown for agents: https://autobot.eidonix.com/p/a61e5eb2-9648-4fab-93b2-27f9a340d11b.md

#1 [high] Should fix: phase tests re-test encoder placement already proven by protocol unit test (~90 lines)

helios/src/server/protocol/tests.rs:2350-2488 per_request_metrics_follow_vllm_placement_and_null_rules already asserts, at the encoder, all of:

Then helios/src/server/runtime/phase_tests.rs re-proves the same rules through HTTP:

Smaller version: keep performance_reports_the_first_scheduled_model_step (:4609-4647) and per_request_metrics_report_the_runtime_instants_of_a_stopped_reasoning_answer (:4692-4743) — those prove the runtime instants land in the right worker step, which nothing else does. Replace the other two phase tests with one ~20-line test that serves a stream and a body with the flag on and off and asserts presence/absence plus commits, then keep placement/null detail only in the encoder test. Saves ~90-100 of the +559 added test lines in phase_tests.rs.

Also overlapping: :4728-4730 (scheduled/first/last inside their steps) repeats :4638-4645, and :4741 (arrival <= scheduled) repeats :4683.

#2 [high] Should fix: docs/api.md restates each histogram population a third time (~35 lines)

Every added histogram's population is now stated three times in this diff:

  1. the Prometheus HELP string in helios/src/server/metrics.rs (e.g. request_queue at :1560-1564, request_prefill :1565-1569, time_per_output_token :1587-1591, inter_token_latency :1592-1596, request_prefill_computed_tokens :1617-1620, request_max_tokens :1625-1628, request_max_choice_generated_tokens :1629-1632, admission_rejections :1648-1660);
  2. the prose block docs/api.md:305-380 (request/HTTP/runtime/token histogram paragraphs) which re-says who is observed and who is excluded;
  3. the vLLM correspondence table docs/api.md:475-517, which repeats the same conditions per row (e.g. "from model-scheduler arrival", "also recorded when a stream that offered text later fails").

/metrics ships the HELP text with the series, so an operator reading a scrape already has (1). The prose in (2) repeats it almost sentence for sentence: compare docs/api.md:321-330 with the HELP at metrics.rs:1560-1569, and docs/api.md:352-369 with metrics.rs:1617-1632. What (2) alone can say — which histograms pair, that all accumulate since server start, the cancelled/failed caveat — is three sentences.

Smaller version: cut docs/api.md:321-369 (the four paragraphs walking each histogram) down to ~8 lines naming the groups and the one exclusion rule, and keep the mapping table as the place that ties a vLLM name to a Flare series. Saves ~35-40 of the +178 docs lines. Nothing is lost because the exposition carries (1) and the table carries the cross-reference.

Note: this block also arrives via the stacked #548, so if the two are merged together it is one cut, not two.

#7 [high] Withdrawn/correction: per_request_metrics Bootstrap key IS reachable from flare run

Correction to entry 5: the Bootstrap key is NOT dead. flare-cli/src/main.rs:355-357 writes config["per_request_metrics"] into the JSON that both serve paths parse: serve calls Bootstrap::load(&config.to_string(), &manifest) at main.rs:626, and serve_local calls LoadedSession::new(owner, config) at main.rs:701. So config.rs:353-357 is the only route and must stay; the alternative of setting the field after load would need two sites (main.rs:639 and :702) because the cluster path hands bootstrap.server straight to Server::start.

What survives as a subtraction, much smaller: the config.rs test at :727-739 loops over three valid/invalid JSON shapes for a key whose only writer emits a literal true. One assertion (key absent → false) plus the shipped CLI test (per_request_metrics_flag_is_off_by_default_and_reaches_rank_zero, cli.rs:1378-1401) covers the behaviour; the else-branch rejecting 1/"true"/null is a guard no product path can reach, but it also costs 4 lines, so the saving is ~14 lines and the case is borderline — report as nit at most, and not worth blocking on. Entry 5's "Should fix" severity is withdrawn; treat this as a nit.

The --bypass-performance-check / --verify-weights precedent in the PR description is only about the docs table, not about reachability.

#8 [high] Research summary

Reviewed PR #560 (Emit vLLM-compatible per-request metrics from runtime instants) with a Subtraction lens: 18 files, +1898/−123, of which the change's own runtime/encoder core is small and well-placed (the encoder decides placement once before submission, so the worker only emits commit instants when they can be carried; the option-off path adds one branch). The removals I can show are concentrated in the tests (I estimate ~110 of the +733 added test lines), a further ~65-70 of the +178 docs/api.md lines, and ~12 encoder/runtime code lines.

Four findings recorded on the scratchpad, ranked by lines saved: (1) should fix — three of the new phase tests re-prove placement/null rules that the new protocol unit test already pins at the encoder (~90-100 lines; keep the two tests that prove runtime instants fall inside the right worker step, replace the rest with one short flag-on/flag-off test); (2) should fix — the api.md histogram prose repeats, almost sentence for sentence, the HELP strings the same change adds in metrics.rs, with the vLLM table a third statement of the same populations (~35-40 lines); (3) nit — the api.md per-request-metrics section restates its own field table, the null rules, and the cost statement that helios/model-contract.md already carries normatively (~28 lines); (4) nit — Timing::streaming duplicates Encoder::streaming (both come from the same decoded.stream), RequestMetrics::Suppressed costs a declaration plus a match arm in three methods, and record_commit/record_times wrap one-line assignments (~12 lines).

One candidate I investigated and withdrew: I first thought the Bootstrap per_request_metrics key was unreachable, but flare-cli/src/main.rs:355-357 writes it into the JSON that both Bootstrap::load (main.rs:626) and LoadedSession::new (main.rs:701) parse, so it must stay; only its strict-type test loop is arguably surplus, worth ~14 lines and not worth blocking. I also noted generate_many_observed as a thin pass-through over enqueue_many (~12 lines) but did not finish verifying that collapsing it keeps the single-prompt special case in http.rs:368-372 correct, so I reported it as a lower-confidence nit rather than a confirmed subtraction.

#9 [high] Final ranked summary and totals (use this for the report; entry 5 is superseded)

PR #560 size: 18 files, +1898/−123 (pr_files). Of that, helios/src is +1661/−112, docs +180/−5, flare-cli/src +43/−0, helios/model-contract.md +14/−6. The change's own code core is small: runtime.rs +155/−55, encode.rs +93/−1, http.rs +59/−28 — the rest is tests (phase_tests.rs +559, protocol/tests.rs +174) and docs (api.md +178).

Verdict on the lens: no blocking finding. The design is close to minimal — the encoder decides placement once before submission (http.rs:361-363) so the worker emits Committed only when a carrier exists; option-off adds one branch at position zero (runtime.rs:1803-1811) and requests no events; no clock read is added in the encoder; runtime defaults to Default::default() for record, so no allocation or clock read per request. The subtraction available is in the test bulk and the docs prose, not in the mechanism.

Final ranking (all verified in code unless noted):

  1. Should fix — ~90-100 lines: three of the new phase tests duplicate placement/null rules already pinned by the new protocol unit test (scratchpad entry 1).
  2. Should fix — ~35-40 lines: api.md histogram prose duplicates the new Prometheus HELP strings; vLLM table is a third copy (entry 2).
  3. Nit — ~28 lines: api.md per-request-metrics section restates its own table, null rules and cost (entry 3).
  4. Nit — ~12 lines: encoder plumbing duplicate state and pass-through setters (entry 4).
  5. Nit, lower confidence — ~12 lines: generate_many_observed is a pass-through over enqueue_many (entry 6).
  6. Nit, marginal — ~14 lines: config.rs strict-type test loop only (entry 7; entry 5's "Should fix" is WITHDRAWN — the Bootstrap key is reachable from flare run).

Estimated total removable: ~140-175 of the change's added lines, roughly 8-9% of +1898, concentrated 90% in tests and docs with no behavioural loss. If the reviewer only takes one item, it is #1 (the tests), because those lines will be maintained forever and prove nothing the unit test does not.

Total added lines I recommend cutting as a fraction of each file: phase_tests.rs ~95/559, api.md ~65/178, encode.rs ~12/93, runtime.rs ~12/155.

#12 [high] Revision at head 046aaef: encoder finding (entry 4) shrinks to ~9 lines

At head 046aaef, helios/src/server/protocol/encode.rs no longer has Timing::streaming, step_ns, record_commit or a commit event (they went to #562). Current metrics code is:

Smaller version: metrics: Option<Timing> + suppressed: bool (drops the 2-variant enum and its match arms at :244 and :252-255), enable_request_metrics(&mut self) reading self.streaming, and the three Timing fields flat on Encoder. ~9-12 lines of the +93 in encode.rs, no behaviour change: suppressed/absent/single are still the three states.

#13 [high] Head-commit line accounting for the final report

pr_files at head 046aaef (22 files, header says +1757/−77; orientation packet says +1898/−123): docs/api.md +174/−4, docs/cli-design.md +4/−2, flare-cli/src/cli.rs +41, config.rs +17, main.rs +3, flare/src/configuration.rs +1, controller.rs +1, settings.rs +15, helios/model-contract.md +10/−4, helios/src/scheduler.rs +4, scheduler/tests.rs +7, server.rs +9/−1, server/config.rs +18, server/http.rs +29/−2, server/latency.rs +24/−8, server/metrics.rs +548/−2, server/observation.rs +8/−8, server/protocol/encode.rs +68/−1, server/protocol/tests.rs +133, server/runtime.rs +104/−37, server/runtime/phase_tests.rs +535/−8, runtime/response_lifecycle_tests.rs +4.

The metrics object itself is small: encode.rs +68 (of which ~40 is metrics_value/enable/record_times), http.rs +29 (of which ~8 is the metrics wiring at :387-389, :410-412, :536-539, :613-615), runtime.rs event fields (~20 of +104), observation.rs +8. Everything else in metrics.rs (+548), latency.rs, scheduler.rs, and the docs histogram block (api.md:305-386) arrives through the stacked #548, not this PR; cuts there are #548's (my entry 2 should be read as "the stacked pair states each histogram population three times").

So the report's removable total splits as: this PR's own lines ~95 phase tests + ~28 api.md per-request-metrics section + ~10 encode.rs = ~133; the ~35 histogram-prose lines are shared with #548.

#14 [high] Final ranking at head 046aaef — finding 6 withdrawn, new totals

Correction to entry 6 / entry 10: generate_many_observed is NOT added by this PR. helios/src/server/runtime.rs:841-843 (pub(super) fn generate_many_observed(&self, prompts, timestamps)) already exists at main (read_file ref=main, runtime.rs:833-860), and helios/src/server/http.rs:335 calls it with the same two arguments before and after the change (pr_diff http.rs shows the hunk at :384 not :335). The earlier finding was based on the pre-force-push revision that threaded a commits flag through it. DROP finding 6 entirely — it is pre-existing code outside this diff, so it is not a subtraction this change can make.

Similarly the (ingress_ns, enqueue_ns, first_scheduled_ns) triple and observation.rs's performance change are this PR's, but the phase-test helper http_generation_request_observed / http_state_for signature churn (+3 lines for the per_request_metrics: false field at :4315) is unavoidable wiring.

Revised removable total for this PR only (head 046aaef):

  1. phase_tests.rs:4730-4850 — two tests re-proving encoder placement/null rules already asserted at protocol/tests.rs:2346-2449; replace with one ~20-line flag-on/off presence test → ~100 lines.
  2. docs/api.md:1040-1050 — null-rule prose + performance paragraph repeating the table at :1016-1023, encode.rs:248-250's doc comment, and helios/model-contract.md:343-355 → ~14 lines.
  3. docs/api.md:1025-1029 and :1031-1038 — the cost/placement prose partly repeats the doc comment of Encoder::enable_request_metrics and the include_usage gap is stated twice (once here, once in the description/table row) → ~10 lines.
  4. encode.rs:67-79 + :232-247 — RequestMetrics::Suppressed variant and enable_request_metrics's streaming parameter (duplicate of self.streaming) → ~9 lines.
  5. docs/api.md:305-386 — histogram prose duplicating the HELP strings at metrics.rs:1548-1660 and the vLLM table at :475-517 → ~35 lines, but shared with stacked #548.
  6. helios/src/server/config.rs:727-739 — strict-type test loop for a key only main.rs writes → ~14 lines, marginal.

This PR's own code: ~133 lines; with the shared #548 block, ~168.

#15 [high] Corrected docs/api.md estimate at head 046aaef (~7 + ~35 shared)

Re-read of docs/api.md at head 046aaef ("Per-request metrics", :1005-1050) shows most of it carries unique information; the earlier ~28-line cut (entry 3) is too aggressive. What is genuinely redundant now:

So api.md's own section yields ~7 lines, not 28. The large doc cut is still :305-386 (four paragraphs walking every histogram, duplicating the HELP strings at metrics.rs:1548-1660 and the vLLM table at :475-517) at ~35 lines, but that block arrives through stacked #548, so it is one cut for the pair rather than this PR's.

Revised removable total for this PR at head 046aaef: ~100 (phase_tests.rs:4730-4850) + ~10 (encode.rs Suppressed/streaming) + ~7 (api.md section) + ~14 marginal (config.rs strict-type loop) ≈ 120-130 lines of its own ~1180 added source/test/doc lines; with the #548-shared histogram prose, ~160.

#16 [high] Refined finding 1 at head 046aaef: phase_tests 4730-4850 (~100 lines)

Head 046aaef line numbers for the test finding.

Already pinned at the encoder by per_request_metrics_follow_vllm_placement_and_null_rules (helios/src/server/protocol/tests.rs:2346-2449): carrier frame and exact six values per protocol (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 / no-instants nulls (2432-2448).

Then in helios/src/server/runtime/phase_tests.rs:

Smaller version (~125 → ~25 lines): delete both tests; add one test that reuses the existing served_through_worker helper (:4563-4610) for a single Completions request in stream and non-stream form with the option on and off:

#[tokio::test]
async fn per_request_metrics_reach_the_encoder_only_when_enabled() {
    for metrics in [false, true] {
        let (_, values) = served_through_worker(|| Fixture::new().text_inputs(), metrics, "/v1/completions",
            json!({"model":"qwen-worker-phases","prompt":"a","max_tokens":2}), &[1, 2]).await;
        assert_eq!(values[0].get("metrics").is_some(), metrics);
    }
}

Saves ~100 lines of the +535 in phase_tests.rs. Nothing lost: placement and null rules stay in the encoder test where they are decided (encode.rs:232-275), and the runtime-instant proof stays in the two tests kept at :4612-4644 and :4684-4728.

Minor related nit: the new Fixture::text_inputs helper (:61-73, 13 lines) exists only to be called from new (:31) and reasoning (:58); folding the retain loop into with_template and deleting the helper and its two call sites saves ~5 lines.

#18 [high] Report of 2026-11-28, run (head 046aaef)

Verdict: make it smaller in one place — the phase tests — otherwise close to minimal.

Head 046aaef, 22 files. The change's own mechanism is small and well-placed: the encoder decides placement once before submission (helios/src/server/http.rs:387-389), the worker copies instants into the terminal event with no extra clock read (helios/src/server/runtime.rs:100-108), and with the option off the encoder never stores a Timing. Most of the diff is not this PR's core: metrics.rs +548, latency.rs +24, scheduler.rs +4 and api.md:305-386 arrive through stacked #548.

Ranked findings at head 046aaef:

  1. Should fix, ~100 lines — helios/src/server/runtime/phase_tests.rs:4730-4850. per_request_metrics_reach_completions_and_responses_where_vllm_places_them and the n=2 half of per_request_metrics_are_absent_without_the_option_and_null_for_several_choices re-prove the carrier, placement and null rules already asserted at the encoder in helios/src/server/protocol/tests.rs:2346-2449, using 30 lines of hand-driven worker plumbing to do it. Keep one ~20-line test that serves a Completions request through the existing served_through_worker helper (:4563-4610) with the option on and off, and assert the key's presence. Keep performance_reports_the_first_scheduled_model_step (:4612-4644) and per_request_metrics_report_the_runtime_instants_of_a_stopped_reasoning_answer (:4684-4728) — those are the only tests proving instants land in the right worker step. Replacement code in scratchpad entry 16.
  2. Should fix, ~35 lines, shared with #548 — docs/api.md:305-386 walks every histogram's population a third time: the same populations are the Prometheus HELP strings added at helios/src/server/metrics.rs:1548-1660 (shipped with every scrape) and the vLLM correspondence table at docs/api.md:475-517. Cut the four paragraphs to ~8 lines naming the groups and the single "successful completions only" exclusion rule, and let the table carry the per-series cross-reference. Because the block arrives through #548, this is one cut for the pair, not two.
  3. Nit, ~9 lines — helios/src/server/protocol/encode.rs:67-79 and :232-247. RequestMetrics::Suppressed exists only so metrics_value can return Some(Value::Null) (:251-255); an Option<Timing> beside a suppressed: bool carries the same three states with no enum and no two match arms. enable_request_metrics(&mut self, streaming: bool) also duplicates Encoder::streaming (:91, set from the same decoded.stream at http.rs:375-379) — drop the parameter and read the field.
  4. Nit, ~7 lines — docs/api.md:1040-1050. The first sentence of the null-rule paragraph restates table rows :1020 and :1022 (mean_itl_ms is defined there), and the performance paragraph re-describes fields defined normatively at helios/model-contract.md:343-355, which the same paragraph links. Keep the n>1 rule and a one-line pointer; keep the placement and queue-arrival paragraphs (:1025-1038), which are the only place these boundaries are stated.
  5. Nit, ~14 lines, marginal — helios/src/server/config.rs:727-739. The per_request_metrics key is written by exactly one caller as a literal (flare-cli/src/main.rs:355-357), so the 1/"true"/null rejection loop guards no product path; the absent→false assertion plus flare-cli/src/cli.rs:1378-1402 covers the behaviour.

Total: ~160 lines removable, ~120 of them this PR's own (≈10% of its added source/test/doc lines), ~100 of that in a single test file. Nothing else: generate_many_observed, which an earlier revision of this review flagged, is pre-existing on main (helios/src/server/runtime.rs:841-843) and outside this diff.

Left behind: nothing. No pre-existing code becomes dead — the change adds an option and an event field but removes no path, and the option-off path is one branch (if state.per_request_metrics, http.rs:387) with no allocation.

#19 [high] Research summary

Re-reviewed PR #560 at head 046aaef with the Subtraction lens and updated the scratchpad (report is now entry 18; entries 14-17 record the corrections).

Verdict: make it smaller in one place (the phase tests); otherwise close to minimal.

Key correction since the last turn: generate_many_observed is pre-existing on main (runtime.rs:841-843), so that finding is withdrawn entirely. The content-instant move to #562 also removed the Timing::streaming/record_commit duplication; what remains in encode.rs is only the RequestMetrics::Suppressed variant and the redundant streaming parameter on enable_request_metrics (~9 lines).

Ranked removals at this head, ~160 lines total (~120 the PR's own, ≈10% of its added lines):

  1. Should fix, ~100 lines — helios/src/server/runtime/phase_tests.rs:4730-4850: two of the new phase tests re-prove the carrier, placement and null rules already asserted at the encoder in protocol/tests.rs:2346-2449, with 30 lines of hand-driven worker plumbing. Keep the two tests that prove instants land in the right worker step; replace with one ~20-line flag-on/off test over the existing served_through_worker helper (code in entry 16).
  2. Should fix, ~35 lines, shared with stacked #548 — docs/api.md:305-386 states every histogram population a third time (the Prometheus HELP strings at metrics.rs:1548-1660 and the vLLM table at api.md:475-517 already carry it).
  3. Nit, ~9 lines — encode.rs:67-79,232-247: enum variant + duplicated streaming parameter.
  4. Nit, ~7 lines — api.md:1040-1050: null rule and performance paragraph restate the table above and helios/model-contract.md:343-355 (not opened).
  5. Nit, ~14 lines, marginal — helios/src/server/config.rs:727-739: strict-type loop for a key one caller writes as a literal.

Everything else (http.rs hunks, the Finished fields, the CLI flag and its config plumbing through flare/Bootstrap, the contract and cli-design docs) was read in context and found already minimal; the option-off path adds one branch and no allocation. No pre-existing code becomes dead.

#20 [high] Charter grounding for the findings — citations and their honest limits

The report should cite the project's own rules as instructed. From read_charter (docs/charter content, per the orientation packet's line numbers):

Limits to state honestly: I read the charter in full (read_charter) but did not open docs/design-review.md, docs/core-design.md or any CONTRIBUTING file, so the report should ground its rules in the charter only and not claim a design-review sign-off requirement. The charter also does not mandate a minimum test count, so finding 1 rests on duplication visible in the code (protocol/tests.rs:2346-2449 vs phase_tests.rs:4730-4850), not on a stated rule.

Also worth carrying into the report as a one-liner: the change keeps the option off by default and adds exactly one branch on the serving path (helios/src/server/http.rs:387-389), which is the smallest shape consistent with issue #551 — so the verdict is "smaller tests, not a smaller feature".

#22 [high] Report of 2026-11-28, run (head 046aaef, second pass with Autobot review in view)

Verdict: make it smaller first (smaller tests and config, not a smaller feature)

Size at head 046aaef: 22 files, +1757/−77 (pr_files). Of that, helios/src/server/metrics.rs +548, docs/api.md:305-386 histogram prose, latency.rs +24 and scheduler.rs +4 arrive through stacked #548; the metrics object itself is ~110 source lines (encode.rs +68, http.rs +29 of which ~8 is the wiring, runtime.rs event fields, observation.rs +8). The rest is tests (phase_tests.rs +535) and one boolean plumbed through five layers.

The mechanism is right-sized: one branch on the serving path (helios/src/server/http.rs:387-389), no clock read (helios/src/server/runtime.rs:2266-2291 stamps from a value #548 already reads), option-off path allocates nothing (RequestRecord is Default). Issue #551 is a reproducible client gap (llama-swap shows -1 rates), so the feature is in scope (charter line 35). Nothing below asks to remove the option.

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 the encoder's placement/null rules, already pinned at helios/src/server/protocol/tests.rs:2346-2449 (carrier frame and six exact values 2375-2389; top-level body 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 instants → null 2432-2448).

#[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 :4612-4644 (first_scheduled_ns inside the first step) and :4685-4728 (instants vs step bounds): they are the only tests proving the worker stamps instants in the right step. Nothing lost: placement and nulls stay where they are decided (encode.rs:232-275).

Minor included nit: Fixture::text_inputs (:61-73) is now called only from new (:31), reasoning (:58) and two tests; folding the retain loop back into with_template and calling Fixture::new() in the tests saves ~5 lines.

2. Should fix, ~37 lines — the [server] per_request_metrics configuration layer

The documented key (docs/api.md:1007, docs/cli-design.md:736,1318,1349) is not in Ignition's config schema: ignition/cli/config.py:21-33 _SECTIONS["server"] lists only host/port/api_key/thinking_token_budget/scheduler_checkpoint_extra_work_fraction, and Configuration._validate rejects any other key (:112-114), as tests/cli/test_config.py:151-177 pins. So a config.toml that enables the documented option makes every ignition command fail with "unknown key per_request_metrics in [server]". Its only consumer without the flag is the desktop controller (flare/src/controller.rs:2566), and flare-winui has no control for it (search: no per_request_metrics under flare-winui/). Smallest consistent version: keep --enable-per-request-metrics (flare-cli/src/cli.rs) and the runtime toggle, drop the file key: flare/src/configuration.rs:34, flare/src/settings.rs:32 + test :76-87 + :224, flare/src/controller.rs:2566, flare-cli/src/config.rs:73-75 + test :222-234, and the three cli-design rows plus the api.md clause. flare-cli/src/main.rs:355-357 and helios/src/server/config.rs:353-357 stay (the flag still writes the JSON key). Alternative is adding the key to ignition's schema — an addition, outside this lens; either way the current state is inconsistent, which is why this is should-fix rather than nit.

3. Should fix, ~35 lines, shared with #548 — docs/api.md:305-386

Four new paragraphs walk every histogram series with the same populations the Prometheus HELP strings already ship on every scrape (helios/src/server/metrics.rs:1548-1642) and that the new correspondence table maps one-to-one (docs/api.md:475-517). Reduce to ~8 lines naming the groups plus the one rule that is not in the HELP strings ("successful completions only; only flare_time_to_first_response_seconds can observe a response that later fails"). This block arrives through #548, so it is one cut for the stacked pair.

4. Nit, ~9 lines — helios/src/server/protocol/encode.rs:67-72, :232-241

RequestMetrics::Suppressed (:69-70) exists only to return Some(Value::Null) (:252-255); Option<Timing> plus fn metrics_value returning Some(Value::Null) when a suppressed bool is set drops the enum and two match arms. enable_request_metrics(&mut self, streaming: bool) (:233) takes the value already in Encoder::streaming (:91, set at :186 from decoded.stream), and the only caller passes decoded.stream right before (:387-389 vs :375-379): drop the parameter.

5. Nit, ~7 lines — docs/api.md:1040-1050

:1040-1043 first sentence restates the table rows :1020/:1022 (keep only the n>1 / several-prompts sentence, ~3 lines). :1045-1050 re-describes performance fields defined normatively at helios/model-contract.md:344-355, which it already links (replace with one pointer, ~4 lines). Keep :1025-1029 and :1031-1038: unique statements of the step-instant, queue-arrival boundary and the include_usage gap.

6. Nit, ~12 lines — helios/src/server/config.rs:734-739

Strict-type rejection loop for a key whose only writer emits a literal true (flare-cli/src/main.rs:355-357). The absent→false assertion (:727) and the shipped CLI test (cli.rs:1379-1401) cover the behaviour; the 1/"true"/null loop guards a path no product reaches.

Checked and minimal (no cuts)

http.rs:387-389, :410-412, :538-539, :613-615; runtime.rs:100-108 and the three emit sites (302-307, 1861-1899, 2024-2078); flare-cli/src/cli.rs (+41, same shape as --bypass-performance-check); flare/src/settings.rs one field; helios/model-contract.md:343-355 (one normative paragraph); encode.rs metrics_value body (six vLLM fields, ~25 lines, nothing generic exists to reuse).

Left behind

None. No pre-existing path becomes dead; the option-off path costs one branch.

Totals

~200 lines removable, ~165 of them this PR's own (~14% of its added lines), ~35 shared with #548. Biggest single cut is one test file.

Limits

#23 [high] Research summary

Reviewed PR #560 (vLLM-compatible per-request metrics) at head 046aaef with the Subtraction lens; all 22 changed files were examined, plus the surrounding code each one touches and the layers it adds to (CLI → flare configuration/settings/controller → helios Bootstrap → HttpState → Encoder), and the pre-existing helpers it could reuse (protocol/tests.rs encoder fixtures, phase_tests served_through_worker, metrics.rs HELP strings and the vLLM correspondence table).

Verdict: make it smaller first — the mechanism is right-sized (one branch at http.rs:387-389, no clock read, nothing allocated when off), but about 200 lines are removable, ~165 of them the PR's own. Biggest single cut is one test file: phase_tests.rs:4730-4850 re-asserts placement and null rules already pinned at protocol/tests.rs:2346-2449 through ~30 lines of hand-driven worker plumbing; ~100 lines become one ~25-line flag-on/off presence test over the existing served_through_worker helper. Second, a substantive new finding: the documented [server] per_request_metrics key is outside ignition/cli/config.py's _SECTIONS["server"] schema, so a config.toml (not opened) that enables it makes every ignition command fail with "unknown key", and serve.py does not forward it either — the smallest consistent version drops the file key (~37 lines across flare/src and flare-cli/src) and keeps the flag. Shared with stacked #548: docs/api.md:305-386 re-walks every histogram population a third time (~35 lines). Three nits follow: encode.rs RequestMetrics::Suppressed plus the redundant streaming parameter (~9), api.md per-request section (~7), config.rs strict-type test loop (~12).

Everything is recorded in scratchpad entry #22, which supersedes entries #1-#21; entry #5's "dead Bootstrap path" claim is withdrawn (entry #7) and entry #6 (generate_many_observed) is withdrawn as pre-existing code (entry #14).

#24 [high] Verified citations for the ignition config-schema finding (entry 22 #2)

Evidence checked this run for the finding that [server] per_request_metrics is a key only Rust understands:

Removal set if the key goes: flare/src/configuration.rs:34; flare/src/settings.rs:32, :76-87 (test), :224; flare/src/controller.rs:2566; flare-cli/src/config.rs:73-75, :222-234 (test); docs/cli-design.md:736/:1318/:1349 edits and docs/api.md:1007 rewrite. Kept: flare-cli/src/cli.rs flag (+41), flare-cli/src/main.rs:355-357, helios/src/server/config.rs:353-357 and its test :727-732. Net ~37 lines.

Also worth carrying: the alternative fix (add the key to ignition _SECTIONS + _BUILT_IN + forward it in serve.py:486-487) is an addition and therefore outside this lens, but it is the maintainer-facing choice between the two consistent states; the review should say so plainly rather than demand removal.

#3 [medium] Nit: docs/api.md per-request-metrics section repeats its own table and the model contract (~28 lines)

docs/api.md:1005-1057 ("Per-request metrics") documents in prose exactly the six keys that the table immediately above it (1015-1022) already defines, then a further block (1025-1047) on placement/null rules that helios/src/server/protocol/encode.rs:238-253 states as the function's doc comment and protocol/tests.rs:2350-2488 pins as behaviour.

Two concrete duplications inside the section itself:

Smaller version: keep the table (1011-1022), the placement paragraph (1024-1032) and a two-sentence null rule; drop the field-by-field prose and the cost restatement, keeping the link to helios/model-contract.md. Saves ~25-30 of the +178 docs lines with no information an API reader needs.

#4 [medium] Nit: Encoder metrics plumbing duplicates state and wraps one-line assignments (~12 lines)

helios/src/server/protocol/encode.rs:238-267, three public methods where one call site exists (helios/src/server/http.rs:363, 527-529, 543):

  1. record_commit (encode.rs:254-261) only assigns timing.step_ns = Some(at_ns) and is called from exactly one place, http.rs:527-530, whose whole arm is GenerationEvent::Committed { at_ns } => { encoder.record_commit(at_ns); Ok(vec![]) }. Since metrics_value is the only reader of step_ns and it is set right before the encoder sees that step's Event::Content (http.rs:543/encode.rs apply at 543-552), the field could be assigned directly in http.rs through a public field or a pub(super) setter — but better: Append of a commit instant is the same shape as the existing observe_generated_token (encode.rs:296-299), so the wrapper buys nothing.

  2. record_times (encode.rs:262-267) is a three-field tuple assignment under a match; the same guard if let Some(RequestMetrics::Single(timing)) recurs in record_commit and again in apply (encode.rs:543-552). A single fn timing(&mut self) -> Option<&mut Timing> helper, or storing the fields flat on Encoder, removes one of the three.

  3. RequestMetrics::Suppressed exists only so metrics_value can return Some(Value::Null) (encode.rs:270-273). An Option<Timing> plus a separate bool is the same information; the enum is 5 lines of declaration plus a match arm in each of the three methods. Timing.streaming (encode.rs:79-80) is a duplicate of Encoder::streaming (encode.rs:97, set at :192) — the same flag stored twice; record_commit's && timing.streaming (encode.rs:257) could read self.streaming.

Smaller version: keep enable_request_metrics, record_commit, record_times, metrics_value as four short Encoder methods but drop RequestMetrics::Suppressed in favour of metrics: Option<Timing> plus suppressed: bool, and drop Timing::streaming in favour of the existing Encoder::streaming. Saves ~10-12 lines and one duplicated flag. Verified: Encoder::streaming is set from decoded.stream at http.rs:349-353 and enable_request_metrics is called with the same decoded.stream at http.rs:363, so the two always agree.

#5 [medium] Should fix: per_request_metrics has a Bootstrap validation path nothing in the product reaches (~18 lines)

Config plumbing in this diff is three layers for one bool, and one layer is dead in the shipped path.

Reachability, verified:

The PR's own description states there is no [server] per_request_metrics key in flare run's configuration file and that the WinUI controller cannot enable it. So the Bootstrap validation at config.rs:353-357 and its four-case test at config.rs:727-739 (absent/true/false accepted, 1/"true"/null rejected, 18 added lines) only serve hand-written JSON in tests and in-process ServerConfig users. --bypass-performance-check and --verify-weights, which the description names as precedent, are CLI-only — they are never read from Bootstrap (grep: no bypass_performance_check or verify_weights key in helios/src/server/config.rs). Following that precedent removes the config.rs branch and its test entirely: ~18 lines, and main.rs becomes the only writer, exactly as for those two flags.

Smaller version in config.rs: delete the per_request_metrics: match arm (353-357) and the loop at 727-739, and set per_request_metrics: false in the ServerConfig literal alongside log_to_stderr: true. main.rs:355-357 keeps working because it mutates the JSON before Bootstrap::load… note: it does NOT — main.rs writes the key into the config JSON that Bootstrap parses, so if the key is removed from Bootstrap the flag stops working. Correct smaller version: instead of writing into the JSON, set the field on the ServerConfig directly where main.rs:335 does owner.server_config().clone() — one line config.per_request_metrics = args.enable_per_request_metrics; — which also removes if args.enable_per_request_metrics { ... } (3 lines). Net saving ~18 lines (config.rs branch + test) and one indirection, with the same behaviour, since Bootstrap accepts nothing else from that key anyway.

Caveat to state honestly: this makes the Bootstrap key a test-only surface disappear, so the config.rs test row for the key goes with it.

#6 [medium] Nit: generate_many_observed is a pass-through wrapper over enqueue_many (~12 lines)

helios/src/server/runtime.rs:860-869 — generate_many_observed gained a doc comment and a signature of three arguments whose third (commits) is threaded from http.rs:363 while the second changed from bool to Option<bool>:

pub(super) fn generate_many_observed(&self, prompts: Vec<Prompt>, observation: Option<bool>, commits: bool) -> Result<Vec<Generation>> {
    self.enqueue_many(prompts, observation, commits)
}

It is a pure pass-through, and http.rs:366-374 now calls generate_many_observed(..., Some(observation.timestamps), commits) where the pre-change code called generate_many_observed(prompts, observation.timestamps) in the continuous-usage arm and generate_many(prompts) in the fallthrough arm. Since enqueue_many already takes observation: Option<bool> and commits: bool, the three wrappers generate, generate_observed, generate_many, generate_many_observed (runtime.rs:843-869) are four names for enqueue_many(.., None|Some(t), c); the whole block is ~27 lines including the doc comment.

Smaller version: keep generate/generate_many (used by helios/src/server/protocol/decisions/mod.rs:838, tests, and the public API) and let http.rs call enqueue_many once behind a single normalisation of the three submission shapes:

let observation = (continuous_usage || (observation.token_ids && size == 1)).then_some(observation.timestamps);
// token_ids && size == 1 also needs the single prompt taken out of the batch;
let submitted = if prompts.is_empty() { Ok(vec![]) } else { state.model.enqueue_many(prompts, observation, commits) };

generate_many_observed then disappears (~12 lines) and the doc comment with it, because enqueue_many's own parameters are already named observation/commits and documented at runtime.rs:860-861.

Note the containing change of http.rs:361-375 already moved the encoder construction above submission, so this reordering is in the same block and costs nothing extra to do.

#10 [medium] Verification status of the generate_many_observed finding (entry 6)

Verified: generate (runtime.rs:843-845), generate_many (:856-858), generate_observed (:847-849) and generate_many_observed (:860-869) all funnel into enqueue_many(prompts, observation, commits) (:871-876). generate_many_observed's body is exactly self.enqueue_many(prompts, observation, commits) and it is called only from http.rs:367 and :374. Its callers pass Some(observation.timestamps) and None respectively, both with the same commits.

NOT verified (state as lower confidence in the report): the proposed replacement folds http.rs's four-arm if (:364-375) into one enqueue_many call, but the arm at :368-372 also needs two side effects that enqueue_many cannot express — it takes a single prompt out of the batch (prompts.remove(0)) for the observation.token_ids && size == 1 case, and the prompts.is_empty() arm must avoid touching the runtime at all (zero-token / prompt-scoring requests). So the arm structure must survive in some form; what can actually go is the wrapper's name, doc comment and signature (~12 lines), not the branching. If the report wants to be conservative, present this as "the wrapper is redundant; the caller's four arms are not" rather than as a caller simplification.

helios/src/server/protocol/decisions/mod.rs:838 and several tests call runtime.generate(...), so generate/generate_many must stay.

#17 [medium] Scope checked and found minimal (http.rs, runtime.rs, CLI, settings, contract docs)

Checked and found minimal at head 046aaef — do not propose cuts here: