Verdict: blocking issues
Correctness review — PR #548 "Add request latency histograms and process metrics" (head a34c4d06)
I read all changed files in context (metrics.rs, metrics/process.rs, runtime.rs, http.rs, latency.rs, server.rs, phase_tests.rs, docs/api.md), followed both request_completed call sites and both HTTP delivery arms, and checked the change against the charter and AGENTS.md.
Key findings
- Blocking —
helios/src/server/metrics/process.rs:68callscrate::runtime_core::open_descriptors(), butruntime_coreis compiled only under#[cfg(feature = "runtime-core")]and theserverfeature does not enable it.--features server(a documented and CI-adjacent configuration) no longer compiles. Introduced by commitd64c3ea3("Exclude cancelled responses and reuse host helpers"). - Should fix — the new e2e exclusion is response-scoped while runtime completions are per generation. A response whose sibling choice trips the tool limit loses its
flare_request_e2e_secondsobservation even for generations that the runtime counted as completed, soflare_request_e2e_seconds_count < flare_requests_completed_totaland the newdocs/api.mdinvariant is wrong for multi-choice responses. - Nit —
parse_stat's hard-coded state-character allow-list (process.rs:26) makes every stat-derived metric silently vanish if a kernel reports a state letter outside"RSDZTtWXxKPI".
Blocking 1 — process.rs references a feature-gated module; --features server stops building
Where: helios/src/server/metrics/process.rs:68
let open_fds = crate::runtime_core::open_descriptors();
Why it does not resolve. helios/src/lib.rs:25-26 declares the module conditionally:
#[cfg(feature = "runtime-core")]
pub mod runtime_core;
helios/Cargo.toml:21 defines runtime-core = ["dep:serde", …], and helios/Cargo.toml:25 defines server = ["dep:serde", "images", "grammar", "dep:axum", …] — it does not include runtime-core. So with --features server alone the path crate::runtime_core does not exist and the crate fails to compile, taking the whole server module tree with it.
This is a regression from the previous head. Before d64c3ea3, the only references to crate::runtime_core under helios/src/server/ were inside the #[cfg(feature = "runtime-core")]-gated session module (helios/src/server.rs:26-29) and the gated runtime/prompt_tests.rs:13 (behind #[cfg(all(test, feature = "runtime-core"))], helios/src/server/runtime.rs:3983). search_code for runtime_core under helios/src/server now returns exactly three hits: session.rs:10 (gated), runtime/prompt_tests.rs:13 (gated), and metrics/process.rs:68 (ungated). The gating in server.rs:26-29 shows the crate is meant to build with server alone.
Configurations that break: docs/model-development.md:99 (cargo test … --features server --lib frontend::), docs/model-development.md:100 (--features server --test message_boundaries), and docs/scheduling-runtime-design.md:735-736 (--features server --lib scheduler:: and … --lib server::runtime::phase_tests::). CI (.github/workflows/native-serving.yml:63,68), flare-cli/Cargo.toml:27,44 and AGENTS.md:317 all pass runtime-core,server, so the primary CI lane would not catch this — precisely the configuration nobody tests is the one the docs tell contributors to use.
The other two helpers this commit adopted are fine, which isolates the mistake: crate::os::page_size() (process.rs:61) and crate::os::raise_open_file_limit(0) (process.rs:70) resolve everywhere because mod os; is unconditional (helios/src/lib.rs:19) and os.rs:8 is pub(crate) use flare_eos::*;. AGENTS.md:20-21 puts host OS operations in that layer.
Fix. Move open_descriptors (helios/src/runtime_core/protection.rs:291-302) into eos/src/unix.rs beside page_size and raise_open_file_limit and re-export it through crate::os — the same route the commit already used for the other two helpers — or gate the call on feature = "runtime-core".
Verification status. No CI checks exist on this head, and I could not compile here, so this rests on the cfg/feature reading above. cargo check --manifest-path helios/Cargo.toml --features server settles it in seconds.
Should fix 2 — e2e exclusion is response-scoped, completions are per generation
Where: helios/src/server/http.rs:598-605
// One observation per successful response: a tool-limit cancellation reaches
// this point but the runtime counts it as cancelled, so it is excluded.
if !count && !encoder.tool_limit_reached {
state.model.metrics().request_e2e.observe(…);
}
tool_limit_reached is a flag on the shared encoder, consulted without an index at every use site (http.rs:471-476, http.rs:526, http.rs:563-567), while a single response can carry several generations: generations: Vec<Option<Generation>> is built per choice at http.rs:351-353, each with its own decoder (decoders[index], http.rs:479-487, :525-527).
What goes wrong. Choice i finishes naturally while choice j is still running; the runtime counts i as completed and Metrics::request_completed already ran for it (runtime.rs:1841-1846 / :1996-2001), observing flare_requests_completed_total, queue, prefill, decode, TPOT and prompt-token histograms. Then j trips the tool limit and sets the shared flag. The single end-of-response check at http.rs:600 now sees tool_limit_reached == true and skips e2e for the whole response, including the already-completed choice i. Result: flare_request_e2e_seconds_count under-counts relative to flare_requests_completed_total, and the new docs sentence "Cancelled and failed requests enter only flare_requests_cancelled_total and flare_requests_failed_total" is false for that choice. That is the same class of divergence the PR sets out to eliminate by making the counter and the histograms share one function (metrics.rs:450-480).
Fix. Decide per finished generation rather than per response: skip the observation only when the termination actually used at http.rs:526 is crate::output::Termination::Cancelled, e.g. observe inside the GenerationEvent::Finished arm (http.rs:517-560) or carry a per-index "completed successfully" bit to the end of the loop. A test with size: 2 where one choice hits the tool limit should pin flare_request_e2e_seconds_count == flare_requests_completed_total.
(Not verified by compile; the flag scoping is plain from the code, and a multi-choice test that crosses the parallel tool limit would settle the intended rule.)
Nit 3 — parse_stat silently drops all stat-derived metrics on an unknown state letter
Where: helios/src/server/metrics/process.rs:26
if !fields.next()?.chars().next().is_some_and(|state| "RSDZTtWXxKPI".contains(state)) {
return None;
}
The module doc (process.rs:4-6) promises that only unreadable or unparsable sources omit metrics. Here a valid /proc/self/stat whose state letter falls outside that hard-coded alphabet returns None, which removes process_cpu_seconds_total, process_virtual_memory_bytes, process_resident_memory_bytes and process_start_time_seconds in one stroke — quietly, mid-scrape. Validating instead that the five values this parser actually consumes parse as integers would bound the same "unrelated text containing )" risk the guard exists for (process.rs:20-29) without a fixed alphabet. Low practical risk on today's kernels; recorded because a silent whole-block disappearance is hard to diagnose from a dashboard.
Verified correct (checked in code — no finding)
- Counter and histograms cannot diverge in the runtime.
Metrics::request_completed(metrics.rs:452-480) is the only increment ofcompleted, and the two former directfetch_addsites are now calls into it (runtime.rs:1841-1846user/text stop,:1993-2001natural finish).prompt_tokens/generated_tokensare hoisted so the histograms and theFinishedevent agree. - Per-generation semantics inside
request_completedare sound: queue needsfirst_scheduled_ns, prefill needsfirst_token_ns, decode/TPOT requiregenerated_tokens > 1using saturating subtraction (metrics.rs:462-479), so a request parked and readmitted still yields one observation each becauseIncoming(and its stamps) survives the parked list. - Graceful degradation — each metric is rendered from an independently read source, so one unreadable
/procfile omits only its own series and never fails the scrape (process.rs:62-125). - Non-Linux compilation — all
libcuse inprocess.rsiscfg(target_os = "linux"); the non-Linux stub discards its argument (process.rs:8-14);libcis already a non-optional dependency (helios/Cargo.toml:50) used under unix cfgs elsewhere. Windows was not built (disclosed). process_max_fdsuses the zero-targetraise_open_file_limit(0)(process.rs:69-70), which only reads the soft limit.- My earlier findings are fixed on this head: cancelled tool-limit responses are now excluded from e2e at a single observation point before
yield Delivery::Complete(http.rs:598-606), pinned by the new assertion inruntime/phase_tests.rs; the streaming-drain asymmetry is now documented; the vision-step caveat is documented. The remaining e2e problem is the multi-choice scoping above.
Rules applied
- Charter line 42 — check interactions across every supported configuration; the feature-matrix break in finding 1 is exactly that check.
AGENTS.md:317/.github/workflows/native-serving.yml:63,68only exerciseruntime-core,server, so the documented--features serverlanes indocs/model-development.md:99-100anddocs/scheduling-runtime-design.md:735-736are uncovered — the gap that let finding 1 through.AGENTS.md:182-186(do not weaken stated guarantees) for finding 2's docs contradiction;AGENTS.md:194-199(disclose unrun checks) — the author does disclose the Windows build and full suite.
Evidence limitations
- No CI checks exist on head
a34c4d06and I could not build here; finding 1 is a cfg/feature-graph conclusion, exhaustive by reading (lib.rs:22-26,Cargo.toml:21,25, all threeruntime_corereferences underserver/). - The author's live scrape ran on a cherry-pick onto a fork commit (
5ffe4d54), not onmain, so it says nothing about the branch's build state or about the feature matrix. - The claim that this PR and #537 "merge in either order" is asserted, not tested; they touch different functions of
metrics.rs, so it is plausible.
Open questions
- Is a multi-choice response where one choice hits the tool limit supposed to contribute e2e observations for the choices that completed? Finding 2's fix depends on that call.
- Should
open_descriptorslive ineos/crate::os(the rule the commit itself followed for the other two helpers) rather than staying inruntime_core?
Verdict: blocking issues
Blocking:
helios/src/server/metrics/process.rs:68:crate::runtime_core::open_descriptors()is behind#[cfg(feature = "runtime-core")](lib.rs:22-26) whichserverdoes not enable, breaking--features server(documented indocs/model-development.md:99,docs/scheduling-runtime-design.md:735-736).
Should fix:
helios/src/server/http.rs:600: e2e is skipped for the whole response on the sharedencoder.tool_limit_reachedflag, so a completed sibling choice loses its e2e observation andflare_request_e2e_seconds_countunder-countsflare_requests_completed_total.
Nits: 1 — process.rs:26 hard-codes the stat state alphabet, silently omitting all stat-derived metrics on an unexpected letter.
Link: https://github.com/NVIDIA/hyperflare-inference/pull/548