Architecture scratchpad · NVIDIA/hyperflare-inference #560

Raw Markdown for agents: https://autobot.eidonix.com/p/d7064fb3-dcaa-4618-bf75-938309d255a9.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.

#5 [high] Re-review of head 046aaef: prior findings 1 and 2 are resolved

Head 046aaef (commits a5d47950, f0ccabcc, 046aaef0) resolves two of the three earlier findings.

RESOLVED — finding 1 (public event field of a private-module type):

RESOLVED — finding 2 (flag-only configuration / silently dropped key):

Also newly documented at head (previously a documentation gap I raised): the include_usage gap and Flare's lack of a --enable-force-include-usage equivalent (docs/api.md:1031-1038), the queue-time origin including the channel send (:1025-1029), null-field rules (:1040-1043), and the performance.first_scheduled_ns field (:1045-1050).

#6 [high] Should fix: authorization for the feature plus an unmeasured, unconditional option-off cost

Finding 3 from my earlier report stands at head 046aaef, though it is now the only issue I would raise. Restated with head citations:

(a) Authorization. Charter "What gets merged" merges PRs that address "a maintainer request, a roadmap item, a reproducible bug, a measured performance/memory issue, or bad docs"; AGENTS.md:165-169 adds that "Hypothetical future consumers, agent-generated suggestions, and lint findings alone do not establish a need", and AGENTS.md:188-193 forbids "configuration switches without a concrete requirement". The only requirement cited is #551 (opened by the same author, 2026-11-27, no maintainer reply, 0 comments) and the maintainer issue #536 asks for Prometheus histograms only (delivered by #548). Predecessors #553 and #552 were both closed after Autobot "Review Stopped … low value or does not align with the project charter" (#553 comments 2026-11-27 05:17 and 06:40); #560 re-argues the same feature. Charter "Bring real evidence" and AGENTS.md:201-207 mean a feature request does not waive the merge criteria.

(b) Off-path cost is still unconditional and unmeasured in a way the description overstates. The feature-flag module is off only for the serialization: the worker-side accumulation runs for every request regardless of per_request_metrics:

Severity: should fix / maintainer decision. Not blocking on correctness: with the option off there is no wire-format change (encoder only touched behind state.per_request_metrics, helios/src/server/http.rs:387-389), no new allocation, and the added work is small — but the merge criteria and the description's cost claim both need settling by a maintainer plus a same-commit measurement.

#8 [high] Research summary

Verdict: should-fix issues only (no blocking defect in this lens)

Re-read at the new head 046aaef. Two of my three earlier should-fix findings are now resolved in code and docs: RequestTimes is exported beside Snapshot (helios/src/server.rs:33, metrics.rs:326), so the public GenerationEvent::Finished field is nameable; and per_request_metrics now has a [server] key threaded through flare::configuration, Settings, and controller.rs:2566 into Bootstrap (which rejects non-booleans), with the flag overriding config and docs updated — the "accept and quietly drop the key" problem is gone.

One should-fix finding remains, unchanged in substance: the feature has no maintainer request or roadmap item behind it (only #551 by the same author; predecessors #552/#553 were stopped on charter grounds), and the worker-side accumulation — record.tokens_committed per committing step at runtime.rs:1800, metrics.model_step at :1727, and the per-step monotonic_ns() stamp at :2262 — runs for every request regardless of the option, which contradicts the description's claim that option-off work is only copying instants into the terminal event. The cost is small and unmeasured; the charter and AGENTS.md want a maintainer decision plus a same-commit option-off measurement.

One nit: mean_itl_ms divides by generated - 1 rather than the recorded inter-token interval count, so it understates ITL when speculative steps commit several tokens at one instant — the deviation is documented, but the interval count already exists in RequestRecord, so carrying it would make the field exactly vLLM's. Everything else in the lens (layer roles, protocol placement, null rules, off-by-default wire compatibility, no per-model special cases) is sound. Findings are in scratchpad notes 5, 6 and 7.

#9 [high] Verdict at head 046aaef — supersedes note #4

This note supersedes note #4 (my 2026-11-27 report of run 1713), which described the previous head (046aaef's parent). Do not repeat note #4's findings 1 and 2 as live issues: both are fixed at head 046aaef (see note #5 for citations).

Verdict for the report: should-fix issues only; nothing blocking in the Architecture-and-scope lens.

Order of findings:

  1. Should fix — authorization and unmeasured, unconditional option-off cost (note #6, full detail there). No maintainer request / roadmap item / bug / measurement authorizes the feature (charter "What gets merged"; AGENTS.md:165-169, 188-193); the only named consumer is llama-swap via #551, opened by the same author with no maintainer reply, and the predecessors #552/#553 were both stopped as "low value or does not align with the project charter". Separately, the worker-side accumulation is not behind the flag — record.tokens_committed per committing step (helios/src/server/runtime.rs:1800-1802, metrics.rs:352-362), metrics.model_step (:1727-1729, manifest.rs:90-101), and the per-step monotonic_ns() stamp plus per-lane loop in reserve_and_pack (:2262-2275) — so the description's summary line "With the option off, the only work this PR adds is copying the request's instants into the terminal event" does not describe the code. The PR's CPU numbers (15.4-15.9 s vs 16.0-16.3 s) are noisy ranges from an earlier revision, not a same-commit option-off A/B against main, which the charter's "Bring real evidence" and AGENTS.md:194-199 ask for on a runtime touch.

  2. Nit — mean_itl_ms is not exactly vLLM's on speculative cores (note #7): encode.rs:266-268 divides the first→last interval by generated - 1, while speculative steps commit several tokens at one instant (api.md:1025-1026), so the mean is understated; the true interval count is already tracked in RequestRecord (metrics.rs:343-362). Documented, hence nit.

What is sound and should be said affirmatively in the report: the layering is right (worker owns instants, encoder owns placement at encode.rs:232-275, http.rs:387-389/613-615, no HTTP-layer clock reads); the option-off wire format is unchanged and no key is emitted (api.md:1009); Messages is excluded and the n > 1 / multi-prompt null/omit rules are enforced and tested (encode.rs:233-241, protocol/tests.rs:2347+); no per-model special cases are introduced; documentation of limits (include_usage gap, no --enable-force-include-usage equivalent, queue-time origin including the channel send, null rules, first_scheduled_ns) is now present at api.md:1005-1050 and cli-design.md:736/1317-1318/1349.

Open question worth stating: whether the option-off increment on the worker loop is worth a flag at all is a maintainer judgement, not something I can settle from the code; a same-commit served-workload comparison would settle the cost half.

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

#7 [low] Nit: mean_itl_ms understates ITL on speculative cores; read coverage list

Nit (accuracy of a vLLM-parity field, documented): mean_itl_ms divides the first→last committed-token interval by generated - 1 (helios/src/server/protocol/encode.rs:266-268), but a speculative step commits several tokens sharing one completion instant (docs/api.md:1025-1026), so the effective number of intervals is smaller than generated - 1 and the reported mean inter-token latency is understated on speculative cores relative to vLLM, which averages over recorded inter-token intervals. RequestRecord already keeps that interval count for the histograms (helios/src/server/metrics.rs:343-362, one observe per committing step), so carrying it in RequestTimes would make the field exactly vLLM's. The deviation is stated in docs/api.md:1022 and is not a correctness bug for the placement/null contract, hence nit only — but it is the one field where the "vLLM-compatible" claim is loose.

For the record: I read the changed files in context at head 046aaef (docs/api.md:1005-1050; docs/cli-design.md:1317-1349, 170-175, 733-737; flare-cli/src/cli.rs:512-540, 640-700, 726-731, 857-866, 1375-1401; flare-cli/src/config.rs:42-76, 130-200, 219-233; flare-cli/src/main.rs:334-360, 595-720; flare/src/configuration.rs:1-70; flare/src/settings.rs:18-90, 220-226; flare/src/controller.rs:2560-2580; helios/model-contract.md:340-360; helios/src/server.rs:9-35, 120-180, 325-340; helios/src/server/config.rs:340-360, 719-740; helios/src/server/http.rs:340-660; helios/src/server/metrics.rs:320-380; helios/src/server/observation.rs:50-80; helios/src/server/protocol/encode.rs:60-280, 660-800; helios/src/server/runtime.rs:90-115, 1690-1760, 1790-1900, 2225-2300; helios/src/execution/manifest.rs:85-102; plus the diff of runtime/encode/tests). Everything else in this lens is sound: the worker owns the instants, the encoder owns placement, Messages is excluded, multi-prompt and n>1 rules are enforced and tested, and nothing is requested or emitted when the option is off.