Recommendation: Ready To Merge
PR #560's per-request metrics implementation at f5d7078 is lean, well-tested, and sound, and both prior Round 3 blockers are resolved: the branch is now rebased onto main (c146d7be) and #548's fixed head (93fdc895, including the Worker::requeue first_scheduled_ns reset at helios/src/server/runtime.rs:2694-2696 and its conformance test), and the PR now reports passing --release crate tests, pytest tests/cli, and Layer 3 TLA+ lifecycle conformance (python3 verification/helios-lifecycle/check.py (not opened)). No new correctness, safety, or hot-path regressions remain. Merge #548 first (as the PR declares) so #560 lands cleanly as its own delta without pulling unreviewed #548 commits ahead of #548.
Merge Risk
Level: Medium
- Low hot-path blast radius for
#560itself: Off by default (per_request_metrics: false),#560's delta above#548adds zero clock reads, zero locks, and zero allocations—only copyingarrival_nsandRequestTimesintoGenerationEvent::Finished, a smallOptionmin-fold inhelios/src/server/http.rs:536, and immediateNoneshort-circuits inEncoder::record_times/Encoder::metrics_value. Arithmetic inhelios/src/server/protocol/encode.rs:255-273guards zero-length spans and single-token divisions against divide-by-zero andNaN. - Stacking risk until
#548lands: Because this branch targetsmainwhile stacked on open PR#548(93fdc895), its diff carries all 10 files (+1,383 / −124) of#548; merging#560before#548would land#548implicitly. - Rebase and CI alignment: Already rebased onto
mainc146d7be(including#545,#608,#614,#615,#620), so the Ignition schema/template changes (ignition/cli/config.py:25,:40,:187,ignition/cli/serve.py:440) align cleanly withmain.
Walkthrough
- Worker → HTTP timing handoff (
helios/src/server.rs,helios/src/server/runtime.rs,helios/src/server/http.rs,helios/src/server/observation.rs,helios/model-contract.md): Re-exportsRequestTimesalongsideSnapshot, attachesarrival_nsandtimestoGenerationEvent::Finished, exposesfirst_scheduled_nsin Chatperformancewhenreturn_token_timestampsis requested, and forwards timing fields toEncoder::record_times. - vLLM
metricsencoding & placement (helios/src/server/protocol/encode.rs,helios/src/server/http.rs): AddsEncoder::enable_request_metricsandEncoder::metrics_valueemitting vLLM's six keys (withtime_to_first_content_token_ms: null) on non-streaming JSON bodies, final Chat/Completions usage chunks, andresponseinsideresponse.completed/response.incomplete; emitsnullforn > 1and omits for multi-prompt Completions and Anthropic Messages. - Configuration & CLI plumbing (
helios/src/server/config.rs,flare-cli/src/{cli,config,main}.rs,flare/src/{configuration,controller,settings}.rs,ignition/cli/{config,serve}.py): Wires--enable-per-request-metrics(flare run,flare orbit runrank zero) and strict-boolean[server] per_request_metrics(defaultfalse) across native CLI, desktop controller, andignition debug-serve, plus Ignition's schema allowlist and generated template. - Docs & tests (
docs/api.md,docs/cli-design.md,helios/src/server/protocol/tests.rs,helios/src/server/runtime/phase_tests.rs,helios/src/server/runtime/response_lifecycle_tests.rs,tests/cli/test_config.py): Documents field definitions, placement,include_usagelimit, and Orbit precedence; adds isolated encoder, HTTP+worker phase, CLI/config, and Ignition schema tests. (Changes inhelios/src/scheduler.rs,helios/src/scheduler/tests.rs(not opened),helios/src/server/latency.rs(not opened), and most ofhelios/src/server/metrics.rsare carried from base PR#548.)
Pre-merge Checks
- [PASS] Security / malicious screen: No suspicious code, secret exposure, or prompt-injection issues; strict boolean validation rejects non-bool values across Helios (
helios/src/server/config.rs:341-345), Flare (flare/src/settings.rs:86), and Ignition (ignition/cli/config.py:25,tests/cli/test_config.py:162-163). - [PASS] Charter & value fit: Opt-in, off by default, lives cleanly in Helios's protocol/config layers with no per-model branches, and serves a real gateway consumer (
llama-swapv250); see Nit 1 onCloses #551. - [WARN] Related / duplicate / conflict check: Stacked on unmerged
#548(93fdc895, must merge first); supersedes closed#552/#553;#562(content TTFT) closed while draft; already rebased cleanly ontomainc146d7be(including#545). - [PASS] Tests & verification evidence: Mandatory
--releasecrate tests (helios1,738 passed / 46 ignored / 15 environmental failures matchingmain;flare246 passed;flare-cli230 passed),pytest tests/cli(137 passed / 1 FlashInfer-env failure), andpython3 verification/helios-lifecycle/check.py(not opened) (3:55) all passed on the rebased tree; earlier 40/40 Blackwell + llama-swap live matrix limitation is transparently disclosed.
Blockers
None.
Should Fix
None.
Subtract / Simplify
- Deduplicate
queue_time_msdefinition (docs/api.md:1021): Instead of restatingqueue_time_mswithout the requeue reset rule already documented for the same instant atdocs/api.md:338-341, point the table row at#health-and-metrics("as defined for the request histograms, including requeue before the first generated token") so one definition governs both surfaces (and optionally note requeue alongside preemption inhelios/model-contract.md:391-394). - Share bucket-index lookup (
helios/src/server/metrics.rs:291-300,:352-368, carried from#548): ExtractBuckets::index(&self, value: u64) -> usizesoHistogram::observeandInterTokenIntervals::observeshare one lookup instead of duplicating the scan and couplingcounts: [u32; 19]toTOKEN_SECONDSby convention. - Deduplicate carried-total folding (
helios/src/server/runtime.rs:1421-1425,:1933-1940,:2096-2100,:2223-2228, carried from#548): A small helper onCarriedcomputing(prompt_tokens, generated_tokens, reused_prompt_tokens)would remove four manualunwrap_or/ addition blocks across completion, cancellation, and park paths.
Nits
- Narrow
Closes #551→Part of #551: Issue#551specifically proposes llama.cpp (not opened)timings(Messages coverage, top-level Responses placement, draft counts, and streams withoutinclude_usage), which#560's vLLMmetricsformat intentionally does not deliver. UsingPart of #551(or updating#551's scope) matches theCloses #536→Part of #536adjustment made on#548. - Optional template round-trip test (
ignition/cli/config.py:187,tests/cli/test_config.py): Parsing of[server] per_request_metricsis already tested (tests/cli/test_config.py:162-163,:178-184) and line 187 is valid TOML when uncommented, butConfiguration.write_initialcurrently has no test intests/. Adding a quick round-trip test would pin the generated template underpython-cpu.yml(not opened).
Dropped on verification
- Candidate Major:
Worker::parkleaves stalefirst_scheduled_nson zero-token parks (helios/src/server/runtime.rs:2185-2232) — False positive (unreachable): Both callers ofWorker::parkstrictly require at least one committed generated token.park_if_preempted(runtime.rs:2166-2183) only fires whenlive.preempted()is set byRequestScheduler::preempt_newest(helios/src/scheduler.rs:1358-1376), which requiresrequest.phase == RequestPhase::Decode; the sole transition intoRequestPhase::Decode(helios/src/scheduler.rs:2742-2748) is gated afterelse if request.generated_tokens == 0 { RequestPhase::Resume }. The reasoning-budget cut (runtime.rs:2013-2071) requiresreasoning_cut.is_some() && generated == max_new_tokens, andreasoning_cutis only created withmax_new_tokens = budget(helios/src/server/request.rs:368-403) where every parser rejectsbudget == 0(helios/src/server/protocol/decode.rs:460,:578-580,helios/src/server/config.rs:338). Preservingfirst_scheduled_nsinparktherefore matchesdocs/api.md:349-350. - Candidate Minor:
first_scheduled_nsstamped beforeexecutor.submitrenders bogusqueue_time_msviafinish_cancelled(runtime.rs:2303-2316,:2415-2422) — False positive: Asubmiterror propagates out ofWorker::run(runtime.rs:1189) toworker.fail_all(&final_error)(runtime.rs:768-777), which callsrequest.incoming.fail(...)(runtime.rs:2726-2741,:319-337) and emitsGenerationEvent::Error—neverfinish_cancelledand neverGenerationEvent::Finished. - Candidate Minor:
cache_lookup_tokensratio understated on readmission (helios/src/scheduler.rs:1560,:1767) — False positive (and belongs to#548): On readmission (runtime.rs:2204), the prefix lookup searches the rewrittenspec.prompt(history + generated) against GPU checkpoints including the terminal checkpoint (scheduler.rs:1381-1395), so both numerator (reused_tokens,:1559,:1769) and denominator (cache_lookup_tokens,:1560,:1767) measure the exact same lookup scope, matchingdocs/api.md:361-364. - Candidate Minor: PR description's option-off cost claim contradicted by
http.rs:617-621— Misattributed:response_completedandencoder.choice_generated_tokens()exist on base PR#548(helios/src/server/http.rs:605-609atpr/548);#560's own delta adds no allocation whenper_request_metricsisfalse. - Candidate Minor: Suppress
metricswhenusage.cancelledonparallel_tool_calls: false(encode.rs:250-274) — Low-signal / counter-productive: Aparallel_tool_calls: falsestop returns a normal HTTP 200 tool-call response with accurate token counts and worker step instants; suppressingmetricswould drop valid gateway rates for those responses. - Candidate Charter tension:
include_usagegate (encode.rs:236) vs charter #417 — Over-flagged: Matching vLLM's usage-chunk placement and explicitly documenting the absence of--enable-force-include-usage(docs/api.md:1036-1043) is not silently dropping an accepted request field. - Candidate Simplification: Remove
streaming: boolfromEncoder::enable_request_metrics(encode.rs:235) — Not a clean subtraction:Encoder.streamingis currently only mutated byset_logprobs(..., Arc<Frontend>, streaming)(encode.rs:186-189), soprotocol/tests.rs:2666-2794(metered(...), which testsEncoderwithout aFrontend) cannot setself.streamingwithout either threadingstreamingintoEncoder::newacross all callers or adding a new setter. - Candidate Dossier uncertainty: Unconfirmed rebase onto
#54893fdc895andmain— Stale: Commit ancestry (search_historyonhelios/src/server/runtime.rsandhelios/src/server/protocol/encode.rs) confirmsf5d70787descends directly from both93fdc895(#548) andc146d7be(main, including#545/#608/#614/#615/#620); the 2026-11-28 timestamp onf5d70787is git's preserved author date after rebase.