#1 [high] Should fix: process.rs re-implements existing helpers and keeps fallbacks for sources that cannot fail (~70 lines)
File: helios/src/server/metrics/process.rs (new, +184).
(a) Duplicate metric writer. process.rs:42-49 defines fn metric(text,name,kind,help,value: impl Display) that is metrics::metric (helios/src/server/metrics.rs:1597-1602) minus the flare_ prefix and with a Display value. Call it from metrics.rs/server.rs with full names and one helper disappears (~9 lines). Same shape is also open-coded at metrics.rs:1626-1636 and server.rs:669, so the repo already tolerates one writer.
(b) Duplicate procfs/resource-limit readers:
open_fds(process.rs:65-67, 4 lines) isopen_descriptors()at helios/src/runtime_core/protection.rs:291-302 verbatim (read_dir("/proc/self/fd").ok().map(|e| e.filter_map(Result::ok).count() as u64)).max_fds(process.rs:68-77, 10 lines) isflare_eos::raise_open_file_limit(0)(eos/src/unix.rs:138-165): getrlimit returns the soft limit unchanged whencurrent >= desired; helios already exports it (pub use flare_eos::raise_open_file_limit, helios/src/lib.rs:36). Calling it with 0 givesSome(rlim_cur)with no setrlimit.page(process.rs:55-58, 4 lines) isflare_eos::page_size()(eos/src/unix.rs:73-75, windows.rs:152). ~15 lines saved and three unsafe blocks (and their SAFETY comments) deleted.
(c) Fallback chains for sources that cannot fail. render_linux (process.rs:51-133, 83 lines) reads /proc/self/stat, /proc/stat btime, /proc/self/fd, RLIMIT_NOFILE as Options and emits each metric behind if let (Some(..), Some(..)) (6 blocks, ~54 lines). On Linux /proc/self/stat, /proc/stat and /proc/self/fd always exist and getrlimit(RLIMIT_NOFILE) always succeeds, so 6 of the 8 fallbacks are dead. Smaller version: one early return / unwrap_or_default per source and 6 straight metrics::metric(...) calls:
let Some(stat) = ... parse_stat(...) else { return };
metrics::metric(text, "process_cpu_seconds_total", "counter", "...", (stat[0]+stat[1]) as f64/ticks as f64);
... (5 more, one line each)
Saves ~30 lines of scaffolding plus the -> Option plumbing in parse_btime (process.rs:34-40).
(d) Test that proves the OS, not the code: render_reports_process_memory_descriptors_and_start_time (process.rs:157-183, ~27 lines) asserts live /proc values and that six # TYPE lines exist; the phase test metrics_route_serves_prometheus_or_json_without_the_api_key (runtime/phase_tests.rs:5387-5388) already asserts a process_* series reaches a scrape. Keeping only parse_stat_reads_fields_after_a_parenthesized_command_with_a_paren (process.rs:148-155) loses nothing. ~25 lines.
Total process.rs: ~70 of 184 lines (38%), no behaviour that a Linux run can observe.
Scope note: #536's missing-metrics table asks for process_cpu_seconds_total, process_resident_memory_bytes, process_open_fds, process_start_time_seconds only. process_virtual_memory_bytes (process.rs:88-96) and process_max_fds (process.rs:124-132) are not requested and virtual size is uninformative for a GPU server; dropping both removes another ~18 lines plus two doc lines (docs/api.md:316-317) and two test assertions (process.rs:163-164,178-179).
#2 [high] Should fix: request_completed keeps a per-request state that cannot occur and publish() recomputes two values
File: helios/src/server/metrics.rs:452-480 and helios/src/server/runtime.rs:1993-2019.
(a) metrics.rs:462-469 — the inner if let Some(first) = times.first_token_ns inside if let Some(scheduled) = times.first_scheduled_ns cannot fail. first_scheduled_ns is stamped in reserve_and_pack (runtime.rs:2189-2203) for every lane of every committed step, and first_token_ns is only stamped in Worker::complete (runtime.rs:1774-1775) for tokens of an active request whose step went through reserve_and_pack; so first_token_ns.is_some() ⇒ first_scheduled_ns.is_some(). Flatten to one if let:
if let Some(scheduled) = times.first_scheduled_ns {
self.request_queue.observe(&REQUEST_SECONDS, scheduled.saturating_sub(arrival_ns));
}
if let (Some(scheduled), Some(first)) = (times.first_scheduled_ns, times.first_token_ns) {
self.request_prefill.observe(&REQUEST_SECONDS, first.saturating_sub(scheduled));
}
(or one block using (Some(s), Some(f)) with the queue observation outside). The test at metrics.rs:1684-1697 constructs the impossible state (first_scheduled_ns: None, first_token_ns: Some(..)) and asserts on it; that half of the test goes too. ~5-8 lines including the test case.
(b) runtime.rs:1993-1998 and 2015-2019 compute the same two expressions twice: request.carried.prompt_tokens.unwrap_or(prompt_tokens) and request.carried.generated_tokens + generated. Worker::complete already hoists them into locals (runtime.rs:1838-1840) before calling request_completed and building the event. Do the same in publish:
let prompt_tokens = request.carried.prompt_tokens.unwrap_or(prompt_tokens);
let generated_tokens = request.carried.generated_tokens + generated;
self.metrics.request_completed(request.incoming.arrival_ns, request.incoming.times, prompt_tokens, generated_tokens);
... GenerationEvent::Finished { prompt_tokens, generated_tokens, .. }
~4 lines, and the two call sites become identical in shape.
#6 [high] Research summary
Reviewed PR #548 (8 files, +545/−20) against the charter, AGENTS.md and docs/design-review.md, strictly for subtraction. The request histograms themselves are the #536 deliverable and are minimal; the removable weight is concentrated in the new process.rs (184 lines) and in the fact that the new Histogram type was added beside the hand-rolled host histograms already in metrics.rs.
Findings, ranked by lines saved (all in the scratchpad with citations):
- Should fix, ~70 of 184 lines in
helios/src/server/metrics/process.rs. A second metric writer duplicatingmetrics::metric(metrics.rs:1597), duplicate procfs readers (open_descriptorsprotection.rs:291,flare_eos::raise_open_file_limit(0),flare_eos::page_size()), and six deadif let (Some, Some)fallbacks around /proc sources that always exist on Linux. ~25 more lines in a test that asserts live /proc values already covered by the scrape test. - Should fix, ~45 lines. The new
Buckets/Histogramcoexists with the hand-rolledHOST_*_BUCKETS+host_cost_sums+ 37-line render loop (metrics.rs:200-210, 382-385, 1029-1065); converting the three host histograms deletes the old machinery. The e2e observation is also written twice (http.rs:614, 631) plus a needlessArcclone, and can be one call before the singleyield Delivery::Complete(http.rs:598). - Should fix, ~13 lines.
request_completednests afirst_token_nscheck that cannot fail (metrics.rs:462-469) and its test constructs the impossible state;Worker::publishrecomputes the prompt/generated expressions twice (runtime.rs:1993-2019) whereWorker::completealready hoists them. - Nits, ~19 lines. Non-Linux shim for a function that writes nothing, second
implblock in latency.rs, docs/api.md restating the HELP strings verbatim, duplicated histogram assertions in phase_tests.
Total: about 145 of the 545 added lines (~27%) removable with no behaviour lost; the change is not blocking on size.
#7 [high] Tally and framing for the final report (change size, per-finding savings, verdict)
Change size (from pr_files / diff): 8 files, +545/−20.
- helios/src/server/metrics.rs +228/−0
- helios/src/server/metrics/process.rs added +184
- docs/api.md +25/−3
- helios/src/server/runtime.rs +38/−8
- helios/src/server/runtime/phase_tests.rs +35/−0
- helios/src/server/latency.rs +27/−8
- helios/src/server/http.rs +6/−1
- helios/src/server.rs +2/−0
Ranked savings (details in notes 1-5, each title starts with its severity):
- Should fix — helios/src/server/metrics/process.rs: ~70 of 184 lines (38%).
- Should fix — helios/src/server/metrics.rs:212-298 + metrics.rs:1029-1065 + http.rs:603,614-617,631-632: ~45 lines.
- Should fix — metrics.rs:452-480, runtime.rs:1993-2019, metrics.rs:1684-1697: ~13 lines.
- Nit — process.rs:8-14 + server.rs:709 (shim, ~6), latency.rs:122-131 (2), docs/api.md:300-313 (~6), phase_tests.rs:4466-4470 (~5): ~19 lines. Total ~147 of +545 (~27%); ~100 of that is in the one new file. Verdict: not blocking on size; no finding asks for a new feature/check/test/option.
What is already minimal (say so plainly in the report): the five request histograms are exactly the #536 "Missing metrics" table (issue #536, opened 2026-11-26); the RequestTimes fields plus the two stamps (runtime.rs:1774-1775, 2189-2203) are the minimum that yields queue/prefill/decode intervals, and preemption preservation is free from Incoming moving into the parked list, not added code. Everything is observability-only; the description claims no performance change, which matches — but charter line 35 / AGENTS.md:165-169 ("what gets merged") means the case rests entirely on #536 being the maintainer-visible request it references, and #536 is a community issue, not a maintainer request. Worth one sentence, not a finding.
Charter/guidance citations to use: charter "Solve the right problem in the right place" (smallest footprint, way to solve without new code at all) and "Keep the runtime small"; AGENTS.md:188-193 ("Reject unsupported abstractions and churn… do not add frameworks… fallback layers"); AGENTS.md:194-199 ("Tests must exercise the affected behavior… source-text checks… cannot establish runtime correctness"); docs/design-review.md principle 1 ("Keep Helios as simple as possible"). Also AGENTS.md:448-451 (no env switches — not violated here; don't cite).
Note on the PR's own evidence: the author's live scrape and 109-test run are credible but include the agent session's own requests (stated in the description), so the histogram counts exceed the three test requests; not a subtraction finding, only context if the report mentions the evidence.
#9 [high] Blocking: process.rs reuses crate::runtime_core, which the documented --features server build does not have (2-line revert, fixes a build break)
Head a34c4d0 (commit d64c3ea3 "reuse host helpers") replaced process.rs's local /proc/self/fd count with crate::runtime_core::open_descriptors() (helios/src/server/metrics/process.rs:68) and widened/re-exported it (helios/src/runtime_core/protection.rs:291 pub(crate), helios/src/runtime_core/mod.rs:58 pub(crate) use protection::open_descriptors;).
runtime_core is behind its own cargo feature: helios/src/lib.rs:25-26 #[cfg(feature = "runtime-core")] pub mod runtime_core; and helios/Cargo.toml:21 runtime-core = [...]; server (Cargo.toml:25) does not enable it. metrics::process is declared unconditionally (helios/src/server/metrics.rs:12) and render_linux (process.rs:56-126) compiles on Linux, so cargo build/test --manifest-path helios/Cargo.toml --features server — the command documented at docs/model-development.md:99 and docs/scheduling-runtime-design.md:735-737 — cannot resolve crate::runtime_core. Everywhere else in server the module is cfg-gated (server.rs:26-27 mod session;) or the reference is #[cfg(all(test, feature = "runtime-core"))] (runtime.rs:3983).
Smaller version (what the file had before d64c3ea3), 4 lines, no cross-feature edge, no visible API change:
let open_fds = std::fs::read_dir("/proc/self/fd")
.ok()
.map(|entries| entries.filter_map(Result::ok).count() as u64);
Goes: runtime_core/mod.rs:58 (1 line), the pub(crate) widening at protection.rs:291 (net 0). Net −2 lines and −2 files in the diff, and the --features server configuration compiles again. (If duplication is unwanted, the 8-line fn belongs in flare_eos, which AGENTS.md:20-21 designates as the holder of host OS operations and which helios always links — but that is a bigger change than reverting.)
Note: could not compile here; derived from the cfg gates above.
#10 [high] Should fix: process.rs still carries a shim, five cfg attrs, six dead Option fallbacks and a kernel-assert test (~80 of 177 lines)
File: helios/src/server/metrics/process.rs (new, 177 lines, unchanged in shape by d64c3ea3).
(a) Non-Linux shim + five inner cfg attrs, ~10 lines. process.rs:8-14 pub(crate) fn render(text) with #[cfg(target_os = "linux")] render_linux(text); / #[cfg(not(target_os = "linux"))] let _ = text;, plus #[cfg(target_os = "linux")] on parse_stat (:18), parse_btime (:39), metric (:47), render_linux (:56) and the test module (:128). The repository cfg-gates whole platform modules instead (helios/src/server.rs:26-27, helios/src/runtime_core/protection.rs:291-302). Smaller: #[cfg(target_os = "linux")] pub(super) mod process; at metrics.rs:12 and #[cfg(target_os = "linux")] metrics::process::render(&mut text); at server.rs:709; all six attributes and the wrapper go. Net ~6 lines and one dead path on the Windows build the description says was never run.
(b) Six if let (Some(..), Some(..)) fallbacks for sources that cannot fail, ~45 lines. process.rs:72-125 emits each metric behind an Option match; the module doc (:4-6) promises a scrape "never panics on a missing or malformed file". On Linux /proc/self/stat, /proc/stat and /proc/self/fd exist for a running process, page_size() is total (eos/src/unix.rs:73-75 falls back to 4096), sysconf(_SC_CLK_TCK) is positive, and crate::os::raise_open_file_limit(0) (eos/src/unix.rs:138-147) returns Some(current) for every desired <= current, so the max_fds Option (:117) is always Some. Smaller: one guard per source and straight calls:
let ticks = unsafe { libc::sysconf(libc::_SC_CLK_TCK) } as u64;
let stat = std::fs::read_to_string("/proc/self/stat").ok().and_then(|l| parse_stat(&l));
let btime = std::fs::read_to_string("/proc/stat").ok().and_then(|c| parse_btime(&c));
let Some(stat) = stat else { return };
metric(text, "process_cpu_seconds_total", "counter", "…", (stat[0] + stat[1]) as f64 / ticks as f64);
metric(text, "process_virtual_memory_bytes", "gauge", "…", stat[3]);
metric(text, "process_resident_memory_bytes", "gauge", "…", stat[4] * crate::os::page_size() as u64);
if let Some(btime) = btime { metric(text, "process_start_time_seconds", "gauge", "…", btime as f64 + stat[2] as f64 / ticks as f64); }
if let Some(open) = open_fds { metric(text, "process_open_fds", "gauge", "…", open); }
if let Some(max) = crate::os::raise_open_file_limit(0) { metric(text, "process_max_fds", "gauge", "…", max); }
Loses nothing on Linux (the only platform that emits anything) and keeps the pre-existing parse_stat/parse_btime Option returns.
(c) Test that asserts the kernel, not the code, ~37 lines. process.rs:150-176 render_reports_process_memory_descriptors_and_start_time plus its value helper (:132-139) assert live /proc values (resident > 0, virtual >= resident, fds >= 1, start time within the last hour) and that six # TYPE lines exist. The route test already scrapes the series (phase_tests.rs:5398-5399 asserts process_resident_memory_bytes reaches a real /metrics body), and the parser is covered by parse_stat_reads_fields_after_a_parenthesized_command_with_a_paren (:141-148), which is the only test that proves something about this code. Removing the render test costs no behaviour: a broken reader would also break the scrape test.
Total for process.rs: ~80 lines of 177 (about 45 in (b), 6 in (a), 37 in (c), minus the 4-line local open_descriptors of note "Blocking: …").
Not a saving, checked and dropped: folding process.rs's metric (:47-54) into metrics::metric (metrics.rs:1597-1602). The shared writer hard-codes the flare_ prefix (metrics.rs:1600) and takes u64, so process names would come out as flare_process_* and the f64 CPU/start-time values would not fit; reuse requires editing the shared helper and its ~20 call sites for no net gain.
#11 [high] Should fix: the new Histogram type was added beside the hand-rolled host histograms instead of replacing them (~53 lines)
The PR adds Buckets<N>/Histogram<N> (helios/src/server/metrics.rs:212-298) and uses it for the five new request histograms, but leaves the three host prefix-store histograms on the older hand-rolled machinery in the same file. Converting them deletes ~53 lines with byte-identical exposition output.
What goes:
HOST_TIME_BUCKETS(metrics.rs:200-209, 10 lines) andHOST_TOKEN_BUCKETS(:210).- Fields
host_cost_sums: [AtomicU64; 3](:382),host_missing_tokens/host_transfer_ns/host_prefill_ns[AtomicU64; 8](:383-385) → threeHistogram<8>. host_lookup_cost's tuple-array loop and.position(..).unwrap()(:672-691, 20 lines) → threeobservecalls.- The render loop with its inline cumulative count,
u64::MAX → "+Inf"special case and separate_sum(:1029-1065, 37 lines) → a three-entryrenderloop.
Smaller version (labels preserved: same integers in le, same integer sums, because scale: 1.0 keeps the exposed unit at nanoseconds/tokens exactly as today):
const HOST_TOKENS: Buckets<8> = Buckets { bounds: [64.0, 256.0, 1024.0, 4096.0, 16384.0, 65536.0, 262144.0, f64::INFINITY], scale: 1.0 };
const HOST_NANOSECONDS: Buckets<8> = Buckets { bounds: [100000.0, 1000000.0, 10000000.0, 100000000.0, 1000000000.0, 10000000000.0, 100000000000.0, f64::INFINITY], scale: 1.0 };
pub(super) fn host_lookup_cost(&self, hit: &flare_selene::HostHit, rate: f64) {
let missing = hit.consumed_tokens - hit.resident_tokens;
self.host_missing_tokens.observe(&HOST_TOKENS, missing);
self.host_transfer_ns.observe(&HOST_NANOSECONDS, (hit.estimated_seconds * 1e9) as u64);
self.host_prefill_ns.observe(&HOST_NANOSECONDS, (missing as f64 / rate.max(1.0) * 1e9) as u64);
}
for (histogram, name, help, buckets) in [
(&self.host_missing_tokens, "host_cache_missing_tokens", "…", &HOST_TOKENS),
(&self.host_transfer_ns, "host_cache_estimated_transfer_ns", "…", &HOST_NANOSECONDS),
(&self.host_prefill_ns, "host_cache_estimated_prefill_ns", "…", &HOST_NANOSECONDS),
] {
histogram.render(text, name, help, buckets);
}
Why nothing is lost: Histogram::observe selects position(|bound| exposed <= *bound).unwrap_or(N - 1) (metrics.rs:264-268), the same rule the removed .position(..).unwrap() used; with scale: 1.0 the rendered le values are the same integers ({} on 100000.0 prints 100000) and _sum prints the same integer. host_outcomes_and_capacity_have_bounded_labels_and_cost_histograms (metrics.rs:1785-1787) reads only _sum and keeps passing. The only output change is that the three series gain # HELP lines (render writes them, :274-277), which is additive exposition, not a behaviour loss.
Savings: consts 11→2 lines (−9 as written; 2 lines each), fields 4→3 (−1), observe 20→3 (−17), render 37→8 (−29): about −53 net.
Side note: the four same-bucket request histograms are already one loop (:1389-1412), and time_per_output_token/request_prompt_tokens cannot join it only because Histogram<19> and Histogram<21> are distinct types; padding TOKEN_SECONDS to 21 bounds would join them but changes bucket boundaries, so it is not a lossless cut — do not propose it.
#13 [high] Tally at head a34c4d0 (548 added lines, ~165 removable) and what is already minimal
Change at head a34c4d0 (pr_files): 10 files, +548/−25 — docs/api.md +28/−3; helios/src/runtime_core/mod.rs +1; runtime_core/protection.rs +1/−1; server.rs +2; server/http.rs +8; server/latency.rs +24/−8; server/metrics.rs +219; server/metrics/process.rs +177 (new); server/runtime.rs +43/−13; server/runtime/phase_tests.rs +45.
Ranked, with the savings I stand behind:
- Blocking (also a subtraction) — process.rs:68
crate::runtime_core::open_descriptors()breaks the documented--features serverbuild; revert to the 4-line local/proc/self/fdread, drop runtime_core/mod.rs:58: −4 lines, −2 files. CI only buildsruntime-core,server(.github/workflows/native-serving.yml:63,68), so it cannot catch this; docs/scheduling-runtime-design.md:735 and docs/model-development.md:99 do buildserveralone. - Should fix — process.rs: ~80 of 177 lines: outer+five inner cfg for a Linux-only file (~6), six Option fallbacks around sources that always exist (~45), render test that asserts live kernel values (~37, minus the 4 lines restored in 1).
- Should fix — metrics.rs: convert the three host histograms to the new
Histogram<8>/Buckets<8>: −53 (HOST_*_BUCKETS 11→2, fields 4→3, observe 20→3, render 37→8). - Nit — ~28: docs/api.md:309-316 repeating HELP text (~8), phase_tests.rs:4428-4432 and 4466-4471 duplicating the scrape test (~11), process.rs:24-28 unreachable state guard (~6), metrics.rs:462-469 nested Option (~3, and only ~3 because flattening would drop the queue observation for step-reaching requests with no token).
Total ≈ 165 of 548 added lines (~30%), roughly 100 of them in the one new file.
Caveat to state honestly for finding 3: Histogram renders _sum as sum as f64 / scale (metrics.rs:291-295), so above 2^53 the ns sums round, where today's host _sum is exact u64. The request histograms this PR adds already accept that; the bucket le labels and counts are unchanged either way.
Verified-minimal at head (say so plainly): the five request histogram definitions and bucket bounds are exactly issue #536's missing-metrics table; the three RequestTimes fields and the two stamps (runtime.rs:1774-1775, 2197-2201) are the minimum that yields queue/prefill/decode, and preemption preservation is free because parking moves Incoming; e2e is now observed once (http.rs:598-606) and Worker::publish hoists its locals (runtime.rs:1993-1998), so two findings from the earlier review are resolved by d64c3ea3/a34c4d0; folding process.rs's metric into metrics::metric does not work (the shared helper hard-codes the flare_ prefix and takes u64, metrics.rs:1597-1602); the retirement histogram (metrics.rs:851-876) cannot join Histogram without a set-style variant, so it is not a lossless cut.
Charter/issue anchors for the report: charter line 35 ("what gets merged": maintainer request, roadmap item, reproducible bug, measured perf/memory issue, or bad docs) — #536 is a community issue, so the histograms' right to exist rests on it being the referenced ask, not a subtraction finding; charter line 12/13 irrelevant here; AGENTS.md:20-21 puts host OS operations in eos/, which is where a shared descriptor counter belongs if it is shared at all; AGENTS.md:52-59 requires designed behaviour and unrun checks to be stated, which the description does.
#14 [high] Research summary
Verdict: make it smaller first. The two pushed commits fixed the earlier duplicate e2e observation and the unhoisted publish locals, but added one problem and left the bulk of the removable weight in place.
The change: +548 / −25 across 10 files (head a34c4d0).
Could remove: about 165 of the 548 added lines (~30%), in six places, roughly 100 of them inside the new helios/src/server/metrics/process.rs.
Biggest subtractions, ranked:
- Blocking (and a subtraction), −4 lines and −2 files:
process.rs:68now callscrate::runtime_core::open_descriptors(), butruntime_coreis behind its own cargo feature thatserverdoes not enable (helios/src/lib.rs:25-26, helios/Cargo.toml:21/25), so the documented--features serverbuild (docs/model-development.md:99, docs/scheduling-runtime-design.md:735-737) no longer compiles. Restore the four-line local/proc/self/fdread and drop thepub(crate) useat runtime_core/mod.rs:58. - Should fix, ~80 of process.rs's 177 lines: the write-nothing wrapper plus five inner
cfgattributes for a Linux-only file; sixif let (Some, Some)fallbacks around procfs sources,sysconf,page_size()andraise_open_file_limit(0)that all always succeed on Linux; and a test that asserts live kernel values (resident > 0, start time within the hour) that the existing/metricsroute test already scrapes. - Should fix, ~53 lines in metrics.rs: the new
Buckets/Histogramtype was added beside the hand-rolled host histograms, not in place of them. Converting the three host histograms deletesHOST_TIME_BUCKETS,HOST_TOKEN_BUCKETS,host_cost_sums, the.position(..).unwrap()loop and the 37-line render loop. Labels and counts are byte-identical (withscale: 1.0); the one caveat is that_sumbecomesf64, which the request histograms already accept. - Nits, ~28 lines: docs/api.md repeating the HELP strings, two phase-test assertions that repeat the route test, and an unreachable state-character guard in
parse_stat.
Already minimal, say so plainly: the five histogram definitions and their bounds are exactly #536's missing-metrics table, the three RequestTimes stamps are the minimum for queue/prefill/decode, preemption preservation is free, and e2e is now observed in one place. Folding process.rs's metric into the shared writer is not a saving — the shared helper hard-codes the flare_ prefix and takes u64.
Full detail with code for each smaller version is in scratchpad notes #9-#13 (report body in #13).
#15 [high] Findings resolved at head a34c4d0 (do not re-raise) and what remains open
Reconciliation of the earlier review (comment on the PR at 2026-11-26 22:00, and scratchpad notes #1-#6) against head a34c4d0, so the final report does not re-raise fixed points. Commits: d64c3ea3 "Exclude cancelled responses and reuse host helpers", a34c4d06 "Hoist completion values and tighten stat parsing".
Resolved at head — do NOT repeat as findings:
- e2e recorded twice (stream and non-stream arms): now one observation before the single
yield Delivery::Complete, http.rs:598-606, withif !count && !encoder.tool_limit_reached. - Tool-limit cancellation excluded from e2e: fixed at http.rs:600 and pinned by the new phase test at phase_tests.rs:4601-4616 (12 lines) — this is the one new HTTP test that proves behaviour no other test proves, so it is not part of the redundant-assertion cut.
Worker::publishrecomputing prompt/generated: now hoisted into locals, runtime.rs:1993-1998.- docs/api.md split by eligibility ("recorded only for requests with at least two generated tokens"), "cumulative since server start", the
process_*exception to theflare_prefix rule (docs/api.md:288-290), and the vision-step phrase for queue time (docs/api.md:310-311): all present. - Impossible
{first_scheduled_ns: None, first_token_ns: Some}test state: the test now usesRequestTimes::default()for the zero-token completion (metrics.rs:1681-1684), so that half is gone; the nestedif letinrequest_completed(metrics.rs:462-469) remains but is only ~3 lines to flatten.
Still open at head, with the note where each is argued: feature-gate build break (#9); process.rs shim/fallbacks/kernel test (#10); host histograms not converted (#11); doc-HELP duplication, two redundant phase-test assertions, unreachable parse_stat state guard (#12).
Also worth stating in the report: the two pushes raised the diff from +545/−20 to +548/−25 and moved work into the new file's neighbours (three files touched only to expose/re-export open_descriptors), so the change grew slightly while two findings closed.
Cannot verify here: no compilation was run on this turn; the build-break claim in #9 is derived from the cfg gates and Cargo feature lists, and Windows was not built by the author either.
#17 [high] Re-verification at head a34c4d0, run after the 2026-11-27 06:15 autobot comment (no new commits)
The PR still ends at a34c4d060f96553c490eceb44b2fcf09ed277098 (read_item #548 header, pr_files: 10 files, +548/−25). No commit after d64c3ea3/a34c4d0, so note #16's findings stand; I re-read each cited line in the head files and all still hold:
- Build break: helios/src/server/metrics.rs:12
pub(super) mod process;is ungated; process.rs:68let open_fds = crate::runtime_core::open_descriptors();sits inrender_linux(:56-126), which compiles on Linux;crate::runtime_coreis behind#[cfg(feature = "runtime-core")](helios/src/lib.rs:25-26);serverdoes not enable it (helios/Cargo.toml:25 vs :21). server.rs:709 callsmetrics::process::render(&mut text)unconditionally. Documented commands that would fail: docs/model-development.md:99 and docs/scheduling-runtime-design.md:735-736 (--features serveralone); CI builds onlyruntime-core,server(.github/workflows/native-serving.yml:63,68), so CI cannot catch it. Smaller version stays the 4-line localstd::fs::read_dir("/proc/self/fd")count (the pre-d64c3ea3 code); the reuse cost the diff 2 lines and 2 files (runtime_core/mod.rs:58, protection.rs:291). - process.rs scaffolding: still lines 8-14 (write-nothing wrapper) + five inner
#[cfg(target_os = "linux")](:18, :39, :47, :56, :128); six Option fallbacks at :72-125 (stat, ticks, btime, open_fds, max_fds); kernel-asserting test :150-176 plusvaluehelper :132-139. eos guarantees the sources: eos/src/unix.rs:73-75 page_size falls back to 4096, :138-147 raise_open_file_limit(0) returns Some(current). ~80 of 177 lines. - Host histograms unchanged and still hand-rolled: consts metrics.rs:200-210, fields :382-385, host_lookup_cost loop :670-692 (
.position(..).unwrap()at :689), render loop :1029-1065 (37 lines,u64::MAX→"+Inf" at :1053). NewBuckets/Histogramat :212-298 is used only for the new series (render loop :1389-1412). ~53 lines. - Nits unchanged: docs/api.md:309-316 restates HELP strings (compare metrics.rs:1398, :1416); phase_tests.rs:4428-4432 and :4466-4471 duplicate what :5389-5395 already asserts through the real route; process.rs:24-28 state-char guard has one production caller (:62-64); metrics.rs:462-469 nested
if let.
One candidate I had not recorded: latency.rs:101-108 FirstResponseSamples::render_histogram is a pure pass-through to Histogram::render with the name and help hard-coded in the wrapper. Inlining it at server.rs:671 (the sole caller, search: helios/src/server) with pub(super) on the histogram field (:36) removes 7 lines. Honest trade: the help string would then live in the route handler instead of beside the observation, unlike the request histograms whose names/helps sit in metrics.rs's render loop, so it is optional and I rank it below the other nits. Not counted in the 165.
#18 [high] Research summary
Re-reviewed PR #548 at the same head commit (a34c4d0, 10 files, +548/−25) — no commits since my last run, so the verdict is unchanged: make it smaller first, about 165 of the 548 added lines removable in four places, roughly 100 of them inside the new helios/src/server/metrics/process.rs.
I re-read every cited line in the head files and each finding still holds:
- Blocking (also a subtraction), −4 lines and −2 files.
process.rs:68callscrate::runtime_core::open_descriptors(), butruntime_coreis behind#[cfg(feature = "runtime-core")](helios/src/lib.rs:25-26) andserverdoes not enable it (helios/Cargo.toml:25vs:21), whilemetrics::processis declared ungated (metrics.rs:12) andserver.rs:709calls it unconditionally. The documented--features serverbuilds (docs/model-development.md:99(not opened),docs/scheduling-runtime-design.md:735-736(not opened)) therefore no longer compile; CI builds onlyruntime-core,server(.github/workflows/native-serving.yml:63 (not opened),68), so it cannot catch this. The smaller version is the 4-line local/proc/self/fdcount that d64c3ea3 replaced, which also removes the two helper re-export lines inruntime_core. - Should fix, ~80 of
process.rs's 177 lines: the write-nothing wrapper plus five inner#[cfg]s (:8-14,:18/:39/:47/:56/:128), sixOptionfallbacks around procfs,sysconf,page_size()andraise_open_file_limit(0)sources that cannot fail on Linux (:72-125; guaranteed byeos/src/unix.rs:73-75,:138-147), and the test asserting live kernel values (:150-176). - Should fix, ~53 lines in
metrics.rs: the newBuckets/Histogramwas added beside the three hand-rolled host histograms (:200-210,:382-385,:670-692,:1029-1065) instead of in place of them; converting deletes two bucket consts,host_cost_sums, the.position(..).unwrap()loop and the 37-line render loop with identicallelabels and sums. - Nit, ~28 lines:
docs/api.md:309-316repeating the HELP strings, two phase-test assertions the route test already makes (:4428-4432,:4466-4471vs:5389-5395), the unreachable state-character guard atprocess.rs:24-28, and the nestedif letatmetrics.rs:462-469.
New this run, and deliberately ranked below the rest: latency.rs:101-108 render_histogram is a pure pass-through to Histogram::render; inlining it at its one caller (server.rs:671) saves ~7 lines but moves the help string away from the observation, so I recorded it as optional and left it out of the count. Scratchpad entry #17 holds the line-by-line re-verification; #16 still holds the full report.
#19 [high] Report of run after the 2026-11-27 06:15 comment (head unchanged a34c4d0) — final text, supersedes #16 as the deliverable
Verdict: make it smaller first. The request histograms themselves are the right shape and are close to minimal, but the new helios/src/server/metrics/process.rs (~100 of the 548 added lines) is mostly scaffolding, the PR adds a histogram abstraction without retiring the three hand-rolled histograms it supersedes, and one cross-feature reference breaks the build documented for --features server.
Change at head a34c4d060f96553c490eceb44b2fcf09ed277098: 10 files, +548/−25 (pr_files, read_item #548). No commits after d64c3ea3/a34c4d0, so nothing from the previous round changed; I re-read every cited line in the head files (notes #16, #17).
Key findings, ranked by lines saved
- Blocking (also a subtraction), −4 lines and −2 files —
process.rs:68crate::runtime_core::open_descriptors()crosses a cargo featureserverdoes not enable, so the documented--features serverbuild no longer compiles; the 4-line local/proc/self/fdread it replaced is also the smaller version. - Should fix, ~80 of
process.rs's 177 lines — write-nothing wrapper plus five inner#[cfg(target_os = "linux")], sixOptionfallbacks around sources that cannot fail on Linux, and a test that asserts live kernel values. - Should fix, ~53 lines in
metrics.rs— the newBuckets/Histogramwas added beside the three hand-rolled host histograms instead of in place of them. - Nit, ~28 lines —
docs/api.mdrepeating the HELP strings, two phase-test assertions the route test already makes, an unreachable state-character guard inparse_stat. - Nit, ~3 lines — the nested
if letinMetrics::request_completed. - Optional, ~7 lines (not counted in the total) —
latency.rs:101-108render_histogramis a pure pass-through toHistogram::render; inlining it at its only caller (server.rs:671) withpub(super)on thehistogramfield (latency.rs:36) removes it, but moves the help string away from the observation, so it trades a little readability for the lines.
Total ≈ 165 of 548 added lines (~30%), about 100 of them in the single new file.
Charter anchors: line 35 (what gets merged: maintainer request, roadmap item, reproducible bug, measured perf/memory issue, or bad docs) — the histograms' right to exist rests on issue #536 being the referenced ask, a scope judgement I do not argue against; AGENTS.md:20-21 puts host OS operations in eos/, where a shared descriptor counter would belong if it is shared at all; AGENTS.md:188-193 "Reject unsupported abstractions and churn" — no frameworks, fallback layers, or configuration switches without a concrete requirement, which is exactly findings 2 and 3; AGENTS.md:194-196 "Require focused, meaningful validation" — a test that asserts the kernel's own values is not validation of this code (finding 2c).
1. Blocking: open_descriptors reuse crosses a cargo feature boundary, breaking the documented --features server build
Files: helios/src/server/metrics/process.rs:68, helios/src/runtime_core/mod.rs:58, helios/src/runtime_core/protection.rs:291.
Commit d64c3ea3 replaced process.rs's local /proc/self/fd count with crate::runtime_core::open_descriptors() and re-exported it (runtime_core/mod.rs:58 pub(crate) use protection::open_descriptors;, protection.rs:291 widened to pub(crate)).
runtime_coreis optional:helios/src/lib.rs:25-26#[cfg(feature = "runtime-core")] pub mod runtime_core;.serverdoes not turn it on:helios/Cargo.toml:25server = [ … ];runtime-coreis a separate feature (Cargo.toml:21).metrics::processis declared unconditionally (helios/src/server/metrics.rs:12) andrender_linux(process.rs:56-126) compiles on Linux, socargo test --features server— documented atdocs/model-development.md:99anddocs/scheduling-runtime-design.md:735-736— cannot resolvecrate::runtime_core.- Everywhere else
servercfg-gates the module (server.rs:26-27 mod session;) or gates the reference onruntime-core. CI builds onlyruntime-core,server(.github/workflows/native-serving.yml:63,68), so CI cannot catch this.
Smaller version (what the file had before d64c3ea3), 4 lines, no cross-feature edge:
let open_fds = std::fs::read_dir("/proc/self/fd")
.ok()
.map(|entries| entries.filter_map(Result::ok).count() as u64);
Goes: runtime_core/mod.rs:58 (1 line) and the pub(crate) widening at protection.rs:291 (net 0). Net −2 lines and −2 files. If duplication is unwelcome, the 8-line helper belongs in flare-eos, which AGENTS.md:20-21 designates for host OS operations and which helios always links — larger than reverting.
2. Should fix: process.rs carries a shim, five cfg attributes, six dead Option fallbacks and a kernel-assert test (~80 of 177 lines)
(a) Non-Linux shim and five inner cfgs, ~10 lines. process.rs:8-14 defines pub(crate) fn render(text) with #[cfg(target_os = "linux")] render_linux(text); / #[cfg(not(target_os = "linux"))] let _ = text;, and #[cfg(target_os = "linux")] is repeated on parse_stat (:18), parse_btime (:39), metric (:47), render_linux (:56) and the test module (:128). The repository gates whole platform modules instead (helios/src/server.rs:26-27). Smaller: #[cfg(target_os = "linux")] pub(super) mod process; at metrics.rs:12 plus #[cfg(target_os = "linux")] metrics::process::render(&mut text); at server.rs:709; all six attributes and the wrapper go. ~6 lines, and removes a never-exercised path on the Windows build the description says was not run.
(b) Six if let (Some(..), Some(..)) fallbacks, ~45 lines (process.rs:72-125). The module doc (:4-6) promises a scrape "never panics on a missing or malformed file", but on Linux /proc/self/stat, /proc/stat and /proc/self/fd exist for a live process, page_size() always returns a value (eos/src/unix.rs:73-75 falls back to 4096), a positive sysconf(_SC_CLK_TCK) is guaranteed, and crate::os::raise_open_file_limit(0) returns Some(current) for every desired <= current (eos/src/unix.rs:138-147), so max_fds (:117) is always Some. Smaller, one guard per source and straight calls:
let ticks = unsafe { libc::sysconf(libc::_SC_CLK_TCK) } as u64;
let stat = std::fs::read_to_string("/proc/self/stat").ok().and_then(|l| parse_stat(&l));
let btime = std::fs::read_to_string("/proc/stat").ok().and_then(|c| parse_btime(&c));
let Some(stat) = stat else { return };
metric(text, "process_cpu_seconds_total", "counter", "…", (stat[0] + stat[1]) as f64 / ticks as f64);
metric(text, "process_virtual_memory_bytes", "gauge", "…", stat[3]);
metric(text, "process_resident_memory_bytes", "gauge", "…", stat[4] * crate::os::page_size() as u64);
if let Some(btime) = btime { metric(text, "process_start_time_seconds", "gauge", "…", btime as f64 + stat[2] as f64 / ticks as f64); }
if let Some(open) = open_fds { metric(text, "process_open_fds", "gauge", "…", open); }
if let Some(max) = crate::os::raise_open_file_limit(0) { metric(text, "process_max_fds", "gauge", "…", max); }
Nothing is lost on Linux, the only platform that emits anything; parse_stat/parse_btime keep their Option returns.
(c) Test that asserts the kernel, ~37 lines. process.rs:150-176 (render_reports_process_memory_descriptors_and_start_time plus its value helper at :132-139) asserts live /proc values — resident > 0, virtual ≥ resident, fds ≥ 1, start time within the last hour — and that six # TYPE lines exist. The route test already checks the series in a real scrape body (phase_tests.rs:5398-5399 asserts process_resident_memory_bytes), and the only test that proves something about this code is parse_stat_reads_fields_after_a_parenthesized_command_with_a_paren (:141-148). A broken reader would fail the scrape test too.
Not a saving, checked and dropped: folding process.rs's metric (:47-54) into the shared metrics::metric. The shared writer hard-codes the flare_ prefix (metrics.rs:1597-1602) and takes u64, so process_* names and the f64 CPU/start-time values do not fit.
3. Should fix: the new Histogram type should replace the hand-rolled host histograms, not sit beside them (~53 lines)
The PR adds Buckets<N>/Histogram<N> (metrics.rs:212-298) for the five new request histograms but leaves the three host prefix-store histograms on the older machinery in the same file.
What goes:
HOST_TIME_BUCKETS(metrics.rs:200-209) andHOST_TOKEN_BUCKETS(:210) — 11 lines.- Fields
host_cost_sums: [AtomicU64; 3](:382) andhost_missing_tokens/host_transfer_ns/host_prefill_ns[AtomicU64; 8](:383-385) — replaced by threeHistogram<8>. host_lookup_cost's tuple-array loop with.position(..).unwrap()(:670-692, 20 lines) — threeobservecalls.- The render loop with inline cumulative count, the
u64::MAX → "+Inf"special case and separate_sum(:1029-1065, 37 lines) — a three-entryrenderloop.
Smaller version (labels and sums preserved exactly, because scale: 1.0 keeps the exposed unit at nanoseconds/tokens):
const HOST_TOKENS: Buckets<8> = Buckets { bounds: [64.0, 256.0, 1024.0, 4096.0, 16384.0, 65536.0, 262144.0, f64::INFINITY], scale: 1.0 };
const HOST_NANOSECONDS: Buckets<8> = Buckets { bounds: [1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, f64::INFINITY], scale: 1.0 };
pub(super) fn host_lookup_cost(&self, hit: &flare_selene::HostHit, rate: f64) {
let missing = hit.consumed_tokens - hit.resident_tokens;
self.host_missing_tokens.observe(&HOST_TOKENS, missing);
self.host_transfer_ns.observe(&HOST_NANOSECONDS, (hit.estimated_seconds * 1e9) as u64);
self.host_prefill_ns.observe(&HOST_NANOSECONDS, (missing as f64 / rate.max(1.0) * 1e9) as u64);
}
for (histogram, name, help, buckets) in [
(&self.host_missing_tokens, "host_cache_missing_tokens", "…", &HOST_TOKENS),
(&self.host_transfer_ns, "host_cache_estimated_transfer_ns", "…", &HOST_NANOSECONDS),
(&self.host_prefill_ns, "host_cache_estimated_prefill_ns", "…", &HOST_NANOSECONDS),
] {
histogram.render(text, name, help, buckets);
}
Why nothing is lost: Histogram::observe picks position(|bound| exposed <= *bound).unwrap_or(N - 1) (metrics.rs:264-268), the same rule the removed .position(..).unwrap() used (:689); with scale: 1.0 the le labels and _sum print the same integers. host_outcomes_and_capacity_have_bounded_labels_and_cost_histograms (metrics.rs:1785-1787) reads only _sum and keeps passing. The only output change is that the three series gain # HELP lines (render, :274-277) — additive exposition, not lost behaviour.
Honest caveat: Histogram::render writes _sum as sum as f64 / scale (:291-295), so ns sums above 2^53 round where today's host _sum is exact u64. The request histograms this PR adds already accept that trade.
Do not propose padding TOKEN_SECONDS to 21 bounds to fold the request histograms into one loop: that changes bucket boundaries, so it is not lossless. The retirement histogram (metrics.rs:851-876) cannot join Histogram without a set-style variant either.
4. Nit: doc prose that repeats the HELP text, two redundant assertions, an unreachable guard (~28 lines)
(a) docs/api.md:309-316 restates the metric HELP strings almost verbatim (compare "spans model-scheduler arrival to the first model step that includes the request" with metrics.rs:1398, and "decode time divided by generated tokens after the first" with metrics.rs:1416). The HELP text ships in every scrape. ~8 of the added doc lines can go, keeping the series names, the "Prometheus format only / cumulative since start" sentence, the cancelled/failed exclusion and the prefix-cache note.
(b) phase_tests.rs:4428-4432 asserts flare_request_e2e_seconds_count 0 in a failed-stream case that already asserts the first-response sample count is 0 for the same condition (:4425-4427); the exclusion that needed proving is pinned by the tool-limit test (:4601-4616). phase_tests.rs:4466-4471 re-renders render_histogram to check flare_time_to_first_response_seconds_count, which metrics_route_serves_prometheus_or_json_without_the_api_key (:5389-5395) already checks through the real route. ~11 lines, no behaviour lost.
(c) process.rs:24-28 — the state-character guard ("rejecting a line without one keeps this parser from reading unrelated text that happens to contain )") cannot trigger: parse_stat has one production caller, the /proc/self/stat read at :62-64, plus its own test. Junk input already fails on parse in value(10). Dropping the guard and the parse_stat("42 (no tail)") line (:147) removes ~6 lines and leaves the utime offset fix intact.
(d) metrics.rs:462-469 — the inner if let Some(first) is guaranteed, since first_token_ns is only stamped in Worker::complete (runtime.rs:1774-1775) for an active request, and every active request reaches a step through reserve_and_pack (runtime.rs:2197-2201). Worth only ~3 lines, because flattening to if let (Some(scheduled), Some(first)) = (…) would also drop the queue observation for a request that reached a step but committed no token.
5. Optional nit: the pass-through renderer in latency.rs (~7 lines, not counted above)
helios/src/server/latency.rs:101-108 render_histogram only forwards to Histogram::render with the name, help and REQUEST_SECONDS hard-coded; its sole caller is server.rs:671. Inlining that call at the route (making the histogram field pub(super) at latency.rs:36) removes the wrapper. The trade: the request histograms keep their names and helps in metrics.rs's render loop (:1389-1412), so this one would live in the route handler instead of beside its observation. I rank it below finding 4 and do not count its lines in the total.
Already minimal — say so plainly
The five request histogram definitions and their bounds (metrics.rs:219-241) are exactly issue #536's missing-metrics table; the three RequestTimes fields and the two stamp sites (runtime.rs:1774-1775, :2197-2201) are the minimum that yields queue/prefill/decode, and preemption preservation is free because parking moves Incoming; cancelled/failed requests correctly stay out; flare_request_e2e_seconds is now observed in exactly one place (http.rs:598-606) and Worker::publish hoists its prompt/generated locals (runtime.rs:1993-1998), so the two findings from the earlier review (duplicate e2e observation, recomputed locals) are resolved at head and are not repeated. The window field rename in latency.rs (11 self.0 → self.window sites) is the unavoidable cost of a named struct with a second field.
Open questions / could not verify
- No compilation was run. The build break in finding 1 is derived from the
#[cfg]/feature lists (lib.rs:25-26,Cargo.toml:21,25), not from a failed build; it should be confirmed withcargo check --manifest-path helios/Cargo.toml --features serverbefore merge. - The author did not build Windows either, so the non-Linux branch of
process.rsis unexercised either way; cutting it (finding 2a) costs nothing testable. - Scope: charter line 35 lists what gets merged; issue #536 is a community issue and this is an observability-only change claiming no performance gain, so the histograms' right to exist rests on #536 being the referenced ask. That is a scope judgement, not a subtraction finding, and I have not argued it against the change.
#21 [high] Should fix: host prefix-store histograms left on the old machinery while the PR adds Histogram/Buckets (~55 lines)
Head 055663a (9 files, +1016/−51). The PR adds Buckets<N> (metrics.rs:213-253) and Histogram<N> with observe/absorb/render (:257-322) for its 17 new histograms, but leaves the three existing host prefix-store histograms on the older hand-rolled machinery in the same file:
HOST_TIME_BUCKETSmetrics.rs:199-208 andHOST_TOKEN_BUCKETS:209 — 11 lines.- Fields
host_cost_sums: [AtomicU64; 3]:475,host_missing_tokens/host_transfer_ns/host_prefill_ns: [AtomicU64; 8]:476-478 (4 lines → 3Histogram<8>fields). Metrics::host_lookup_cost:819-841 — tuple-array loop with.position(..).unwrap()and index-into-host_cost_sums, 23 lines → 5.- Render loop :1178-1214 — inline cumulative count,
u64::MAX → "+Inf"special case, separate_sum, 37 lines → ~8 withHistogram::render.
Smaller version (labels, counts and sums identical because scale: 1.0 keeps the exposed unit at ns/tokens, and Histogram::observe uses the same position(|b| exposed <= *b).unwrap_or(N-1) rule as the removed .position(..).unwrap()):
const HOST_TOKENS: Buckets<8> = Buckets { bounds: [64.0, 256.0, 1024.0, 4096.0, 16384.0, 65536.0, 262144.0, f64::INFINITY], scale: 1.0 };
const HOST_NANOSECONDS: Buckets<8> = Buckets { bounds: [1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, f64::INFINITY], scale: 1.0 };
pub(super) fn host_lookup_cost(&self, hit: &flare_selene::HostHit, rate: f64) {
let missing = hit.consumed_tokens - hit.resident_tokens;
self.host_missing_tokens.observe(&HOST_TOKENS, missing);
self.host_transfer_ns.observe(&HOST_NANOSECONDS, (hit.estimated_seconds * 1e9) as u64);
self.host_prefill_ns.observe(&HOST_NANOSECONDS, (missing as f64 / rate.max(1.0) * 1e9) as u64);
}
for (histogram, name, help, buckets) in [
(&self.host_missing_tokens, "host_cache_missing_tokens", "…", &HOST_TOKENS),
(&self.host_transfer_ns, "host_cache_estimated_transfer_ns", "…", &HOST_NANOSECONDS),
(&self.host_prefill_ns, "host_cache_estimated_prefill_ns", "…", &HOST_NANOSECONDS),
] {
histogram.render(text, name, help, buckets);
}
Nothing is lost: the only consumers of those fields are the sites listed (search_code for host_missing_tokens|host_transfer_ns|host_prefill_ns|host_cost_sums returns exactly these lines, no snapshot/JSON reader), and the existing test host_outcomes_and_capacity_have_bounded_labels_and_cost_histograms reads only _sum and keeps passing. Only output change: the three series gain # HELP lines. Honest caveat: Histogram::render writes _sum as sum as f64 / scale (:315-319), so ns sums above 2^53 round, where today's host _sum is exact u64; the request histograms this PR adds already accept that trade.
Savings: 11→4 consts (−7), fields −1, observe 23→5 (−18), render 37→8 (−29) ⇒ ≈55 lines.
Do NOT fold the 19-bound TOKEN_SECONDS request histograms into the 21-bound REQUEST_SECONDS loops: different bounds, so not lossless.
Citation: AGENTS.md:188-193 "Reject unsupported abstractions and churn … fallback layers … Refactoring must directly support the requested behavior or remove a demonstrated source of cost" — adding a histogram type beside two older ones is exactly the churn this forbids.
#22 [high] Should fix: per-response choice histograms are the only per-response state in the change (~50 lines)
The per-request side of the change is request-scoped and needs no per-response state. The choice pair is the exception, and it is the weakest of the new series:
request_choices: Histogram<6>andrequest_max_choice_generated_tokens: Histogram<21>metrics.rs:407-408;CHOICE_COUNTS:249-253.Metrics::response_completed(elapsed_ns, choices, generated):608-618 — thegenerated.chunks(choices)loop is the only reason the HTTP layer carries token counts.- http.rs:407
let mut generated = vec![0u32; size];, http.rs:530generated[index] = generated_tokens;, and the two extra arguments at :604-609. - Render: the
request_max_choice_generated_tokensentry in the TOKEN_COUNTS loop (:1617-1621) and therequest_choices.renderblock (:1625-1630). - Test
response_histograms_count_choices_and_largest_choice_per_promptmetrics.rs:1980-2004 (~20 lines); docs/api.md:322-326 (5 lines) and the narrative in table row :507.
Smaller version — Metrics::response_completed(&self, elapsed_ns: u64) observes request_e2e only, and http.rs:604-609 becomes:
if !count && !encoder.tool_limit_reached {
state.model.metrics().response_completed(admitted_at.elapsed().as_nanos() as u64);
}
Why nothing is lost: flare_request_generated_tokens already observes every completed request's generated-token count, and the PR's own docs (api.md:325-326) state that Flare runs each choice as its own model request — so each of the n choices is already its own observation in a histogram with identical TOKEN_COUNTS bounds. flare_request_max_choice_generated_tokens adds only "the max of choices already counted individually", and flare_request_choices adds a n parameter value that /v1/completions alone accepts. Their removal drops two table rows to "Not provided" rather than losing a measurement. Issue #536 — the stated justification the PR closes — asks for e2e, queue, prefill, decode, inter-token/time-per-output-token, TTFT, prompt tokens and process metrics; neither choice series is in its table. Nothing in the repo reads either series yet (no dashboard/example consumer; #541 does not name them).
Savings: consts 5, fields 2, observe loop 7, render 11, http.rs 3 + signature 2, test 20, docs 6 ⇒ ≈50 lines (or ≈25 if only request_max_choice_generated_tokens and its Vec go and request_choices is observed once per response).
Honest counter-argument to state in the report: both are names in vLLM's production list, so dropping them weakens the "parity" framing, though not any dashboard that has a consumer today.
Same test applied to flare_request_inference_seconds (metrics.rs:412, :587-590, :1569-1573, docs:333-334): it is exactly prefill + decode on the same 21 REQUEST_SECONDS bounds, so an operator can add the two existing histograms bucketwise; dropping it saves ≈20 lines including tests. I would keep it, because vLLM's logger exports request_inference_time_seconds and the mapping table promises it — mention as optional, do not count it.
#23 [high] Should fix/nit: match duplicates existing samples() helper, docs restate HELP, redundant assertions; tally ≈163 lines
Verified at head 055663a:
(a) GraphKind::samples() already exists and the PR re-derives it (~8 lines). runtime.rs:1721-1730 lists Prefill | TerminalPrefill | ScoredPrefill | Resume | Decode | Speculative | Mixed to gate model_step. helios/src/execution/manifest.rs:90-101 defines GraphKind::samples() as exactly those seven variants (Prefill|TerminalPrefill|ScoredPrefill|Decode|Speculative|Mixed|Resume); the enum (manifest.rs:70-83) has only three more, Init/Restore/Snapshot/Vision, which the PR's docs (api.md:383-386) say must be excluded. Existing callers: manifest.rs:944, execution/transport.rs:1319,1334, model/testing.rs:170, server/runtime.rs:2956 — so it is the established predicate. Smaller version:
if kind.samples() {
self.metrics.model_step(prefill + generated.len() as u64);
}
10 lines → 3. Note runtime.rs:1669-1677 has the same variant list minus Resume for a different gate, so this also removes an inconsistency hazard.
(b) docs/api.md repeats the HELP text and the mapping table (~30 lines). api.md:311-346 narrates e2e/queue/prefill/inference/TTFT/decode/inter-token in prose that metrics.rs:1548-1595 already ships as HELP strings in every scrape (e.g. api.md:329-331 vs :1557, api.md:340-341 vs :1567, :1586). api.md:377-386 then restates the same facts a third time in the correspondence rows :501-504 and :484-515. Keeping the population rules an operator cannot read from HELP (which requests are excluded, per-response vs per-request) and dropping the restatement is ≈30 lines of the +127 doc lines.
(c) Redundant test assertions (~20 lines). phase_tests.rs:943-946 (reasoning_budget_does_not_readmit_eos_or_user_stops) asserts flare_requests_completed_total 1 and flare_requests_output_limited_total 0 on top of the budget_events assertion of "stop" at :937-940 that already pins the same termination. phase_tests.rs:1499-1508 re-asserts model_step_tokens_count/sum which metrics.rs unit tests already cover for the same 2-step shape. The 40-line full_http_admission_counts_a_queue_limit_rejection (:5418-5457) spins a real TCP listener to reach a try_acquire_many_owned error arm that acquire_ingress's unit test (:846-858) already exercises directly — the counter add at server.rs:816/http.rs:237-240 could be asserted through acquire_ingress without the socket.
Tally. Change: 9 files, +1016/−51 (pr_files at 055663a). Removable: host-histogram conversion ≈55 (21), per-response choice series ≈50 (22), samples() reuse ≈8, docs ≈30, redundant tests ≈20 → ≈163 lines, plus the optional flare_request_inference_seconds (prefill+decode) ≈20 and latency.rs:101-108 render_histogram pass-through ≈7 not counted.
Already minimal (say so): request histograms/bounds match #536's table; three RequestTimes stamps are the minimum for queue/prefill/decode; preemption survival is free (parking moves Incoming); e2e observed once (http.rs:604-609); publish_gauges is a 9-line fold of an existing 5-line block + one store, justified.
Charter: line 35 (what gets merged), AGENTS.md:188-193 unsupported abstractions/fallbacks, AGENTS.md:194-199 focused validation.
#24 [high] Report of 2026-11-28, run at head 055663a — verdict and ranked findings (supersedes #19/#20)
Verdict: make it smaller first. The request histograms are the right shape and mostly minimal, but the change adds a histogram abstraction without retiring the three hand-rolled histograms it supersedes, adds per-response choice series that duplicate the per-request generated-token histogram, and re-derives a predicate the repo already has.
Change at head 055663a (pr_files): 9 files, +1016/−51. docs/api.md +127/−4; scheduler.rs +4; scheduler/tests.rs +7; server.rs +2; server/http.rs +15; server/latency.rs +24/−8; server/metrics.rs +548/−2; server/runtime.rs +102/−37; server/runtime/phase_tests.rs +187. Since the previous review round the author fixed the --features server build break (deleted metrics/process.rs, reverted open_descriptors to private), so my earlier blocking finding is closed and must not be re-raised.
Findings, ranked by lines saved
-
Should fix, ≈55 lines — the new
Histogramtype was added beside the three hand-rolled host histograms instead of in place of them.helios/src/server/metrics.rs:199-209(HOST_TIME_BUCKETS,HOST_TOKEN_BUCKETS),:475-478(host_cost_sums, the three[AtomicU64; 8]),:819-841(host_lookup_cost's tuple loop with.position(..).unwrap()),:1178-1214(37-line render loop withu64::MAX → "+Inf"). Smaller: twoBuckets<8>consts, threeHistogram<8>fields, threeobservecalls, one three-entryrenderloop. Labels, counts and sums identical (scale: 1.0, sameposition(|b| exposed <= *b).unwrap_or(N-1)rule). Caveat:_sumbecomesf64, so ns sums above 2^53 round — the request histograms already accept that. (detail: note 21) -
Should fix, ≈50 lines — the per-response choice pair duplicates the per-request generated-token histogram.
metrics.rs:407-408(request_choices,request_max_choice_generated_tokens),:249-253(CHOICE_COUNTS),:608-618(response_completed'schunks(choices)loop),:1617-1630(render),http.rs:407,530,604-609(let mut generated = vec![0u32; size]plus the extra arguments), the 20-line testmetrics.rs:1980-2004, and docs:322-326,:507.flare_request_generated_tokensalready observes each choice separately (Flare runs each choice as its own model request — the PR's own docs say so), and neither series is in #536's request table nor read by any dashboard in the repo. (detail: note 22) -
Should fix, ≈8 lines — the model-step gate duplicates
GraphKind::samples().runtime.rs:1721-1730lists seven variants;execution/manifest.rs:90-101defines exactly those seven, with five existing callers (manifest.rs:944,transport.rs:1319,1334,model/testing.rs:170,runtime.rs:2956). Replace withif kind.samples() { self.metrics.model_step(prefill + generated.len() as u64); }. Side benefit: removes the drift risk against the near-identical list atruntime.rs:1669-1677. -
Nit, ≈30 lines —
docs/api.md:311-346and:377-386restate the HELP strings that ship in every scrape (metrics.rs:1548-1595), and the correspondence rows:501-504repeat them a third time. Keep the population rules an operator cannot read from HELP (what is excluded, per-response vs per-request); drop the restatement. -
Nit, ≈20 lines — assertions that prove what another test already proves:
phase_tests.rs:943-946(thebudget_eventsassertion above it already pins"stop"),:1499-1508(model_step_tokensalready unit-tested for the same 2-step shape), and the 40-line TCP-listener test:5418-5457reaching a semaphore error armacquire_ingress's unit test (server.rs:846-858) already covers.
Total ≈163 of 1016 added lines (~16%), two thirds in two consolidations that remove whole mechanisms rather than lines.
Optional, not counted: flare_request_inference_seconds is exactly prefill+decode on the same bounds (≈20 lines, but vLLM exports it and the mapping table promises it — keep); latency.rs:101-108 render_histogram is a pass-through to Histogram::render with one caller server.rs:671 (≈7 lines, but moves the help string away from the observation).
Already minimal — say so plainly
The new histogram set and bounds are exactly #536's missing-metrics table; the three RequestTimes stamps (runtime.rs:1803-1805, :2230-2235) are the minimum for queue/prefill/decode and preemption survival is free because parking moves Incoming; e2e is observed once (http.rs:604-609); publish_gauges (runtime.rs:1202-1211) is a justified 9-line fold of an existing block plus one store; the RequestRecord/CompletedRequest split keeps request_completed the only increment of the completion counter, which is the stated design.
Charter anchors: line 35 (what gets merged / bad docs) — the histograms' right to exist rests on #536 being the referenced ask, which I do not contest; AGENTS.md:188-193 (reject unsupported abstractions, fallback layers, and churn — "Refactoring must directly support the requested behavior or remove a demonstrated source of cost") for findings 1 and 2; AGENTS.md:194-199 (focused, meaningful validation) for finding 5. Caveats: no compilation run this turn; line counts are read from the diff and files. Finding 2's counter-argument (both series are vLLM names, so dropping them weakens the stated parity) is stated in the report.
#25 [high] Research summary
Verdict: make it smaller first. Full report is scratchpad entry #24; supporting detail in #21, #22, #23.
The change: head 055663a, 9 files, +1016/−51. Since the last round the author deleted helios/src/server/metrics/process.rs (not opened) and reverted open_descriptors to private, so the earlier blocking --features server build break is fixed and was not re-raised. The process_* scaffolding findings are moot.
Could remove: about 163 of the 1016 added lines (~16%), two thirds of it in two consolidations that remove mechanisms rather than lines:
- ≈55 lines (should fix) — the new
Histogram/Bucketstype was added beside the three hand-rolled host prefix-store histograms instead of in place of them:metrics.rs:199-209HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS,:475-478host_cost_sumsand the three[AtomicU64; 8],:819-841the.position().unwrap()observe loop,:1178-1214the 37-line render loop. Converting keepslelabels, counts and sums identical (scale: 1.0); the one caveat is_sumbecomingf64. - ≈50 lines (should fix) —
flare_request_max_choice_generated_tokensandflare_request_choices(metrics.rs:407-408, 249-253, 608-618, 1617-1630;http.rs:407,530,604-609; a 20-line test; 6 doc lines) duplicateflare_request_generated_tokens, since Flare runs each choice as its own model request. Neither series is in #536's table nor read by any dashboard in the repo. The counter-argument, which the report should state, is that both are names in vLLM's production list. - ≈8 lines (should fix) —
runtime.rs:1721-1730re-derivesGraphKind::samples()(execution/manifest.rs:90-101, five existing callers):if kind.samples() { self.metrics.model_step(...) }. - ≈30 lines (nit) —
docs/api.md:311-346, 377-386, 501-504restate the HELP strings that ship in every scrape (metrics.rs:1548-1595). - ≈20 lines (nit) —
phase_tests.rs:943-946,:1499-1508, and the 40-line TCP test at:5418-5457assert what thebudget_events/unit/semaphore tests above them already prove.
Already minimal, said plainly: the histogram set and bounds are exactly #536's missing-metrics table; the three RequestTimes stamps are the minimum for queue/prefill/decode and preemption survival is free because parking moves Incoming; e2e is observed once; publish_gauges is a justified 9-line fold of an existing block plus one store.
Caveats: no compilation was run this turn; all line counts come from the diff and the head files. Charter anchor: line 35, plus AGENTS.md:188-193 ("Reject unsupported abstractions and churn … Refactoring must directly support the requested behavior or remove a demonstrated source of cost") for findings 1–2, and AGENTS.md:194-199 for finding 5.
#26 [high] Citations and do-not-re-raise list for the report at head 055663a
Notes for the final report so no citation needs re-reading at head 055663a (Wynn Drahorad, 9 files, +1016/−51 per pr_files).
Do not re-raise (fixed by the author's five pushed commits 54e06b3..055663a):
- The
--features serverbuild break:helios/src/server/metrics/process.rsis deleted (177 lines gone),helios/src/runtime_core/mod.rs:58pub(crate) use protection::open_descriptorsremoved,protection.rs:291back tofn open_descriptors. My earlier blocking finding is closed. - All
process.rsscaffolding/fallback/test findings are moot with the file. - Duplicate e2e observation: now one
response_completedcall athttp.rs:604-609insideif !count && !encoder.tool_limit_reached. Hoistedpublishlocals atruntime.rsFinished handling. Duplicate phase-test first-response assertion (render_histogramone) was deleted by the author atphase_tests.rs:4572area.
Citations the five ranked findings rest on (all read this turn):
metrics.rs:199-208HOST_TIME_BUCKETS,:209HOST_TOKEN_BUCKETS,:475-478host_cost_sums + host_missing_tokens/host_transfer_ns/host_prefill_ns,:819-841host_lookup_cost (.position(...).unwrap()at :838),:1178-1214render loop (u64::MAX→"+Inf" at :1202-1206). New machinery:Buckets:213-253,Histogram:257-322 (observe:272-283 same bound rule;renderwrites_sumassum as f64 / scale:315-319). Existing test that keeps passing:host_outcomes_and_capacity_have_bounded_labels_and_cost_histograms(metrics.rs ~:1785).metrics.rs:249-253CHOICE_COUNTS,:407-408the two histograms,:608-618response_completed,:1617-1630render entries;http.rs:407let mut generated = vec![0u32; size];,:530generated[index] = generated_tokens;,:604-609the call; testresponse_histograms_count_choices_and_largest_choice_per_promptmetrics.rs:1980-2004; docs/api.md:322-326 and table row :507. The PR's own docs (api.md:325-326) say Flare runs each choice as its own model request.runtime.rs:1721-1730the seven-variantmatches!;execution/manifest.rs:70-83enum,:90-101pub fn samples(self)with exactly those seven; callers manifest.rs:944, execution/transport.rs:1319 and :1334, model/testing.rs:170, server/runtime.rs:2956. Near-identical list minus Resume at runtime.rs:1669-1677.- docs/api.md:311-346 (prose) vs HELP at metrics.rs:1548-1595 (e.g. :1557 queue, :1567 decode, :1571 inference, :1586 time_per_output_token); third restatement at api.md:377-386 and rows :501-504, :484-515.
- phase_tests.rs:937-946 (
budget_eventspins "stop" then :943-946 re-asserts the counters), :1499-1508 (model_step_tokens, already unit-tested in metrics.rs), :5418-5457 (TCP-listener 429 test) vsacquire_ingressunit testserver.rs:846-858; counter add sitesserver.rs:816andhttp.rs:237-240.
Optional, verified, not counted: flare_request_inference_seconds (metrics.rs:412, observe :587-590, HELP :1569-1573, docs :333-334) is prefill+decode on the same REQUEST_SECONDS bounds — keep, vLLM exports it. latency.rs:101-108 render_histogram pass-through, sole caller server.rs:671, field histogram at latency.rs:36.
Already minimal: histogram bounds = #536's table (issue text read: it asks e2e/queue/prefill/decode/time-per-output-token/TTFT/prompt tokens + process metrics — neither choice series is in it); stamps runtime.rs:1803-1805 and :2230-2235; publish_gauges runtime.rs:1202-1211; RequestRecord/CompletedRequest keep request_completed the only completion-counter increment (metrics.rs:545-603).
Unverified: no build or test run this turn; all numbers read from the diff and head files.
#3 [medium] Should fix: new Histogram type coexists with the hand-rolled host histograms; e2e observation written twice (~45 lines)
File: helios/src/server/metrics.rs:212-298 (new Buckets/Histogram, ~87 lines) and helios/src/server/server.rs-adjacent call sites.
(a) The new generic histogram duplicates machinery that already exists in the same file. HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS plus the parallel arrays host_missing_tokens/host_transfer_ns/host_prefill_ns and host_cost_sums (metrics.rs:200-210, 382-385) and the 37-line render loop (metrics.rs:1029-1065) do exactly what Histogram<N> + Buckets<N> do. Smaller version: convert the three host histograms to Histogram<8> and delete HOST_TOKEN_BUCKETS, HOST_TIME_BUCKETS, host_cost_sums, the .zip(limits) bucket loop and the .position(...).unwrap() in host_lookup_cost (metrics.rs:670-692) — the existing host_outcomes_and_capacity_have_bounded_labels_and_cost_histograms test (metrics.rs:1740-1796) keeps passing unchanged because it only reads the rendered text. ~40 lines net saving after subtracting what the PR adds (the PR currently adds the type alongside the hand-rolled version, so both exist).
(b) The e2e observation is written twice, once per delivery shape (helios/src/server/http.rs:614-617 and 631-632), and needs a second Arc clone only for the streaming arm (let metrics = state.model.metrics_handle(); at http.rs:603). Every successful generation yields exactly one Delivery::Complete from the generator body (http.rs:598, the only such yield); failures return after Delivery::Failed. Recording once in the generator immediately before that yield replaces both match-arm copies:
if !count {
state.model.metrics().request_e2e.observe(&super::metrics::REQUEST_SECONDS, admitted_at.elapsed().as_nanos() as u64);
}
yield Delivery::Complete(response);
Deletes the metrics_handle() line, both if !count {...} copies, and keeps the same timing (the generator reaches that point only when the client polls to completion, which is what the two arms test today). ~5 lines and one Arc clone removed.
#4 [medium] Nit: thin platform shim, second impl block, docs restating HELP text, duplicated test assertions (~20 lines)
Smaller items, all verified:
(a) Nit — non-Linux shim. helios/src/server/metrics/process.rs:8-14 wraps render_linux so other platforms compile a function that writes nothing (#[cfg(not(target_os="linux"))] let _ = text;), and metrics.rs:12 pub(super) mod process; is unconditional. The repo already cfg-gates platform modules (helios/src/runtime_core/protection.rs:291-302, eos crate). Smaller: #[cfg(target_os = "linux")] pub(super) mod process; in metrics.rs:12 and #[cfg(target_os = "linux")] metrics::process::render(&mut text); at server.rs:709, dropping the wrapper and the let _ = text arm. ~6 lines, and one less dead path to reason about on Windows builds (which the description says were not run).
(b) Nit — latency.rs:122-131 adds a second impl FirstResponseSamples block for render_histogram instead of putting it in the existing impl at latency.rs:63-101. 2 lines of churn.
(c) Nit — docs/api.md:300-313 restates, sentence for sentence, the HELP strings added at metrics.rs:1387-1425 ("from model-scheduler arrival to the first model step...", "decode time divided by generated tokens after the first", etc.). One of the two is enough for an operator; the API doc could keep the names and the one non-obvious rule (cancelled/failed excluded, prefix-reused tokens counted) and drop the four start/end clauses, ~6 lines.
(d) Nit — duplicated assertion. phase_tests.rs:4429-4432 and 4464-4470 check e2e/ttfr counts in two separate tests and metrics_route_serves_prometheus_or_json_without_the_api_key (phase_tests.rs:5379-5388) checks the same series through a real scrape. The scrape test covers the rendering; the two per-test assertions could keep only the behavioural bit each proves (a failed stream leaves e2e at 0; one offered body leaves it at 1) and drop the re-render of the histogram at 4466-4470, ~5 lines.
Verified-minimal parts (do not ask to cut): the five histogram definitions themselves are the #536 deliverable (issue #536 "Missing metrics" table); the RequestTimes field additions and the two reserve_and_pack/complete stamps are the minimum that produces queue/prefill/decode intervals, and the parked-request preservation falls out of moving Incoming into the parked list (runtime.rs:2058+ park path) rather than any added code; RequestTimes derives Debug unused, 0 lines. The state.first_response.render_histogram split (latency.rs:123-131, server.rs:671) is needed because the first-response histogram lives outside Metrics.
#5 [medium] Correction: open_descriptors lives behind the runtime-core feature; move it to eos
Correction/adjustment to entry 1(b): open_descriptors() (helios/src/runtime_core/protection.rs:291-302) is not directly callable from the server — runtime_core is a separate cargo feature (helios/Cargo.toml:21,25; server does not enable it). So reuse needs one of: move that 8-line fn into flare_eos (eos/src/unix.rs already holds the platform split, and helios/src/lib.rs:36 already re-exports from it), or keep the duplication. Prefer moving it: flare_eos is an unconditional dependency of helios (Cargo.toml:34) and already owns /proc and rlimit access (page_size unix.rs:73-75, windows.rs:152; raise_open_file_limit unix.rs:138-165). Either way the process.rs copy at lines 65-67, 68-77 and 55-58 collapses onto eos calls, saving ~15 lines and three unsafe blocks in the new file.
flare_eos::page_size() and flare_eos::raise_open_file_limit(0) are both reachable from server code today (helios/src/lib.rs:36, eos is not feature-gated), so 1(b)'s max_fds and page parts stand as written.
Also confirmed for the report: the hand-rolled metric in process.rs (43-49) is fine to fold into metrics::metric (metrics.rs:1597) — both live in helios::server, and metrics::metric is pub(super) within server.
#12 [medium] Nit: docs repeat the HELP strings, two phase-test assertions repeat the scrape test, an unreachable stat guard (~25 lines)
Small items at head a34c4d0, all verified:
(a) docs/api.md:309-316 repeats the HELP strings almost verbatim. "spans model-scheduler arrival to the first model step that includes the request" vs metrics.rs:1398 "Model-scheduler arrival to the first model step that includes the request, for completed requests."; "decode time divided by generated tokens after the first" vs metrics.rs:1416. The HELP text is emitted in every scrape, so the operator already has it. Roughly 8 of the 39 added doc lines could go, keeping the names, the "histograms are Prometheus-only and cumulative" sentence, the cancelled/failed exclusion and the prefix-cache note. Not a loss of information — same statements, one copy less.
(b) phase_tests.rs:4428-4432 (5 lines) asserts flare_request_e2e_seconds_count 0 in a failed-stream test that already asserts the first-response sample count is 0 (same condition, :4425-4427); the exclusion of cancellations is the thing that needed proving and is covered by the tool-limit test at :4601-4616. phase_tests.rs:4466-4471 (6 lines) re-renders render_histogram to check flare_time_to_first_response_seconds_count, which metrics_route_serves_prometheus_or_json_without_the_api_key (:5390-5393) already checks through the real route. Removing both loses no behaviour: about 11 lines.
(c) process.rs:24-28 — the state-character guard added in a34c4d0 ("rejecting a line without one keeps this parser from reading unrelated text that happens to contain )") cannot trigger: parse_stat has exactly one production caller, the /proc/self/stat read at process.rs:62-64, plus its own test. Junk input already fails on parse in value(10); dropping the guard and the test's parse_stat("42 (no tail)") line (:147) removes ~6 lines and leaves the offsets fix (utime is value(10) now) intact.
(d) metrics.rs:462-469 — if let Some(first) = times.first_token_ns nested inside if let Some(scheduled): first_token_ns is only stamped in Worker::complete (runtime.rs:1774-1775) for an active request, and every active request reaches a step through reserve_and_pack (runtime.rs:2197-2201, or a test calling it directly), so the inner Some is guaranteed. Flattening to
if let (Some(scheduled), Some(first)) = (times.first_scheduled_ns, times.first_token_ns) { … }
would also drop the queue observation for a completed request that reached a step but committed no token, so it is not a clean win: about 3 lines at most, nit.
Already minimal, checked and dropped: RequestTimes derives (Clone, Copy used when the value is passed by value; Debug unused but zero lines); the window field rename in latency.rs (11 self.0 → self.window sites) is the unavoidable cost of a named struct with a second field; the five new bucket tables are the #536 deliverable; flare_request_e2e_seconds now records in exactly one place (http.rs:598-606), so the earlier duplicate-observation finding is resolved at head; Worker::publish already hoists prompt/generated into locals (runtime.rs:1993-1998), resolved at head.