Architecture and scope review — #560 "Emit vLLM-compatible per-request metrics from runtime instants"
Verdict: should-fix issues only. The layering is right (the worker owns the instants, the encoder owns placement; no clock reads added in the HTTP layer) and the placement/null rules are documented and tested. Three issues argue against merging as-is: one public-API leak, one configuration-surface hole that contradicts the project's own configuration rule, and one authorization/evidence gap under the charter's "What gets merged" clause. No blocking defect found in this lens — nothing here breaks served output or configures itself wrongly by default.
Key findings
- Should fix —
helios/src/server/runtime.rs:107: the public enumGenerationEvent::Finishednow carriestimes: super::metrics::RequestTimes, a type declared in a private module (helios/src/server/metrics.rs:326), so out-of-crate consumers can neither name nor read it (finding 1). - Should fix —
flare/src/configuration.rs:26-34/helios/src/server/config.rs:353-357: the option has no[server]key in theflarelibrary or configuration file, so config-driven front ends cannot enable it, and the keyBootstrapdoes accept is silently dropped by the file parser (finding 2). - Should fix — whole change: no maintainer request, roadmap item, bug or measurement authorizes it, and the option-off runtime work on the worker hot path is unconditional and unmeasured (finding 3).
What I checked and found sound
- Layering and the charter's "solve the right problem in the right place". The change moves timing into the layer that owns the instants (the model worker already reads
completed_at_nsfor the histograms) rather than adding HTTP-layer clock reads, which is exactly what #553 was closed for.helios/src/server/http.rs:361-363shows the division of labour cleanly: the encoder decides placement and returnscommits, which is passed togenerate_observed/generate_many_observed, and the worker only emitsCommitted { at_ns }when it was asked (helios/src/server/runtime.rs:1830-1832). That is the smallest correct footprint for this feature and matches the charter line "Look for the smallest footprint in shared code". - Off-path cost. The only added work when the option is off is the guard at
helios/src/server/runtime.rs:1830and the unchanged event capacity — consistent with the description. TheCommittedvariant atruntime.rs:112-114is additive to the enum; no existing event changed shape exceptFinished. - No per-model special cases. Nothing model-specific is introduced; the rule is protocol-level (Chat/Completions/Responses/Messages), which is where it belongs. The encoder-side null/placement rules are documented in
docs/api.md:1031-1045and matched by the tests the description lists. - Compatibility of the wire format. The option is off by default and no key appears when off (
docs/api.md:1009), so existing OpenAI/Anthropic clients are unaffected. The documented deviations from vLLM (metrics: nullforn > 1in both bodies and streams, nometrics.speculative_decoding) are stated in the description and are honest. - Flag wiring.
flare-cli/src/cli.rs:648(run),:862(orbit run),:697(forwarding) andflare-cli/src/main.rs:355-356(config["per_request_metrics"] = true) match the description, anddocs/cli-design.md:173,736document the rank-zero forwarding. Precedent for a flag with no config key exists (--bypass-performance-check,--verify-weights,docs/cli-design.md:729-730, and[server]keys listed atdocs/cli-design.md:1317-1319do not include them) — but those two are host checks with no persistent-desktop meaning, whereas this one changes served output and the description itself concedes a front end cannot reach it.
Findings
Should fix 1 — a public event field whose type is not nameable outside the crate
Where: helios/src/server/runtime.rs:104-107 (field), helios/src/server/metrics.rs:326 (pub struct RequestTimes), helios/src/server.rs:16 (mod metrics; — private) and :33-34 (pub use metrics::Snapshot;, pub use runtime::{Generation, GenerationEvent, ModelRuntime, Prompt};).
What is wrong: GenerationEvent is re-exported publicly, but its Finished variant now has a field of type super::metrics::RequestTimes, and metrics is not a public module — only Snapshot is surfaced. An out-of-crate consumer of flare_helios::server::GenerationEvent therefore cannot name the type: it cannot read the instants the field was added to carry (it can only pattern-match with ..), and it cannot construct a Finished event in a test or in a substitute runtime. Before this PR Finished was all primitives, so the enum was fully usable from outside.
Why it matters: The charter lists the in-process Rust SDK (#6) as a roadmap item; the public event enum is that SDK's surface. Publishing a field nobody outside the crate can name is a permanent wart, and docs/api.md/helios/model-contract.md now describe the field as part of the contract. It is also the kind of change AGENTS.md's compatibility rules want deliberate rather than incidental.
Fix: Either re-export the type alongside Snapshot (pub use metrics::RequestTimes; at helios/src/server.rs:33), or keep the instants off the public event entirely — they are consumed only by the HTTP encoder, so a field on Incoming/Generation read by the encoder would keep the public enum's shape unchanged. The arrival_ns: u64 field (runtime.rs:105) is fine; only the private-module type is the problem.
What would settle it: cargo check --features server with #![warn(private_interfaces)]/unused visible; the PR reports "clean", so the lint either is not enabled or does not fire for this shape. A one-line compile test (fn assert_nameable(_: flare_helios::server::GenerationEvent)) from an external crate would demonstrate the gap.
Should fix 2 — flag-only configuration is unreachable for config-driven front ends, and the accepted config key is silently dropped
Where: flare-cli/src/cli.rs:648,862 (flag), flare-cli/src/main.rs:355-356 (into config["per_request_metrics"]), helios/src/server/config.rs:353-357 (Bootstrap accepts the key, bool only), flare/src/configuration.rs:26-34 (Server has no such field, #[serde(default)], no deny_unknown_fields), flare/src/settings.rs:19-34 (Settings has no such field), docs/cli-design.md:1317-1319,1343-1348 (native [server] keys and sample config), AGENTS.md:452-456.
What is wrong: two reachability holes.
flare/src/settings.rs:19-34andflare/src/configuration.rs:26-34carry noper_request_metrics, so theflarelibrary — which the WinUI desktop controller and an embedding SDK go through (docs/windows.md:260(not opened): "the Rustflarelibrary owns discovery, …") — cannot enable the option at all. #553, the closed predecessor, did addflare/src/configuration.rs,controller.rs(not opened) andsettings.rssupport; this PR drops that surface.- Because
ServerderivesDeserializewith#[serde(default)]and nodeny_unknown_fields(flare/src/configuration.rs:26-34), an operator who writes[server] per_request_metrics = truegets no error and no effect — the key is silently discarded.docs/cli-design.md:1317-1319lists exactly which[server]keys nativeflare runapplies and this is not among them, and the sample at:1343-1348does not mention it either.
Why it matters: AGENTS.md:452-456 states "A setting has one of three homes: the recipe declaration, the configuration file, or a command-line flag"; the PR picks the flag but leaves the runtime accepting a config key that no front end can supply — the same failure mode the charter prohibits under "Don't silently ignore API fields … Never accept it and quietly drop it", one layer down. The description asserts "The consequences are documented: the WinUI desktop controller reads only configuration settings and cannot enable the option, and a persistent Orbit group that saves the flag cannot turn it off without a negating flag." That is not true of the repository: per_request_metrics appears in docs/ only at docs/api.md:1007 and docs/cli-design.md:173,736, and neither states either limitation.
Fix (either):
- add
per_request_metrics: Option<bool>toflare/src/configuration.rs::Server, thread it throughSettingsintoServerConfigas #553 did, and add the key todocs/cli-design.md:1317and the sample config; or - keep the flag as the only home and make the miss explicit: reject
[server] per_request_metricswhere the config is parsed (or adddeny_unknown_fieldshandling for this key), and record the two limitations indocs/cli-design.md:736anddocs/TODO.txtrather than only in the PR body.
Should fix 3 — authorization and evidence for a runtime-touching feature
Where: charter "What gets merged" and "Bring real evidence"; AGENTS.md "Contribution scope"; the PR description's Cost section.
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 a third-party gateway (llama-swap reading vLLM's metrics), argued in #551 by the same author; #551 is neither a maintainer request nor a roadmap item, and the only linked maintainer issue, #536, asks for Prometheus histograms (delivered by #548), not a response-body object. The two predecessors were halted by review on exactly this ground: #553's discussion records two "Auto-Review halted due to finding: It is low value or does not align with the project charter" (2026-11-27), and #552 is closed likewise. AGENTS.md is explicit that "Hypothetical future consumers … do not establish a need for a change" and that switches are not to be added "without a concrete requirement".
The description also concedes "CPU overhead under load was not measured", while the change adds work to the worker loop that is not gated by the flag: helios/src/server/runtime.rs:1826-1832 calls request.incoming.record.tokens_committed(completed_at_ns) for every committing step of every request (first-token store, and for later steps a histogram observe with an atomic add plus a store), and metrics.model_step runs per completed text step. Whether that is negligible is a measurement question, not an assertion, and the charter asks runtime changes to bring evidence.
Why it matters: scope, not correctness. The right resolution is a maintainer naming the feature on the roadmap (or in #551) and, given a hot-path touch, a before/after number for the option-off path on a served workload. Until then the change is good engineering for an unnamed consumer.
Would settle it: a maintainer statement on #551 or in the PR that per-request response metrics are wanted, plus an option-off throughput/latency comparison against main on a served workload.
Open questions / not verified
- Whether
rustc'sprivate_interfaceslint fires forGenerationEvent::Finished(finding 1) — the PR sayscargo check --features serveris clean; it may be that the lint is not enabled in this workspace. Not settled from the code alone. - Whether the orbit-group "cannot turn the flag off" limitation is a real behavioural gap or merely undocumented: I confirmed no negating flag in
flare-cli/src/cli.rs, but did not trace saved-group option merge precedence beyonddocs/cli-design.md:1337-1340. - The stacked dependency #548 is open; the
Committedevent budget andfirst_scheduled_nscontract inhelios/model-contract.mdcannot be judged independently of it, and I reviewed this diff as the description instructs (as the layer above #548). - Not re-run: the test suites and both
cargo checkcommands reported in the description; no GPU, live server, gateway, or Windows verification exists for this PR, per its own Evidence section.