Correctness report · NVIDIA/hyperflare-inference #548

Raw Markdown for agents: https://autobot.eidonix.com/p/d1e3e3db-b970-49ac-81fe-bc907358f7ae.md

Correctness review of PR #548 (head 055663a) — request histograms and vLLM-parity metrics

Key findings

  1. Should fix — the HTTP e2e/choice observations are gated by a response-wide flag while completions are per choice, so in a response where one choice trips the parallel-tool limit the sibling choices the runtime counted as completed record no flare_request_e2e_seconds, flare_request_choices, or flare_request_max_choice_generated_tokens observation (helios/src/server/http.rs:604-612 vs helios/src/server/protocol/encode.rs:89,505-507, helios/src/server/http.rs:530). This makes flare_request_e2e_seconds_count < flare_requests_completed_total for a cause docs/api.md:311-318 does not list. Reachability through the public API is currently blocked (tools are rejected for /v1/completions, and n > 1 is rejected for every protocol that carries tools — helios/src/server/protocol/decode.rs:813-815, :753-755), so the defect is latent, not live.
  2. Resolved since the last round: the previous blocking finding — helios/src/server/metrics/process.rs:68 (not opened) calling the feature-gated crate::runtime_core::open_descriptors() under --features server — is gone; commit 54e06b30 deletes helios/src/server/metrics/process.rs (not opened) and its call site, and no process_* series remain in the tree. That also makes the older "docs contradict flare_-only naming" nit moot.
  3. Everything else I checked in the runtime half holds: Metrics::request_completed is the sole writer of the completion counter, the histogram populations match the documented ones, and RequestRecord survives park/requeue with its max_tokens and preemptions.
  4. Nits: the non-stream e2e observation is taken before the body is ever polled, which is looser than the "delivered response" wording in the docs; the TPOT/decode preemption span is not documented although it is real; and !count at http.rs:606 is dead (count responses return at :284-286).

Should fix 1 — response-wide tool-limit gate drops sibling choices' HTTP observations

Where: 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 (all read in context):

Consequence: for any response that mixes a naturally finished choice with a choice that trips the parallel-tool limit, flare_request_e2e_seconds_count, flare_request_choices, and flare_request_max_choice_generated_tokens under-count relative to flare_requests_completed_total by every surviving sibling. That is exactly the counter/histogram divergence the PR set out to remove by funnelling the counter and histograms through one function (helios/src/server/metrics.rs:543-558).

Reachability (verified this round — this is what makes it a "should fix" and not "blocking"):

Fix (minimal, per-choice): decide per finished generation instead of per response — e.g. record which indices were finished with crate::output::Termination::Cancelled at http.rs:531-532 and pass only the surviving choices' counts, still observing e2e once when at least one choice was delivered. Alternative if the behaviour is intended: state in docs/api.md:311-318 that a response in which any choice hits the parallel tool limit contributes no e2e/choice observations for any of its choices.

What would settle it: a phase test of the kind used at helios/src/server/runtime/phase_tests.rs (not opened) (disabled_parallel_calls_complete_http_and_stop_decoding, added by this PR) that builds a two-choice response where one choice trips the tool limit and asserts flare_request_e2e_seconds_count against flare_requests_completed_total. Today such a request cannot be built through the decoder, which is itself the evidence that the path is latent.


Verified correct (checked in code — no finding)


Nits

  1. http.rs:606's !count is dead. count responses return at http.rs:284-286, before the delivery stream exists, so the condition can never be false there. Harmless, but it suggests a guard that does not exist for the streaming path.
  2. The non-stream observation is taken before the body is polled. response_completed runs inside the generator at http.rs:606-612, while the non-stream body is streamed lazily afterwards (http.rs:646-651). A client that receives headers and drops the connection is therefore still counted, whereas a stream client that abandons before draining is not. docs/api.md:311-318 documents only the streaming half ("requires the client to drain the body"), so the word "delivered" is generous for the non-stream case. Either note the asymmetry or move the observation into the body wrapper.
  3. The preemption span is documented for inter-token latency but not for decode/TPOT. docs/api.md:342-345 says the interval spanning a preemption is included for flare_inter_token_latency_seconds; the same is true of flare_request_decode_seconds and flare_time_per_output_token_seconds, which are computed from first-to-last committed token (metrics.rs:593-601) and therefore also include the wait for readmission. One sentence next to docs/api.md:340-341 would remove the guess.

Evidence limitations

Open questions

  1. Should a multi-choice response in which one choice hits the tool limit contribute e2e and choice observations for the choices that completed? The fix in finding 1 depends on that product decision.
  2. Is the non-stream e2e observation intended to count a response whose body the client never reads? If so, the docs should say it; if not, the observation should move into the body stream.