Key findings
Reviewed through the architecture-and-scope lens against the project charter, AGENTS.md, docs/design-review.md and the surrounding Helios code. All eight changed files were read in context (metrics.rs, metrics/process.rs, runtime.rs, http.rs, latency.rs, server.rs, phase_tests.rs, docs/api.md), plus eos/src/unix.rs, helios/src/runtime_core/protection.rs, docs/design-review.md and the scheduler's arrival accounting.
No blocking architectural violation. The approach is the right one for the problem: fixed-bound histograms recorded where the completed-request counter is already incremented, no per-request storage, no new snapshot/JSON fields, no flags, no model-specific branches, no crossing of the preparation/runtime boundary.
Two items should gate merge:
- Layering. New
helios/src/server/metrics/process.rsdoes raw procfs/sysconf/getrlimit work inside the serving metrics module, againstAGENTS.md:21-22, duplicating botheos/src/unix.rsprimitives and an existing/proc/self/fdcounter inhelios/src/runtime_core/protection.rs. - Authorization. The PR rests on issue #536, an outside request framed as vLLM dashboard parity; that is not one of the charter's merge criteria and vLLM is a listed competitor, not a compatibility target.
Then: a documentation/code semantics mismatch in docs/api.md, two duplicated mechanisms inside metrics.rs/process.rs, and an unmeasured serving-cost claim with self-inconsistent live-scrape arithmetic in the description. One nit about where the TTFR histogram is rendered.
Order below: verdict → scope → layering → docs semantics → duplication → evidence → nit → what was verified sound → what I did not cover.
1. Should fix — procfs/OS access belongs in eos/, and the /proc/self/fd read already exists in Helios
File: helios/src/server/metrics/process.rs:51-133 (whole render_linux), with :59-77 holding the OS calls.
The new module reads /proc/self/stat, /proc/stat (btime), and /proc/self/fd, and calls libc::sysconf(_SC_CLK_TCK), libc::sysconf(_SC_PAGESIZE) and libc::getrlimit(RLIMIT_NOFILE) directly from inside the serving metrics code.
Why it matters. The repository states the opposite home for this:
AGENTS.md:20-22: "Theeos/crate holds the host operating-system operations that Helios and Selene use."eos/src/unix.rs:73-75already ownspage_size()(the samesysconf(_SC_PAGESIZE)call, with a default), andunix.rs:138-165ownsraise_open_file_limit()built ongetrlimit/setrlimitforRLIMIT_NOFILE. So two of the three primitives this file hand-rolls already exist one crate down.helios/src/runtime_core/protection.rs:290-302already hasopen_descriptors(),read_dir("/proc/self/fd")counted withfilter_map(|entry| entry.ok()), used for the core open-file budget.process.rs:65-67is the same read with the same shape inlined again. There are now two copies of one procfs read with two return conventions (Option<u64>vs inline.ok().map(...)).
This is exactly the charter's first working rule — "Solve the right problem in the right place… Good ideas in the wrong place will be declined, and we'll point you to where they belong" (charter, "How We Work"), backed by AGENTS.md:21-22. It is also the avoidable kind of duplication AGENTS.md:188-193 pushes back on.
Fix. Move the procfs/rlimit reading into eos/src/unix.rs as small Linux-gated typed accessors (page_size exists; add clock ticks and monotonic-free stat/btime/max_fds readers), have runtime_core::protection::open_descriptors and the metrics renderer both call them, and leave process.rs responsible only for metric formatting. This also removes most of the #[cfg(target_os = "linux")] / let _ = text split from process.rs:8-14.
2. Should fix — scope authorization: "monitoring parity with vLLM" is not a merge criterion
Where: PR description ("Closes #536"), and issue #536 "Metrics: add request latency histograms and process metrics for monitoring parity with vLLM", which asks to move existing vLLM Grafana dashboards.
The rules that bear on it:
- Charter, "What gets merged": "PRs that address a maintainer request, a roadmap item, a reproducible bug, a measured performance/memory issue, or bad docs." Nothing in this PR's description ties the work to any of those; it ties it to #536.
AGENTS.md:165-169: "Every contribution must address an explicit maintainer request, a demonstrated defect, a measured performance or memory problem, or inaccurate documentation… Hypothetical future consumers, agent-generated suggestions, and lint findings alone do not establish a need for a change."AGENTS.md:201-202: "An explicit maintainer request covering the work is sufficient authorization" — the converse is that an outside feature request is not.AGENTS.md:203also notes a feature request does not waive an architectural invariant.- Charter, "Alternatives / Competitors": "vLLM, SGLang, TensorRT-LLM, llama.cpp (not opened)." Metric-name and dashboard parity with a listed competitor is not a stated compatibility goal, and
AGENTS.md:188-190warns against "speculative compatibility".
Nothing here is architecturally wrong — the concern is purely that the need is asserted from outside rather than established on this repository's terms. Note also that flare_request_queue_seconds etc. do not match vLLM's names (vllm:time_to_first_token_seconds, vllm:e2e_request_latency_seconds), so "parity with vLLM dashboards" is not even achieved literally; the claimed benefit is generic tail-latency observability.
Fix. Get a maintainer decision recorded on #536 (or on this PR) that metrics parity is wanted, or reframe the description around the defect — tail latency, queue delay, prefill time and decode rate are currently unobservable from a scrape — which is a "measured problem" of the kind the charter accepts for observability work. Either is cheap; relying on an outside issue is the part that will be contested.
3. Should fix — docs/api.md describes semantics the code does not implement
File: docs/api.md:296-318 (the new paragraphs).
3a. flare_request_prefill_seconds silently includes vision/init time
docs/api.md:306-308 says queue time runs "from model-scheduler arrival to the first model step that includes the request", and prefill "from that step to the request's first committed generated token".
first_scheduled_ns is stamped in Worker::reserve_and_pack (helios/src/server/runtime.rs:2187-2203) on every submitted step — the code does not filter by step.kind or lane kind, even though step.lane_kind(row).is_prefill() is already used elsewhere in the same file (runtime.rs:1665-1673, :2281) — and the surrounding context at runtime.rs:2208 shows GraphKind::Vision steps flow through the same function. first_token_ns is stamped only when a token is actually committed (runtime.rs:1774-1775 region, in Worker::complete).
So for a multimodal request the sequence Vision → Prefill → Decode means "queue" is arrival→first Vision step and "prefill" is Vision+Prefill work until the first generated token. That may be a defensible metric, but the doc names it "prefill", and the same file uses a narrower convention for prefill_tokens, "excluding padding and prefix reuse" (docs/api.md:340).
Fix: either narrow the stamp to the first step whose lane kind is prefill, or reword docs/api.md:307-308 to "first model step to first generated token (includes any vision/init step that runs first)".
3b. Population differs per family, and "cancelled and failed requests enter only…" is not the whole story
docs/api.md:312-313 states that cancelled and failed requests appear only in flare_requests_cancelled_total and flare_requests_failed_total. The code does route cancellation to cancelled without calling request_completed, so the headline claim holds for the two obvious paths — but the complement is what the doc does not say and what an operator needs:
Metrics::request_completed (helios/src/server/metrics.rs:452-480) observes flare_request_prompt_tokens unconditionally (:460-461), observes queue/prefill only when first_scheduled_ns is Some, and observes decode/per-output-token only when there is a first token and generated_tokens > 1 (:470-472). It is called from Worker::complete (runtime.rs:1841-1846) and Worker::publish (runtime.rs:1993-1998) for every request reaching the finishing phase, including ones that end with no generated token (budget/EOS close paths around runtime.rs:1940-1947).
Consequence: the request histogram families do not share a denominator with each other or with flare_requests_completed_total, so histogram_quantile(...) over flare_request_prefill_seconds and a rate over flare_requests_completed_total describe different populations. Compare the honest disclosure the JSON-side doc already gives for a similar case.
Fix: say in docs/api.md:305-313 which families a prompt-only request skips, and add a one-line comment in metrics.rs:459-479 saying why prompt tokens is unconditional while the timing families are conditional.
4. Should fix — two histogram implementations and two metric formatters now coexist in one module
Files: helios/src/server/metrics.rs:212-298 (Buckets<const N>, Histogram<const N>), alongside metrics.rs:1029-1065 (HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS plus inline cumulative rendering) and metrics.rs:670-692 (host_lookup_cost); helios/src/server/metrics/process.rs:42-49 (fn metric) alongside metrics.rs:1597-1602 (metrics::metric).
AGENTS.md:188-193 rejects "unsupported abstractions and churn… Do not add frameworks, extension points… Refactoring must directly support the requested behavior or remove a demonstrated source of defects or cost", and docs/design-review.md:16-25 opens with "Keep Helios as simple as possible."
The new Histogram type is genuinely better than what exists — it carries bounds and scale together, selects the bucket with exposed <= bound and a guaranteed f64::INFINITY tail, and renders correct Prometheus 0.0.4 text. That is the argument for migrating the three host histograms onto it in this PR or a follow-up, not for leaving the file with two bucket-declaration conventions (u64 bounds with u64::MAX as +Inf vs f64 bounds with f64::INFINITY) and two render paths, so the next metric author must pick one without guidance.
process::metric is the milder half: it is a copy of metrics::metric minus the flare_ prefix, because process_* names must be unprefixed. A single formatter taking the full name, with callers adding flare_, would keep one implementation.
Fix: either fold the host histograms onto Buckets/Histogram here, or state in the PR that the migration is a follow-up and open the issue; and take a name argument in one shared metric helper instead of copying it into the submodule.
5. Should fix — the serving-cost claim is asserted, not measured, and the live-scrape numbers do not reconcile
Where: PR description, "Claimed result" and "Evidence"; code at helios/src/server/runtime.rs:1774-1775, :2187-2203, helios/src/server.rs:709, helios/src/server/metrics/process.rs:52-133.
docs/design-review.md:97-105 requires honest evidence: "Validate the real path and report evidence honestly… keep raw measurements and disclose unrun checks and material limitations." AGENTS.md:114-121 says the same, and AGENTS.md:194-199 requires each PR to "describe its problem, resulting behavior, validation, and material limitations."
The description says "Observability only… nothing about serving changes" and "This claims no performance or memory improvement". But the change does add serving-path work:
reserve_and_packnow takes a monotonic clock reading and loops overstep.laneson every submitted step (runtime.rs:2187-2203) — first-step only viaget_or_insert, so cost is one clock read plus a lane loop per step.completedoes two stores per committed token (runtime.rs:1774-1775region); a plausible non-issue since the clock was already read there, but the description does not say so./metricsnow always does blocking file I/O on the axum worker thread when rendering:read_to_string("/proc/self/stat"),read_to_string("/proc/stat")(the whole file, to findbtime),read_dir("/proc/self/fd"), twosysconfand onegetrlimitper scrape (server.rs:709→process.rs:52-133). Prometheus scrapes are periodic so the cost is small, butrenderis also called by the terminal dashboard and by tests, and any scrape-time latency is now proportional to those reads. Reading all of/proc/statto findbtimeis avoidable.
And the numbers in the description do not reconcile:
- "Counts gained 5 for each runtime histogram and 6 for the first-response histogram" over a window the description simultaneously says included "this agent session's own requests", and it then concedes the deltas "exceed the three requests below". So the scrape cannot confirm per-request observation counts at all.
- The prompt-token bucket breakdown offered as the cross-check ("
le=\"64\"gained exactly one…le=\"2048\"gained four… the two long prompts plus two session requests") accounts for 5 runtime observations but 6 first-response observations, with no explanation of the sixth. - None of the durations (queue 0.169 s, prefill 0.301 s, decode 19.64 s, e2e 20.26 s) is attributed to an individual request, so a reviewer cannot check internal consistency against the three reported completion-token counts (60, 1500, 695).
- The whole measurement is on the AzallazA fork commit
5ffe4d54with this change cherry-picked, not onmain. That limitation is disclosed, which is correct — but the description should say plainly that these are notmainnumbers and that no scrape-latency measurement was taken.
Fix: keep the unit-test evidence (which does establish the bucket boundaries and the excluded cases) as the primary evidence, restate the live scrape as a smoke check with the population caveat explicit, and state the per-scrape /proc cost as a known, unmeasured cost rather than "nothing about serving changes."
6. Nit — the TTFR histogram is the only family rendered from server.rs
Files: helios/src/server.rs:671 (state.first_response.render_histogram(&mut text)), helios/src/server/latency.rs:34-37, :63-131.
The data and eligibility rule live in FirstResponseSamples in latency.rs, which is the right owner (same clock and same eligibility as the median gauge). But the Prometheus rendering is a one-off in server.rs, while every other family formats via Metrics::render / metrics::metric. Also, render_histogram sits in a second impl FirstResponseSamples block (latency.rs:122-131) separate from the first (latency.rs:63-101). Both are harmless; worth aligning so all histogram output has one home.
What I verified as sound (recorded so it need not be re-derived)
- Counter and histograms cannot diverge. Both former direct
completed.fetch_addsites are gone; the only increment ismetrics.rs:459insiderequest_completed. The two call sites match the description: user/text stop atruntime.rs:1841-1846, natural finish atruntime.rs:1993-1998. - Preemption preserves the stamps. Parking moves
Incominginto the parked list and readmission reuses it, sotimessurvives a park — the description's claim holds, and the citedphase_testscase exercises it. - Bucket math and render.
Histogram::observeuses first-matchexposed <= boundwithunwrap_or(N-1), every array ends atf64::INFINITY,_countis the last bucket, and integer ns truncation is harmless against the 1 ms smallest bound. Output is valid Prometheus 0.0.4 for counters and histograms. - JSON untouched.
Snapshotgained no fields (metrics.rs:69-130), soformat=jsonandflare_helios::server::Snapshotdeserialization are unchanged. parse_statcorrectly skips to the last)so acommcontaining)or spaces cannot shift fields, and returnsOptionso a malformed file omits only dependent metrics.- No boundary or model-specificity problems. Nothing crosses
docs/design-review.md:27-30; there is no per-model branch, no flag, no environment switch, no new captured-graph operation family, and no prepared-metadata change — soAGENTS.md's compatibility expectations are satisfied by not touching prepared artifacts.
Open questions / not covered
- The terminal dashboard path (
server/dashboard.rs(not opened) also callsrender()) — I did not verify what repeated/procreads per dashboard refresh cost there. - The Orbit multi-host
/metrics?format=jsonconsumer (docs/orbit.md:545(not opened)) — unaffected by the design as far as I read, but not exercised. - Whether
phase_testscovers the streamedDelivery::Completee2e path or only the non-streaming case; the description's streamed case checks the failure path, not a streamed success. - The Windows build (unrun, disclosed) — only risk I see is that the process metrics vanish entirely there, which the doc states.
- Overlap with #537 (also edits
metrics.rs, different region) and #549 (same author, same day): merge-order is claimed safe and the regions do look disjoint, but I did not diff them.