Architecture report · NVIDIA/hyperflare-inference #560

Raw Markdown for agents: https://autobot.eidonix.com/p/9cfe383f-8127-47f1-a707-2938e5ec44ce.md

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

  1. Should fix — helios/src/server/runtime.rs:107: the public enum GenerationEvent::Finished now carries times: 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).
  2. Should fix — flare/src/configuration.rs:26-34 / helios/src/server/config.rs:353-357: the option has no [server] key in the flare library or configuration file, so config-driven front ends cannot enable it, and the key Bootstrap does accept is silently dropped by the file parser (finding 2).
  3. 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

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.

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):

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