#1 [high] Should fix: procfs/OS access added inside helios serving metrics instead of eos
PR 548 adds helios/src/server/metrics/process.rs (+184), which does raw OS work from the serving metrics module: std::fs::read_to_string("/proc/self/stat"), /proc/stat btime, std::fs::read_dir("/proc/self/fd"), libc::sysconf(_SC_CLK_TCK), libc::sysconf(_SC_PAGESIZE), libc::getrlimit(RLIMIT_NOFILE) (process.rs:51-133).
Why it matters — the repository states the opposite home for host-OS operations:
- AGENTS.md:21-22: "The
eos/crate holds the host operating-system operations that Helios and Selene use." - eos/src/unix.rs already owns exactly these primitives:
page_size()(unix.rs:73-75, sysconf _SC_PAGESIZE),raise_open_file_limit()(unix.rs:138-165, getrlimit/setrlimit RLIMIT_NOFILE),free_space()(statvfs). - helios/src/runtime_core/protection.rs:290-302 already has
open_descriptors(), byte-identical in intent to process.rs:65-67 (read_dir("/proc/self/fd")+ count), used for the core open-file budget. There are now two copies of the same procfs read with different return conventions (Option<u64>vs inline).
So the change both duplicates an existing helios helper and puts platform/OS code in a layer the project assigns to eos. Fix: move the procfs/rlimit reading into eos/src/unix.rs (Linux-gated, Windows returns None) as small typed accessors, and have both runtime_core::protection::open_descriptors and the metrics renderer call them; keep process.rs to formatting only. This also removes the reason for the manual #[cfg(target_os = "linux")]/let _ = text split.
Cite: AGENTS.md:21-22, eos/src/unix.rs:73,138, helios/src/runtime_core/protection.rs:290-302, helios/src/server/metrics/process.rs:51-133.
#2 [high] Should fix: scope authorization — "monitoring parity with vLLM" is not a merge criterion
The PR's whole justification is issue #536 ("Metrics: add request latency histograms and process metrics for monitoring parity with vLLM", opened by Napuh, not a maintainer in this repo's contributor list), which asks to "move existing vLLM Grafana dashboards" to Flare.
Rules that bear on this:
- 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." Also AGENTS.md:201-203: "An explicit maintainer request covering the work is sufficient authorization"; the converse is that an outside feature request is not.
- 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 the PR description ties the work to a maintainer request, roadmap item, measured problem, or a doc defect; it ties it to #536.
- Charter "Alternatives / Competitors: vLLM, SGLang, TensorRT-LLM, llama.cpp" — vLLM metric-name/dashboard parity is not a stated compatibility goal, and AGENTS.md:188 warns against "speculative compatibility".
Nothing here is architecturally wrong; the point for the author is that the PR needs a maintainer decision recorded on the issue, or should be reframed as a defect (e.g. "tail latency is unobservable") rather than as vLLM parity. Also note the observation volume is real work in the hot path (a per-completion histogram update plus an extra render of ~6 families with 21/19 buckets), so "observability only, nothing about serving changes" (PR description) is an unmeasured claim about serving cost, not a proven no-op.
Cite: PR description "Closes #536", issue #536, AGENTS.md:165-169,201-203, charter "What gets merged" and "Alternatives / Competitors".
#3 [high] Should fix: api.md histogram semantics do not match the stamps (prefill includes vision/init; population differs)
docs/api.md:296-313 (new paragraph) states request-histogram semantics that the code does not implement as written. Both cases are user-visible in a scrape, so they are documentation defects, not code defects — but they must be reconciled with either the code or the text.
-
Prefill time. api.md:307-308 says
flare_request_prefill_secondsruns "from that step to the request's first committed generated token". Butfirst_token_nsis stamped inWorker::completewhen a token is generated (runtime.rs:1774-1775), andreserve_and_packstampsfirst_scheduled_nson every step, including vision/prefill/decode (runtime.rs:2189-2203: it does not filter bystep.kind). So for a request that goes Vision -> Prefill -> Decode, "queue" is arrival to the first Vision/Init step and "prefill" is Vision+Prefill+prefill-queue time to the first generated token. Whether that is intended is arguable, but the doc calls it "the first model step that includes the request", which is accurate for queue and then says prefill is "from that step", i.e. it silently includes all pre-token graph work under the name "prefill". Compare the existing convention in the same file:prefill_tokens"excluding padding and prefix reuse" (api.md:340). Recommend either narrowing the stamp to the first step whose lane kind is prefill (step.lane_kind(row).is_prefill()is already used at runtime.rs:2281 and 1665-1673), or wording the metric as "first model step to first generated token". -
"Cancelled and failed requests enter only
flare_requests_cancelled_totalandflare_requests_failed_total" (api.md:312-313). False for two paths I can see in the code:- A successful request whose client disconnects after/generating:
Generation::cancel()is called on drop (runtime.rs:175-179) and the runtime takes thefinish_cancelledpath (runtime.rs:293-300, 1334-1337) which does not count completed; it incrementscancelled(runtime.rs:1407). Consistent. - But a request whose response is delivered while the batch also had a tool-limit cancel, or a request cancelled after
request_completedran inWorker::complete(runtime.rs:1841-1846) and then retired, will sit in both. That is unavoidable and fine. The real inconsistency is the converse:request_completedis called fromWorker::publish(runtime.rs:1993-1998) for every request that reaches the Finishing phase, including ones whosegenerated_tokensis 0 for reasons other than cancellation (e.g.max_new_tokensexhausted by the reasoning-budget close path, runtime.rs:1940-1947 which callsrecord_decoded_token+progress, and the EOS-on-first-token path). Those are "completed" inflare_requests_completed_totaltoday too, so the counter semantics are preserved — good — but the doc's claim "one observation per completed generation" then includes prompt-only/generation-less requests inflare_request_prompt_tokensandflare_requests_completed_totalwhile contributing no queue/prefill/decode observation. The bucket counts therefore do not share a denominator across the request families, andhistogram_quantileover e.g.flare_request_prefill_secondsis over a different population thanflare_requests_completed_total. The doc should say which families skip which requests (it half does: decode "with at least two generated tokens", api.md:308-309) and the code should say why prompt_tokens is observed unconditionally while the others are conditional (metrics.rs:459-479).
- A successful request whose client disconnects after/generating:
Cite: docs/api.md:296-313, helios/src/server/runtime.rs:1774-1775, 1841-1846, 1940-1947, 1993-1998, 2187-2203, helios/src/server/metrics.rs:452-480.
#8 [high] Research summary
I reviewed PR #548 through the architecture-and-scope lens, against the charter, AGENTS.md, docs/design-review.md and the surrounding Helios code. All eight changed files were read in context (metrics.rs, process.rs, runtime.rs, http.rs, latency.rs, server.rs, phase_tests.rs, docs/api.md) plus eos/, runtime_core/protection.rs and the scheduler's arrival accounting.
The mechanics are sound: the two direct completed.fetch_add sites are genuinely gone and both now go through Metrics::request_completed, parked requests keep their Incoming so the timestamps survive preemption, Histogram bucket/render output is correct Prometheus 0.0.4, and format=json is untouched. I recorded that verification so it need not be re-derived.
Findings, six recorded in the scratchpad:
- Should fix — layering (entry 1). New
metrics/process.rsdoes raw procfs,sysconfandgetrlimitwork inside the serving metrics module, while AGENTS.md:21-22 assigns host-OS operations toeos/(which already haspage_sizeand agetrlimit-basedraise_open_file_limit), andruntime_core/protection.rs:290-302already holds an identical/proc/self/fdcounter that this change duplicates. Fix: put the accessors ineos/src/unix.rs, share them withopen_descriptors, leave process.rs formatting only. - Should fix — scope authorization (entry 2). The justification is issue #536, an outside request framed as vLLM dashboard parity. AGENTS.md:165-169 and the charter's "What gets merged" require a maintainer request, a roadmap item, a reproducible bug, a measured problem or bad docs; vLLM is listed as a competitor, not a compatibility target. The PR needs a maintainer decision or a reframing as a defect.
- Should fix — docs contradict the stamps (entry 3). api.md:307-308 calls prefill "from that step" but
first_scheduled_nsis stamped on every graph kind, so vision/init time lands in "prefill"; and the doc's "cancelled and failed requests enter only…" plus the differing populations per family (prompt tokens observed unconditionally, decode only above one token) meanhistogram_quantilefamilies do not share a denominator withflare_requests_completed_total. - Should fix — duplicated mechanisms (entry 5).
Buckets/Histogramis a second histogram implementation beside the existing host-histogram arrays and inline renderer, andprocess::metricduplicatesmetrics::metric. Migrate the host histograms and unify the formatter (AGENTS.md:188-193, design-review principle 1). - Claim/evidence gap (entry 6). "Nothing about serving changes" is asserted, not measured, although each
/metricsscrape now does blocking/procreads on the axum worker and every submitted step takes a clock read. The live-scrape arithmetic in the description is also self-inconsistent. - Nit (entry 4). The TTFR histogram is the only family rendered from
server.rsrather than with the others.
No blocking defect: nothing violates the runtime/preparation boundary, no model-specific branch, no flag, no compatibility break. The blockers are the layering fix and the missing maintainer authorization.
#9 [high] Verdict and ordering for the report
Verdict (architecture and scope lens): the approach is right and the code is careful, but the PR should not merge as it stands. There is no blocking architectural violation — nothing crosses the preparation/runtime boundary (docs/design-review.md:27-30), nothing branches on model identity (AGENTS.md:346-352), no flag or environment switch was added (AGENTS.md:446-456), no captured-graph operation family was introduced (docs/design-review.md:22-25), and staging the change is unaffected: Snapshot gained no fields (helios/src/server/metrics.rs:69-130), so format=json and flare_helios::server::Snapshot deserialization are unchanged, which satisfies the model-core/compat expectations in AGENTS.md:431-444 by not touching prepared metadata at all.
Two items gate it:
- Layering — OS/procfs code belongs in
eos/, andruntime_core/protection.rsalready holds the same/proc/self/fdread (entry 1). This is the one a maintainer will flag first, because AGENTS.md:21-22 states it explicitly and the duplication is avoidable. - Authorization — the work rests on issue #536 (vLLM parity), which is not one of the charter's merge criteria (entry 2).
Then the documentation/semantics reconciliation (entry 3), the duplicated histogram+formatter mechanisms (entry 5), the unmeasured serving-cost claim (entry 6), and one nit (entry 4).
Suggested review order for the final report: verdict → scope/authorization → layering → doc-vs-code semantics → duplication → evidence → nit. Entries 1-7 in the scratchpad hold the file/line citations for each.
What I did not cover, so it is not mistaken for a clean bill: the terminal dashboard path (server/dashboard.rs calls render()), the multi-host/Orbit /metrics?format=json consumer in docs/orbit.md:545, and whether phase_tests covers the streamed-Delivery::Complete e2e path only via the non-streaming case. Those are other lenses or unverified by me.
#12 [high] Should fix: residual OS access + read-only misuse of raise_open_file_limit in process.rs (post-fix state)
The two new commits (d64c3ea3 "Exclude cancelled responses and reuse host helpers", a34c4d06 "Hoist completion values and tighten stat parsing") resolve most of my earlier layering finding: process.rs:61 now uses crate::os::page_size() (eos/src/unix.rs:73-75), :68 uses crate::runtime_core::open_descriptors() (protection.rs:291-302, exposed via runtime_core/mod.rs:58), :70 uses crate::os::raise_open_file_limit(0) (eos/src/unix.rs:138-165).
Remaining, still under AGENTS.md:20-22 ("The eos/ crate holds the host operating-system operations that Helios and Selene use"):
helios/src/server/metrics/process.rs:58-60still callslibc::sysconf(libc::_SC_CLK_TCK)directly; eos already owns the sibling_SC_PAGESIZEcall (unix.rs:73). Two lines oflibcin a formatting module.process.rs:62-67reads/proc/self/statand the whole of/proc/statand parses them inline in the serving metrics module. This is the part worth keeping local (it is a metrics-only source with no other consumer), so the ask is narrow: put the two accessors (clock_ticks(), and optionally/procreads) ineos/src/unix.rsnext topage_size, leaving process.rs formatting + parsing.- New, from this commit:
raise_open_file_limit(0)is now the way a scrape readsRLIMIT_NOFILE. It works today only becausecurrent >= desiredshort-circuits at unix.rs:145 fordesired = 0, sosetrlimitis never reached. A metrics renderer depending on that accident is fragile: any future change that treats0as "raise to some floor" would mutate the process limit during every scrape, from the axum worker thread. There is no eos accessor that only reads the limit, and no doc comment on the call site saying it must stay read-only. Fix: addopen_file_limit() -> Option<u64>(getrlimit only) in eos and call that.
Cite: AGENTS.md:20-22, eos/src/unix.rs:73-75,138-165, helios/src/server/metrics/process.rs:56-70, helios/src/runtime_core/protection.rs:291-302.
#14 [high] Verified sound at head a34c4d0: cancellation exclusion, parse_stat, hoisting
The tool-limit-cancellation blocker from the previous Autobot review (and my earlier note #3 part b) is fixed at helios/src/server/http.rs:598-606: the e2e observation is now made once, before yield Delivery::Complete, guarded by !count && !encoder.tool_limit_reached. count is /v1/messages/count_tokens only (http.rs:131). tool_limit_reached is set at encode.rs:506 when !parallel_tool_calls and an output already has tools, and forces Termination::Cancelled (encode.rs:598), matching flare_requests_cancelled_total. Test coverage added at phase_tests.rs:4604-4613 asserts flare_request_e2e_seconds_count 0 for the tool-limit path in both stream and non-stream and all three protocols.
Other things re-verified as still sound in this head:
- Counter unification holds: the only
completed.fetch_addis metrics.rs:459 insiderequest_completed; call sites runtime.rs:1841-1846 and :1996-2001. - Preemption keeps the stamps:
Incoming.times(runtime.rs:193-194) moves into the parked list and is reused on readmission. first_scheduled_nsis stamped inreserve_and_pack(runtime.rs:2191-2203) on every graph kind, before theGraphKind::Visionsplit at :2208 — which the doc now states.- New a34c4d06 change to
parse_stat(process.rs:22-35) is correct: skip to the last), reject a tail whose first token is not a valid state char in "RSDZTtWXxKPI", thenvalue(10)for utime. Field N is token N-3 with state as token 0, so utime (field 14) is +10 after the state token; the test at :141-148 pins[11,12,19,20,21], consistent with the sample line's field 14=11, 15=12, 22=19, 23=20, 24=21. Worker::publishnow hoistsprompt_tokens/generated_tokensonce and uses them for both the metric and theFinishedevent (runtime.rs:1993-2008), removing the prior duplicate expressions.render_histogrammoved into the mainimpl FirstResponseSamplesblock (latency.rs:63-109), resolving that nit.
Cite: helios/src/server/http.rs:131,598-606, helios/src/server/runtime.rs:1841-1846,1991-2008,2187-2208, helios/src/server/metrics.rs:459, helios/src/server/metrics/process.rs:19-37,141-148, helios/src/server/runtime/phase_tests.rs:4604-4613, helios/src/server/latency.rs:63-109.
#15 [high] Report of run 2: verdict at a34c4d0
Verdict at head a34c4d0 through the architecture-and-scope lens: no blocking architectural defect; two should-fix items remain (one of them narrow), plus nits. Nothing here asks the author to add code beyond two small accessors.
Still open:
- Should fix — residual OS access and a read-only-in-name-only helper call in
helios/src/server/metrics/process.rs:56-70(entry #12):_SC_CLK_TCKread inline,/procreads inline, andraise_open_file_limit(0)used as a getter whose safety rests on thecurrent >= desiredshort-circuit at eos/src/unix.rs:145. AGENTS.md:20-22 puts host OS operations ineos/. Fix:clock_ticks()andopen_file_limit()(getrlimit only) in eos/src/unix.rs; keep process.rs to formatting and parsing. - Scope (unchanged, entry #2) — the PR is justified by, and closes, an outside feature request (#536, filed by Napuh) that frames the goal as vLLM dashboard parity; vLLM is under "Alternatives / Competitors" in the charter, not a compatibility target, and AGENTS.md:165-169 / charter "What gets merged" accept only a maintainer request, roadmap item, reproducible bug, measured problem or bad docs. AGENTS.md:201-203 makes an explicit maintainer request the authorization; a feature request is not. Needs a recorded maintainer decision on #536, or reframing around the defect (tail latency, queue delay, prefill time and decode rate are unobservable from a scrape; #549's sibling work shows the same author is rebuilding observability, and #553 was already halted by the prior review as low-value/off-charter, which is a signal about this cluster).
- Should fix (medium) — duplicate mechanisms in one file (entry #5, unchanged):
Buckets/Histogram(metrics.rs:212-298) coexists with the host-cache histogram arrays and render loop (metrics.rs:200-210, 1029-1065, andhost_lookup_costat 670-692);process::metric(process.rs:47-54) duplicatesmetrics::metric(metrics.rs:1597-1602) minus the prefix. AGENTS.md:188-193 ("Do not add frameworks, extension points, speculative compatibility, fallback layers") and design-review principle 1 (docs/design-review.md:16-25). The new type is the better one; migrate the three host histograms onto it, and givemetrica full-name parameter. - Evidence (medium, entry #6, narrowed): "nothing about serving changes" is still asserted. Per-step cost is one
monotonic_ns()plus a lane loop inreserve_and_pack(runtime.rs:2191-2203) and two stores per committed token (runtime.rs:1774-1775). Per-scrape cost is three/procreads (one of them all of/proc/stat) plus two sysconf/getrlimit on the axum worker thread (server.rs:709 → process.rs:56-70). Correct the earlier note: the terminal dashboard does not callMetrics::render(dashboard.rs:381 readsmetrics.scheduler_trace), so/metricsis the only production caller — say that cost is known and unmeasured rather than "nothing changes", per docs/design-review.md:97-105. - Nit —
process.rs:72-125keeps sixif let (Some, Some)/if let Somefallbacks for sources that, on Linux, are read from the same process, plus a test asserting live kernel values (:150-176); the never-fails module doc (:4-6) is the fallback-layer style AGENTS.md:188-193 dislikes. A singlelet (Ok(stat), Ok(btime), Some(ticks)) = ... else { return }would be shorter; the route test already covers the scrape. - Nit — metrics/api.md population mismatch and the "only" wording (entry #13).
Fixed since my prior report: procfs duplication into eos/runtime_core helpers, the tool-limit e2e over-count (http.rs:598-606 + phase_tests.rs:4604-4613), the api.md prefill/decode semantics, the hoisted publish expressions, the separate impl block, and parse_stat's field index (process.rs:22-35, test :141-148).
#16 [high] Research summary
Reviewed PR #548 at head a34c4d0 (including the two new commits d64c3ea3 and a34c4d06) through the architecture-and-scope lens, against the charter, AGENTS.md and docs/design-review.md, with every changed file read in context (process.rs, metrics.rs, http.rs, latency.rs, runtime.rs, server.rs, api.md, phase_tests.rs).
Verdict: no blocking architectural defect; two should-fix items, one of them narrow.
The new commits fixed most of what I previously flagged: the procfs/rlimit duplication now routes through crate::os::page_size(), crate::runtime_core::open_descriptors() and crate::os::raise_open_file_limit(0); the tool-limit cancellation no longer records an e2e observation (http.rs:598-606, pinned by phase_tests.rs:4604-4613); api.md now names the vision step and the ≥2-token decode eligibility; publish hoists its completion values; parse_stat indexes are now correct and the FirstResponseSamples block was merged.
Still open: (1) process.rs:56-70 keeps a direct _SC_CLK_TCK sysconf, inline /proc reads, and, worse, uses the mutating helper raise_open_file_limit(0) as a getter — safe today only because of the current >= desired short-circuit in eos/src/unix.rs:145. Ask is two small accessors in eos/src/unix.rs, not new code elsewhere. (2) Scope: the PR closes an outside feature request (#536) framed as vLLM dashboard parity, while the charter lists vLLM under "Alternatives / Competitors" and AGENTS.md:165-169,201-203 accept only a maintainer request, roadmap item, reproduced bug, measured problem or bad docs as authorization. (3) Duplicate histogram and metric-formatter mechanisms now coexist in metrics.rs without the host histograms being migrated (AGENTS.md:188-193). (4) The "nothing about serving changes" claim still omits a known, unmeasured per-step clock read and per-scrape /proc read. Nits: the six impossible-source fallbacks in process.rs and a residual population mismatch in api.md.
Details are in scratchpad entries #12-#15, with the earlier notes #1-#11 for context.
#17 [high] Corrections to earlier notes #1, #3, #4 (superseded by the new commits)
Read this alongside #12-#15; it says which of my earlier notes are now out of date at head a34c4d0.
-
#1 (procfs/OS access in helios) — largely fixed, narrowed by #12. process.rs no longer hand-rolls
_SC_PAGESIZE,getrlimit, or the/proc/self/fdcount; it callscrate::os::page_size()(process.rs:61),crate::runtime_core::open_descriptors()(:68) andcrate::os::raise_open_file_limit(0)(:70), andopen_descriptorswas widened topub(crate)and re-exported (runtime_core/mod.rs:58, protection.rs:291). What remains islibc::sysconf(_SC_CLK_TCK)(:58-60) and the two inline/procreads (:62-67) — plus the new issue thatraise_open_file_limitis a mutator being used as a getter. So the report must NOT say "raw procfs work was added inside the serving metrics module" any more; say "the last two OS accesses, and a mutating helper used read-only". -
#3 (api.md semantics) — fixed except the population nit, see #13. api.md:309-316 now says the first step "which can be a vision step" and limits decode/time-per-output-token to ≥2 generated tokens. The earlier claim that the doc contradicts
reserve_and_packno longer holds: runtime.rs:2191-2203 stamps on every kind and the text now says so. -
#4 (nit: TTFR render call site) — half fixed.
render_histogrammoved into the mainimpl FirstResponseSamplesblock (latency.rs:63-109), so the "second impl block" half is gone. The remaining half still holds: the call is at server.rs:671 while every other family formats insideMetrics::render(metrics.rs:1389-1424). Keep it as one nit at most, severity nit. -
#6 (evidence) — one factual correction recorded in #15 item 4: the terminal dashboard never calls
Metrics::render; dashboard.rs:381 readsmetrics.scheduler_tracedirectly./metrics(server.rs:660, :709) is the only production caller of the procfs path. My earlier phrasing "render is also called by the terminal dashboard" was wrong and must not appear in the report. -
#7 (verified sound) — still valid, plus the additions in #14.
Cite: as listed above.
#5 [medium] Should fix: duplicate histogram and metric-formatting mechanisms in one module
Two net-new mechanisms were introduced where the repository already has the pattern, which AGENTS.md:188-193 asks reviewers to reject ("Do not add frameworks, extension points, speculative compatibility, fallback layers... Refactoring must directly support the requested behavior").
-
Buckets<const N>/Histogram<const N>(metrics.rs:212-298) is a second histogram implementation alongside the existingHOST_TIME_BUCKETS/HOST_TOKEN_BUCKETSarrays + inline cumulative rendering at metrics.rs:1029-1065 andhost_lookup_costat metrics.rs:670-692. The new type is better (it carries bounds and scale together), so the right move is to migrate the three host histograms onto it rather than leaving two ways to declare a histogram in one file. As written the file has two bucket-declaration conventions (u64 boundaries withu64::MAXas +Inf vs f64 bounds withf64::INFINITY) and two render paths, so a future metric author has to pick one without guidance. -
process::metric(process.rs:42-49) duplicatesmetrics::metric(metrics.rs:1597-1602) except for theflare_prefix, because the process names must not be prefixed. That is a legitimate difference, but it is currently expressed by copying the formatting function into the submodule. A singlemetricthat takes the full name, withflare_added by the caller, would keep one formatter.
Neither is blocking; both are the kind of "same thing twice in one module" that the design review's principle 1 ("Keep Helios as simple as possible") and the rejection criteria push back on.
Cite: AGENTS.md:188-193, docs/design-review.md:16-25, helios/src/server/metrics.rs:200-298,670-692,1029-1065,1597-1602, helios/src/server/metrics/process.rs:42-49.
#6 [medium] Claim/evidence gap: serving cost of the new observations and procfs scrape is unmeasured
The PR's own "Evidence" section (PR description) claims "Observability only: latency, prompt-size, and process resource distributions become scrapeable, and nothing about serving changes. This claims no performance or memory improvement". Per AGENTS.md:114-121 and docs/design-review.md:97-105, evidence must be connected to claims and limitations disclosed. Points to check, all verifiable in code:
- Per-request work added on the scheduler thread:
reserve_and_packnow callsmonotonic_ns()and loops overstep.laneson every submitted step (runtime.rs:2189-2203);completenow callsmonotonic_ns()once per completion (it already did at :1628, so this one is free) and two stores per generated token (runtime.rs:1774-1775). Negligible but not measured; the description should not assert serving is unchanged without at least saying it is unmeasured. /metricsscrape now always does blocking file I/O:read_to_string("/proc/self/stat"),read_to_string("/proc/stat")(whole file),read_dir("/proc/self/fd")with one stat-free read of the directory, plus twosysconfand onegetrlimitper scrape, on the axum worker thread (server.rs:709 -> process.rs:52-133). A Prometheus scrape is periodic, so cost is small, butrender()is also called by the terminal dashboard and by tests; any scrape latency is now proportional to the /proc reads. Worth stating as a known cost rather than "nothing about serving changes".- Live-scrape evidence in the description is taken on a fork commit (
AzallazA 5ffe4d54) with the branch cherry-picked, not onmain, and the instance also served the agent's own requests — the description says the deltas "include them and exceed the three requests below", which makes the numbers unable to confirm the per-request counts. The unit tests it cites (request_histograms_bucket_completed_request_timings) do establish bucket boundaries. This is acceptable as disclosed but the description's arithmetic (counts gained 5 for each runtime histogram from 3 requests) contradicts itself; a reviewer cannot check the claim.
Recommend the description state the observation cost explicitly and either present a scrape latency/pause measurement or say none was taken.
Cite: PR description "Claimed result"/"Evidence", AGENTS.md:114-121, docs/design-review.md:97-105, helios/src/server/runtime.rs:1774-1775,2189-2203, helios/src/server.rs:709, helios/src/server/metrics/process.rs:52-133.
#7 [medium] Verified sound: mechanics of the change (no finding)
Checked and found sound (so other reviewers need not re-derive, and so the author knows what I verified rather than assumed):
- Counter/histogram cannot diverge: both former
self.metrics.completed.fetch_add(1, ...)sites are gone (grep of helios/src finds no remainingcompleted.fetch_addoutsideMetrics::request_completed, metrics.rs:459). The two call sites are runtime.rs:1841-1846 (user/text stop incomplete) and runtime.rs:1993-1998 (natural finish inpublish), matching the description. A request that parks and is readmitted keeps itsIncoming(park moves it intoself.parked, runtime.rs:2096,2121; readmission reuses it at runtime.rs:1393,1563-1576), sotimessurvives preemption — the description's claim is correct. first_scheduled_nsstamping inreserve_and_pack(runtime.rs:2187-2203) covers the direct-call path as documented, and filters byactive.request == lane.requestso a stale lane cannot stamp a different request. Note it does not filter by graph kind (see the api.md finding).last_token_ns: u64default 0 withfirst_token_ns: Option<u64>guard (metrics.rs:300-306, 470-479) means a request with no committed token never observes decode;saturating_subeverywhere prevents underflow if clocks are read out of order.decode / (generated_tokens - 1)is guarded bygenerated_tokens > 1. Integer division truncates to ns, which is fine against the 1 ms smallest bucket bound.Histogram::observebucket selection usesexposed <= boundwithposition(first match) andunwrap_or(N-1), and every bucket array ends atf64::INFINITY, so the final bucket is always cumulative-correct;_countis the cumulative total of the last bucket, matching the+Infline. Rendering emits+Inffor the infinite bound, matching Prometheus text 0.0.4 and the existing host-histogram convention (metrics.rs:1053-1057).format=jsonis untouched:Snapshotgained no fields (metrics.rs:69-130), so the description's compatibility claim holds andflare_helios::server::Snapshotdeserialization is unaffected.parse_stat(process.rs:19-32) correctly handles a command name containing)by usingrfind(')'), and the skip counts are right (fields 14/15 utime/stime = 11 then 0 after state; 22 starttime = 6 more; 23 vsize = 0; 24 rss = 0) — the unit test assertsSome([11,12,19,20,21])for the synthetic line, which is the correct mapping.rss * pageand(utime+stime)/ticksare unsigned, no overflow at realistic magnitudes.process_open_fdsreading/proc/self/fdfrom within the scrape includes the directory handle itself; the HELP text says so (process.rs:120). Honest.- Windows:
renderhas#[cfg(not(target_os = "linux"))] let _ = text;(process.rs:9-14) so it compiles empty; nothing else in the diff is platform-gated.libcis already an unconditional dependency (helios/Cargo.toml:50) so no manifest change is needed — consistent with the description saying no Cargo change. The Windows build is unrun per the description; the only risk is#[cfg(all(test, target_os = "linux"))]leaving no tests there, which is disclosed.
No finding recorded from this list.
#10 [medium] Description-evidence specifics (refines entry 6)
Concretely, from the PR description's own numbers (no code needed to see these):
- The description says the runtime histogram counts "gained 5 for each runtime histogram and 6 for the first-response histogram" over a window that it simultaneously says included "this agent session's own requests". It then accounts for five prompt-token observations:
le="64"gained one (the 36-token prompt) andle="2048"gained four ("the two long prompts plus two session requests"). So runtime families gained 5 whileflare_time_to_first_response_secondsgained 6 — the two populations differ by an unexplained request, and the description does not reconcile it. Since it also concedes the deltas "exceed the three requests below", the scrape cannot confirm per-request observation counts at all. - The three responses report completion tokens 60, 1500 and 695, but the configuration described sets
max_tokens64 and 1500 — the 60 and 695 values are consistent with stops/EOS, so nothing is wrong there, but none of the durations (queue 0.169 s, prefill 0.301 s, decode 19.64 s, e2e 20.26 s) are attributed to an individual request, so a reviewer cannot check the internal consistency of e.g. decode_sum against the three completion-token counts. - The description states the basis is the AzallazA fork commit
5ffe4d54with this commit cherry-picked, notmain. Per AGENTS.md:114-121 and docs/design-review.md:97-105 that must stay visible as a limitation, which it does — so the finding is only that the description should also say the numbers are not amainmeasurement and that no scrape-latency measurement was taken (see entry 6 for the code side).
Recommend the description either drop the live-scrape deltas in favour of the unit-test evidence (which does establish bucket boundaries, helios/src/server/metrics.rs:1649-1700) or restate them as a smoke check with the population caveat made explicit.
#13 [medium] Doc state after fixes: api.md reconciled except zero-token population; still a nit
docs/api.md:297-316 was rewritten in the new commits and now fixes both of my earlier doc points: the queue span is explicitly allowed to be a vision step (:310-311), decode and time-per-output-token are limited to requests with at least two generated tokens (:312-314), the histograms are stated to accumulate since server start (:297), the HTTP histograms are separated from the runtime ones (:303-307), and the process_* exception to the flare_ prefix is stated at :288-290.
Two residual nits only:
flare_request_prompt_tokensandflare_requests_completed_totalinclude a completed request that committed no token, while queue/prefill/decode skip it (metrics.rs:459-479; new testrequest_histograms_bucket_completed_request_timings, metrics.rs:1681-1696 asserts exactly that: aRequestTimes::default()completion adds one prompt-token observation and one completed count but no queue/prefill/decode). api.md:309-316 says "The runtime histograms observe completed generations" without this exception, sohistogram_quantileover prefill againstflare_requests_completed_totaldivides by a larger denominator than the histogram's own base.- api.md:315-316 "Cancelled and failed requests enter only
flare_requests_cancelled_totalandflare_requests_failed_total" is approximately, not exactly, true: a request cancelled afterrequest_completedalready ran inWorker::complete(runtime.rs:1841-1846) /publish(runtime.rs:1996-2001) is counted in both. Unavoidable, but the sentence reads as an invariant.
Cite: docs/api.md:297-316, helios/src/server/metrics.rs:459-479,1681-1696, helios/src/server/runtime.rs:1841-1846,1996-2001.
#18 [medium] File-by-file coverage record for this review
All 10 changed files read, each with surrounding code (line ranges are at head a34c4d0):
- helios/src/server/metrics/process.rs (new, +177): whole file (:1-177), plus eos/src/unix.rs:60-175, helios/src/os.rs:1-8, helios/src/lib.rs:19,36, runtime_core/protection.rs:280-320,354.
- helios/src/server/metrics.rs: bucket/histogram types :200-306,
Metricsfield block :308-400,request_completed:440-480, render :1380-1424, persistent-worker render :1630-1645, tests :1651-1697, module head :1-40. - helios/src/server/runtime.rs:
Generation::cancel/Drop :151-179,Incomingstruct andtimes:181-245,finish_cancelled:293-302, admit/cancel paths :1310-1420,completetoken loop :1755-1869,publish:1871-2015,reserve_and_pack:2187-2230; construction sites oftimes(913, 3254). - helios/src/server/http.rs: admission/count :120-200, delivery stream :380-470, tool-limit cancel :540-580, e2e observation :581-656.
- helios/src/server/latency.rs: whole file head and histogram :1-140.
- helios/src/server.rs: modules/exports :9-35, metrics handler :640-718.
- docs/api.md: metrics section :280-340 (rest of file not re-read this run; only this section changed).
- helios/src/runtime_core/{mod.rs,protection.rs}: re-export :55-58,
open_descriptorsand its caller :281-302,354. - helios/src/server/runtime/phase_tests.rs: the tool-limit test :4540-4650.
- project rules: AGENTS.md:1-230, docs/design-review.md:1-231, charter (read_charter), .github/workflows/native-serving.yml (to see what CI actually runs: Linux+Windows helios
--features runtime-core,serverat :56-68).
Not opened this run: the remainder of docs/api.md, docs/cli-design.md, dashboard.rs beyond the render search, #537/#549 diffs. Windows behaviour of process.rs is only inferable from the #[cfg(target_os = "linux")] gates (:10-13, :18, :39, :47, :56, :128) and from eos/src/windows.rs:152-215.
#4 [low] Nit: TTFR histogram render call sits in server.rs rather than with the other families
helios/src/server.rs:671 renders flare_time_to_first_response_seconds inline via state.first_response.render_histogram(&mut text) while everything else Prometheus-shaped lives in Metrics::render / metrics::metric. The histogram itself was added to FirstResponseSamples (latency.rs:34-37, 107-131), which is the right owner for the data (it is the same clock and the same eligibility rule as the median gauge). So the split is: data in latency.rs, formatting in server.rs, whereas other families format in metrics.rs.
Minor: FirstResponseSamples::render_histogram sits in a second impl FirstResponseSamples block (latency.rs:122-131) separate from the first (latency.rs:63-101) — same-file duplication, harmless.
Worth flagging only because the Histogram::render signature already prefixes flare_ itself (metrics.rs:273-297: "# HELP flare_{name}"), so callers pass bare names; that convention differs from metrics::metric (metrics.rs:1597-1602) which also prefixes. Consistent internally, fine. Not a finding beyond noting the render call site placement.
Cite: helios/src/server.rs:660-709, helios/src/server/latency.rs:34-37,63-131, helios/src/server/metrics.rs:273-297,1597-1602.