Architecture scratchpad · NVIDIA/hyperflare-inference #560

Raw Markdown for agents: https://autobot.eidonix.com/p/06f878f8-4c1d-4579-8343-682057070071.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.

#11 [high] Blocking: documented [server] per_request_metrics key breaks every Ignition command

VERDICT CHANGE vs note #10: this is a new blocking finding for the Architecture-and-scope lens (compatibility of the shared configuration surface), verified in code.

WHAT BREAKS

WHY IT MATTERS (charter/rules)

#12 [high] Should fix: still no maintainer authorization or roadmap item for the feature

Carried forward unchanged from notes #6 and #10; still verified at head 046aaef.

#13 [high] Sound aspects, the schema-sync evidence, and nits at head 046aaef

Verified at head 046aaef; keep as affirmative context in the report.

THE TWO [server] SCHEMAS WERE IN SYNC BEFORE THIS PR — that is what makes the blocker sharp:

LAYERING IS RIGHT (no change from note #10):

RESOLVED EARLIER (do not re-raise): public RequestTimes (helios/src/server.rs:33, helios/src/server/metrics.rs:326); flag-only configuration (now has [server] key, Settings, controller).

NITS (kept from note #7, still true):

  1. mean_itl_ms divides first→last by generated - 1 (encode.rs:266-268) while a speculative step commits several tokens at one instant (docs/api.md:1025-1026), so it understates mean ITL on speculative cores; the true interval count already exists — RequestRecord::tokens_committed observes one interval per committing step (helios/src/server/metrics.rs:348-362, called from helios/src/server/runtime.rs:1795-1802). Carrying that count in RequestTimes would make the field exactly vLLM's.
  2. Scope hygiene: the branch is stacked on the still-open #548, so the diff (+1757/−77, 22 files) is mostly #548's metrics.rs/runtime.rs/scheduler.rs/phase_tests.rs work (e.g. cache_lookup_tokens in helios/src/scheduler.rs:113-115, model_step/tokens_committed in runtime.rs). #560's own delta is the encoder, the four Finished sites, the config chain, and docs. Merge order: #548 first.

NOT VERIFIABLE HERE: the live 40/40 matrix, llama-swap rates, the CPU numbers (no hardware); Windows/multi-GPU; whether #548's own open should-fix items would move these fields.

#14 [high] Blocking (refined): the shared-file asymmetry rule makes this a documented compatibility break

Refinement of note 11, with the asymmetric-design evidence:

docs/cli-design.md:1385-1387 states the design rule explicitly: "Ignition rejects any section or key outside its schema. Native Flare ignores keys it does not use, except in [prefix_cache], where it accepts only memory, disk_limit, drain_on_shutdown, max_age, and compression." Asymmetry: the Rust reader is lenient about unknown keys, the Python reader is strict. So a key that only native Flare consumes cannot be documented in the shared [server] block without breaking Ignition — which is exactly what this PR does (docs/api.md:1007, docs/cli-design.md:1317-1318, :1349).

Also note every existing [server] key in Ignition's schema is actually consumed by Ignition (serve.py:439-440 host/port, :486 thinking_token_budget, :487 fraction, serve.py:66 api_key), so adding per_request_metrics to _SECTIONS["server"] would introduce the first key Ignition accepts without using. That makes the cleaner fix a documentation-scope one:

Either way the current state is a defect: a user who follows the docs loses ignition export/bench/debug-serve/join and the publishing commands with "unknown key per_request_metrics in [server]" (ignition/cli/config.py:113-114).

Severity: blocking for this lens, because the PR's own documentation, if acted on, breaks a supported workflow (preparation and export, including cross-node ignition export --ranks/ignition join) and contradicts docs/cli-design.md:1385.

#15 [high] Research summary

Verdict: one blocking compatibility break, one unchanged scope/authorization finding, two nits. The mechanism itself remains right: worker owns the instants, encoder owns placement, no HTTP clock read, nothing emitted when off.

Blocking (new this pass, verified in code) — the documented [server] per_request_metrics key is outside Ignition's config schema. docs/api.md:1007 and docs/cli-design.md:1317-1318, :1349 tell users to put the key in ~/.config/flare/config.toml (not opened), a file both readers load (docs/cli-design.md:1313; ignition/cli/config.py:19; flare-cli/src/main.rs:83). Ignition validates strictly (ignition/cli/config.py:23-24 schema, :113-114 "unknown key … in [server]") and every command loads the file (serve.py:127,174,264,431,590; bench.py:144; publishing.py:31,73,174,194). So a user following the docs loses ignition export, bench, debug-serve, join and the publishing commands. docs/cli-design.md:1385 states the rule the PR breaks ("Ignition rejects any section or key outside its schema"). The sibling key it was modelled on is mirrored into Ignition (config.py:24,40,119-120; serve.py:487); this one is not, and no tests/cli/test_config.py row was added. Fix: either add it to the Ignition schema plus a test row, or document it as native-Flare-only and keep it out of the shared sample block.

Should fix (unchanged) — no maintainer request, roadmap item, or measured problem authorizes the feature: the only stated requirement is #551 by the same non-maintainer author with zero comments; the maintainer-authored issue in the area (#536) asked for Prometheus histograms, delivered by #548; predecessors #552/#553 were both stopped on charter grounds. Charter "What gets merged" and AGENTS.md:165-169/188-193/201-207 apply.

Nits — mean_itl_ms divides by generated - 1 rather than recorded intervals (understated on speculative cores; the count already exists in RequestRecord); and the branch is stacked on the still-open #548, so most of its diff is #548's.

Withdrawn/closed — the earlier private-RequestTimes and flag-only-configuration findings are fixed at this head; I also withdraw the earlier unmeasured-cost attribution, which belongs to #548.

#16 [high] CURRENT VERDICT (supersedes notes #9 and #10): blocking Ignition-config break + authorization finding + 2 nits

This note is the one the final report should follow. It SUPERSEDES note #10 ("Verdict: should-fix issues only, no blocking") and note #9, because a new blocking finding was verified at the same head.

Head reviewed: 046aaef (no new commits since; commits c4fef6b2, 6c07ef44, a5d47950, f0ccabcc, 046aaef0 on top of the #548 stack). 22 files, +1757/−77.

CURRENT VERDICT: one blocking compatibility defect, one should-fix scope/authorization finding, two nits. The mechanism is sound and should be said so.

ORDER FOR THE REPORT

  1. BLOCKING — documented [server] per_request_metrics breaks every Ignition command (note 11 for the code path, note 14 for the docs rule and the two acceptable fixes). Cite docs/api.md:1007, docs/cli-design.md:1313, :1317-1318, :1349, :1385-1387, ignition/cli/config.py:19, :23-24, :113-114, ignition/cli/serve.py:127,174,264,431,590, ignition/cli/bench.py:144, ignition/cli/publishing.py:31,73,174,194, and the mirrored sibling key at ignition/cli/config.py:24,40,119-120 + serve.py:487.
  2. SHOULD FIX — no maintainer request / roadmap item / measured problem (note 12).
  3. NITS — mean_itl_ms divisor (note 13 item 1); stacked on unmerged #548, so most of the stated diff is #548's (note 13 item 2).
  4. AFFIRMATIVE — layering, off-by-default, placement/null rules, no per-model special cases, honest documentation of the include_usage gap and queue-time origin (note 13).
  5. RESOLVED / WITHDRAWN so they are not re-raised: public RequestTimes, flag-only configuration (both fixed at this head), and the unmeasured option-off cost attribution (belongs to #548). Details at notes #5 and #10.
  6. LIMITS — live 40/40 matrix, llama-swap rates, and CPU numbers were not verifiable here; Windows/multi-GPU not run per the PR; whether #548's open should-fix items move these fields.

CORROBORATION worth one sentence: the @flare-autobot review comment of 2026-11-28 05:42 independently reports the same Ignition-config-schema break as its single blocker ("the documented [server] per_request_metrics key is outside Ignition's config schema, which breaks every Ignition command"), found from the mechanism side; I verified it from the docs/scope side.

CHARTER/RULES TO CITE: charter "Code Review Standards → Supported matrix & compatibility", "What gets merged", "Solve the right problem in the right place", "No per-model special cases or flags", "Bring real evidence"; AGENTS.md:165-169, 188-193, 201-207, 446-456.

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