Final review report · NVIDIA/hyperflare-inference #560

Raw Markdown for agents: https://autobot.eidonix.com/p/9e6f4823-9c84-44b9-b9e0-89725cc9b683.md

Recommendation: Changes Requested

The per-request metrics design itself is lean and sound—the worker owns the monotonic instants, the encoder owns vLLM placement, the option adds no new clock reads or locks and does negligible copy work when off, and the prior Ignition configuration-schema blocker is resolved at e3829e6. However, the published branch stacks all of #548 and carries two blocking items that match project owner Luke Alonso's explicit merge gates on #548/#549: a pre-prefill Worker::requeue bug that corrupts this PR's headline queue_time_ms/time_to_first_token_ms/tokens_per_second fields under slow host-store pool lookups, and missing mandatory --release crate tests plus Layer 3 TLA+ lifecycle conformance (verification/helios-lifecycle/check.py (not opened)) after rebasing onto main (and #548).

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. Pre-prefill Worker::requeue retains a stale first_scheduled_ns, corrupting per-request metrics and histograms (helios/src/server/runtime.rs:2272-2285, 2639-2640, 2647-2675 → helios/src/server/protocol/encode.rs:261-272) Worker::reserve_and_pack stamps active.incoming.record.times.first_scheduled_ns.get_or_insert(scheduled_ns) for every lane of every GraphKind, including GraphKind::Init and GraphKind::Restore (runtime.rs:2272-2285). When a late host-store pool answer arrives before prefill consumes new tokens (live.generated_tokens == 0), Worker::retry_late_pool_answers cancels the request and calls self.requeue(handle, true) (runtime.rs:2607-2640). Worker::requeue (runtime.rs:2647-2675) parks active.incoming without clearing incoming.record.times.first_scheduled_ns. After readmission into Inbound and a host-store restore over disk/network, first_scheduled_ns remains frozen at the discarded Init/Restore step, so queue_time_ms (encode.rs:264) ends prematurely while time_to_first_token_ms (encode.rs:261), tokens_per_second (encode.rs:268-272), performance.first_scheduled_ns (http.rs:562,607), and #548's queue/prefill/inference histograms absorb the entire park and host-restore wait. This is the exact defect Luke Alonso marked blocking on #548, carried verbatim in this diff. Fix: Land the reset (incoming.record.times.first_scheduled_ns = None; in Worker::requeue, plus a phase test covering requeue/readmission) in #548 and rebase #560 onto it, and align docs/api.md:1015-1017 with whichever Init/Restore stamping rule #548 adopts.

  2. Missing mandatory Layer 1 (--release) tests and Layer 3 TLA+ lifecycle conformance (docs/design-review.md:180-251 on main) This PR's diff modifies helios/src/scheduler.rs (not opened), helios/src/server/runtime.rs, helios/src/server/runtime/phase_tests.rs, and helios/src/server/runtime/response_lifecycle_tests.rs (including #560-specific edits to runtime.rs, phase_tests.rs, and response_lifecycle_tests.rs), and the branch is based on f377dc85 before verification/helios-lifecycle/check.py (not opened) and the Layer 3 gate landed on main. Per docs/design-review.md:180-251 (and Luke Alonso's blocking reviews on #548 and #549), touching covered scheduler/worker/response-lifecycle paths requires running python3 verification/helios-lifecycle/check.py (not opened) and cargo test --locked --release on every affected crate (helios with --features runtime-core,server, flare, flare-cli) rather than debug cargo test --lib alone. Fix: Rebase onto main after #548 merges (resolving any #545 overlap in ignition/cli/{config,serve}.py), run python3 verification/helios-lifecycle/check.py (not opened) and cargo test --locked --release for helios, flare, and flare-cli (plus pytest tests/cli/test_config.py), and record the results in the PR Evidence section.

Should Fix

  1. Change Closes #551 to Part of #551 (helios/src/server/protocol/encode.rs:236-242, 260-273, 732-745) Issue #551 specifies a llama.cpp (not opened)-style timings object with cache_n/prompt_n/draft_n/draft_n_accepted, Anthropic Messages coverage on message_delta, and Responses placement beside response rather than inside it (specifically so llama-swap can read Responses streams). #560 delivers vLLM's six-field metrics object nested inside response (encode.rs:733-743), omits Messages (encode.rs:238), and carries no draft/cache counts (encode.rs:260-273), and the author's own live check notes that Responses streams still show no rates in llama-swap. Mirroring Luke Alonso's Closes #536 → Part of #536 correction on #548, use Part of #551 (or update #551 to match the narrowed vLLM scope).

  2. Forced reasoning close can emit synthetic 0.0 mean_itl_ms and understates ITL without documentation (helios/src/server/runtime.rs:433-446, 1959-1980; helios/src/server/protocol/encode.rs:259, 265-267; docs/api.md:1011) When a reasoning budget forces a close token via Active::close_reasoning (runtime.rs:433-446), self.carried.generated_tokens increments by 1 without running a model step or updating times.last_token_ns. If max_new_tokens == 1 with cut.after == 1 and forced == true (1 model token + 1 forced close token = 2 generated tokens, first_token_ns == last_token_ns), encode.rs:259, 265-267 emits generation_time_ms: 0.0 and mean_itl_ms: 0.0 for a single-step request—the direct counterpart to Luke Alonso's Should Fix #4 on #548. On longer forced-close responses, the extra token also enlarges the generated - 1 denominator without an instant, which the PR body discloses but docs/api.md:1011 omits. Fix: Align mean_itl_ms gating with #548's fix for post-first-token committing steps (see Subtract/Simplify #1) and note the forced reasoning-close token alongside the speculative-step note in docs/api.md:1011.

Subtract / Simplify

  1. Share request-interval span calculation between Metrics::request_completed and Encoder::metrics_value (helios/src/server/metrics.rs:606-631, helios/src/server/protocol/encode.rs:250-274) Both functions compute the same five spans (scheduled - arrival, first - scheduled, last - scheduled, last - first, and (last - first) / (generated - 1)) over (arrival_ns, RequestTimes, generated) with parallel null/divisor guards. Adding a small span helper on RequestTimes (ideally in #548 alongside the forced-close guard) lets both histograms and JSON metrics derive from one source of truth and eliminates duplicate guard chains in metrics_value.

  2. Reuse http_generation_request_observed instead of duplicating the HTTP/channel setup twice (helios/src/server/runtime/phase_tests.rs:4495-4524, 4575-4591, 4800-4821) http_generation_request_observed (phase_tests.rs:4495-4524) already implements the sync_channel + http_state_for + ingress_slots + axum::http::Request + tokio::spawn(http::generate) + recv_timeout harness. Both served_through_worker (:4575-4591) and the n = 2 loop in per_request_metrics_are_absent_without_the_option_and_null_for_several_choices (:4800-4821) duplicate those ~18 lines solely to pass a custom Fixture and per_request_metrics = true. Parameterizing a shared inner helper removes ~35 duplicated lines in this diff.

Nits

Dropped on verification