Architecture scratchpad · NVIDIA/hyperflare-inference #560

Raw Markdown for agents: https://autobot.eidonix.com/p/8037ad96-e465-47c3-98fc-ae414a1fee6a.md

#1 [high] Should fix: RequestTimes from a private module leaks into the public GenerationEvent

helios/src/server.rs:16 mod metrics; is private; :33 pub use metrics::Snapshot;; :34 pub use runtime::{Generation, GenerationEvent, ModelRuntime, Prompt};.

This PR makes RequestTimes pub inside that private module (helios/src/server/metrics.rs, new pub struct RequestTimes) and then uses it as a field type of the public enum: helios/src/server/runtime.rs:106-107 times: super::metrics::RequestTimes on GenerationEvent::Finished, and the new Committed { at_ns } variant at :109-114.

Consequence: an out-of-crate consumer of flare_helios::server::GenerationEvent cannot name RequestTimes (the metrics module is not public), so it can only ignore the field with ..; it cannot read the instants it was added to carry, and cannot construct a Finished event for tests or a substitute runtime. Before this change Finished had only primitives, so the enum was usable. The in-process Rust SDK is an explicit roadmap item (charter, "In-process Rust SDK (#6)"), so the public event shape is the SDK surface.

Fix options: keep the instants out of the public event (a private side channel on Incoming/Generation that the HTTP layer reads), or declare them in a public module (pub use metrics::RequestTimes; alongside Snapshot at server.rs:33). The arrival_ns field is fine; only the private-module type is the problem.

Verified in the diff and in server.rs; whether rustc's private-interface lint also fires can be settled by cargo check --features server and reading warnings, which the PR reports as "clean", so it may already warn or not.

#2 [high] Should fix: flag-only configuration leaves the option unreachable for config-driven front ends and silently drops a config key

The option is only --enable-per-request-metrics on flare run / flare orbit run (flare-cli/src/cli.rs:648, :862; forwarded at flare-cli/src/main.rs:355-357 into config["per_request_metrics"]) plus the runtime JSON key per_request_metrics accepted by Bootstrap (helios/src/server/config.rs:353-357).

Paths that cannot reach it:

The PR 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." Verified against the repository, that is not documented: search_code per_request_metrics in docs/ returns only docs/api.md:1007 and docs/cli-design.md:173,736, and none of them states either limitation. AGENTS.md requires disclosure of such gaps ("Identify missing hardware, inputs, and unrun checks explicitly"; record unresolved items in docs/TODO.txt), and #553's own docs did describe the [server] key.

Rules cited: AGENTS.md "Configuration — A setting has one of three homes: the recipe declaration, the configuration file, or a command-line flag"; "Contribution scope and rejection criteria — Reject weakened guarantees ... silently substitute execution paths"; charter "Don't silently ignore API fields" (same failure mode at the config-file layer).

Fix: add per_request_metrics: Option<bool> to flare/src/configuration.rs::Server and thread it through Settings into the served config as #553 did, or reject the key explicitly where the config is parsed and document that the flag is the only home. Also add the two limitations to docs/cli-design.md:736 or docs/TODO.txt.

#3 [medium] Should fix: no maintainer authorization for the feature and no measured cost despite runtime work on the hot path

Charter "What gets merged": PRs addressing "a maintainer request, a roadmap item, a reproducible bug, a measured performance/memory issue, or bad docs". AGENTS.md "Contribution scope": "Hypothetical future consumers ... do not establish a need for a change"; "Reject unsupported abstractions and churn. Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement."

Justification is a third-party gateway (llama-swap) reading vLLM's metrics object (#551, same author; #551 states llama-swap "does not scrape /metrics"). #551 is not a maintainer request and not on the roadmap. The only linked maintainer issue is #536, which #548 closes and which asks for Prometheus histograms, not a response-body object. Prior attempts #553 and #552 were closed after Autobot halted review on "low value or does not align with the project charter". The feature's authorization therefore rests on a consumer the project has never named as supported.

Cost claim in the description: "No clock read is added in either state" and option-off cost "one predictable branch per committing step at position zero". Even off, the stacked diff adds unconditional work to the worker loop: