Code review summary scratchpad · NVIDIA/hyperflare-inference #560

Raw Markdown for agents: https://autobot.eidonix.com/p/ff3a53d3-54b7-4c24-af70-80e3b738353e.md

#1 [high] PR #560 verified code citations

PR #560 head ce44060, base main, 18 files, +1898/-123. Verified at head:

ENCODER (helios/src/server/protocol/encode.rs)

HTTP (helios/src/server/http.rs)

RUNTIME (helios/src/server/runtime.rs)

MANIFEST: helios/src/execution/manifest.rs:90-101 GraphKind::samples() = Prefill|TerminalPrefill|ScoredPrefill|Decode|Speculative|Mixed|Resume (exactly the inline list)

SERVE VISIBILITY: helios/src/server.rs:16 mod metrics; (private), :33 pub use metrics::Snapshot;, :34 pub use runtime::{Generation, GenerationEvent, ModelRuntime, Prompt}; -> GenerationEvent::Finished's times: super::metrics::RequestTimes type is not nameable outside the crate. metrics.rs:326 pub struct RequestTimes. No private_interfaces/deny attrs anywhere (search returned no matches), so cargo check is clean and the PR's claim holds — the lint does not fire for pub-in-private-module.

DECODE: helios/src/server/protocol/decode.rs:742-755 — n parsed; if protocol != Protocol::Completions && choices != 1 { return Err("n must be 1") } => Chat/Responses/Messages always one choice, so http.rs:542 last-writer-wins is latent (Completions never emits performance, http.rs:609 is Chat-only).

#2 [high] Config/CLI reachability + docs state (verified)

#3 [high] Docs gaps, cost-claim falsity, test duplication

COST CLAIM (false): PR "Claimed result" says "No clock read is added in either state"; "Cost / Option off: no commit events, unchanged event capacity, and one branch per committing step at position zero." Verified: runtime.rs:2253-2270 adds monotonic_ns() per scheduled step unconditionally (both states, and for SDK generate/generate_many callers) plus a per-lane get_or_insert; runtime.rs:1829 record.tokens_committed(completed_at_ns) also runs unconditionally at position 0. The stamp serves first_scheduled_ns for #548's histograms AND this PR's performance.first_scheduled_ns (observation.rs:70-74). Fix is wording + a measurement of the option-off path; magnitude is one clock_gettime-class read per step (trivial), so no code change required.

QUEUE_TIME BOUNDARY (misdescribed): description says "the HTTP handler reads [model-queue arrival] just before sending the request to the worker, so it includes that channel transit (microseconds)". Verified false actor/order: arrival_ns is read in ModelRuntime::enqueue_many at runtime.rs:928, inside the per-prompt build loop, before the rest of the group's admission work and before try_send at :965; enqueue_ns (observation) is read LATER at :951-953. So queue_time_ms (encode.rs:284, scheduled - arrival) includes the remaining group validation + channel send + worker pickup, and the described order of the two instants is reversed. docs/api.md:1017 defines queue_time_ms without stating where arrival is read.

DOCS CROSS-REFERENCE UNREADABLE: docs/api.md:1047-1054 introduces performance.first_scheduled_ns and per-token timestamps; a search of docs/api.md shows performance, ingress_ns, enqueue_ns, reused_prompt_tokens, token_timestamps_ns occur NOWHERE else in the file (only :1051 and a passing return_token_timestamps at :992). The authoritative description is helios/model-contract.md:344-355 (top-level performance with ingress_ns, enqueue_ns, first_scheduled_ns, reused_prompt_tokens; same monotonic origin as choices[0].token_timestamps_ns; first_scheduled_ns - enqueue_ns = wait for first step). Anchor #token-and-timing-observation resolves (model-contract.md:326 region).

TEST DUPLICATION (verified spans):

#4 [high] Research summary

Full Review — PR #560 "Emit vLLM-compatible per-request metrics from runtime instants"

Head ce44060, base main, 18 files, +1898/−123. Stacked on #548 (must merge first). Reviewed as the layer above #548, per the description.

Recommendation: request changes before merge. No serving defect was found — the layering is right (the worker owns the instants, the encoder owns placement, no HTTP clock reads), the event budget matches the worst case added, and with the option off nothing is requested or emitted. Two blockers are scope/evidence: no named requirement authorizes the change, and the Cost section claims "No clock read is added in either state", which runtime.rs:2257 contradicts.


Key findings

  1. No maintainer request, roadmap item, bug or measurement authorizes this PR (charter "What gets merged"). The requirement is a third-party gateway reading vLLM's metrics, argued by the same author in #551; #552 and #553 were both halted by review on exactly this ground.
  2. The stated cost is wrong: reserve_and_pack reads monotonic_ns() for every scheduled step, in both flag states (helios/src/server/runtime.rs:2257-2270), and tokens_committed runs unconditionally at position zero (:1829). The magnitude is one clock_gettime-class read per step, so the fix is wording plus a measurement, not code.
  3. A public enum gained a field whose type cannot be named outside the crate (GenerationEvent::Finished.times: super::metrics::RequestTimes, private module) — helios/src/server/runtime.rs:107 vs helios/src/server.rs:16,33-34.
  4. The option has no configuration-file home, and the key it does accept is silently dropped by flare/src/configuration.rs:26-34 (no deny_unknown_fields), so [server] per_request_metrics = true is accepted with no error and no effect — and the two consequences the description admits are recorded nowhere in the repository.
  5. ~140–175 added lines can go with no behaviour lost, almost all in phase_tests.rs (+559) and docs/api.md (+178), plus one dead encoder field, one redundant admission wrapper and one duplicated GraphKind predicate.

Verified sound and needing no change: event-budget arithmetic (runtime.rs:62-84); Committed emitted at position 0 before the step's tokens so the content instant can never latch from a later step (runtime.rs:1826-1833); request times survive preemption (Incoming.record moves with the request; record.max_tokens set only at first admission, runtime.rs:1591-1594); option-off wiring (http.rs:363); the content instant skips reasoning, tool-call output, empty text and named-tool-choice-discarded text (encode.rs:541-551); the six field definitions against encode.rs:275-293; the metrics: null vs absent divergence (disclosed in description and docs/api.md:1038-1045); flag forwarding parity with --api-key-file (flare-cli/src/cli.rs:671-701, port-style block per struct); flare_arc/CLI test for rank zero's re-parse.


Blockers

1. Authorization and evidence for a runtime-touching, third-party-motivated feature

Where: charter "What gets merged" and "Bring real evidence"; AGENTS.md:188-193,201-205; PR "Cost" and "Claimed result"; #551, #552, #553.

What is wrong: the charter merges PRs that address "a maintainer request, a roadmap item, a reproducible bug, a measured performance/memory issue, or bad docs". Here the requirement is llama-swap reading vLLM's metrics object; the only issue stating it, #551, is open and authored by the same person — neither a maintainer request nor a roadmap item. #553 records two automated "Review Stopped — low value or does not align with the project charter" (2026-11-27 05:17 and 06:40) and was closed as superseded; #552 is closed likewise. AGENTS.md:188-193 is explicit that new switches need "a concrete requirement" and that hypothetical consumers do not establish one. Separately, the change adds work to the worker hot path in both states (see Blocker 2), and the description states "CPU overhead under load was not measured", while the charter asks runtime changes to "bring real evidence".

Why it matters: this is the exact ground the two predecessors were stopped on, so merging without it repeats a rejected decision. The engineering is good; the question is whether the feature is wanted.

What settles it: a maintainer statement on #551 or in the PR that per-request response metrics are wanted (plus, for a roadmap link, entry under charter roadmap #6 in-process Rust SDK, whose public surface item 3 repairs), and a before/after option-off throughput/latency number on a served workload against main.

2. "No clock read is added in either state" is false, and the option-off branch count understates the diff

Where: helios/src/server/runtime.rs:2253-2270 (read at :2257, per-lane stamp :2258-2270), :1826-1833; PR description Claimed result and Cost.

What is wrong: reserve_and_pack calls super::observation::monotonic_ns() for every scheduled step, unconditionally, and stamps record.times.first_scheduled_ns per lane. That read runs with the flag on and off, and for SDK callers of generate/generate_many that never reach HTTP. record.tokens_committed(completed_at_ns) at :1829 is likewise unconditional. The stated "only added work is one predictable branch per committing step at position zero" and "No clock read is added in either state" are therefore both wrong for the code at head.

The instant serves two consumers — #548's request histograms and this PR's own client-visible performance.first_scheduled_ns (helios/src/server/observation.rs:70-74, helios/src/server/http.rs:609-615) — so it is mandatory, but it is a new per-step read introduced by the change set and the claim is checkable and false.

Why it matters: reviewers judge hot-path impact from the Cost section; a cost claim that the code contradicts is worse than a disclosed cost. The magnitude itself is trivial (one clock read beside a kernel launch).

Requested change: in Claimed result and Cost, state that one monotonic read per scheduled model step is added (serving first_scheduled_ns for both the histograms and performance.first_scheduled_ns) and that Committed adds no read of its own because it reuses the instant the histogram path already took; and record the option-off measurement under Blocker 1 rather than asserting "unchanged cost". No code change requested.


Should Fix

1. GenerationEvent::Finished.times has a type no out-of-crate consumer can name

Where: helios/src/server/runtime.rs:104-108 (field times: super::metrics::RequestTimes at :107), helios/src/server/metrics.rs:324-330 (pub struct RequestTimes), helios/src/server.rs:16 (mod metrics; private), :33 (pub use metrics::Snapshot;), :34 (pub use runtime::{Generation, GenerationEvent, ModelRuntime, Prompt};).

What is wrong: GenerationEvent is re-exported publicly, but Finished's new field is typed with a type from a private module. An out-of-crate consumer of flare_helios::server::GenerationEvent cannot name it, so it can read the instants only by destructuring other fields, and it cannot construct a Finished event in a test or a substitute runtime. Before this PR Finished was all primitives. docs/api.md and helios/model-contract.md now describe the field as contract. I confirmed no private_interfaces/deny/warn attribute exists in the tree, so cargo check --features server being clean is consistent — the lint simply does not fire for pub-in-private-module.

Why it matters: the charter roadmap's in-process Rust SDK (#6) is the consumer of this public enum; publishing an unnameable field is a permanent wart in that surface.

Requested change (either): re-export alongside Snapshot (pub use metrics::RequestTimes; at helios/src/server.rs:33), or keep the instants off the public event — they are consumed only by the HTTP encoder, so exposing them via Incoming/Generation would leave the public enum's shape unchanged. The primitive arrival_ns: u64 at runtime.rs:105 is fine.

2. Flag-only home plus a silently ignored configuration key, and the admitted limitations exist only in the PR body

Where: flare-cli/src/cli.rs:646-648 (Orbit), :859-862 (run), :697-699 (forwarding); flare-cli/src/main.rs:353-357; helios/src/server/config.rs:353-357; flare/src/configuration.rs:26-34; flare/src/settings.rs:30,157,208; docs/cli-design.md:1317-1323,1342-1348,1384-1386,736; AGENTS.md:452-456; description "Material limitations".

What is wrong: two holes.

Why it matters: AGENTS.md:452-456 gives a setting exactly one home; the PR picks the flag but leaves the runtime accepting a key no front end can supply, and hides the consequence in a description that will not be read next month.

Requested change (either):

3. queue_time_ms's boundary is described with the wrong actor and the wrong order

Where: description "Material limitations" bullet 1; docs/api.md:1017; helios/src/server/runtime.rs:926-953,965; helios/src/server/protocol/encode.rs:284.

What is wrong: the description says the HTTP handler "reads [model-queue arrival] just before sending the request to the worker, so it includes that channel transit (microseconds)". The HTTP handler never reads it. ModelRuntime::enqueue_many reads arrival_ns while building Incoming, inside the per-prompt loop (runtime.rs:928), before the rest of that group's admission work and before self.sender.try_send(incoming_group) at :965; the observation enqueue_ns is read later, at :951-953. So queue_time_ms (scheduled − arrival, encode.rs:284) covers the remaining group validation plus channel send plus worker pickup — more than "channel transit", and the order the text implies for arrival vs enqueue is reversed.

Why it matters: the bullet exists precisely to tell a reader how far queue_time_ms sits from vLLM's engine-core scheduler queue; it understates the gap and asserts an unmeasured magnitude (microseconds).

Requested change: description — "queue_time_ms starts at model-queue arrival, which the runtime reads when it builds the request group, before publishing the group to the worker channel; it therefore includes the channel send and worker pickup, and starts later than vLLM's engine-core scheduler queue." docs/api.md:1017 — append the same clause so the document states the boundary rather than only the interval.

4. docs/api.md refers to a performance shape it never documents

Where: docs/api.md:1047-1054; helios/model-contract.md:344-355; helios/src/server/observation.rs:70-74.

What is wrong: the new passage says "Chat token observation reports the same first scheduled step as performance.first_scheduled_ns, beside per-token timestamps; the prepated model contract defines those fields." A search of docs/api.md shows performance, ingress_ns, enqueue_ns, reused_prompt_tokens and token_timestamps_ns appear nowhere else in the file (only this line, plus a passing return_token_timestamps at :992). A reader of the HTTP API reference therefore cannot learn that performance is a top-level object on timed Chat responses only, which four fields it holds, that they are absolute nanoseconds on a process-local monotonic origin shared with choices[0].token_timestamps_ns, or that token_timestamps_ns aligns with choices[0].token_ids. The description's claim that "a client can compute the same intervals from Flare's own shape" is supported only from the component contract.

Why it matters: AGENTS.md:46-50 and the repo-prose skill require prose that a reader with the repository can act on; a self-comparison is not a definition.

Requested change: replace the paragraph's second half with one sentence stating the shape — "A Chat request with return_token_timestamps: true also receives the same first scheduled step as performance.first_scheduled_ns, a top-level object emitted on timed responses beside ingress_ns, enqueue_ns and reused_prompt_tokens; these are absolute nanoseconds on the same process-local origin as choices[0].token_timestamps_ns, so first_scheduled_ns - enqueue_ns is the wait for the first model step" — and keep the existing link to helios/model-contract.md (anchor resolves, model-contract.md:326).


Subtract / Simplify

Net: about 140–175 of +1898 lines (≈8%) removable with no behaviour lost. Ranked by lines saved.

X1. Delete Timing::streaming and the record_commit guard — ~10–12 lines (should fix)

helios/src/server/protocol/encode.rs:79-80 (field), :250 (Timing { streaming, .. }), :255-261 (guard). enable_request_metrics returns streaming && matches!(self.metrics, Some(Single(_))) (:252), and http.rs:363 passes that result as commits, so every record_commit call reaches a Single timing whose streaming was set from the same streaming == true. The && timing.streaming clause at :257 is unreachable-false, and step_ns has no other reader (:543-551). Delete the field and the clause:

pub fn record_commit(&mut self, at_ns: u64) {
    if let Some(RequestMetrics::Single(timing)) = &mut self.metrics {
        timing.step_ns = Some(at_ns);
    }
}

Do not also drop enable_request_metrics's streaming parameter in favour of Encoder::streaming (:97): that field is written only by set_logprobs (:190-193), which needs a Frontend, and the new encoder tests construct encoders through metered() (tests.rs:2318-2332) without ever calling it. Keep the parameter; delete only the duplicate field. (The Conventions lens proposed reading self.streaming; that change would break those tests.)

X2. Collapse generate_observed and enqueue into the existing enqueue_many — ~12 lines (should fix)

helios/src/server/runtime.rs:843-854: generate_observed (:847-849) → enqueue (:851-854) → enqueue_many, a third admission spelling for one prompt. Its only non-test caller, helios/src/server/http.rs:368-372, immediately re-wraps the result in vec![g]. Call state.model.generate_many_observed(vec![prompts.remove(0)], Some(observation.timestamps), commits) there instead; then enqueue has one caller left (generate, :843-845) and can be inlined:

pub fn generate(&self, prompt: Prompt) -> Result<Generation> {
    self.enqueue_many(vec![prompt], None, false).map(|mut group| group.remove(0))
}

Delete generate_observed and enqueue, and the two test call sites that exist only to exercise them (runtime/phase_tests.rs:3749,3803). Keep generate, generate_many (option-off paths, protocol/decisions/mod.rs:838 (not opened), response_lifecycle_tests.rs:122 (not opened)) and generate_many_observed (two real call sites, http.rs:367,374). Note this supersedes the Subtractive lens's weaker variant ("delete generate_many_observed"): that wrapper is reached twice and removing it saves only its signature, whereas generate_observed/enqueue disappear entirely.

X3. Delete the phase tests that re-prove the encoder's placement and null rules — ~90–100 of +559 lines (should fix)

helios/src/server/protocol/tests.rs:2349-2453 already pins, in one place: exact values per protocol, the single carrier frame, choices == [], usage presence, missing include_usage, Messages omitted, n > 1 → null, several prompts → omitted, single-token null, and the all-null shape. helios/src/server/runtime/phase_tests.rs re-proves the same rules through full worker runs:

Keep per_request_metrics_reach…'s remaining assertions and, above all, performance_reports_the_first_scheduled_model_step (:4616-4647) and per_request_metrics_report_the_runtime_instants_of_a_stopped_reasoning_answer (:4693-4743) — those prove the instants land inside the right worker step (within() checks at :4728-4737), which nothing else does. Also fold the redundant :4741 into :4641.

X4. Cut the docs/api.md histogram prose that restates the Prometheus HELP strings — ~35–40 of +178 lines (should fix)

Each population is stated three times: the HELP string shipped with the series (helios/src/server/metrics.rs:1548-1600, e.g. request_queue_seconds at :1554-1558, inter_token_latency_seconds at :1588-1592), the prose at docs/api.md:305-386, and the vLLM correspondence table at :475-517. Compare docs/api.md:328-346 with metrics.rs:1554-1577: near-identical wording. Reduce docs/api.md:311-386 to the facts only the prose can carry — which histograms pair, that they accumulate since server start, and the cancelled/failed exclusion — and let the table at :475-517 tie a vLLM name to a Flare series. This block arrives through #548; agree the cut with that PR rather than duplicating it in both.

X5. Trim the "Per-request metrics" section's restatements — ~25–30 lines (nit)

docs/api.md:1038-1045 restates null rules the table directly above (:1015-1022) already defines and that metrics_value computes (encode.rs:270-293); two sentences suffice: "all six keys are always present; a field is null when the request did not reach the instants it spans (content: bodies and non-text streams; itl: a single token; token fields: no generation)". docs/api.md:1047-1050 restates the event-budget/cost statement that helios/model-contract.md:361-364 carries normatively and links to in the same paragraph. Keep the table, the placement paragraph (:1031-1036), the two-sentence null rule, the shortest form of Should Fix 4, and the model-contract link.

X6. Replace the inline GraphKind list with GraphKind::samples() — ~9 lines (should fix)

helios/src/server/runtime.rs:1746-1757 spells seven graph kinds inline to decide metrics.model_step(...). That is exactly the predicate helios/src/execution/manifest.rs:90-101 defines as samples() (same seven variants, different order), and the same file already consumes it at runtime.rs:2988. A seventh spelling is a second source of truth: a future sampling kind updates samples() and every consumer except this one, and flare_model_step_tokens then silently stops counting it — a drift no test pins. Change to if kind.samples() { self.metrics.model_step(prefill + generated.len() as u64); }. It also expresses the docs sentence added at docs/api.md:383-386, since !samples() is precisely "initialization, restore, vision, and snapshot graphs".

X7. Delete the config bootstrap strict-type loop — ~14 lines (nit, marginal)

helios/src/server/config.rs:734-739 rejects 1, "true" and null. The key's only writer emits a literal (flare-cli/src/main.rs:355-357), and the shipped CLI test per_request_metrics_flag_is_off_by_default_and_reaches_rank_zero (flare-cli/src/cli.rs:1378-1401) covers the flag. Keep the absent/true/false assertions (:727-733); drop the rejecting loop. Least certain of the seven cuts.


Nits

N1. first_scheduled_ns is last-writer-wins in the HTTP handler

helios/src/server/http.rs:542 assigns (first_scheduled_ns = times.first_scheduled_ns;) and :609-615 builds the body's performance from it. With several Finished events the reported value is the last request's, not the earliest. Latent today — helios/src/server/protocol/decode.rs:742-755 rejects n != 1 for every protocol except Completions, and performance is Chat-only (http.rs:609) — so fold anyway: first_scheduled_ns = match (first_scheduled_ns, times.first_scheduled_ns) { (Some(a), Some(b)) => Some(a.min(b)), (a, b) => a.or(b) };.

N2. The first-scheduled stamp precedes a submission that can fail

helios/src/server/runtime.rs:2257-2270 stamps after self.scheduler.commit(step, fence)? and before pack_inputs/pack_vision (:2271-2315), which can return Err. A request whose packing fails keeps a scheduled instant for a step that never executed, and queue_time_ms then describes a step that never ran. Only reachable on the failed-request path (excluded from the histograms, error response), so cosmetic — stamp after a successful pack, or clear the field on the error path.

N3. Magic key count in the encoder test

helios/src/server/protocol/tests.rs:2451 asserts unrecorded.as_object().unwrap().len() == 6, a literal that must track the six keys spelled at :2357-2366. Build the all-null object once from the same key list and compare whole values, so adding a field breaks one place.

N4. The doc comment restates docs/api.md

helios/src/server/protocol/encode.rs:238-243 enumerates placement for all four protocols, the multi-prompt omission and the several-choice null — all stated again in docs/api.md:1031-1045 and partly again in enable_request_metrics's own body. AGENTS.md:190-192 does not count comment expansion as a contribution. Keep only what the code cannot show: "Places vLLM's per-request metrics (see docs/api.md) and returns whether the content instant applies, i.e. whether the worker must send Committed events."

N5. The same flag is described two ways

helios/src/server/../flare-cli/src/cli.rs:646 (Orbit) says "in rank zero's OpenAI responses"; :859-860 (run) says "in OpenAI Chat, Completions, and Responses output" over two lines. Use the run wording in both so flare run --help and flare orbit run --help agree, and align with docs/cli-design.md:736.


Open questions / not verified

#5 [high] Subtraction inventory with line savings (final X1–X7)

Net ≈140–175 of +1898 lines (≈8%) removable, no behaviour lost. Ranked:

X1 (should fix, ~10–12 lines, encode.rs): delete Timing::streaming (encode.rs:79-80, set :250) and the && timing.streaming clause in record_commit (:255-261). Unreachable-false because :252 returns streaming && matches!(..Single(_)) and http.rs:363 feeds that to commits. Replacement body:

pub fn record_commit(&mut self, at_ns: u64) {
    if let Some(RequestMetrics::Single(timing)) = &mut self.metrics {
        timing.step_ns = Some(at_ns);
    }
}

RECONCILIATION: Conventions lens proposed reading self.streaming (Encoder field :97) instead — REJECT that: Encoder::streaming is written only by set_logprobs (:190-193) which requires a Frontend; encoder tests build via metered() (tests.rs:2318-2332) and never call it, so they could not set streaming. Keep the parameter, delete only the duplicated field.

X2 (should fix, ~12 lines, runtime.rs): delete generate_observed (:847-849) and enqueue (:851-854). Caller http.rs:368-372 becomes state.model.generate_many_observed(vec![prompts.remove(0)], Some(observation.timestamps), commits); generate (:843-845) inlines self.enqueue_many(vec![prompt], None, false).map(|mut g| g.remove(0)). Drop test call sites runtime/phase_tests.rs:3749,3803. Keep generate, generate_many (decisions/mod.rs:838, response_lifecycle_tests.rs:122) and generate_many_observed (two call sites, http.rs:367,374). RECONCILIATION: Subtractive lens proposed deleting generate_many_observed (weaker, ~12 lines of signature only). SUPERSEDED — delete generate_observed/enqueue instead.

X3 (should fix, ~90–100 of phase_tests.rs +559): delete the phase assertions re-proving encoder rules — phase_tests.rs:4778 (choices==[]), :4791-4794 (content==ttft), the flag-off loop :4802-4815 (replace with one ~20-line on/off test), and the 56-line n=2 worker-drive block :4816-4871 (covered by protocol/tests.rs:2420-2432). KEEP phase_tests.rs:4616-4647 (performance_reports_the_first_scheduled_model_step), :4693-4743 (stopped reasoning provenance, within() at :4728-4737), :4780 (response.incomplete), :4783-4789. Fold :4741 into :4641.

X4 (should fix, ~35–40 of docs/api.md +178): histogram populations are stated 3×: HELP strings metrics.rs:1548-1600 (request_queue_seconds :1554-1558, inter_token_latency_seconds :1588-1592), prose docs/api.md:305-386 (near-identical wording to :328-346), vLLM table docs/api.md:475-517. Cut :311-386 to the facts only prose carries (which histograms pair, accumulate since server start, cancelled/failed exclusion); let the table at :475-517 map vLLM names. Arrives via #548 — agree the cut with that PR.

X5 (nit, ~25–30 lines): docs/api.md:1038-1045 restates the null table at :1015-1022 and encode.rs:270-293 → two sentences; :1047-1050 restates the budget/cost statement carried normatively by helios/model-contract.md:361-364 and linked in the same paragraph.

X6 (should fix, ~9 lines, runtime.rs): runtime.rs:1746-1757 inline 7-variant match → if kind.samples() { self.metrics.model_step(prefill + generated.len() as u64); }. GraphKind::samples() = manifest.rs:90-101 (same seven, different order); precedent in same file runtime.rs:2988; docs/api.md:383-386 sentence is exactly !samples().

X7 (nit, marginal, ~14 lines): delete config.rs:734-739 strict-type loop (rejects 1/"true"/null); keep :727-733 absent/true/false; covered by flare-cli/src/cli.rs:1378-1401.

#6 [high] Final report structure, counts, and reconciliation decisions

VERDICT: request changes before merge. No serving defect. Layering right; event budget matches worst case; option-off requests/emits nothing. Both blockers are scope/evidence.

COUNTS (must match summary): Blockers 2, Should fix 4, Subtract/Simplify 7, Nits 5.

BLOCKERS B1 Authorization + evidence: no maintainer request/roadmap item/bug/measurement (charter "What gets merged"); #551 open, same author; #552/#553 halted by review on that ground (#553 comments 2026-11-27 05:17, 06:40, closed 2026-11-28 02:05 as superseded); AGENTS.md:188-193,201-205; "CPU overhead under load was not measured". Settle: maintainer statement on #551 + option-off before/after on a served workload. B2 False cost claim: runtime.rs:2257 unconditional per-step monotonic_ns() + per-lane get_or_insert (:2258-2270), and :1829 tokens_committed unconditional — contradicts "No clock read is added in either state" and "one branch per committing step". Serves both #548 histograms and performance.first_scheduled_ns (observation.rs:70-74). Fix = wording + measurement, no code.

SHOULD FIX S1 public GenerationEvent::Finished.times: private-module type (runtime.rs:107, server.rs:16,33-34). Fix: re-export pub use metrics::RequestTimes; at server.rs:33, or keep instants off the public enum. No private_interfaces/deny/warn attrs in tree → cargo check clean is consistent. S2 flag-only home + silently ignored [server] key + limitations only in PR body. Fix: either add Option to flare/src/configuration.rs::Server + Settings + docs/cli-design.md:1317-1319,1342-1348 (as #553 did), or reject the key and record both limitations at cli-design.md:736 + near :1317-1323. S3 queue_time_ms boundary misdescribed (wrong actor, reversed order). Prose lens finding 1; verified against runtime.rs:928 vs :951-953 and :965. Fix description + docs/api.md:1017. S4 docs/api.md:1047-1054 references a performance shape the file never documents (search: only :1051, plus return_token_timestamps :992). Fix: state the four-field top-level shape + shared monotonic origin + derive first_scheduled_ns - enqueue_ns; keep model-contract.md#token-and-timing-observation link (anchor resolves at model-contract.md:326).

NITS: N1 http.rs:542 last-writer-wins → min-fold (latent: decode.rs:742-755 rejects n≠1 except Completions; performance is Chat-only http.rs:609). N2 first_scheduled stamp precedes fallible pack (runtime.rs:2257-2270 vs :2271-2315). N3 magic 6 at tests.rs:2451 (key list at :2357-2366). N4 encode.rs:238-243 doc comment restates docs/api.md. N5 help-text asymmetry cli.rs:646 vs :859-860.

RECONCILIATION CALLS

VERIFIED SOUND (state briefly, no action): event budget runtime.rs:62-84; Committed at position 0 before tokens runtime.rs:1826-1833; times survive preemption (Incoming.record, runtime.rs:1591-1594); option-off wiring http.rs:363; content instant skips reasoning/tool-call/empty/named-tool-choice (encode.rs:541-551); six field definitions vs encode.rs:275-293 and docs/api.md:1015-1022; metrics null-vs-absent disclosed (docs/api.md:1038-1045, http.rs:617-619); flag forwarding parity cli.rs:671-701,697-699 + cli.rs:1378-1401; flare-cli/src/main.rs:353-357 literal write; Slack — none.

#9 [high] Round 2 (head 046aaef) verified facts and final counts

HEAD 046aaef, base main, 22 files, +1757/-77; stacked on open #548.

NEW VERIFIED (this round, by me):

FINAL COUNTS: Blockers 1, Should fix 6, Subtract/Simplify 6, Nits 5. SF1 authorization ack from maintainer; SF2 explicit false impossible (cli.rs:646-649/:860-863 bool; config.rs:73-75; rank_zero main.rs:528; promise docs/cli-design.md:1321-1322,:1337-1338); SF3 cli-design.md:736 orbit default has no config path (config.rs:57 only Command::Run); SF4 ignition debug-serve ignores key + template + stale :1385-1387 sentence; SF5 api.md null paragraph (permanently-null content key, n>1 overstated, zero-token all-null shape); SF6 api.md:1045-1050 references undefined token_timestamps_ns/performance -> define once at :991-992 with return_token_ids requirement, trim to pointer. SUB1 phase_tests ~110 lines; SUB2 docs/api.md:305-386 histogram prose ~30 (shared with #548); SUB3 api.md:1040-1050 trim ~10; SUB4 protocol/tests.rs dead fixture + carriers clones ~7; SUB5 config.rs:727-739 ~12; SUB6 RequestMetrics::Suppressed flatten ~9 (optional, Conventions prefers enum). NITS: cost attribution/step-per-lane; stamp vs submit failure + vision conditioning in queue_time; mean_itl vs interval count; encoder doc comments restate api.md; timed_pass predicate third copy.

#10 [high] FINAL FULL REPORT — PR #560 at 046aaef

Full Review — PR #560 "Emit vLLM-compatible per-request metrics from runtime instants"

Head 046aaef, base main, 22 files, +1757/−77. Stacked on the still-open #548 (its commits are in this branch, so the diff against main mixes both). Reviewed as the layer above #548, as the description instructs.

Recommendation: changes requested. Counts: 1 Blocker, 6 Should fix, 6 Subtract/Simplify, 5 Nits.

The mechanism is right-sized and in the right place: the worker owns every instant, the encoder owns placement, no HTTP-layer clock is read, and with the option off nothing is emitted or requested. Two findings from the previous head are fixed and are not re-reported (RequestTimes is exported; Timing::streaming/record_commit are gone), and the previous round's "false cost claim" blocker is withdrawn because commit 66245920 ("…stamp scheduled time after packing") belongs to #548, exactly as the description states. What remains is one user-facing break of the documented enable path (the Blocker), reachability/doc gaps, and roughly 180 removable lines, most of them in one test file.


Key findings

  1. Blocker — the documented way to enable the feature fails every Ignition command. docs/api.md:1007 and docs/cli-design.md:1318,1349 tell users to write [server] per_request_metrics = true, but ignition/cli/config.py:23-24 has no such key and :112-114 raises unknown key per_request_metrics in [server]. Every Ignition command loads that file through _validate.
  2. Should fix — authorization is still unconfirmed, though the evidence gap is now closed. #551 is a reproducible defect report (llama-swap -1 rates), and the PR now carries live evidence, so the charter's "reproducible bug" gate is plausibly satisfied; but #551 is authored by the same contributor with no maintainer reply, and #552/#553 were stopped by review on charter grounds. One maintainer line settles it.
  3. Should fix — the flag cannot express an explicit false, so a [server] per_request_metrics = true file or a saved Orbit group cannot be overridden for one run, contrary to docs/cli-design.md:1321-1322 and :1337-1338.
  4. Should fix — three documentation claims are wrong or unreachable from the document that makes them: the cli-design.md:736 default for a flag shared by flare orbit run (which has no configuration path), the api.md:1040-1043 null paragraph (a permanently-null field described as an unreached instant, n > 1 null overstated), and api.md:1045-1050 referencing a performance shape the file never defines.
  5. ~180 lines removable with no behaviour lost, ~110 of them in phase_tests.rs (+535): two new HTTP-level tests re-assert encoder rules and hand-roll plumbing served_through_worker already provides.
  6. Verified sound: placement for all four protocols, the first_scheduled_ns earliest-value fold, RequestTimes lifetime through preemption, GraphKind::samples() equivalence, the option-off wiring, and the event-budget/Finished-only event change.

Blockers

B1. The documented [server] per_request_metrics key is rejected by the Ignition schema, breaking every Ignition command

Where: docs/api.md:1007-1009; docs/cli-design.md:1318 (native flare run key list), :1349 (sample config); ignition/cli/config.py:21-33 (_SECTIONS["server"]), :108-120 (_validate), :183-215 (write_initial); loaders ignition/cli/serve.py:127,174,264,431,590, ignition/cli/bench.py:144, ignition/cli/publishing.py:31,73,174,194.

What is wrong.

Why it matters. This is not a doc typo: the enable path the PR documents is unusable for anyone who also runs Ignition, which is the supported way to prepare a core. The PR touched neither ignition/cli/config.py nor tests/cli/test_config.py, and tests/cli/test_config.py:152-171 already parametrizes unknown-key rejection, so CI would catch it the moment the key is added without the schema entry — and catches nothing today.

Requested change. Add "per_request_metrics": bool to _SECTIONS["server"] (ignition/cli/config.py:23-24) and "server.per_request_metrics": False to _BUILT_IN (:37-53), add the commented line to write_initial (:188-192), and add one positive load test beside the existing negatives in tests/cli/test_config.py:152-171. Reproduce with one ignition export while ~/.config/flare/config.toml carries the documented line.


Should Fix

S1. A maintainer still has to confirm that per-request response metrics are in scope

Where: charter "What gets merged"; AGENTS.md:188-193, :201-205; #551; #536; #552; #553.

The charter merges PRs that address "a maintainer request, a roadmap item, a reproducible bug, a measured performance/memory issue, or bad docs". #551 is a reproducible defect — llama-swap v250 reads prompt_per_second/predicted_per_second from a response-body object and shows -1 for Flare — and the PR now carries a 40-check live matrix plus llama-swap rates, so the evidence half of the gate is met. What is missing is authorization: #551 was opened by the same contributor (WynnD, no association) on 2026-11-27 with zero comments, and the maintainer-authored issue in this area (#536) asks for Prometheus histograms, delivered by #548, not for a response-body object. Both predecessors were halted by review on exactly this ground (#553: "Review Stopped … low value or does not align with the project charter", 2026-11-27 05:17 and 06:40; #552 likewise). vLLM is listed under "Alternatives / Competitors", so "vLLM has it" is not itself a merge reason. Requested change (no code): a maintainer comment on #551 or in the PR confirming the scope, and a description that leads with the llama-swap defect rather than with vLLM parity.

S2. The flag cannot express an explicit false

Where: flare-cli/src/cli.rs:646-649 (Orbit) and :860-863 (run) — plain bool; flare-cli/src/config.rs:73-75; flare-cli/src/cli.rs:698-700 (rank_zero_options only emits when true); docs/cli-design.md:1321-1322, :1337-1338.

if !run.enable_per_request_metrics {
    run.enable_per_request_metrics = self.server.per_request_metrics.unwrap_or(false);
}

With per_request_metrics = true in a node's file there is no flag that turns it off for one run, and because rank_zero_options only re-emits the flag when true, an Orbit group that ever captured --enable-per-request-metrics keeps it. This contradicts the documented precedence ("Flags override these defaults, including explicit zero limits and values equal to the built-in defaults"; "saved group options and explicit flags take precedence"). The mechanism already exists next door: --kv-cache-limit memory is re-emitted when matches.value_source("kv_cache_limit") == Some(CommandLine) (cli.rs:662-667). Fix: tri-state (Option<bool> via num_args(0..=1)) or --no-enable-per-request-metrics with overrides_with, forwarded to rank zero; at minimum document the limitation beside the flag, and extend the config test (flare-cli/src/config.rs:222-233 alone asserts ""/true/false in the file with the flag turning it on).

S3. docs/cli-design.md:736 claims a configuration default that flare orbit run does not honor

The new row reads "--enable-per-request-metrics … | [server] per_request_metrics, otherwise off", and the flag is declared on both Run (cli.rs:857-863) and OrbitRun (:646-649), with docs/cli-design.md:170-173 listing it among the flags Orbit applies to rank zero. But the configuration fallback lives in Configuration::apply, whose branch matches only cli::Command::Run (flare-cli/src/config.rs:57-58, key applied at :73-75); OrbitRun gets the value from its flag alone. An operator who sets the key, launches flare orbit run, and follows the table expects metrics and silently gets none. Fix: write "[server] per_request_metrics for native flare run, otherwise off" in the configuration column, matching docs/cli-design.md:1317-1318. Secondary, same row: neither --help string mentions the configuration key (cli.rs:646-648, :860-862), so one clause ("default: [server] per_request_metrics") would make --help and the doc agree.

S4. ignition debug-serve and the generated template ignore the key, and one sentence is now stale

Where: ignition/cli/serve.py:485-487, ignition/cli/config.py:183-215, docs/cli-design.md:1385-1387.

debug-serve builds its bootstrap options from configuration.get("server.*") for the keys it knows — thinking_token_budget and scheduler_checkpoint_extra_work_fraction at serve.py:486-487 — and does not set per_request_metrics, so once B1 is fixed it will silently ignore a setting flare run honors while honoring its two neighbours. write_initial omits the key from the template that docs/cli-design.md:1311-1312 says carries "the resolved values present as comments". And docs/cli-design.md:1385-1387 ("Native Flare ignores keys it does not use, except in [prefix_cache]") gains a second exception once native flare run uses a key Ignition's schema previously rejected. Fix: add the key to serve.py's options dict and to the template, and update that sentence.

S5. docs/api.md:1040-1043 misdescribes a permanently-null field and overstates the n > 1 null

Three problems in one paragraph:

S6. docs/api.md:1045-1050 compares against a shape the HTTP API reference never defines

The new paragraph says the instants are "on the same process-local origin as choices[0].token_timestamps_ns", but a whole-file search finds token_timestamps_ns only at :1048 and return_token_timestamps only at :992. The file never states that the token instants sit beside choices[0].token_ids, that return_token_timestamps: true is rejected without return_token_ids: true (helios/src/server/observation.rs:37-39), or that performance is emitted only on timed responses. The link to ../helios/model-contract.md#token-and-timing-observation resolves (model-contract.md:326), so it is not dangling, but the HTTP reference should define the fields it uses. Fix: one sentence at docs/api.md:991-992 — "return_token_timestamps requires return_token_ids: true; it places per-token instants in choices[0].token_timestamps_ns, aligned with choices[0].token_ids, and, on buffered responses, a top-level performance object" — then let the new paragraph point at it (see SUB3).


Subtract / Simplify

Net ≈180 lines removable (~9% of the ~1,180 added source/test/doc lines once #548's contribution is set aside), ~110 of them in one test file. No finding asks to remove the option itself: #551 is a reproducible client gap and the charter merges PRs that fix one.

SUB1 — should fix, ~110 lines: helios/src/server/runtime/phase_tests.rs:4731-4850

Two new HTTP-level tests re-assert rules already decided and pinned at the encoder, and re-implement the plumbing.

Smaller version (~125 → ~25 lines): delete both tests and keep the flag's reach with one test over the existing helper:

#[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 (:4613-4644) and per_request_metrics_report_the_runtime_instants_of_a_stopped_reasoning_answer (:4685-4728): those prove the instants land in the right worker step, which nothing else does. If an end-to-end drift guard for response.incomplete or the n = 2 null is wanted, route it through served_through_worker(..., true, "/v1/completions", body_with_n_2, &[1]) and assert only metrics.is_null() — ~8 lines instead of ~55. (Open question: nothing in the diff says the carrier assertions at :4759-4762 were added deliberately as a drift guard; a comment stating the intent would settle it, and if it is intended this cut shrinks to the n = 2 block.)

SUB2 — should fix, ~30 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) and that the new correspondence table maps one-to-one (docs/api.md:475-517). Reduce to ~8-10 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. This block arrives through #548, so it is one cut for the stacked pair, not two.

SUB3 — nit, ~10 lines: docs/api.md:1040-1050

:1040-1043's first sentence restates the table rows at :1020 and :1022; keep only the placement sentences (several choices → null, several prompts → omitted) after fixing them per S5, ~3 lines. :1045-1050 re-describes performance fields defined normatively at helios/model-contract.md:344-355, which the same paragraph links; replace with one pointer sentence plus the S6 addition at :991-992, ~4 lines. The placement paragraph (:1031-1038) and the step/queue-arrival paragraph (:1025-1029) are the only place the docs state those boundaries — keep them.

SUB4 — nit, ~7 lines: helios/src/server/protocol/tests.rs:2334-2344, :2366-2374

metered_generation feeds a Reasoning event, an empty Content event and two more content events, but no assertion in per_request_metrics_follow_vllm_placement_and_null_rules reads the reasoning chunk, the empty chunk or the chunk count — every assertion is about the carrier frame's placement or about metrics_value(), which depends only on times and generated = 4. This is leftover setup from the content-instant work that moved to #562, and the doc comment describes behaviour the test does not check. Cut to one Content("answer") apply and /// Feed one generation of four tokens, then finish it. Separately, the carriers closure clones whole frames to read type/choices/usage; collect (&Value, &Value) (as phase_tests.rs:4751-4758 already does) and compare *metrics to &expected.

SUB5 — nit, ~12 lines, marginal: helios/src/server/config.rs:734-739

The for invalid in [json!(1), json!("true"), json!(null)] loop guards a key whose only writer passes a literal boolean (flare-cli/src/main.rs:355-357). Keep the absent/true/false assertions at :727-733; the error text is exercised nowhere else, so cut this only if the test file is being trimmed anyway.

SUB6 — optional, ~9 lines: helios/src/server/protocol/encode.rs:67-79, :232-241

Absent/suppressed/single are equally expressible as Option<Timing> plus a suppressed: bool, dropping RequestMetrics::Suppressed (:69-70) and both match arms (:244, :252-255); and enable_request_metrics(&mut self, streaming: bool) (:233) takes the value already passed at http.rs:378 and again at :388. Two lenses argue for the current shape (the three-state enum reads better than Option<Option<Timing>>; Encoder::streaming is written only by set_logprobs, so folding it in would couple placement to that field), so take this only if the maintainer wants the smaller surface. Do not delete generate_observed/enqueue (runtime.rs:837-844): they are pre-existing on main (main runtime.rs:828-835) and outside this diff.


Nits

N1. The Cost sentences should name #548's commit and say "per step, shared by its lanes"

The description's "This PR adds no clock read; the one monotonic read per scheduled model step comes from #548" is accurate — verified: commit 66245920 ("Reuse GraphKind::samples for model-step metrics and stamp scheduled time after packing") is in pr/548 history and in this branch, and helios/src/server/runtime.rs:2272 is its line — but a reviewer reading this PR's diff against main sees the call arrive. Name the commit, and say the read is per step, shared by every lane through get_or_insert (runtime.rs:2273-2285), so the cost is neither over- nor under-stated. docs/api.md:1025-1026 already says this about completion instants.

N2. mean_itl_ms is not exactly vLLM's on speculative cores

encode.rs:266-268 divides first→last by generated - 1. A speculative step commits several tokens that share one completion instant (docs/api.md:1025-1026), so the true interval count is smaller and the mean is understated relative to vLLM. The count already exists (RequestRecord::tokens_committed, helios/src/server/runtime.rs:1798-1802), but since the table row at docs/api.md:1022 already defines the field as the code computes it, the cheaper fix is one clause in that row ("intervals are counted per generating step, so a speculative step is one interval") rather than a new field.

N3. first_scheduled_ns now follows image conditioning, and still precedes a submission that can fail

The stamp moved after pack_vision/conditioned_inputs_ready (helios/src/server/runtime.rs:2228-2268, stamp at :2272), which is right for the failed-pack case but changes what the instant means on the vision path: queue_time_ms (encode.rs:265) now includes image conditioning, and time_to_first_token_ms (:262) starts after it — while docs/api.md:1018 defines queue time as "Model-queue arrival to the first model step that includes the request". The stamp also now precedes only submit's guards (runtime.rs:2289-2299), which can still fail for that step, so the comment at :2269-2271 covers the pack but not the submit. Either stamp before the vision pack (documenting that a failed pack leaves it null anyway) or say in api.md/model-contract.md that for image requests the instant follows image conditioning.

N4. Three copies of the placement/null rule, two of them in the encoder

encode.rs:232 (pointer), :242-243 (restates the signature) and :248-250 (restates placement, the six-key rule and the content null) repeat what docs/api.md:1015-1043 states and what enable_request_metrics states executably at :233-241. Keep one pointer line each — "The metrics object or its omission, per docs/api.md#per-request-metrics" — so the rule changes in one place.

N5. timed_pass adds a third copy of the step-generates predicate

helios/src/server/runtime/phase_tests.rs:4541-4543:

let generates = matches!(step.kind, GraphKind::Decode | GraphKind::Resume)
    || (step.kind == GraphKind::Prefill
        && lane.start_position + lane.tokens as u64 == live.prompt_tokens as u64);

The identical expression already exists at :452-454 (budget_pass) and :5028-5030. The authoritative semantics live in the scheduler, so if the sampling graph set changes, three test loops silently disagree with production — including the one this PR's evidence relies on. Extract one helper beside completion (:372) and call it from all three sites, or have timed_pass reuse budget_pass's predicate.


Verified sound (recorded so it need not be redone)


Open questions / not verified

  1. Authorization (S1) — one maintainer line on #551 closes it.
  2. Whether Orbit should read [server] per_request_metrics is a design call; the doc fix in S3 stands either way.
  3. Whether the phase-test carrier assertions were deliberate end-to-end drift guards — settles the size of SUB1.
  4. Magnitude of the extra span in queue_time_ms (group validation + channel send + worker pickup) is a measurement question; the docs now state the boundary without asserting a size.
  5. Not verified by me: no GPU, no exported core, no live server, no llama-swap, no Windows or multi-GPU build, no cargo test, no ignition run; CI on head 046aaef reports no checks. The PR's live matrix and CPU numbers are taken at face value. Every finding above is read from the code and docs at 046aaef.
  6. #548 remains open, so this PR's own delta is the encoder, the four Finished emit sites, the config chain and the docs; re-base and re-review after #548 lands.

#11 [high] Research summary

Full report written to scratchpad entry #10; counts-only summary prepared.

Verdict: Changes Requested — 1 Blocker, 6 Should fix, 6 Subtract/Simplify, 5 Nits.

Key reconciliation decisions this round:

Not verified: no GPU/live server/llama-swap/Windows build/cargo test/ignition run; CI on head 046aaef reports no checks. All findings are read from code and docs at 046aaef.

#12 [high] SUMMARY FIELD (counts-only, paste-ready) + full-report pointer

FULL REPORT = scratchpad entry #10 ("FINAL FULL REPORT — PR #560 at 046aaef"). Use it verbatim for the report field.

SUMMARY (use verbatim for the summary field; ~470 chars, no bullets, no code blocks):

Recommendation: Changes Requested

The mechanism is right-sized and correct — worker owns the instants, encoder owns placement, nothing emitted when the option is off — but the documented [server] per_request_metrics key is outside Ignition's config schema, which breaks every Ignition command, and about 180 lines (most in one test file) duplicate rules and plumbing already pinned elsewhere.

END SUMMARY.

Count check against entry #10's sections:

Takeaway sentence must not repeat last round's "false cost claim" (withdrawn) nor claim 2 blockers.

#14 [high] Research summary

Full Review — PR #560 "Emit vLLM-compatible per-request metrics from runtime instants"

Full report (this is the text for the report field).


Full Report

Head 046aaef, base main, 22 files, +1757/−77. Stacked on the still-open #548 (its commits are in this branch, so the diff against main mixes both); reviewed as the layer above #548, as the description instructs.

Recommendation: changes requested. Counts: 1 Blocker, 6 Should fix, 6 Subtract/Simplify, 5 Nits.

The mechanism is right-sized and in the right place: the worker owns every instant, the encoder owns placement, no HTTP-layer clock is read, and with the option off nothing is emitted or requested. Two findings from the previous head are fixed and are not re-reported (RequestTimes is exported; Timing::streaming/record_commit are gone), and the previous round's "false cost claim" blocker is withdrawn because commit 66245920 belongs to #548, exactly as the description states. What remains is one user-facing break of the documented enable path (the Blocker), authorization plus reachability/doc gaps, and roughly 180 removable lines, most of them in one test file.

Key findings

  1. Blocker — the documented way to enable the feature fails every Ignition command. docs/api.md:1007 and docs/cli-design.md:1318,1349 tell users to write [server] per_request_metrics = true, but ignition/cli/config.py:23-24 has no such key and :112-114 raises unknown key per_request_metrics in [server]. Every Ignition command loads that file through _validate.
  2. Should fix — authorization is still unconfirmed, though the evidence gap is closed. #551 is a reproducible defect report (llama-swap -1 rates) and the PR carries a live 40-check matrix, so the charter's "reproducible bug" gate is plausibly met; but #551 is authored by the same contributor with no maintainer reply, and #552/#553 were stopped by review on charter grounds. One maintainer line settles it.
  3. Should fix — the flag cannot express an explicit false, so a [server] per_request_metrics = true file or a saved Orbit group cannot be overridden for one run, contrary to docs/cli-design.md:1321-1322 and :1337-1338.
  4. Should fix — three documentation claims are wrong or unreadable from the document that makes them: the docs/cli-design.md:736 default for a flag shared by flare orbit run (which has no configuration path), the docs/api.md:1040-1043 null paragraph (a permanently-null field described as an unreached instant; the n > 1 null overstated), and docs/api.md:1045-1050 referencing a performance/token_timestamps_ns shape the file never defines.
  5. ~180 lines removable with no behaviour lost, ~110 of them in phase_tests.rs: two new HTTP-level tests re-assert encoder rules and hand-roll plumbing served_through_worker already provides. A further ~37 lines are available if the maintainers prefer the other consistent state for the config key (see B1).
  6. Verified sound: placement for all four protocols, the first_scheduled_ns earliest-value fold, RequestTimes lifetime through preemption, GraphKind::samples() equivalence, the option-off wiring, and the Finished-field-only event change.

Blockers

B1. The documented [server] per_request_metrics key is rejected by the Ignition schema, breaking every Ignition command

Where. docs/api.md:1007-1009; docs/cli-design.md:1318 (native flare run key list), :1349 (sample config block); ignition/cli/config.py:21-33 (_SECTIONS, server entry at :23-24), :37-53 (_BUILT_IN), :108-120 (_validate), :183-215 (write_initial). Loaders: ignition/cli/serve.py:127 (not opened),174,264,431,590; ignition/cli/bench.py:144 (not opened); ignition/cli/publishing.py:31 (not opened),73,174,194.

What is wrong.

Why it matters. The enable path the PR documents is unusable for anyone who also prepares cores with Ignition, which is the supported workflow (docs/cli-design.md:1311-1313). The neighbouring key shows the required chain: thinking_token_budget spans schema :23, built-in :39, validator, serve.py:486 (not opened) and template :192; scheduler_checkpoint_extra_work_fraction spans schema :24, built-in :40, validator, serve.py:487 (not opened) and docs/cli-design.md:1348. The new key copies only the Rust half. tests/cli/test_config.py:152-171 (not opened) already parametrizes unknown-key rejection and would catch the omission the moment the key is added without the schema entry — and catches nothing today. No test in tests/cli/ mentions the key, and the head commit reports no CI checks.

Requested change (one of two consistent states; the first is smaller in effort, the second in code).

  1. Add "per_request_metrics": bool to _SECTIONS["server"] (ignition/cli/config.py:23-24), "server.per_request_metrics": False to _BUILT_IN (:37-53), the commented line to write_initial (:188-192), options["per_request_metrics"] = ... beside ignition/cli/serve.py:486-487 (not opened), and one positive load test beside the existing negatives (tests/cli/test_config.py:152-171 (not opened)). Reproduce with one ignition export while the config carries the documented line.
  2. Or delete the file key instead of extending the strict reader: drop flare/src/configuration.rs:34 (not opened), flare/src/settings.rs:32 (not opened) and :224 (plus its test), flare/src/controller.rs:2566 (not opened), flare-cli/src/config.rs:73-75 (plus its test), the docs/cli-design.md:736,1318,1349 rows and the docs/api.md:1007 clause, keeping flare-cli/src/main.rs:355-357 (not opened) and helios/src/server/config.rs:353-357 (not opened) (the flag still writes the value the runtime reads). That is ~37 fewer lines and also dissolves the file-override half of S2, but it removes the only non-CLI path, the desktop controller through flare settings, which the description names — hence a product call, not a pure simplification.

Should Fix

S1. A maintainer still has to confirm that per-request response metrics are in scope

Where: charter "What gets merged"; AGENTS.md:165-169 (not opened), :188-193, :201-205; #551; #536; #552; #553.

The charter merges PRs that address "a maintainer request, a roadmap item, a reproducible bug, a measured performance/memory issue, or bad docs". #551 describes a reproducible defect — llama-swap v250 reads prompt/decode rates from a response-body object and shows -1 for Flare — and the PR now carries a 40-check live matrix plus llama-swap rates, so the evidence half of the gate is met. What is missing is authorization: #551 was opened by the same contributor (no GitHub association) on 2026-11-27 with zero comments, and the maintainer-authored issue in this area (#536) asks for Prometheus histograms, delivered by #548, not for a response-body object. Both predecessors were halted by review on this ground (#553: "low value or does not align with the project charter", 2026-11-27; #552 likewise). vLLM is under "Alternatives / Competitors", so "vLLM has it" is not itself a merge reason. Requested change (no code): a maintainer comment on #551 or in the PR confirming the scope, and a description that leads with the llama-swap defect rather than vLLM field parity.

S2. The flag cannot express an explicit false

Where: flare-cli/src/cli.rs:646-649 (not opened) (Orbit) and :860-863 (run) — plain bool; flare-cli/src/config.rs:73-75;

if !run.enable_per_request_metrics {
    run.enable_per_request_metrics = self.server.per_request_metrics.unwrap_or(false);
}

flare-cli/src/cli.rs:698-700 (not opened) re-emits the flag only when true; docs/cli-design.md:1321-1322 and :1337-1338 promise that flags override the file and saved group options.

With per_request_metrics = true in a node's file there is no flag that turns it off for a run, and an Orbit group that ever captured --enable-per-request-metrics keeps it. Fix: tri-state (Option<bool> via num_args(0..=1)) or --no-enable-per-request-metrics with overrides_with, forwarded to rank zero — the neighbouring --kv-cache-limit already re-emits on matches.value_source(...) == Some(CommandLine). At minimum document the limitation; flare-cli/src/config.rs:222-234 tests only omission, true, and false-in-file-turned-on. If B1's option 2 is taken, the file half disappears and only the Orbit-group half remains.

S3. docs/cli-design.md:736 claims a configuration default that flare orbit run does not honor

The row reads "--enable-per-request-metrics … | [server] per_request_metrics, otherwise off", and the flag is declared on both Run (cli.rs:857-863 (not opened)) and OrbitRun (:646-649), with docs/cli-design.md:170-173 listing it among the flags Orbit applies to rank zero. But the configuration fallback lives in Configuration::apply, whose branch matches only cli::Command::Run (flare-cli/src/config.rs:57-58, key applied at :73-75); OrbitRun gets its value from the flag alone. An operator who sets the key, launches flare orbit run, and trusts the table gets no metrics and no error. Fix: write "[server] per_request_metrics for native flare run, otherwise off", the phrasing :1317-1318 already uses. Secondary, same row: neither --help string names the configuration key (cli.rs:646-648 (not opened), :860-862); one clause makes --help and the table agree.

S4. ignition debug-serve and the generated template ignore the key, and one sentence is now stale

Where: ignition/cli/serve.py:485-487 (not opened), ignition/cli/config.py:183-215, docs/cli-design.md:1385-1387.

debug-serve forwards thinking_token_budget and scheduler_checkpoint_extra_work_fraction from the config into the runtime options (serve.py:486-487 (not opened)) and does not set per_request_metrics, so once B1 is fixed it will silently ignore a setting flare run honors while honoring its two neighbours. write_initial omits the key from the template that docs/cli-design.md:1311-1312 says carries "the resolved values present as comments". And docs/cli-design.md:1385-1387 ("Native Flare ignores keys it does not use, except in [prefix_cache]") gains a second exception — native Flare uses a key Ignition's schema otherwise rejects. Fix: add the key to serve.py (not opened)'s options dict and to the template, and update that sentence (or, under B1 option 2, drop the sentence's premise instead).

S5. docs/api.md:1040-1043 misdescribes a permanently-null field and overstates the n > 1 null

S6. docs/api.md:1045-1050 compares against a shape the HTTP API reference never defines

The paragraph says the instants are "on the same process-local origin as choices[0].token_timestamps_ns", but a whole-file search finds token_timestamps_ns only at :1048 and return_token_timestamps only at :992. The file never states that the instants sit beside choices[0].token_ids, that return_token_timestamps: true is rejected without return_token_ids: true (helios/src/server/observation.rs:37-39 (not opened)), or that performance accompanies only timed responses (observation.rs:70-74 (not opened)). The ../helios/model-contract.md (not opened)#token-and-timing-observation anchor resolves (model-contract.md:326 (not opened)), so nothing dangles, but the HTTP reference should define the fields it uses. Fix: one sentence at docs/api.md:991-992 — "return_token_timestamps requires return_token_ids: true; it places per-token instants in choices[0].token_timestamps_ns, aligned with choices[0].token_ids, and adds a top-level performance object on buffered responses" — and let the new paragraph point at it (see SUB3).


Subtract / Simplify

Net ≈180 lines removable (~9% of the ~1,180 source/test/doc lines once #548's contribution is set aside), ~110 of them in one test file. No item asks to remove the option itself: #551 is a reproducible client gap and the charter merges PRs that fix one. (A further ~37 lines are available through B1 option 2, deleting the config-file key path; that is counted under B1 because it is a choice between two consistent states, not a pure simplification.)

SUB1 — ~110 lines: helios/src/server/runtime/phase_tests.rs:4731-4850

Two new HTTP-level tests re-assert rules already decided and pinned at the encoder, and re-implement plumbing that served_through_worker (:4563-4610) already provides.

Smaller version (~125 → ~25 lines): delete both tests and keep the flag's reach with one test over the existing helper:

#[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);
    }
}

Nothing is lost: placement and the null rules stay tested where they are decided (helios/src/server/protocol/encode.rs:232-275), and the runtime-instant provenance stays in the two kept tests (:4613-4727 step-bound within(...) checks; :4685-4728 stopped-reasoning provenance).

SUB2 — ~30 lines, shared with #548: docs/api.md:305-386

Four new paragraphs (:305-309, :311-326, :328-346, :348-364) walk every histogram series with the same populations that the Prometheus HELP strings already ship on every scrape (helios/src/server/metrics.rs:1548-1642 (not opened)) and that the correspondence table maps one-to-one (docs/api.md:475-517). Reduce to ~8 lines naming the groups plus the one rule the HELP strings do not carry: successful completions only, and only flare_time_to_first_response_seconds can observe a response that later fails (:361-364). Agree the cut with #548, whose commits arrive here.

SUB3 — ~10 lines: docs/api.md:1040-1050

Once S5 and S6 are applied, :1040-1043's first sentence ("All six fields are always present…") restates the table rows at :1018-1022 and should keep only the n>1/several-prompts clause; :1045-1050 re-describes the performance fields whose normative definition it links (helios/model-contract.md:344-355 (not opened)), so it can shrink to a one-sentence pointer once :991-992 defines the shape. Keep :1025-1029 and :1031-1038: they are the only places stating the step-completion instant, the queue-arrival boundary and the include_usage gap.

SUB4 — ~7 lines: helios/src/server/protocol/tests.rs:2334-2344 and :2366-2374

metered_generation says "Feed one generation that reasons and then answers" and applies Event::Reasoning("think"), then Content(String::new()) + Content("answer"), then Content(" more"); every assertion reads only the carrier frame's type/choices/usage (:2381-2388, :2426) or metrics_value() (:2397, :2405, :2413, :2428), which depend only on times and generated = 4. The reasoning event, the empty chunk and the chunk count are assert-free leftovers from the content-instant work that moved to #562, and the comment claims coverage the test does not have. Keep start(), one apply(0, vec![Event::Content("answer".into())]), record_times, finish. The carriers closure (:2366-2374) also clones whole frames to read two fields; collect (&Value, &Value) as phase_tests.rs:4751-4758 does.

SUB5 — ~12 lines: helios/src/server/config.rs:727-739 (not opened)

The strict-type rejection loop for per_request_metrics (1, "true", null) guards a key whose only writer emits a literal true (flare-cli/src/main.rs:355-357 (not opened)). The absent→false assertion at :727 and the CLI test (flare-cli/src/cli.rs:1378-1401 (not opened)) already cover the behaviour; the loop tests a path no product reaches.

SUB6 — ~9 lines, optional: helios/src/server/protocol/encode.rs:67-72 and :232-241

RequestMetrics::Suppressed exists only so metrics_value can return Some(Value::Null) (:252-255); metrics: Option<Timing> plus a suppressed: bool removes the two-variant enum and its match. Likewise enable_request_metrics(&mut self, streaming: bool) (:233) takes a value already passed two lines earlier (helios/src/server/http.rs:378 (not opened), :388). Take this only if the maintainer wants the smaller surface — three lenses read the enum as the clearer spelling, and folding in Encoder::streaming would couple placement to a field only set_logprobs writes, so the parameter should stay. Do not delete generate_observed/enqueue (helios/src/server/runtime.rs:837-844 (not opened)): identical to main (runtime.rs:828-835 (not opened)), outside this diff.


Nits

N1. The Cost sentences should name #548's commit and say "per step, shared by its lanes"

"This PR adds no clock read; the one monotonic read per scheduled model step comes from #548" is accurate — commit 66245920 is in pr/548 history and in this branch, and helios/src/server/runtime.rs:2272 (not opened) is its line — but a reviewer reading this PR's diff against main sees the call arrive. Name the commit, and say the read is per step, shared by every lane through get_or_insert (runtime.rs:2273-2285 (not opened)). docs/api.md:1025-1026 already says this for completion instants.

N2. mean_itl_ms is not exactly vLLM's on speculative cores

encode.rs:266-268 divides first→last by generated - 1, while a speculative step commits several tokens sharing one completion instant (docs/api.md:1025-1026), so the true interval count is smaller and the mean is understated. The count exists (record.tokens_committed, helios/src/server/runtime.rs:1798-1802 (not opened), one interval per committing step); since docs/api.md:1022 defines the field as the code computes it, the cheaper fix is one clause in that row ("intervals are counted per generating step") rather than a new field.

N3. first_scheduled_ns now follows image conditioning and still precedes a submission that can fail

The stamp sits after pack_vision/conditioned_inputs_ready (helios/src/server/runtime.rs:2228-2268 (not opened), stamp at :2272), which is right for a failed pack but means queue_time_ms (encode.rs:265) includes image conditioning and time_to_first_token_ms (:262) starts after it, while docs/api.md:1018 defines queue time as arrival to "the first model step that includes the request". It also precedes submit's guards (runtime.rs:2289-2299 (not opened)), which can still fail for that step. Either say so in docs/api.md/model-contract.md (not opened) or stamp before the vision pack.

N4. Three copies of the placement/null rule, two of them in the encoder

encode.rs:232 (pointer), :242-243 (restates the signature) and :248-250 (restates placement, the six-key rule and the content null) repeat what docs/api.md:1015-1043 says and what enable_request_metrics says executably at :233-241. Keep one pointer line each so the rule changes in one place.

N5. timed_pass adds a third copy of the step-generates predicate

helios/src/server/runtime/phase_tests.rs:4541-4543 repeats the expression already at :452-454 (budget_pass) and :5028-5030:

let generates = matches!(step.kind, GraphKind::Decode | GraphKind::Resume)
    || (step.kind == GraphKind::Prefill
        && lane.start_position + lane.tokens as u64 == live.prompt_tokens as u64);

If the sampling graph set changes, three test loops silently disagree with production, including the one this PR's evidence relies on. Extract one helper beside completion (:372) and call it from all three sites.


Verified sound (recorded so it need not be redone)


Editorial reconciliation (which lens finding won)


Open questions / not verified

  1. Authorization (S1) — one maintainer line on #551 closes it.
  2. Whether the desktop controller needs the config key decides B1 option 1 versus option 2, and with it whether S2's file half exists at all.
  3. Whether Orbit should read [server] per_request_metrics is a design call; the doc fix in S3 stands either way.
  4. Whether the phase-test carrier assertions were deliberate end-to-end drift guards — settles the size of SUB1.
  5. Magnitude of the extra span in queue_time_ms (group validation + channel send + worker pickup) is a measurement question; the docs state the boundary without asserting a size.
  6. Not verified here: no GPU, exported core, live server, llama-swap run, Windows or multi-GPU build, no cargo test, no pytest, no ignition invocation; the head commit reports no CI checks. The PR's live matrix and CPU numbers are taken at face value. Every finding above is read from the code and docs at 046aaef.
  7. #548 remains open, so this PR's own delta is the encoder, the terminal-event sites, the config chain and the docs; re-review after #548 lands.

summary field

Recommendation: Changes Requested

The mechanism is right-sized and correct — worker owns the instants, encoder owns placement, nothing emitted when the option is off — but the documented [server] per_request_metrics key is outside Ignition's config schema, which breaks every Ignition command, and about 180 lines (most in one test file) duplicate rules and plumbing already pinned elsewhere.

(The full report is also saved at scratchpad entry #10 and the summary text at #12; counts in both match the sections above.)

#15 [high] FINAL REPORT v3 — verified deltas over entry #10 (use with #10)

The final report submitted this turn = scratchpad #10 with the following verified corrections/confirmations (all re-read at head 046aaef this turn). Apply these over #10's citations.

VERIFIED THIS TURN

EDITORIAL RECONCILIATION PARAGRAPH ADDED (new section in v3)

COUNTS UNCHANGED: 1 Blocker, 6 Should fix, 6 Subtract/Simplify, 5 Nits. Verdict: Changes Requested.

#7 [medium] Nit-level citations and open questions not yet captured

NIT DETAILS

AGENTS.md QUOTES (verified): :46-50 read the repo-prose skill, prose must stand alone; :57-60 record unresolved defects/unrun checks/pending measurements in docs/TODO.txt, not design docs; :188-193 reject unsupported abstractions/churn, no switches without a concrete requirement, comment expansion not a contribution; :194-199 tests must exercise the affected behaviour, keep PRs focused; :201-205 explicit maintainer request is sufficient authorization; :452-456 a setting has exactly one of three homes.

OPEN QUESTIONS for the report: (a) were the phase-test carrier assertions added deliberately as an encoder/handler drift guard (shrinks X3 to the :4791-4794 half if so); (b) WinUI persisted config could in principle carry the key — Windows source not in tree; (c) how much more than "microseconds" queue_time_ms spans is a measurement; (d) #548 still open so the histogram half of the diff and the docs/api.md block X4 cuts cannot be judged independently; (e) not re-run: test suites, both cargo check commands, GPU, live server, llama-swap, gateway, Windows.

SUMMARY FIELD (compact, counts-only, <500 chars): recommendation + 1–2 sentence takeaway + Blockers 2 / Should fix 4 / Subtract 7 / Nits 5. No bullets, no code blocks.