Verdict: worth merging, with changes — but one hard blocker was just introduced
Re-reviewed at head a34c4d06 (10 files, +548/−25), after d64c3ea3 and a34c4d06. The two review commits fixed most of what I asked for last time, including both e2e blockers. They also introduced a compile break in a documented build configuration. The capability is still worth having and still belongs where it is.
1. New blocker: --features server no longer compiles (introduced by d64c3ea3)
helios/src/server/metrics/process.rs:68 now calls crate::runtime_core::open_descriptors(), but helios/src/lib.rs:25-26 gates pub mod runtime_core; behind #[cfg(feature = "runtime-core")], and helios/Cargo.toml:25 (server = [...]) does not imply runtime-core. Neither server.rs:16 (mod metrics;) nor metrics.rs:12 (pub(super) mod process;) is gated, so on Linux the module compiles without runtime_core in scope and fails to resolve.
- Before this commit,
process.rsreached onlycrate::os(lib.rs:19, ungated) and an inlineread_dir, so the configuration built. - Search confirms it is the only such reference: inside
helios/src/server,crate::runtime_coreappears atprocess.rs:68and atruntime/prompt_tests.rs:13(not opened), and the latter is gated by#[cfg(all(test, feature = "runtime-core"))]atruntime.rs:3983. - CI cannot catch this:
.github/workflows/native-serving.yml:63(not opened) and:68both pass--features runtime-core,server, on Linux and Windows. But it is a documented configuration —docs/model-development.md:99-100(--features server --lib frontend::) anddocs/scheduling-runtime-design.md:735-737(--features server --lib scheduler::,server::runtime::phase_tests::).
Fix (and it is the fix I was already asking for): move open_descriptors into eos/ beside page_size (eos/src/unix.rs:73) and raise_open_file_limit (:138), then call crate::os::open_descriptors(). crate::os is ungated and re-exports flare_eos::* (helios/src/os.rs:8), so the break disappears and the third copy of process introspection goes away at the same time. Gating the call at metrics.rs:12 instead would only hide the layering problem.
2. What the review commits fixed
All verified at head:
- E2E counts cancelled responses (my blocker 1).
http.rs:598-605now observes exactly once, beforeyield Delivery::Complete, guarded by!count && !encoder.tool_limit_reached; the two duplicate observations in the streaming and non-streaming arms are gone (:621,:635).phase_tests.rs:4604-4613pins the tool-limit path toflare_request_e2e_seconds_count 0. This is the right fix — it keys off the same flag the runtime keys cancellation off (protocol/encode.rs:506(not opened),:598). - Docs (should-fix 1–3). The
process_*exception to theflare_prefix (docs/api.md:288-290), "accumulate since server start" (:297), the e2e drain caveat (:303-307), ≥2 generated tokens for decode/tpot (:312-314), the vision-step absorption into queue/prefill (:310-311), and theprocess_*list (:318-321) are all now stated. - OS reads delegated.
process.rs:61usescrate::os::page_size()and:70usescrate::os::raise_open_file_limit(0); sincerlim_cur >= 0always holds,eos/src/unix.rs:145-147returns early andsetrlimitis never called, sodesired = 0is a correct read-only use. Only/proc/self/statandbtimeparsing remain local, which is what I asked for. parse_stathardened.process.rs:26-28now requires the state character to be in"RSDZTtWXxKPI"after the last). I re-derived the offsets againstproc_pid_stat: utime/stime/starttime/vsize/rss are fields 14/15/22/23/24, i.e. indices 10/11/18/19/20 once the state token is consumed, which is exactlyvalue(10), value(0), value(6), value(0), value(0). The test at:142-148matches ([11, 12, 19, 20, 21]).Worker::publishhoistedprompt_tokens/generated_tokens(runtime.rs:1993-1999), matchingWorker::complete.- Histogram arithmetic is sound. 21/19/21 const-generic bounds match the declared arrays;
exposed <= boundgives correct inclusivelesemantics;sumis rendered assum / scale; and becauseobserveincrements exactly one bucket, the cumulative render atmetrics.rs:278-290is correct. The test at:1648-1697covers bucket boundaries and the excluded queue/decode case.
3. Still open
(a) Two histogram implementations, not one. HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS (metrics.rs:200-210), host_cost_sums with its .position(..).unwrap() loop (:670-692), the hand-rolled render loop for the three host_cache histograms (:1029-1065), and flare_host_cache_retirement_seconds (:851-876) all still bypass the new Histogram. Porting those four onto Buckets/Histogram deletes more than it adds and leaves one path in the file; shipping both all but guarantees the next histogram author copies the wrong one.
(b) process_open_fds still self-counts. The read_dir descriptor is included (runtime_core/protection.rs:294-296), and process.rs:113 now documents the +1 rather than subtracting it. Documentation is better than silence, but Prometheus convention and every client-library exporter exclude the counting descriptor, so any dashboard comparing against them reads one high. Subtract one.
(c) Invariant sources re-read per scrape. /proc/self/stat's btime requires reading the whole of /proc/stat (process.rs:65-67), and _SC_CLK_TCK is re-queried (:59), on every text scrape. Both are fixed for the process lifetime; a OnceLock removes it in a few lines. This is the one place the description's "nothing about serving changes" is materially wrong.
(d) Preemption semantics are unstated. Decode and tpot span first→last committed token (metrics.rs:473-478), so a parked-and-readmitted request's tpot is inflated by the parked interval with no way to tell; and the second queue wait is never counted because first_scheduled_ns uses get_or_insert (runtime.rs:2196-2201). The description advertises that the stamps survive parking, but docs/api.md:309-316 says nothing about either consequence. One sentence each, or subtract parked time from decode.
(e) Authorization is still not on record. Under the charter's "What gets merged" — a maintainer request, a roadmap item, a reproducible bug, a measured performance/memory issue, or bad docs — this PR is literally none of the five. #536 is a third-party feature request, and the author is not one of the three named priority contributors. It should be merged as a real capability gap in a surface the project already maintains and already documents (docs/operating.md (not opened) presents flare_host_cache_retirement_seconds as "the latency histogram"), but a maintainer should say so on the PR.
(f) Description still overstates. "Nothing about serving changes" contradicts (c); "CI covers the first two" is an expectation — and now demonstrably not true of the Windows leg for the new break, since CI's flags would mask it; the live scrape still comes from fork 5ffe4d54 plus a cherry-pick, not main; and the Windows build is still not run.
4. Cost and benefit, against the charter
- Benefit is real and moderate. An operator on a workstation or DGX Spark gets P95/P99, queue delay, prefill, decode and prompt-size distributions from one scrape; today the only latency signal is
flare_first_response_median_seconds, a 60-second median that cannot answer any of those, exactly as #536 argues. The larger beneficiary is arguably the maintainers themselves: per-phase histograms are the instrumentation that makes a latency regression visible, which is what the charter's "Bring real evidence" and "measured performance/memory issue" depend on. - A second consumer has appeared, which strengthens the case. #552 ("Report request timings on final responses") is explicitly stacked on this PR — "Merge #548 first" — and reuses
RequestTimesto give llama-swap real prompt and decode rates. So the runtime stamping work here is load-bearing for a directly user-facing integration, not only for histograms. (#553, the separate per-request metrics object, was stopped as low value; that does not bear on this PR.) - Cost is proportionate. ~one relaxed
fetch_addper bucket plus one for the sum, per completed request, on the worker thread; a clock read plus a lane loop per submitted step (runtime.rs:2191-2203); two stores per committed token (:1774-1775). Negligible against a prefill or a 1500-token decode, but unmeasured, and it should be said that way. - Placement is right. No model branch, no flag, no backend, nothing per-model; the observations are recorded in the one function that already increments
flare_requests_completed_total(metrics.rs:452-482, called fromruntime.rs:1841and:1996), so counter and histograms cannot diverge. That is the correct instinct and the reason this fits the charter's "smallest footprint in shared code." The JSON snapshot is untouched, andprocess_*closes an obvious hole beside series the project already ships. - Risk is now concentrated in one place. The serving-path logic checks out; the new risk is build-configuration coverage, which one commit turned from fine into broken. That is the argument for landing the
/proc/rlimitwork ineos/: it removes the cross-feature reference entirely.
5. What to ask for
- Fix the
--features serverbuild — moveopen_descriptorsintoeos/and callcrate::os::open_descriptors()(process.rs:68). - Maintainer sign-off that #536 authorizes the work.
- Port the four existing histograms onto
Buckets/Histogramand delete the old constants, loops, and render block. - Subtract the counting descriptor from
process_open_fds; cachebtimeand_SC_CLK_TCK. - Document the preemption inclusions in decode/tpot and the uncounted second queue wait.
- Correct the description: state the per-step and per-scrape costs as known and unmeasured, and a green CI run on
mainincluding a leg that builds--features serveralone.
With 1 and 2 addressed, this is a small, well-placed, evidence-backed increment to an observability surface the project already maintains — worth merging.
Nothing in this PR or its discussion tried to direct me. The only non-technical comment is the automated case-file notice; the PR text is a reviewable argument and I treated it as such.