Key findings
Reviewed at head 046aaef through the correctness lens. The mechanism itself is sound: the worker's instants are carried to the encoder on the terminal event, placement matches vLLM per protocol, and nothing is added when the option is off except copying instants into Finished.
- 1 blocking: the enablement path the PR now documents (
[server] per_request_metrics = true) makes every Pythonignitioncommand fail, because Ignition validates the sameconfig.toml(not opened) against a closed schema that this PR did not extend. - 3 should fix: the flag cannot express an explicit false, so the option can never be turned off against a file or a saved Orbit group;
reserve_and_packstill takes an unconditional per-step clock read while the PR body says no clock read is added; thefirst_scheduled_nsstamp lands after vision packing, charging image conditioning toqueue_time_ms. - 1 should fix (docs):
api.md's "null when the request did not reach the instants it spans" contradicts a field that is permanently null, overstates then > 1null to protocols that rejectn > 1, and does not describe the zero-token all-null object. - 2 nits:
ignition debug-serveand its generated config template ignore the new key, and onecli-design.mdsentence about unknown keys is now stale. - Verified clean: metrics placement and per-protocol omission for all four protocols,
RequestTimeslifetime through preemption, thefirst_scheduled_nsfold, andGraphKind::samples()equivalence.
Blocking
1. The documented way to enable the feature breaks every Ignition command.
docs/api.md:1007-1009 tells users to enable the option with [server] per_request_metrics = true "in the host configuration", and docs/cli-design.md:1317-1319 lists per_request_metrics among the [server] keys native flare run applies, with the commented example at docs/cli-design.md:1349.
That file is shared. docs/cli-design.md:1313 states "Ignition and native Flare read this file", and :1385 says "Ignition rejects any section or key outside its schema". The Ignition schema is closed:
ignition/cli/config.py:21-33—_SECTIONS["server"]is{host, port, api_key, thinking_token_budget, scheduler_checkpoint_extra_work_fraction}; there is noper_request_metrics.ignition/cli/config.py:108-114—_validateiterates every key and raisesUsageError(f"{path}: unknown key {key} in [{section}]")for anything outside the schema.config.py:119shows the schema is the only gate; the key would also need abooltype entry.
Every command loads that file through the loader that runs _validate: ignition/cli/serve.py:127 (export), :174, :264, :431, :590 (debug-serve), ignition/cli/bench.py:144 (not opened) (not opened — cited from search hits), ignition/cli/publishing.py:31 (not opened)/73/174/194 (not opened). So a user who follows the new docs and writes the line Ignition itself is supposed to generate gets UsageError: unknown key per_request_metrics in [server] from ignition export, debug-serve, bench, and convert — the model preparation path, which is the step before any serving.
The PR touched neither ignition/cli/config.py nor tests/cli/test_config.py, and tests/cli/test_config.py:151-177 already parametrizes unknown-key rejection, so nothing in CI would catch this either way.
Fix: add "per_request_metrics": bool to _SECTIONS["server"] at ignition/cli/config.py:23-24 (and decide whether debug-serve forwards it, below), plus a positive load case in tests/cli/test_config.py. One ignition export with the documented line in ~/.config/flare/config.toml (not opened) reproduces the failure.
Should fix
2. No way to turn the option off once a file or a saved group enables it.
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);
}
enable_per_request_metrics is a plain bool (flare-cli/src/cli.rs:649 for orbit run, :863 for 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-1322promises "Flags override these defaults, including explicit zero limits and values equal to the built-in defaults", and:1337-1338says saved group options and explicit flags take precedence over each node's file. Withper_request_metrics = truein a node's file, no flag can disable it for one run. Siblings do handle explicit defaults —--kv-cache-limit memoryis re-emitted whenmatches.value_source("kv_cache_limit") == Some(CommandLine)(cli.rs:662-667) — so the mechanism exists and was not applied here.- Persisted Orbit groups:
rank_zero_optionsemits the flag only when true (cli.rs:698-700) andflare/src/controller.rs:691-692(not opened) merges a savedspec.rank_zerowith new options by extension, so a group that ever captured--enable-per-request-metricskeeps it, and the only escape (the config file) also cannot express false.
Fix: make it 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, document the limitation beside the flag. No test exercises a false override: flare-cli/src/config.rs:222-233 only tests ""/true/false in the file with the flag turning it on.
3. The PR body still claims no clock read is added, but reserve_and_pack reads one per model step.
helios/src/server/runtime.rs:2272: let scheduled_ns = super::observation::monotonic_ns(); runs for every reserve_and_pack regardless of the option, and for every request source that reaches this path (including SDK generate/generate_many). The PR body says, under Result, "This PR adds no clock read; the one monotonic read per scheduled model step comes from #548", and the Cost-shaped claim is that with the option off the only added work is copying instants — which is stated correctly elsewhere but contradicted by the earlier sentence. #548's own description already declares "one clock read per model step" as its cost.
Not a new defect in this PR's code, but a claim a reviewer will use to assess cost. Fix: attribute the read to #548 in the Cost section and drop "No clock read is added in either state" / keep the accurate "the one monotonic read per scheduled model step comes from #548" only.
4. For image requests the scheduling instant now lands after vision packing.
helios/src/server/runtime.rs:2269-2285 stamps first_scheduled_ns after pack/pack_vision and conditioned_inputs_ready have run (runtime.rs:2228-2267), which is the right move for the failing-pack case, but it changes what the instant means on the vision path: queue_time_ms (encode.rs:265, arrival_ns → first_scheduled_ns) now includes image conditioning and time_to_first_token_ms (encode.rs:262) starts after it. docs/api.md:1018 defines queue_time_ms as "Model-queue arrival to the first model step that includes the request", and helios/model-contract.md:346-352 (not opened) describes "when the worker reserves and packs that step before submitting it". #548's review raised the same class of issue ("first_scheduled_ns is stamped before the Vision split"). Only reachable with per_request_metrics or return_token_timestamps on and an image request.
Fix: either stamp before the vision pack for vision steps (and document that a failed pack leaves it null anyway), or state in api.md/model-contract.md (not opened) that for image requests the instant follows image conditioning. Note the stamp now precedes only submit's guards (runtime.rs:2289-2295), which can still fail for that step, so the "leaves first_scheduled_ns unset" comment at :2269-2271 covers the pack but not the submit.
5. api.md: a permanently-null field described as an unreached instant, and an overstated n > 1 null.
docs/api.md:1040-1041: "All six fields are always present, and a field is null when the request did not reach the instants it spans, such asmean_itl_msfor a single generated token." Butdocs/api.md:1020documentstime_to_first_content_token_msas "Always null", andhelios/src/server/protocol/encode.rs:263hard-codesValue::Null. A field that never has a value is not an unreached instant; telling llama-swap and billing clients (the audience named in the PR body) that it is a supported-but-unavailable measurement invites them to consume a value that will never arrive. Say plainly that the key is present for vLLM shape compatibility and is always null until #562.docs/api.md:1042: "Withngreater than onemetricsis null" —helios/src/server/protocol/decode.rs:753rejectschoices != 1for every protocol except Completions, so Chat/Responses/Messagesn > 1is a 400, never a null. Restrict the sentence to Completions (matching the encoder, whereRequestMetrics::Suppressedis what produces the null).docs/api.md:1040-1041shows only one null case.encode.rs:257-273nullstime_to_first_token_ms,generation_time_ms,queue_time_ms,tokens_per_secondandmean_itl_mstogether whenfirst_scheduled_ns/first_token_nsare unset (notelet last = first.map(...), so generation depends on the first token), andhelios/src/server/protocol/tests.rs:2446-2448(not opened) pins that all-null object for an output-limited zero-token response. One clause documenting the zero-token shape would close it.
Nits
6. ignition debug-serve and write_initial ignore the new key, and one doc sentence is stale.
ignition/cli/serve.py:485-487 builds the same bootstrap options dict from configuration.get("server.*") for the keys it knows and does not set per_request_metrics; once the schema accepts the key (finding 1), ignition debug-serve will silently ignore a setting flare run honours while honouring its two neighbours. ignition/cli/config.py:183-215 (write_initial) writes the commented template, and this key is missing from it even though docs/cli-design.md:1311-1312 says the file is generated "with the resolved values present as comments". Separately, docs/cli-design.md:1385-1387 ("Native Flare ignores keys it does not use, except in [prefix_cache]") now has a second exception: native Flare uses [server] per_request_metrics and Ignition's schema would reject it. Add the key to serve.py's options and to the template, and update that sentence.
7. Charter/roadmap framing is another lens's territory — noted only so this lens does not double-report it.
Verified clean (recorded so it need not be redone)
- Placement. Non-stream bodies get
response["metrics"]only when!streamingand the encoder has a value (helios/src/server/http.rs:613-615); Chat/Completions put it on the final usage chunk (encode.rs:711-719), Responses onresponse.completed/response.incomplete(encode.rs:731-744). Messages never gets it becauseenable_request_metricssetsself.metrics = NoneforProtocol::Messages(encode.rs:235-236) and the HTTP layer does not consult the protocol again.http.rs:387-389gates onstate.per_request_metrics, wired fromServerConfigdefaulting false (helios/src/server.rs:333(not opened),:148). first_scheduled_nsfolding.http.rs:538isfirst_scheduled_ns.into_iter().chain(times.first_scheduled_ns).min()— an earliest-value fold, so the earlier last-writer-wins concern is gone; the response-levelperformanceobject athttp.rs:605-611is correct.- Lifetime.
RequestTimesis nowpub(helios/src/server/metrics.rs:326) and exported (helios/src/server.rs:33(not opened));recordlives inIncoming(runtime.rs:196-198) and moves with the request through park/readmission (runtime.rs:2116-2157), so instants survive preemption andlast_token_nsspans the park. GraphKind::samples()(helios/src/execution/manifest.rs:90-101) reproduces the previous inlinematches!exactly (Init,Restore,Snapshot,Visionexcluded in both). Only residual risk is a future variant silently joining the sampling set —samples()is the better home for that rule.- Zero-token / never-scheduled responses yield
first_scheduled_ns: nullinperformanceashelios/model-contract.md:349-351(not opened) promises (http.rs:561-567passes the per-frame value,:609the folded one). - Event capacity (
runtime.rs:62-80) needs no change: the PR adds fields toFinished, not a new event variant.
Not verified / open questions
- Windows build and multi-GPU cores were not run (author-admitted). Nothing in the diff is
cfg-gated andflare-cli/src/main.rs:261-272's Windows path reaches the sameconfig["per_request_metrics"]write at:355, so compilation is expected to be fine, but it is unverified. - WinUI bridge.
flare-winui/bridge/src/lib.rs:1319(not opened) /:1381buildflare::settings::RuntimeSettings, notflare::settings::Settings, which is whereper_request_metricslives (flare/src/settings.rs:32). If the Windows app buildsSettingsthroughSettings::resolveit inherits the option; if it buildsSettingsby hand it would fail to compile only because the field is a plainboolwith noDefaultto lean on. No such edit appears among the PR's 22 changed files, which is weak evidence the app goes throughresolve. Settle by buildingflare-winuion Windows or grepping aSettingsliteral. - #562 ordering. If #562 lands first,
docs/api.md:1013-1018and:1020need re-reading for the merged content-token wording; today's text is accurate only while content tokens are always null. - Untested in CI: no checks exist on head
046aaef. The Python-side breakage in finding 1 could not be caught by the Rust suites the PR ran (cargo test ... server:: scheduler:: cache::,flare-cli cli:: config::,flare settings:: configuration::).
Coverage
Read in context at head 046aaef: helios/src/server/http.rs:130-660; helios/src/server/protocol/encode.rs:233-278, :640-790; helios/src/server/runtime.rs:280-330, :1770-1910, :2085-2175, :2210-2330; helios/src/server/metrics.rs:320-380; helios/src/execution/manifest.rs:60-120; helios/src/server/protocol/decode.rs:742-760; flare/src/configuration.rs:1-130; flare/src/settings.rs:1-110, :220-226; flare-cli/src/main.rs:60-400, :470-540; flare-cli/src/cli.rs:532-760, :1375-1400; flare-cli/src/config.rs:1-200, :219-233; ignition/cli/config.py:1-216; ignition/cli/serve.py:120-200, :460-505; tests/cli/test_config.py:140-200; docs/api.md:1000-1060; docs/cli-design.md:1305-1360. Not read: helios/src/server/protocol/tests.rs (not opened) new tests (diff text only), runtime/phase_tests.rs (not opened) new tests, response_lifecycle_tests.rs (not opened), helios/src/scheduler.rs (not opened) diff, ignition/cli/bench.py (not opened) and publishing.py (not opened) (loader use cited from search). Caveat: the GitHub diff contains the whole stacked #548 change, so #560's own lines were separated using #548's item description.