#1 [high] Research summary
Correctness review of #560 (vLLM-compatible per-request metrics)
Coverage note first, since it bounds the review: I read the full diffs and surrounding code for helios/src/server/runtime.rs, http.rs, protocol/encode.rs, metrics.rs, config.rs, server.rs, observation.rs, latency.rs, helios/src/scheduler.rs, the flare-cli changes, docs/api.md, docs/cli-design.md, plus the new phase tests. I did not read the added tests in protocol/tests.rs (not opened), the diff to helios/model-contract.md (not opened), scheduler/tests.rs (not opened), response_lifecycle_tests.rs (not opened), or protocol/decode (which matters for finding 3). Also: the diff posted on this PR already contains the whole stacked histogram change (#548), so I could not cleanly separate which lines are #560's own and which come from its dependency.
No blocking defect found. I traced the main paths the lens cares about and they hold: output_event_capacity (runtime.rs:62–80) budgets exactly the worst case this change adds — one presentation event, one observation, one commit per generated token, checked_mul(1 + observed + commits); Committed is emitted at position == 0 before the step's token events (runtime.rs:1826–1834), so the encoder's step_ns always precedes the content event that latches it; RequestRecord/RequestTimes live inside Incoming and therefore survive park/readmission, and record.max_tokens is set only at first admission (runtime.rs:1591–1594) so preemption cannot reset it; with the option off enable_request_metrics is never called at all (state.per_request_metrics && …, http.rs:363), so no metrics key and no commit events; the content instant correctly skips reasoning, tool output, empty text and named-tool-choice-discarded text (encode.rs:541–551 — the ToolChoice::Named continue precedes the content check); Messages, multi-prompt Completions and n > 1 mapping to None/Suppressed matches the documented placement table; Bootstrap rejects non-boolean per_request_metrics (config.rs:353–357).
Three items worth fixing, all correctness-adjacent:
-
Should fix — the added clock read contradicts the stated cost.
reserve_and_packnow callsobservation::monotonic_ns()once per model step (runtime.rs:2255–2270), unconditionally, before packing. The PR body says under Claimed result "No clock read is added in either state" and under Cost "Option off: … one branch per committing step at position zero". A per-step clock read is in fact added on the serving hot path in both states (it servesfirst_scheduled_nsfor the histograms andperformance.first_scheduled_ns). Either gate the stamp behind the option/histogram need or correct both statements; the current wording is a claim the code does not support. -
Should fix (needs one check to confirm) —
per_request_metricsappears to be settable fromflare run's configuration file, contrary to the docs.Bootstrapreads the key out of the same server-configuration object it readsqueue_capacity,event_capacity,max_body_bytesandfrontend_workersfrom (config.rs:343–404), andflare-cli/src/main.rs:355writes it into that very object (config["per_request_metrics"] = true.into()). If the host configuration file's[server]section flows into that object as those other keyless settings do, thenper_request_metricsis a supported-from-file setting and bothdocs/cli-design.md("off", implied flag-only) and the PR's "There is no[server] per_request_metricskey inflare run's configuration file" are wrong — and the persistent-Orbit-group caveat is not the only way to enable it without a flag. It also means an explicitfalsemust survive the CLI path:main.rsonly writes the key when the flag is set, so a file value oftrueplus no flag would still enable it. Settle it by puttingper_request_metrics = truein aflare.toml(not opened)[server]section and checking whether a response carriesmetrics. I could not read the CLI configuration loader in the time available. -
Nit —
first_scheduled_nsis last-writer-wins in the HTTP handler.http.rs:542assignsfirst_scheduled_ns = times.first_scheduled_ns;rather than folding the earliest value, and the response-levelperformanceblock (http.rs:609–615) then reports the one from the lastFinishedevent. This is only reachable if/v1/chat/completionsacceptsn > 1(the code comments assume "Chat has one choice", andEncoder::response()builds a single choice at encode.rs:811, so it is at most latent). Settling it needs a look atprotocol/decode: if Chat rejectsn > 1this is dead code, otherwise it is a wrongperformance.first_scheduled_ns. Folding withget_or_insert/minwould remove the hazard either way. -
Nit — the first-scheduled stamp precedes a submission that can fail. The stamp happens immediately after
scheduler.commitand beforepack_inputs(runtime.rs:2253–2314); if packing returns an error the request keeps a scheduled instant for a step that never executed, soqueue_time_msandflare_request_queue_secondscan describe a step that never ran. Cosmetically relevant only for failed requests, which the histograms already exclude, but the response body'squeue_time_msis computed from the same instant.
One thing I checked and deliberately dropped: mean_itl_ms dividing generation_time_ms by usage-counted tokens minus one (encode.rs:285–287) disagrees with the worker's step-count-based flare_inter_token_latency_seconds for speculative steps and for the forced reasoning-close token — but docs/api.md defines the response field exactly as the code computes it, and the PR body discloses the close-token limitation, so there is no undocumented divergence.
Also worth knowing for whoever reviews the runtime lens: publish_gauges publishes parked only when the worker makes progress (runtime.rs:1181–1183, 1227–1236) and it is reset to zero only at worker exit (runtime.rs:766), so the gauge is a sampled value, not a strictly current one.
#2 [high] Coverage and verification basis for PR #560 review
PR #560 (per-request vLLM metrics), head ce44060, open, no reviews, no CI.
Read in full diff + surrounding code:
- helios/src/server/runtime.rs (output_event_capacity :62-80; GenerationEvent/Incoming :193-390; enqueue/enqueue_many :841-970; run/publish_gauges :1162-1236; admit :1348-1460; park/park_if_preempted :2125-2190; reserve_and_pack :2253-2317; submit :2319-2400; complete :1663-1780; token commit loop :1813-1900; finish paths :2050-2120)
- helios/src/server/http.rs (full :120-736)
- helios/src/server/protocol/encode.rs (full :1-867)
- helios/src/server/metrics.rs (full diff)
- helios/src/server/{config.rs,server.rs,observation.rs,latency.rs} diffs
- helios/src/scheduler.rs diff
- flare-cli/src/cli.rs (:470-760 + test), flare-cli/src/main.rs (:250-400)
- docs/api.md, docs/cli-design.md diffs
- helios/src/server/runtime/phase_tests.rs :4250-4900 (http_state_for, timed_pass, served_through_worker, the 4 new metrics tests)
- repo rules: AGENTS.md, docs/design-review.md, charter
NOT read: helios/src/server/protocol/tests.rs added tests; helios/model-contract.md diff; scheduler/tests.rs; response_lifecycle_tests.rs; helios/src/server/protocol/decode (needed for finding 3 — whether Chat accepts n>1); flare-cli configuration-file loader in flare/src (needed for finding 2).
Caveat: the diff posted on the PR already contains the whole stacked histogram change (#548), so I could not separate #560's own lines from its dependency's.
#3 [high] Should fix: added per-step clock read contradicts stated cost
File: helios/src/server/runtime.rs:2253-2270 (reserve_and_pack, immediately after self.scheduler.commit(step, fence)?).
let scheduled_ns = super::observation::monotonic_ns(); runs unconditionally for every scheduled step, then stamps record.times.first_scheduled_ns for each lane via get_or_insert.
The PR description states, under "Claimed result": "No clock read is added in either state." And under Cost: "Option off: no commit events, unchanged event capacity, and one branch per committing step at position zero."
That is not what the code does: with the option off, and for every non-HTTP call site (generate/generate_many from the SDK), a clock read is added per model step on the serving hot path. The read serves both the runtime histograms (stacked #548) and performance.first_scheduled_ns (http.rs:542), so it is needed — but the cost claim in the PR body and any matching doc sentence is unsupported by the code.
Fix: either state the added per-step clock read honestly in the Cost section and drop "no clock read is added", or gate the stamp so it only happens when some consumer needs it (histograms always on here, so the honest wording is the likelier fix).
#5 [high] Blocking: Python Ignition config schema rejects [server] per_request_metrics
Severity: blocking (documented enablement path breaks a supported tool).
docs/api.md:1007-1009 now tells users to enable the feature with [server] per_request_metrics = true "in the host configuration"; docs/cli-design.md:1317-1319 lists per_request_metrics as a [server] key native flare run applies, and cli-design.md:1349 shows it in the example config.
But the same file is read by the Python preparation CLI, which validates it against a closed schema:
- ignition/cli/config.py:21-33
_SECTIONS["server"]= {host, port, api_key, thinking_token_budget, scheduler_checkpoint_extra_work_fraction} — no per_request_metrics. - ignition/cli/config.py:108-114
_validateraisesUsageError(f"{path}: unknown key {key} in [{section}]")for any key not in the schema. - Every ignition command loads that file: serve.py:127 (export), :174 (export hosts), :264, :431, :590 (debug-serve), bench.py:144, publishing.py:31/73/174/194.
- docs/cli-design.md:1313 states "Ignition and native Flare read this file", and :1385 "Ignition rejects any section or key outside its schema".
- The PR touched neither config.py nor tests/cli/test_config.py, so no test covers it (test_config.py:151-177 already asserts unknown-key errors).
Consequence: a user who follows the new docs and writes [server] per_request_metrics = true into ~/.config/flare/config.toml gets, on every ignition export/debug-serve/bench/convert/edit/join, UsageError: unknown key per_request_metrics in [server]. Because the key is documented as the recommended enablement, this is a live regression in the preparation path, not just a doc gap.
Fix: add "per_request_metrics": bool to ignition/cli/config.py:23-24 _SECTIONS["server"], and decide whether debug-serve forwards it (see separate note). Add one case to tests/cli/test_config.py's invalid-key parametrization plus a positive load test.
Settled by reading the code; a single ignition export with that key in the file shows the error.
#6 [high] Should fix: no way to turn the option off from the CLI once the config enables it
Severity: should fix.
flare-cli/src/config.rs:73-75:
if !run.enable_per_request_metrics { run.enable_per_request_metrics = self.server.per_request_metrics.unwrap_or(false); }
and flare-cli/src/main.rs:355-357 writes the key only if args.enable_per_request_metrics.
enable_per_request_metrics is a plain bool (cli.rs:649 orbit, :863 run). There is no --no-enable-per-request-metrics and no tri-state, so an explicit false is indistinguishable from omission.
Two consequences:
- docs/cli-design.md:1321-1322 states "Flags override these defaults, including explicit zero limits and values equal to the built-in defaults", and cli-design.md:1337-1338 says per-node configuration is overridden by flags. With
per_request_metrics = truein a node's file, a user cannot disable it for one run by any flag. Sibling settings do offer explicit defaults:--kv-cache-limit memoryis re-emitted whenmatches.value_source("kv_cache_limit") == CommandLine(cli.rs:662-667), and--scheduler-checkpoint-extra-work-fraction 0is accepted. This option has no equivalent. - Persistent Orbit groups:
rank_zero_optionsreturns the flag only when true (cli.rs:698-700), and controller.rs:691-692 merges savedspec.rank_zerowith new options by extension. So a saved group that captured--enable-per-request-metricskeeps it forever; removing it requires editing the config file, which is exactly the path that cannot express false either.
Fix: make the flag a tri-state (Option<bool> via num_args(0..=1)/--enable-per-request-metrics[=BOOL]) or add --no-enable-per-request-metrics with overrides_with, and forward the explicit false to rank zero as a config override. At minimum, state the limitation in docs/cli-design.md beside the flag.
Verified by reading cli.rs/config.rs/main.rs; no test asserts a false override (config.rs:222-233 tests only "" / true / false in the file, always with the flag turning it on).
#7 [high] Should fix: per-step clock read and vision packing charged to queue time
Severity: should fix (scoped write-up; the family may also be a stack issue).
New loc: helios/src/server/runtime.rs:2269-2285 — the stamp moved after packing (good), but two behaviours remain:
-
Unconditional clock read per model step.
let scheduled_ns = super::observation::monotonic_ns();runs for everyreserve_and_packregardless of--enable-per-request-metricsand regardless of whether the request came from HTTP (generate/generate_manyfrom the SDK reach this path). The PR body still says "No clock read is added in either state" and the Cost section says the only added work with the option off is copying instants into the terminal event. #548's body declares "one clock read per model step" as its own cost (read_item 548, What changed/Result), so the read most plausibly belongs to the base #548; #560 nonetheless inherits it and repeats the "no clock read" claim. Fix: attribute the read to #548 in #560's Cost (or gate it), and drop "No clock read is added in either state". -
A step's requested class is no longer the class it executes in.
reserve_and_packstamps whateverstep.lanescontains, andstep.kindis only what the plan requested. On the vision path the same function callspack_visionandconditioned_inputs_ready(runtime.rs:2228-2259 duringGraphKind::Vision); #548's review already notedfirst_scheduled_nsstamped before the Vision split absorbs vision work intoflare_request_prefill_seconds. After the move it is stamped after vision conditioning too, soqueue_time_msfor a vision request measures image conditioning as queue delay andtime_to_first_token_msstarts after it. Docs (docs/api.md:1013-1017 "Model-queue arrival to the first model step that includes the request"; helios/model-contract.md:346-352 "when the worker reserves and packs that step before submitting it") describe a scheduling instant, not a packing instant. Only reachable for image requests withper_request_metrics/return_token_timestampson.
Also worth stating: the stamp precedes submit's own guards — nothing after the stamp can fail for that step, but scheduler.commit and the pack both can, and on failure the field stays unset (documented at runtime.rs:2269-2271, and now accurate).
Verified in code; the earlier "stamp precedes a failing pack" nit is resolved by the move and is dropped.
#12 [high] Research summary
Reviewed PR #560 at head 046aaef through the correctness lens, re-checking everything against the six commits pushed since my last turn (the content-instant removal, the post-pack first_scheduled_ns stamp, the [server] per_request_metrics configuration key, and the Ignition/CLI plumbing).
Verdict: one blocking, three should-fix, two nits.
Blocking (new this turn, created by the added configuration key): docs/api.md:1007 (not opened) and docs/cli-design.md:1317-1349 now tell users to enable the feature with [server] per_request_metrics = true in ~/.config/flare/config.toml (not opened), but that same file is read by the Python preparation CLI, whose schema at ignition/cli/config.py:21-33 is closed and whose validator at :108-114 rejects unknown keys. Every ignition export/debug-serve/bench/convert/join (serve.py:127,174,264,431,590, bench.py:144 (not opened), publishing.py:31-194 (not opened)) would then fail with unknown key per_request_metrics in [server]. The PR touched neither config.py nor tests/cli/test_config.py, and cli-design.md:1313 says "Ignition and native Flare read this file". Following the new docs breaks model preparation.
Should fix: the boolean flag cannot express an explicit false, so a node config that enables the option cannot be turned off for one run and a saved Orbit group can never drop it, contradicting cli-design.md:1321-1322 and the sibling settings' explicit-default handling; reserve_and_pack still takes an unconditional per-step clock read (runtime.rs:2272) while the PR body still claims no clock read is added; the stamp now lands after vision packing (runtime.rs:2269-2285), charging image conditioning to queue_time_ms and TTFT for vision requests; and api.md:1013-1034 (not opened) describes a permanently-null field as an "unreached instant" and overstates the n > 1 null to protocols that reject n > 1 at decode.rs:753.
Resolved since my last report: the first_scheduled_ns last-writer-wins nit is gone (http.rs:538 now folds the minimum), and the failing-pack nit is gone (the stamp moved after packing). I re-verified HTTP placement for all four protocols, RequestTimes lifetime through preemption, and that GraphKind::samples() reproduces the old inline match exactly.
Findings are entries #5-#11 in the scratchpad; #4 is the superseded previous report and #5-#7 supersede its verification notes.
#13 [high] Verdict for head 046aaef (supersedes entry 4)
Head 046aaef, open, ready for review, no reviews, no CI on head. Replaces my entry #4 (written against the previous head); #5-#7 supersede its verification notes.
One blocking (new, created by the configuration-key commit f0ccabcc):
- [blocking] The documented way to enable the feature,
[server] per_request_metrics = truein ~/.config/flare/config.toml, makes every Pythonignitioncommand fail withunknown key per_request_metrics in [server](ignition/cli/config.py:21-33 closed schema, :108-114 rejects unknown keys, loaded by serve.py:127/174/264/431/590, bench.py:144, publishing.py:31/73/174/194; docs/cli-design.md:1313 "Ignition and native Flare read this file"). The PR touched neither config.py nor tests/cli/test_config.py.
Three should-fix:
- The boolean flag cannot express an explicit false (cli.rs:649/:863, config.rs:73-75, main.rs:355-357), so a file that enables the option cannot be overridden per run, and a saved Orbit group can never drop it (cli.rs:698-700 + controller.rs:691-692). Contradicts cli-design.md:1321-1322 and the sibling settings' explicit-default handling (cli.rs:662-667).
reserve_and_packstill takes an unconditionalmonotonic_ns()per model step (runtime.rs:2272) while the PR body still says "No clock read is added in either state"; #548's body already declares "one clock read per model step", so this is an attribution/claim fix, not new code.- The stamp now lands after vision packing (runtime.rs:2269-2285), so for image requests
queue_time_msincludes image conditioning and TTFT starts after it — docs/api.md "Model-queue arrival to the first model step" and model-contract.md:346-352 describe a scheduling instant. #548's earlier review raised the same class of issue ("first_scheduled_ns is stamped before the Vision split"). - api.md, Per-request metrics section: describes
time_to_first_content_token_msas "Always null" inside a table whose preamble says fields are null "when the request did not reach the instants it spans", and overstates then > 1null to protocols that rejectn>1at decode.rs:753.
Two nits:
ignition debug-servebuilds the same Bootstrap object (serve.py:485-487) and skips the new key;write_initial(config.py:183-215) omits it from the generated template; cli-design.md:1385-1387's "Native Flare ignores keys it does not use" sentence is now stale.- Charter/roadmap framing: the vLLM-parity name and the option's default-off status are other lenses' territory; nothing on this lens.
Resolved since #4 and worth stating so the next reviewer does not re-raise them: http.rs:538 now folds the minimum (was last-writer-wins), the failing-pack nit is gone, and first_scheduled_ns for a response whose choices never ran is null as model-contract.md:349-351 says.
Not run / not verified: multi-GPU cores and the Windows build (author-admitted); flare-winui bridge's Settings construction (see #11); whether #562 lands first and changes the api.md content-token wording.
#14 [high] Coverage basis for the 046aaef review
Files I read in context at head 046aaef (this turn):
- helios/src/server/http.rs:130-332 (decode/prepare/submit), :330-660 (encoder construction, the event loop, Finished arm at :527-575, response assembly :596-625, stream vs body delivery :627-660). Confirmed :387-389 gating, :538 fold, :561-567 per-frame performance, :605-615 response performance + metrics.
- helios/src/server/protocol/encode.rs:233-278 (enable_request_metrics/record_times/metrics_value), :640-748 (finish: usage chunk + metrics, Responses terminal event), :749-790 (usage_value/response).
- helios/src/server/runtime.rs:280-330 (finish_cancelled), :1770-1910 (token commit loop, tokens_committed, stop path), :2085-2175 (park_if_preempted/park/retire/plan), :2210-2330 (reserve_and_pack, submit).
- helios/src/server/metrics.rs:320-380 (RequestTimes pub, RequestRecord, tokens_committed semantics).
- helios/src/execution/manifest.rs:60-120 (GraphKind::samples vs the old inline matches!).
- helios/src/server/protocol/decode.rs:742-760 (choices validation;
protocol != Completion && choices != 1rejects n>1 on Chat/Messages/Responses). - flare/src/configuration.rs:1-130 (Server struct incl. per_request_metrics:34;
#[serde(default)]without deny_unknown_fields on Server:26-28, only PrefixCache denies at :49-57; parse/validation :80-108). - flare/src/settings.rs:1-40 (:32 field), :40-110 (resolve + the two new tests), :220-226.
- flare-cli/src/main.rs:60-110 (config path + apply), :120-200, :200-290, :280-400 (config JSON writes; per_request_metrics at :355-357), :470-540 (orbit_command → rank_zero_options/run_args).
- flare-cli/src/cli.rs:532-540 (OrbitPush), :600-760 (OrbitRun fields, rank_zero_options :672-702, run_args :705-732, Run struct), :1375-1400 (new flag test).
- flare-cli/src/config.rs:1-200 (load/apply, the new per_request_metrics plumbing :73-75), tests :219-233.
- ignition/cli/config.py:1-216 (full: _SECTIONS :21-33, _BUILT_IN, _validate :108-142, get :144-156, write_initial :183-215).
- ignition/cli/serve.py:120-140, :160-200, :460-505 (_server_options + thinking_token_budget/scheduler_checkpoint_extra_work_fraction writes).
- tests/cli/test_config.py:140-200 (unknown-key parametrization :151-177).
- docs/cli-design.md:40-80, :1300-1400; docs/api.md new section via search hit at :1007 plus the diff hunk.
- Read #548's item body (read_item 548) to attribute the per-step clock read.
NOT read this turn: helios/src/server/protocol/tests.rs added tests (used only the diff text), helios/src/server/runtime/phase_tests.rs new tests (diff text only), response_lifecycle_tests.rs, helios/src/scheduler.rs diff, latency.rs, flare/src/controller.rs around :2563, flare-winui/bridge.
Caveat that still applies: the PR diff on GitHub contains the whole stacked #548 change, so I could not separate #560's own lines from its dependency's by diff alone; I used #548's own item description to attribute the per-step clock read.
#8 [medium] Nit: ignition debug-serve and write_initial ignore the new key; stale unknown-key sentence
Severity: nit (but it is a silent divergence between two commands that read the same file).
[server] per_request_metrics now reaches flare run (flare/src/configuration.rs:34, flare-cli/src/config.rs:73-75) and the desktop controller (flare/src/settings.rs:224, controller.rs:2566). flare orbit run forwards it only when the flag is set (cli.rs:698-700), and the Orbit per-node configuration is read by flare run on each node, so nodes still pick it up — consistent.
But the Python ignition debug-serve path builds the same server-configuration object that Bootstrap parses (ignition/cli/serve.py:485-487 sets options["thinking_token_budget"] and options["scheduler_checkpoint_extra_work_fraction"] from configuration.get("server.*")) and does not set per_request_metrics. Once the Ignition schema accepts the key (see the blocking note), ignition debug-serve will silently ignore a setting that flare run honours, while honouring its two neighbours. Fix: add options["per_request_metrics"] = configuration.get("server.per_request_metrics").value beside :487, or document that debug-serve ignores it.
Related doc gaps to fix in the same pass:
- docs/cli-design.md:1385-1387 says "Native Flare ignores keys it does not use, except in [prefix_cache]". After this PR native Flare uses
[server] per_request_metrics, and Ignition's schema at config.py:23-24 would reject it — so both halves of that sentence need the new key. - ignition/cli/config.py:183-215
write_initialwrites the commented template for every "resolved value"; docs/cli-design.md:1311-1312 says the file is "Written on first export with the resolved values present as comments". The new key is absent from that template, so the file Ignition generates does not mention the option the docs advertise. Add a commented line beside the scheduler_checkpoint_extra_work_fraction one.
Verified by reading both CLI trees; nothing here needs a test to show the code paths, only a live run to see the user-visible error.
#9 [medium] Should fix: api.md null-field wording contradicts "always present, null when unreached" and overstates n>1 null
Severity: should fix (documentation claim contradicted by the same PR's code, and by #562).
New head 046aaef moved the content instant to #562. docs/api.md:1013-1018 now says time_to_first_content_token_ms is "Always null: Flare does not report when answer text first appeared", and the PR body says it "is always null; vLLM allows null when a value is unavailable, and a follow-up PR reports it for streams".
But helios/src/server/protocol/encode.rsmetrics_value (encode.rs:251-278) hard-codes "time_to_first_content_token_ms": Value::Null and the field is still emitted on every object, so today the doc is true. The issue is the shape the docs promise: "All six fields are always present, and a field is null when the request did not reach the instants it spans" (api.md:1032-1034). A field that never has a value is not an unreached instant; documenting "always null" invites clients (llama-swap and billing tools named in the PR body) to treat it as a supported-but-unavailable measurement, exactly what it is not on the server side today.
Two smaller, checkable doc/code mismatches in the same area:
- api.md:1030-1032: "With
ngreater than onemetricsis null, and Completions with several prompts omit it." The code agrees forn>1only when the protocol can express it —decode.rs:753rejectschoices != 1for every protocol except Completions, so Chat/Responsesn>1is an HTTP 400, never a null. The sentence is not wrong for Completions but implies all protocols; say "Completions withngreater than one". - api.md:1030 "a field is null when the request did not reach the instants it spans, such as
mean_itl_msfor a single generated token": encode.rs:262-268 also nullstime_to_first_token_ms,generation_time_ms,queue_time_msandtokens_per_secondwhenfirst_scheduled_ns/first_token_nsare unset (first.map(|_| timing.times.last_token_ns)makesgenerationdepend onfirst), and protocol/tests.rs:2446-2448 pins the all-null object for an output-limited zero-token response. Worth one clause so the zero-token response shape is documented.
Verified in encode.rs and protocol/tests.rs. Not verified: what #562 changes; if it lands first, re-read api.md:1013-1018 for the merged wording.
#10 [medium] Verified-clean coverage notes for head 046aaef
Severity: nit. HTTP-layer placement is correct at this head; recorded so the next reviewer need not redo it.
Checked at head 046aaef:
- Non-stream bodies:
helios/src/server/http.rs:613-615setsresponse["metrics"]only when!streamingand the encoder has a value; the encoder returnsNonefor Messages, multi-prompt Completions, and streamed Chat/Completions withoutinclude_usage(encode.rs:233-241, gated byself.include_usage). Protocol is not consulted again, so Messages never gets the key even though!streamingis true —enable_request_metricssetself.metrics = NoneforProtocol::Messages(encode.rs:235-236). - Streams: Chat/Completions place it on the final usage chunk (encode.rs:711-719); Responses on
response.completed/response.incomplete(encode.rs:731-744).http.rs:387-389callsenable_request_metrics(decoded.stream)only whenstate.per_request_metrics, andserver.rs:333wires the flag fromServerConfig, defaulting false (server.rs:148). first_scheduled_nsfolding at http.rs:538 isfirst_scheduled_ns.into_iter().chain(times.first_scheduled_ns).min()— this is now an earliest-value fold, not last-writer-wins, so my earlier nit is resolved for the response-levelperformanceobject (http.rs:605-611).decode.rs:753also restricts Chat to one choice, so the multi-choice case could not arise there anyway; Completions reachesmetricsvia the encoder'sSuppressed/None, not via this fold.RequestTimesispubnow (metrics.rs:326) and exported fromserver.rs:33, soGenerationEvent::Finishedcan carry it;recordlives inIncoming(runtime.rs:196-198) and moves with the request throughpark/readmission (park at runtime.rs:2116-2157 keepsincoming), sotimessurvives preemption andlast_token_nsspans the park.metrics_bodyfor Responses bodies:!streamingsetsresponse["metrics"]on the body fromencoder.response(), and Responses bodies are built from the sameresponse()(encode.rs:783+), so the key is at the top level of both the stream event'sresponseand the JSON body — matching what llama-swap reads.Metrics/GraphKind::samplesreuse (manifest.rs:90-101) is behaviour-preserving: the previous inlinematches!listed exactly the same seven kinds assamples();Init,Restore,Snapshot,Visionare excluded in both. Only risk is a future variant silently joining the sampling set;samples()is the better home for that rule.output_event_capacity(runtime.rs:62-80) and the encoder's per-token counters are unchanged by this revision; no event-capacity change is needed because #560 adds no new event variant, only fields onFinished.
One thing I could not settle from code: whether a Chat request with return_token_timestamps and n=1 but a zero-token response emits performance with first_scheduled_ns: null — the docs say "It is null when no model step included the request" (model-contract.md:349-351), and http.rs:561-567 passes times.first_scheduled_ns per frame while :609 passes the folded value, so a response whose only choices never ran yields null. That matches the docs; no finding.
#11 [low] Unverified: WinUI bridge settings and the Windows build
Severity: nit / open question to state, not a defect I could show.
The PR body and docs say the option reaches the desktop controller "through flare settings" (flare/src/settings.rs:76-87, :224; controller.rs:2566 writes config["per_request_metrics"] = self.settings.per_request_metrics.into()). That is wired.
What I could not check: flare-winui/bridge/src/lib.rs:1319 FlareRuntimeSettings and :1381 build flare::settings::RuntimeSettings, not flare::settings::Settings, so the WinUI bridge's own settings struct does not obviously carry per_request_metrics — the field is on Settings (:32), which the controller builds in Worker (controller.rs:2563-2566). If the WinUI app constructs Settings through Settings::resolve(config, ..) from the same TOML, the option works there without a UI toggle; if it builds Settings by hand, it will compile only because per_request_metrics: bool is a plain field, and the Windows app will always send false. Settings has no Default impl to lean on, so a struct literal would have had to be updated — the fact that no such edit is in the PR's 22 files is weak evidence the app goes through Settings::resolve.
Also unverified: the Windows build. The PR says "Not run: multi-GPU cores and the Windows build". flare-cli/src/main.rs:261-272 has a separate #[cfg(windows)] path that builds authorized and then reaches the same config["per_request_metrics"] write at :355, so the code is shared; nothing in the diff is cfg-gated, which is the reason to expect it to compile. Worth one sentence in the PR's evidence rather than a finding.
Settle by building flare-winui on Windows, or by finding the Settings literal in the WinUI bridge. I did not read enough of flare-winui/bridge to call it.