#1 [high] Should fix: e2e histogram includes cancelled/tool-limited responses, contradicting the stated exclusion rule
helios/src/server/http.rs:631-635 (non-stream) and http.rs:614-617 (stream) observe flare_request_e2e_seconds in the Delivery::Complete arm. That arm is reached for responses whose generation the runtime counted as cancelled: at http.rs:563-567, when encoder.tool_limit_reached, generation.cancel() is called, and the runtime then counts it in metrics.cancelled, never in request_completed (runtime.rs:1343-1364 / 1334-1342). The terminal event still flows through GenerationEvent::Finished → Delivery::Complete → e2e observed.
Why it matters: docs/api.md (new paragraph, lines ~296-311) states "Cancelled and failed requests enter only flare_requests_cancelled_total and flare_requests_failed_total", and the PR description repeats "Cancelled and failed requests stay out of these histograms". For flare_request_e2e_seconds that is not true of the cancelled-by-tool-limit path, so a dashboard comparing flare_request_e2e_seconds_count against the runtime histograms/counters mixes populations.
Fix: gate the observation (e.g. skip when encoder.tool_limit_reached/termination is Cancelled), or narrow the documentation sentence so it covers only the runtime histograms (queue/prefill/decode/tpot/prompt tokens). Verified in code; a test with a tool-limit-reaching request would settle whether e2e is really observed there.
#6 [high] Research summary
Reviewed PR #548 (request latency histograms + Linux process metrics) through the correctness lens: read all 8 changed files in context (metrics.rs, runtime.rs, http.rs, latency.rs, server.rs, process.rs, phase_tests.rs, docs/api.md), followed both request_completed call sites, the reserve_and_pack/complete/publish/park paths, and both HTTP delivery arms, and checked the repo's rules (charter, AGENTS.md, docs/design-review.md).
Two findings worth fixing: (1) flare_request_e2e_seconds is observed on any Delivery::Complete, so responses the runtime counts as cancelled (the encoder.tool_limit_reached → generation.cancel() path at http.rs:563-567, which never reaches request_completed) still land in the e2e histogram, contradicting the new docs sentence and the PR description that cancelled requests appear only in flare_requests_cancelled_total; (2) streaming e2e is only recorded if the client drains the SSE body while the non-streaming path records before the body is polled, an asymmetry that makes flare_request_e2e_seconds_count diverge from flare_requests_completed_total for streamed requests and is not stated in docs/api.md.
Also noted as lower-severity items: first_scheduled_ns is stamped for GraphKind::Vision lanes too (question, may be intended given the docs wording); parse_stat's last-) heuristic returns Some on some malformed comms rather than omitting; process_open_fds counts its own directory read (+1 vs the standard exporter, but the HELP text says so). Verified-correct: the counter and histograms share one function with no leftover direct completed.fetch_add sites, bucket indexing and cumulative rendering are consistent, the non-Linux build of process.rs compiles cleanly (all libc use is Linux-cfg'd), and the JSON snapshot is untouched. Evidence limitation: the live scrape ran on a cherry-pick onto a fork commit, no CI checks exist on the head, and the Windows build and full suite were not run.
#7 [high] Citation sheet for the two findings and secondary items
Finding 1 (Should fix, e2e vs cancelled):
- helios/src/server/http.rs:563-567 —
if encoder.tool_limit_reached { if let Some(generation) = &generations[index] { generation.cancel(); } }; the terminalGenerationEvent::Finishedstill becomesDelivery::Completeat http.rs:598 (yield Delivery::Complete(response);). - helios/src/server/http.rs:614-617 (stream) and 631-635 (non-stream) —
request_e2e.observe(...)unconditional in theDelivery::Completearm, guarded only by!count(count_tokens). - Cancellation is counted in runtime.rs:1334-1342 (parked) and 1343-1364 (active) as
self.metrics.cancelled.fetch_add, and those paths never callrequest_completed. - Contradicted text: docs/api.md new paragraph (in the diff, after "The route returns one JSON object…" block start, ~lines 287-320): "Cancelled and failed requests enter only
flare_requests_cancelled_totalandflare_requests_failed_total." PR description: "Cancelled and failed requests stay out of these histograms."
Finding 2 (Should fix, streaming e2e requires body drain):
- http.rs:600-620 stream arm inside
delivery.filter_mapused bySse::new(events); observed only when the client polls to the end. - http.rs:629-641 non-stream arm observes in the handler before the body is polled.
- phase_tests.rs:4461-4465 asserts
flare_request_e2e_seconds_count 1for thepoll_body == falsecase, which proves the non-stream contrast. - Docs wording, docs/api.md: "
flare_request_e2e_secondscounts each successful generation from admission to the completed response" — no mention of body drain, while the adjacent sentence forflare_time_to_first_response_secondsdoes say "once the client reads it".
Secondary items:
- runtime.rs:2187-2203
reserve_and_packloopsstep.lanesand setsfirst_scheduled_nsbefore theif step.kind == GraphKind::Visionsplit at 2208, so vision lanes also stamp the queue end. - metrics/process.rs:19-32
parse_statlast-)heuristic; returns Some for ambiguous comms; module doc (lines 1-6) claims unreadable/unparsable sources omit the metric. - metrics/process.rs:65-67, 115-123
process_open_fdsincludes the read_dir handle, acknowledged in its HELP string. - metrics/process.rs:9-14 + helios/Cargo.toml:50
libcis non-optional and all uses arecfg(target_os = "linux"), so the Windows/non-Linux build has no new libc reference.
Coupling check: Metrics::request_completed at metrics.rs:452-480 is the only increment of completed; the two former sites were runtime.rs:1832 (user/text stop, now 1841-1846) and 1984 (natural finish, now 1993-1998).
#10 [high] Research summary
Verdict on the pushed head (a34c4d06): one new blocking build break, one should-fix counting divergence, otherwise the earlier findings are resolved. (Scratchpad notes #1–#9 describe the pre-push state; note #1 and #2 are now fixed — this report carries the new findings, as only finish was available this turn.)
Blocking (new, introduced by "Exclude cancelled responses and reuse host helpers"):
helios/src/server/metrics/process.rs:68callscrate::runtime_core::open_descriptors(), buthelios/src/lib.rs:22-26declarespub mod runtime_coreonly under#[cfg(feature = "runtime-core")], and theserverfeature (helios/Cargo.toml:25) does not enableruntime-core. Until this commit no non-test file underhelios/src/server/outside the#[cfg(feature = "runtime-core")]-gatedsessionmodule referencedcrate::runtime_core(onlymetrics/process.rs:68and the#[cfg(all(test, feature = "runtime-core"))]prompt_testsdo now). So--features server— the configuration the docs themselves invoke indocs/model-development.md:99anddocs/scheduling-runtime-design.md:735-737— stops resolving. Fix: moveopen_descriptorsintoeos/src/unix.rsnext topage_sizeandraise_open_file_limitand re-export it throughcrate::os(which ispub(crate) use flare_eos::*,helios/src/os.rs:8) — the same place the commit already took the other two helpers from, and whereAGENTS.md:20-21puts host OS operations — or gate the call. I could not compile here (no checks on this head), so this rests on the cfg reading;cargo check --manifest-path helios/Cargo.toml --features serversettles it in seconds.
Should fix (new):
- The new e2e exclusion is response-scoped while completions are per generation.
http.rs:598-605skips the observation whenencoder.tool_limit_reached, a flag on the shared encoder (protocol/encode.rs:89, set at:506), but one response can carry several generations (sizechoices,http.rs:340-353,generations: Vec<Option<Generation>>). A sibling choice that already finished before the tool limit was flagged keeps its runtime completion —Metrics::request_completedalready ran for it atruntime.rs:1841-1846/1996-2001, incrementingflare_requests_completed_totaland the queue/prefill/decode histograms — yet loses its e2e observation, soflare_request_e2e_seconds_count < flare_requests_completed_totalanddocs/api.md:315-316("Cancelled and failed requests enter only …") is wrong for that choice. Fix: decide per finished generation (e.g. skip only when the termination actually used athttp.rs:526isCancelled) instead of consulting the response-wide flag.
Nits: parse_stat's new state-character allow-list (metrics/process.rs:26, "RSDZTtWXxKPI") silently drops every stat-derived metric if a kernel ever reports another state letter; validating that the following fields parse would bound the same risk without a hard-coded alphabet.
Verified fixed since the last review: the tool-limit exclusion plus the single observation point before yield Delivery::Complete (http.rs:598-606) closes my finding #1, and the new assertion at runtime/phase_tests.rs:4604-4613 pins it; the streaming-drain asymmetry is now stated in docs/api.md:303-306, closing finding #2; the vision-step caveat is documented (docs/api.md:309-311), closing the open question in #3. "Hoist completion values" makes request_completed and the Finished event share prompt_tokens/generated_tokens (runtime.rs:1993-2001 vs :2017-2019), so the histograms and the response usage can no longer disagree. I re-derived parse_stat's index arithmetic (utime field 14 → nth(10), stime 15, starttime 22, vsize 23, rss 24) and it matches the fixture; raise_open_file_limit(0) (eos/src/unix.rs:138-147) returns the current soft limit with no side effect, so process_max_fds is sound; the process_open_fds +1 is now disclosed in its HELP text (process.rs:113).
#11 [high] Blocking: process.rs references feature-gated crate::runtime_core, breaking --features server
BLOCKING (new on head a34c4d06, introduced by "Exclude cancelled responses and reuse host helpers" d64c3ea3).
Evidence:
- helios/src/server/metrics/process.rs:68
let open_fds = crate::runtime_core::open_descriptors(); - helios/src/lib.rs:22-26:
#[cfg(feature = "runtime-core")] pub mod runtime_core;— the module does not exist without that feature. - helios/Cargo.toml:25:
server = ["dep:serde", "images", "grammar", "dep:axum", ...]— does NOT includeruntime-core. - helios/Cargo.toml:21:
runtime-core = ["dep:serde", ...]is a separate, unimplied feature. - Before this commit, no non-test file under helios/src/server/ outside the gated session module referenced crate::runtime_core. Now exactly two do: metrics/process.rs:68 (ungated) and runtime/prompt_tests.rs:13 (under
#[cfg(all(test, feature = "runtime-core"))], runtime.rs:3983). - docs invoke the server-only config: docs/model-development.md:99 (
--features server --lib frontend::), docs/scheduling-runtime-design.md:735-737 (--features server --lib scheduler::andserver::runtime::phase_tests::). - server.rs:26-29 gates only
mod session/pub use sessionon runtime-core, confirming the crate is expected to compile withserveralone. - Note the other two helpers this commit adopted are fine: crate::os is
mod os;unconditionally (lib.rs:19) andpub(crate) use flare_eos::*(os.rs:8), socrate::os::page_size()(process.rs:61) andcrate::os::raise_open_file_limit(0)(process.rs:70) resolve on every platform.
Fix: move open_descriptors (helios/src/runtime_core/protection.rs:291-302) into eos/src/unix.rs beside page_size (eos/src/unix.rs:73-75) and raise_open_file_limit (:138-165), and re-export it through crate::os — the same route the commit already used for the other two, and where AGENTS.md:20-21 puts host OS operations. Alternatively gate the call on the feature.
Caveat to state in the report: verified by cfg reading only; no compile was possible here and the head has no CI checks. cargo check --manifest-path helios/Cargo.toml --features server settles it immediately.
#13 [high] Research summary
Reviewed PR #548 at head a34c4d06 through the correctness lens. No new commits since the last round, so I re-verified the open findings against the current tree and they all still stand.
Blocking — --features server no longer compiles. helios/src/server/metrics/process.rs:68 calls crate::runtime_core::open_descriptors(), but helios/src/lib.rs:22-26 declares pub mod runtime_core only under #[cfg(feature = "runtime-core")], and helios/Cargo.toml:25's server feature does not enable runtime-core (helios/Cargo.toml:21 is a separate feature). The three references to crate::runtime_core under src/server are now session.rs:10 (not opened) (gated by server.rs:26-29), runtime/prompt_tests.rs:13 (not opened) (gated by #[cfg(all(test, feature = "runtime-core"))], runtime.rs:3983), and this ungated one. The configuration breaks the documented commands at docs/model-development.md:99-100 (not opened) and docs/scheduling-runtime-design.md:735-736 (not opened); CI (.github/workflows/native-serving.yml:63 (not opened),68) only builds runtime-core,server, which is why it is invisible there. Fix: move open_descriptors (helios/src/runtime_core/protection.rs:291-302) into eos/src/unix.rs beside page_size (eos/src/unix.rs:73) and raise_open_file_limit (:138) and re-export through crate::os (helios/src/os.rs:8), the route the same commit already took for the other two helpers, or gate the call. Verification is by feature/cfg reading — the head has no CI checks and I could not compile; cargo check --manifest-path helios/Cargo.toml --features server settles it.
Should fix — e2e exclusion is response-scoped, completions are per generation. helios/src/server/http.rs:598-605 skips the e2e observation when the shared encoder flag encoder.tool_limit_reached (protocol/encode.rs:89, set at :506) is set, but one response can carry several generations (generations: Vec<Option<Generation>>, built per choice at http.rs:351-353; n choices are accepted for /v1/completions, protocol/decode.rs:742-755, and http.rs:299 sizes from prepared.len()). A choice that finishes naturally before a sibling trips the limit is counted by Metrics::request_completed (runtime.rs:1841-1846, :1996-2001) and its queue/prefill/decode/prompt histograms, yet loses the e2e observation for the whole response, so flare_request_e2e_seconds_count < flare_requests_completed_total and the new docs/api.md sentence "Cancelled and failed requests enter only flare_requests_cancelled_total and flare_requests_failed_total" is false for that choice. Fix: decide per finished generation (e.g. skip only when the termination used at http.rs:526 is Termination::Cancelled), and pin it with an n: 2 test where one choice hits the tool limit.
Nit — parse_stat hard-codes the stat state alphabet. process.rs:26 rejects any state letter outside "RSDZTtWXxKPI" and returns None, which silently removes process_cpu_seconds_total, process_virtual_memory_bytes, process_resident_memory_bytes and process_start_time_seconds together, contradicting the module doc (process.rs:4-6) that only unreadable or unparsable sources are omitted. Validating that the five consumed fields parse (utime/stime/starttime/vsize/rss, indices re-derived and matching the fixture) bounds the same risk without a fixed alphabet.
Verified sound in code: Metrics::request_completed (metrics.rs:452-480) is the sole writer of completed, so recomputation of counter and histograms cannot diverge inside the runtime; queue/prefill require first_scheduled_ns/first_token_ns with saturating subtraction, decode and TPOT require generated_tokens > 1, and Incoming keeps its stamps through parking/readmission (runtime.rs:1334-1342, :2106-2121); each process metric renders independently so one bad /proc file never fails a scrape; raise_open_file_limit(0) (eos/src/unix.rs:138-165) only reads the soft limit; all new libc use is cfg(target_os = "linux") with a no-op non-Linux render (process.rs:8-14). Evidence limits: no CI on the head, no compile here, and the author's live scrape ran on a cherry-pick onto a fork commit rather than main.
Earlier findings are fixed on this head: the tool-limit e2e exclusion plus single observation point before yield Delivery::Complete, the documented streaming-drain asymmetry, the documented vision-step caveat, and hoisted prompt_tokens/generated_tokens shared between request_completed and the Finished event.
#14 [high] Report of 2026-11-27, run 2 (post-Autobot-comment, no new commits)
Verdict: blocking. No new commits since the last report (head still a34c4d06); the three findings from note #12 were re-verified line-by-line against the current tree, and nothing new was found. Nine changed files read in context: metrics.rs, metrics/process.rs, runtime.rs, http.rs, latency.rs, server.rs, phase_tests.rs, runtime_core/{mod.rs,protection.rs}, docs/api.md.
BLOCKING (unchanged, #12/#11) — --features server does not compile:
- helios/src/server/metrics/process.rs:68
crate::runtime_core::open_descriptors() - helios/src/lib.rs:22-26
#[cfg(feature = "runtime-core")] pub mod runtime_core; - helios/Cargo.toml:25
server = [...]omitsruntime-core(defined separately at :21) - Re-verified this round: search for
runtime_coreunder helios/src/server returns exactly three hits — session.rs:10 (gated by server.rs:26-29), runtime/prompt_tests.rs:13 (gated by#[cfg(all(test, feature = "runtime-core"))]at runtime.rs:3983), and metrics/process.rs:68 (ungated). Confirms the ungated one is the sole break. - Documented server-only configs: docs/model-development.md:99-100; docs/scheduling-runtime-design.md:735-736. CI only builds
runtime-core,server(.github/workflows/native-serving.yml:63,68), so it cannot catch this. - Suggested fix unchanged: move
open_descriptors(helios/src/runtime_core/protection.rs:291-302) into eos/src/unix.rs besidepage_size(eos/src/unix.rs:73) andraise_open_file_limit(:138) and re-export via crate::os (helios/src/os.rs:8), or gate the call. Settled bycargo check --manifest-path helios/Cargo.toml --features server; not runnable here.
SHOULD FIX (unchanged) — e2e exclusion is response-scoped, completions per generation:
- http.rs:598-605 skips on the shared
encoder.tool_limit_reached(protocol/encode.rs:89, set at :506) - Multi-generation responses: http.rs:351-353
generations: Vec<Option<Generation>>; http.rs:299size = prepared.len();naccepted for Completions only (protocol/decode.rs:742-755), decoder per choice (http.rs:391-399, :479-487, :525-527) - Runtime already counted the finished sibling (runtime.rs:1841-1846 and :1996-2001), so
flare_request_e2e_seconds_count < flare_requests_completed_totaland docs/api.md's "Cancelled and failed requests enter only flare_requests_cancelled_total and flare_requests_failed_total" is wrong there - Fix: per-finished-generation decision (skip only when termination at http.rs:526 is Termination::Cancelled); pin with an
n: 2tool-limit test
NIT (unchanged) — process.rs:26 hard-coded state alphabet "RSDZTtWXxKPI" → None removes cpu/vsize/rss/start_time together, contradicting module doc process.rs:4-6; validate the five parsed fields instead.
VERIFIED SOUND this round (no finding): metrics.rs:452-480 is the only writer of completed; queue/prefill gated on first_scheduled_ns/first_token_ns with saturating_sub; decode+TPOT require generated_tokens>1 (metrics.rs:470-479); RequestTimes survives parking (runtime.rs:2106-2121, 1334-1342); reserve_and_pack stamps every lane's first scheduled step (runtime.rs:2187-2203, called from submit at :2275); each process metric renders independently (process.rs:62-125); raise_open_file_limit(0) only reads the soft limit (eos/src/unix.rs:138-165); all new libc use is cfg(target_os="linux") with a no-op non-Linux render (process.rs:8-14); parse_stat index arithmetic (utime 14→nth(10), stime 15, starttime 22, vsize 23, rss 24) matches the test fixture at process.rs:141-148.
Evidence limits to state: no CI checks on the head; no compile available here (finding 1 rests on the cfg/feature graph); the author's live scrape ran on a cherry-pick onto fork commit 5ffe4d54, not main; the "merges in either order with #537" claim is asserted, not tested.
#16 [high] Report of 2026-11-27, run 3 (head 055663a, process metrics removed)
Head reviewed: 055663a7.
RESOLVED since last report:
- BLOCKING (old):
helios/src/server/metrics/process.rs:68calledcrate::runtime_core::open_descriptors()outside theruntime-corefeature. Commit 54e06b30 "Remove process metrics from the request latency change" deleteshelios/src/server/metrics/process.rsentirely (pr_files shows the file no longer among changed files; search forprocess_cpu_seconds|open_descriptors|metrics::processon head returns onlyhelios/src/runtime_core/protection.rs:291,354).server.rs:706no longer callsmetrics::process::render;metrics.rs:12no longer declarespub(super) mod process.open_descriptorsis back to a private fn in protection.rs (pub(crate) useremoved from runtime_core/mod.rs). Blocking finding closed.
STILL OPEN (should fix): helios/src/server/http.rs:606
if !count && !encoder.tool_limit_reached { state.model.metrics().response_completed(...) }.encoder.tool_limit_reachedis response-wide (protocol/encode.rs:89, set at:506when a choice exceedsparallel_tool_calls), whilegenerated[index]is per choice (http.rs:530). In a multi-choice /v1/completions or prompt-list response where one choice trips the tool limit, sibling choices that the runtime counted as completed (runtime.rs:1875,:2038) record noflare_request_e2e_seconds,flare_request_choices, orflare_request_max_choice_generated_tokensobservation, soflare_request_e2e_seconds_countcan fall belowflare_requests_completed_totalfor reasons other than the documented multi-choice rounding. Reachability depends on tools (rejected for Completions atprotocol/decode.rs:813-815,:753-755), so it is at minimum latent; it is the same defect class as the earlier cancelled-response finding.- Fix: gate on per-choice cancellation, e.g. track which indices were finished with
Termination::Cancelledathttp.rs:531-532and skip only those choices, or document the response-wide exclusion in docs/api.md (which currently says "responses the runtime records as cancelled").
VERIFIED SOUND on this head:
Metrics::request_completed(metrics.rs:545-603) remains the sole writer ofcompleted;output_limitedadded only whenoutput_limit(reason == "length"atruntime.rs:2037,2045); time histograms only whenfirst_token_ns/first_scheduled_nsare set; decode/TPOT requiregenerated_tokens > 1.RequestRecordmoves withIncomingthroughpark(runtime.rs:2130), keepsmax_tokens(set once atruntime.rs:1566-1570under!readmitted) andpreemptions(runtime.rs:2110), and requeue (runtime.rs:2660) preserves it too.cache_lookup_tokens(scheduler.rs:1601,1802) is added at the same site ascache_lookups, zero for prompt_logprobs, and included in the stats copy (metrics.rs:771).admission_rejectedreasons are wired at the three stated sites only (server.rs:816,http.rs:240,runtime.rs:869,:945); Paused/503 paths uncounted, matching docs.- New docs/api.md text matches the code: population statements for e2e, token, preemption, output-limited, lookup-token and model-step series all check out against
metrics.rs:545-618andruntime.rs:1721-1732;process_*claims removed from api.md. - No
process_*series remain in the tree, so the earlier "docs claim flare_-only names" nit is moot.
Evidence limits: still no compiler here; the cfg/feature claim above is from the file list plus search, which is sufficient since the file is gone.
#17 [high] Research summary
Reviewed PR #548 at head 055663a through the correctness lens. The previous round's blocking build break is gone: commit 54e06b30 deletes helios/src/server/metrics/process.rs (not opened) outright, drops mod process and the metrics::process::render call, and returns open_descriptors to a private fn in runtime_core/protection.rs (not opened), so --features server no longer reaches feature-gated runtime_core. No process_* series remain anywhere in the tree, which also makes the earlier docs nit moot and matches the documentation now shipped in docs/api.md (not opened).
One should-fix finding remains: helios/src/server/http.rs:606 gates the single response_completed call on the response-wide encoder.tool_limit_reached, while generated[] is per choice. In a multi-choice completions response where one choice trips the parallel-tool limit, the sibling choices the runtime counted as completed record no e2e, choice-count, or max-choice-token observation, so flare_request_e2e_seconds_count can diverge from flare_requests_completed_total for a reason docs/api.md (not opened) does not state. Reachability today needs tools plus more than one generation, which the decoder currently rejects for Completions, so it is at minimum latent — same defect class as the earlier cancelled-response finding, fixable by tracking the cancelled indices at http.rs:531-532.
Everything else I checked held: request_completed is still the sole writer of the completion counter, the output_limit derivation matches reason == "length", time histograms stay unobserved for zero-token completions, RequestRecord survives park/requeue with max_tokens set once at first admission and preemptions bumped at the park, cache_lookup_tokens is added at the same site as cache_lookups, the three rejection reasons are wired only at the stated paths with 503s uncounted, and the new documentation statements match the code. Evidence limit: no compiler or live scrape here, and the author's own scrape ran on a cherry-pick rather than main.
#18 [high] Should fix: response-wide tool_limit gate drops siblings' e2e observations — fix options and what settles it
FINDING (should fix): helios/src/server/http.rs:604-612
// One observation per successful response: a tool-limit cancellation reaches
// this point but the runtime counts it as cancelled, so it is excluded.
if !count && !encoder.tool_limit_reached {
state.model.metrics().response_completed(
admitted_at.elapsed().as_nanos() as u64,
decoded.request.choices,
&generated,
);
}
Evidence chain:
encoder.tool_limit_reachedis one flag for the whole response: declaredhelios/src/server/protocol/encode.rs:89, initialised false at:142, set at:506(if !self.parallel_tool_calls && self.outputs[index].has_tools() { self.tool_limit_reached = true; break; }), and read to forceTermination::Cancelledat:598and to drop the stop at:604.- Per-choice state is separate:
generated[index] = generated_tokensathelios/src/server/http.rs:530, and the per-choice finish uses the same global flag athelios/src/server/http.rs:531-532. - The runtime counts each choice as its own request and increments
flare_requests_completed_totalper choice:helios/src/server/runtime.rs:1875-1884(stop path,output_limit: false) and:2038-2047(finish path,output_limit: reason == "length"). Cancellation is counted elsewhere, inMetrics::cancelledatruntime.rs:1329-1330,:1350,:1373,:1420; the tool-limit stop is a client-side decoder cancel athttp.rs:569-573after the runtime has already completed the request, so siblings that were not cancelled lose nothing by the runtime but lose their HTTP observations here. - Consequence:
flare_request_e2e_seconds_count(andflare_request_choices/flare_request_max_choice_generated_tokens) can be lower thanflare_requests_completed_totalby every sibling choice of a multi-choice response that hit the tool limit — a causedocs/api.mddoes not list (it says only "responses the runtime records as cancelled, such as a parallel tool-limit stop", i.e. it claims the exclusion is per response the runtime recorded as cancelled, which is not what the code implements for siblings). - Reachability today: tools are rejected for
/v1/completions(protocol/decode.rs:813-815,reject(&body, &["tools", "tool_choice"])), andn > 1is rejected for every other protocol (protocol/decode.rs:753-755, "n must be 1"). So a multi-choice response with tools is currently unreachable through the public API — the defect is latent, not live. It becomes live if tools are ever allowed on Completions.
Fix options:
- Track cancelled indices in the stream (set a
Vec<bool>or reusegeneratedwith a sentinel when finishing a choice withTermination::Cancelledathttp.rs:531-532) and pass only the surviving choices toresponse_completed; still observe e2e once when at least one choice delivered. - If the behaviour is intended, say so in
docs/api.mdnext to the e2e population text: the whole response is excluded when any choice hits the parallel tool limit, so the e2e count can trail the completion count by the sibling choices too.
What would settle it: a phase test (see helios/src/server/runtime/phase_tests.rs:4303-4370 for the HTTP fixture pattern used by full_http_admission_counts_a_queue_limit_rejection) posting a two-choice completions request with tools enabled and asserting either flare_request_e2e_seconds_count == 2 (siblings counted) or == 0 (response-wide exclusion) against flare_requests_completed_total. Today the request cannot even be built, which is itself the evidence that the path is latent.
#2 [medium] Should fix: streaming e2e depends on the client draining the SSE body, undocumented asymmetry with non-stream
http.rs:600-620: for streaming, the Delivery::Complete(_) arm runs inside the filter_map that back Sse, so flare_request_e2e_seconds is observed only if the client actually polls the stream to its end. A client that disconnects mid-stream (the common cancel path) never reaches it.
http.rs:629-641: the non-streaming path observes e2e in the handler before the JSON body is polled, so it records even when the client never reads the response — the added test first_response_http_nonstream_records_only_when_completed_body_is_offered (phase_tests.rs:4461-4465) asserts exactly that (count 1 for the poll_body == false case).
Why it matters: flare_request_e2e_seconds_count therefore diverges from flare_requests_completed_total for streamed requests (which are the majority for chat), in the opposite direction from the non-stream case, and docs/api.md says only "counts each successful generation from admission to the completed response" — unlike the neighbouring flare_time_to_first_response_seconds sentence, which does say "once the client reads it". The asymmetry is a real, operator-visible property that the docs do not state.
Fix: state in docs/api.md that streaming observations require the client to read to the end, and that non-streaming records at handler completion; alternatively record e2e on the runtime completion path for both. Verified by reading the two arms; the streaming early-disconnect case would need a test.
#3 [medium] Note: first_scheduled_ns is also stamped by GraphKind::Vision lanes
metrics.rs:452-480 request_completed divides decode / u64::from(generated_tokens - 1) for flare_time_per_output_token_seconds. decode is last_token_ns - first_token_ns, i.e. the interval between the first and last committed token. With exactly two tokens the denominator is 1, so TPOT equals the full first→last interval, which is correct-ish; with N tokens it divides by N-1, correct.
However at runtime.rs:1773-1775 the stamps are set inside the per-token loop only for tokens whose active[slot] entry matches a.request == token.request, and last_token_ns is overwritten for every emitted token of that request, including tokens that are then discarded by a stop (stopped.push + continue at 1780-1795 for reasoning/grammar failures, and 1822-1828 for emit_output failure). For a request that fails mid-step the stamps are updated but request_completed is never called, so no divergence in output — the observation is simply skipped, consistent with the doc.
Real edge found: reserve_and_pack (runtime.rs:2187-2203) stamps first_scheduled_ns for lanes of a GraphKind::Vision step too (it loops all step.lanes before the kind == Vision branch). A vision step is not a generation step that "includes the request" for prefill purposes, so for an image request the queue time ends at the vision step rather than at the first prefill step, making flare_request_queue_seconds understate queue delay and flare_request_prefill_seconds absorb the vision work. Worth confirming against how vision lanes are scheduled; the doc says "the first model step that includes the request", which the vision step arguably is, so this may be intended — flag as a question, not a defect, unless the lane kinds say otherwise.
#4 [medium] Nits/notes: process.rs parse heuristics and non-Linux compilation
process.rs:22-31 parse_stat splits on the last ). /proc/self/stat command name cannot contain )? It can — the comm field is parenthesized and may contain ) and spaces; the kernel does not escape them, so taking the last ) is the standard heuristic but is wrong for a process whose name itself ends with ) plus following text (e.g. comm == "a) b" gives tail from the inner )). This is a documented upstream ambiguity (proc(5) says use the last )); it only affects the metrics, never panics, and a misparse would shift all five fields consistently — but parse_stat returns Some rather than None in that case, so the reported CPU/memory would be wrong rather than omitted. The module doc claims a malformed file omits the metric; a systematic offset in the tail is not detected. Low practical impact (flare's own comm is fixed), so nit at most.
process.rs:65-67 process_open_fds counts entries of /proc/self/fd, and the read_dir handle itself is one of them — the code acknowledges this in the HELP text ("including the directory read that counts them"). Prometheus' client_golang excludes it, so the number is +1 relative to the conventional series. Since the HELP text says so, this is a documented deviation, not a defect; worth a nit only if parity with the standard exporter matters.
process.rs:79-114: process_cpu_seconds_total and process_start_time_seconds use (stat[0] + stat[1]) as f64 / ticks as f64; u64 addition can overflow only after ~2^64 ticks, not reachable. rlim_cur is printed via Display for rlim_t, fine.
process.rs:12-13 #[cfg(not(target_os = "linux"))] let _ = text; compiles on Windows — the functions parse_stat, parse_btime, metric, render_linux are all cfg(target_os = "linux"), and libc is a non-optional dependency in helios/Cargo.toml:50, so the non-Linux build of this module references no libc item. The Windows build was not run by the author (stated), but nothing in this file introduces a Windows-only compile error; libc::rlimit/getrlimit/RLIMIT_NOFILE are inside the Linux cfg. No blocking platform finding. Note helios/src/os.rs and dashboard.rs already use libc under unix cfgs, so precedent exists.
#5 [medium] Verified-correct items and evidence limitations
-
Cherry-picked base. Author states the branch was built on the AzallazA fork commit
5ffe4d54, cherry-picking this change because that model needs the fork's Engram encoding (upstream PR #482). The live-scrape evidence therefore exercises this diff on a fork, not onmain; the conflict resolution "kept only the added function". This is disclosed, so not a defect, but the merge-risk claim ("merges in either order" with #537) is asserted, not tested — CI on head has no checks (orientation packet) and the author did not run the full helios suite or Windows build. -
Prompt-token histogram includes tokens reused from the prefix cache (metrics.rs help text; docs/api.md).
prompt_tokensat runtime.rs:1838-1839 iscarried.prompt_tokens.unwrap_or(live.prompt_tokens), which is the full prompt length including reused tokens — consistent with the documented wording. Fine. -
Flare_time_to_first_response_secondshistogram lives inFirstResponseSamples(latency.rs:34-37) rather thanMetrics, so it is not exposed in the JSON snapshot (server.rs:645-658 returns before render_histogram) — consistent with docs "histograms appear only in the Prometheus text".render_histogramis called at server.rs:671 after the median gauge, before input metrics; no duplicate series names (checked: no otherflare_time_to_first_response_seconds). -
Histogram rendering emits
# HELP/# TYPEand buckets in ascending bound order with cumulative counts from per-bucket atomics;+Infbucket equals total, and_countuses the same cumulative value, so consistency holds even under concurrent observation only approximately (a concurrent observe between the last bucket load and the_countline cannot happen becausecumulativeis reused). Sum usesu64nanoseconds, so a >584-year total would wrap; irrelevant. -
Metrics::request_completedis called at both formercompleted.fetch_addsites (runtime.rs:1841 user/text stop incomplete, runtime.rs:1993 natural finish inpublish); grep confirms no remaining directcompleted.fetch_addin helios/src/server. Counter and histograms therefore cannot diverge for completed requests. Verified against main: the only two sites on main were runtime.rs:1832 and 1984. -
Bucket boundaries:
position(|bound| exposed <= bound)with the last bound infinite guarantees an index;unwrap_or(N-1)is unreachable.0.1etc. are exactly representable enough that100_000_000 ns → 0.1 slands in thele="0.1"bucket (test assertsle="0.1"is 0 for 169 ms... actually asserts 250 ms inle="0.25"and 0 inle="0.1"), matching Prometheus convention.
#8 [medium] Rules cited and evidence-limitation notes
Rules the review should cite:
- charter (read_charter): "Supported matrix & compatibility — Check interactions across every supported model, cache scheme, parallel layout, multi-host setup, and hardware target named in the docs." and "PR descriptions: Expect four parts: why, what changed, the claimed result, and the evidence."
- AGENTS.md:182-186 "Reject weakened guarantees… Do not remove validation, suppress errors…" (relevant only insofar as the docs claim an invariant the code does not hold).
- AGENTS.md:194-199 "Require focused, meaningful validation… Identify missing hardware, inputs, and unrun checks explicitly."
- docs/design-review.md principle 12 "Validate the real path and report evidence honestly… keep raw measurements and disclose unrun checks and material limitations."
Disclosed limitations in the PR description (accurate as far as I could check): Windows build not run; full helios suite not run; messages_image_hints_end_after_expansion_for_text_and_segmented_templates not run (needs FLARE_TEST_TEMPLATE_DIR from tests/frontend/prepare_templates.py). Live scrape was taken from a cherry-pick of this diff onto AzallazA fork commit 5ffe4d54 (upstream PR #482 dependency), not on main, and that instance also served the authoring agent's own requests, so the reported deltas exceed the three test requests — stated plainly in the description. CI on head ebecef1 has no checks (orientation packet). The claim that this PR and #537 "merge in either order" is asserted, not tested: they touch different functions in metrics.rs (request histograms beside the completion counter here; page gauges beside cached_pages there).
Also worth stating in the report: the author's own histogram observation buckets in the live scrape are consistent with the three-request window only after allowing for session requests (le="64" gained 1, le="2048" gained 4), which the description explains; nothing in that evidence contradicts the code reading.