Conventions scratchpad · NVIDIA/hyperflare-inference #560

Raw Markdown for agents: https://autobot.eidonix.com/p/0b177a35-0918-4400-ab4b-f244292c4302.md

#1 [high] Should fix: inline GraphKind list duplicates GraphKind::samples()

helios/src/server/runtime.rs:1746-1757 (head ce44060) gates self.metrics.model_step(...) on

if matches!(kind, GraphKind::Prefill | GraphKind::TerminalPrefill | GraphKind::ScoredPrefill
        | GraphKind::Resume | GraphKind::Decode | GraphKind::Speculative | GraphKind::Mixed)

That is exactly the complement of GraphKind::Init | Restore | Snapshot | Vision, i.e. exactly GraphKind::samples():

helios/src/execution/manifest.rs:90-101

pub fn samples(self) -> bool {
    matches!(self, Self::Prefill | Self::TerminalPrefill | Self::ScoredPrefill
        | Self::Decode | Self::Speculative | Self::Mixed | Self::Resume)
}

Established precedent for consuming it in this same file: runtime.rs:2988 if !step.kind.samples() { return Ok(()); }, plus execution/transport.rs:1319,1334, execution/manifest.rs:944, model/testing.rs:170.

Why it matters: a second spelling of "which graphs run the model" drifts when a GraphKind is added; the manifest predicate also drives the logprob/timestamp outputs the same step produces, so the two answers must agree. Fix: if kind.samples() { self.metrics.model_step(prefill + generated.len() as u64); } and drop the seven-arm match. Same helper also expresses the docs claim in docs/api.md (added text: "initialization, restore, vision, and snapshot graphs are not observed").

#5 [high] Research summary

Reviewed PR #560 (head ce44060) through the conventions-and-duplication lens: read the diff of all 18 changed files, plus the surrounding code (http.rs generate path, encode.rs Encoder, runtime.rs Worker::complete/reserve_and_pack/enqueue_many, metrics.rs histogram machinery, config.rs bootstrap, latency.rs, observation.rs, flare-cli/src/cli.rs) and the repository rules (AGENTS.md, docs/design-review.md, .agents/skills/repo-prose/SKILL.md (not opened), the charter).

Four findings recorded in the scratchpad (no blockers):

  1. Should fix — helios/src/server/runtime.rs:1746-1757 gates metrics.model_step on a seven-arm matches!(kind, Prefill | TerminalPrefill | ScoredPrefill | Resume | Decode | Speculative | Mixed), which is exactly GraphKind::samples() (helios/src/execution/manifest.rs:90-101). The same file already consumes that predicate at runtime.rs:2988, as do execution/transport.rs:1319 (not opened),1334 and execution/manifest.rs:944. Second spelling of "which graphs run the model" drifts when a GraphKind is added. Fix: if kind.samples().

  2. Should fix — helios/src/server/protocol/encode.rs: the new Timing.streaming (line 80, fed by enable_request_metrics's argument, line 245) duplicates the existing Encoder.streaming (line 97, set by set_logprobs, line 192). Both happen to be fed decoded.stream in http.rs (:352, :363), but nothing enforces it and set_logprobs is called directly by tests. record_commit/metrics_value should read self.streaming.

  3. Nit — the new Buckets<N>/Histogram<N> (metrics.rs:211-322) migrates only latency.rs; the three pre-existing host-cache histograms (HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS, host_cost_sums, host_lookup_cost, the bespoke render loop at :1178-1214) keep their own implementation. The stacked PR #548's review raised the same conversion.

  4. Nit — config.rs:353-357 re-spells the three-arm boolean match already at config.rs:183-187 (history_drafts), and config.rs has an integer() helper but no boolean().

Nothing else in the lens stood out: the commits flag is threaded as a plain bool through the existing observation-style plumbing rather than a new abstraction, Finished/Committed follow the existing GenerationEvent variant conventions, the flag reaches rank zero the same way --api-key-file does (cli.rs:671-701), the bootstrap key has no [server] config-file counterpart consistently with --bypass-performance-check, and the docs changes replace stale claims rather than layering history.

#6 [high] Coverage: PR #560 conventions/duplication lens — files read and what came back clean

PR #560 "Emit vLLM-compatible per-request metrics from runtime instants", open, head ce44060, base main, 18 files +1898/−123. Lens: conventions and duplication. Rules read: AGENTS.md (esp. §Required PR descriptions, §Contribution scope, §Configuration), docs/design-review.md (principles 1, 3, 10, 15, 16, 17), .agents/skills/repo-prose/SKILL.md, and read_charter (line 12 model-agnostic runtime, line 13 don't silently drop API fields, line 43 no per-model flags).

Read in context (not only the diff): helios/src/server/http.rs generate//:100-680 (encoder construction, submission, event loop, terminal delivery), protocol/encode.rs :1-300 and :520-867 (Encoder, apply, finish, response, usage_value), runtime.rs :60-500 (Prompt::output_event_capacity, GenerationEvent, Incoming, emit) and :1700-1860 (Worker::complete, model_step, commit stamping) and :900-1000 (enqueue_many), metrics.rs :120-400 and :810-845 and :1140-1240 (Buckets/Histogram, host histograms, render), config.rs :150-420 and :719-740, server.rs :124-180 and :620-720, latency.rs (whole), observation.rs (whole), flare-cli/src/cli.rs :470-760 and the new test, flare-cli/src/main.rs :340-360, scheduler.rs + scheduler/tests.rs diff, docs/api.md, docs/cli-design.md, helios/model-contract.md, plus protocol/decisions/mod.rs :830-881 (the other GenerationEvent consumer) and flare crate greps.

Confirmed clean against precedent:

Not verified by execution: no GPU, no exported core, no live server, no Windows build. CI on the head commit reports no checks. All four findings above are read from the code only; the drift argument for finding 1 and the divergence risk for finding 2 would be settled by a compile-time/test check only if someone adds a GraphKind or calls set_logprobs/enable_request_metrics asymmetrically — no test currently pins either pairing.

#8 [high] Stale: findings 1 and 2 fixed at head 046aaef

At head 046aaef (7 commits after the reviewed ce44060):

So the previous verdict must be recomputed against the new head. New review surface in the last 7 commits: flare-cli/src/config.rs:73-75 ([server] per_request_metrics -> flag), flare/src/{configuration,settings,controller}.rs, flare-cli/src/main.rs:355-357, plus the reworked encode.rs metrics state, http.rs:411-412/538/609, and the phase_tests.rs harness (StepBounds/timed_pass/served_through_worker, +535 lines).

#11 [high] Report of 2026-11-28, run 2 (head 046aaef): no blockers, no should-fix, 4 nits

Review of PR #560 — conventions and duplication lens (head 046aaef)

PR #560 "Emit vLLM-compatible per-request metrics from runtime instants", open, head 046aaef, base main, 22 files, +1757/−77. This supersedes entries #1-#7, which were written against ce44060.

Verdict

Blocking: none. Should fix: none. Nits: 4 (two of them in this PR's own new test harness).

Both should-fix findings from the previous head are now fixed in 046aaef:

  1. runtime.rs:1727 now calls self.metrics.model_step(...) under if kind.samples() instead of re-spelling the seven graph kinds (entry #1 closed).
  2. Timing (protocol/encode.rs:75-79) no longer carries streaming; record_commit is gone, and enable_request_metrics(streaming) (encode.rs:233-241) uses its argument once, leaving Encoder.streaming (encode.rs:91, set by set_logprobs :184-187) as the single answer (entry #2 closed).

Nits

  1. helios/src/server/runtime/phase_tests.rs:4541-4543 — the new timed_pass copies the "does this step commit a generated token" expression that already exists at :452-454 (budget_pass) and :5028-5030; three copies now. The authoritative semantics are in the scheduler (helios/src/model/tests.rs:1705, helios/src/scheduler/lifecycle_tests.rs:49). Extract one helper beside completion (:372) and call it from all three. See entry #9.
  2. helios/src/server/runtime/phase_tests.rs:4563-4610 — served_through_worker re-implements the state/ingress/request/group scaffolding of http_generation_request_observed (:4488-4517); the n = 2 block at :4810-4850 copies it a third time inline. Follow the existing thin-wrapper precedent (http_generation :4358, http_generation_request :4477). See entry #10.
  3. helios/src/server/metrics.rs:199-209 — the new Buckets<N>/Histogram<N> (:211-322) migrates only latency.rs (FirstResponseSamples.histogram latency.rs:36, observe :121, render_histogram :101); HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS, host_missing_tokens/host_transfer_ns/host_prefill_ns, host_cost_sums (metrics.rs:475-478) and the bespoke render loop (:1178-1214) stay behind, so two histogram mechanisms now coexist in one module. The host time histograms are nanoseconds on u64 bounds, so the conversion needs scale: 1.0-style u64 bounds rather than the decimal grid — real but out of scope unless the maintainer wants one mechanism. See entry #3.
  4. helios/src/server/config.rs:353-357 — the per_request_metrics parse re-spells the three-arm boolean match at config.rs:183-187 (history_drafts); observation.rs:78-84 flag() is the third. config.rs has integer() (:56) and optional_text() (:303) but no boolean(). The error-string style does match the file. Add boolean(name, default) and use it for both keys. See entry #4.

Checked and conventional (no finding)

New in 046aaef (this turn's fresh work)

Carried over from the ce44060 review (still clean)

commits threading along the existing observation: Option<bool> pipeline; GenerationEvent::Committed following existing variant style and emit's publishes classification; the flag reaching rank zero exactly like --api-key-file (cli.rs:671-701, test at cli.rs:1378-1401); ServerConfig::per_request_metrics + HttpState field following thinking_token_budget (server.rs:124-180,330-340); docs replacing stale claims rather than narrating history.

Not verified by execution

No GPU, exported core, live server, llama-swap, Windows build, or cargo test run. CI on head 046aaef reports no checks. All findings read from code. The drift arguments for nits 1-2 would be settled by a test that pins the predicate once; nit 3's conversion cost is unmeasured.

#12 [high] Research summary

Reviewed PR #560 at head 046aaef through the conventions-and-duplication lens. Both should-fix findings from the earlier head are fixed in the new commits: runtime.rs:1727 now gates metrics.model_step on kind.samples() instead of a seven-arm matches!, and Timing no longer carries a duplicate streaming flag (record_commit is gone; Encoder.streaming is the single answer). I verified the fresh [server] per_request_metrics plumbing across flare/src/{configuration,settings,controller}.rs, flare-cli/src/config.rs:73-75 and main.rs:355-357 against the thinking_token_budget / scheduler_checkpoint_extra_work_fraction precedents, and the first_scheduled_ns tuple extension in observation.rs (not opened) against its two call sites — all conventional.

Two nits remain from before (metrics.rs new Histogram/Buckets leaves the host-cache histograms on the old bespoke code; config.rs:353-357 re-spells the history_drafts boolean parse with no boolean() helper), and this turn found two new test-only duplications introduced by the PR's own harness: timed_pass adds a third copy of the "this step commits a token" expression (phase_tests.rs:4541-4543 vs :452-454 and :5028-5030), and served_through_worker (:4563-4610) plus the n = 2 block (:4810-4850) re-implement http_generation_request_observed's setup rather than wrapping it. No blockers and nothing should-fix; all findings are read from code, with no GPU, live server, Windows build or test run and no CI checks on the head commit.

#13 [high] Entry status map for the report writer (head 046aaef)

Use entry #11 as the report. Status of the other entries so nothing stale is quoted:

Counts for the report: blocking 0, should fix 0, nits 4. Rules cited: docs/design-review.md:31 (principle 3, shared mechanisms), AGENTS.md:348, charter line 12. Not verified by execution: no GPU, no live server, no cargo test, no Windows build, no CI checks on 046aaef.

#15 [high] Blocking: [server] per_request_metrics is missing from Ignition's config schema, so every Ignition command rejects it

New finding at head 046aaef. Severity: blocking.

What. This PR documents and reads a new [server] per_request_metrics configuration key, but registers it only on the Rust side. The Python reader that Ignition uses never learns the key:

Why it matters. A user who follows this PR's own documentation — docs/cli-design.md:1349 (# per_request_metrics = false in the sample config.toml) or docs/api.md:1007 — and uncomments the key gets a hard failure from every Ignition command, including ignition export, the documented preparation path. The repository states both halves of the rule the PR breaks: docs/cli-design.md:1313 "Ignition and native Flare read this file", and :1385 "Ignition rejects any section or key outside its schema. Native Flare ignores keys it does not use". Every other [server] key is present in all four places (schema, built-in, template, and the Rust Server struct at flare/src/configuration.rs:26-35); this one is in only the last. flare/src/configuration.rs:26-35 has no deny_unknown_fields, so the Rust reader silently tolerates the key while the Python one rejects it — a divergence in a file both are documented to read.

Fix. Add "per_request_metrics": bool to _SECTIONS["server"] (ignition/cli/config.py:23-24), "server.per_request_metrics": False to _BUILT_IN (:39-40), a commented # per_request_metrics = false line to write_initial (:192), and the forwarding line beside options["thinking_token_budget"] in ignition/cli/serve.py:486 if debug-serve is meant to honour it. Add the key to the invalid-file matrix in tests/cli/test_config.py:151-177 (or a positive load test) so the next key cannot repeat the omission.

Lens note. This is a conventions finding: the closest precedent is scheduler_checkpoint_extra_work_fraction, which the same author's own neighbouring commits registered in ignition/cli/config.py (schema :24, built-in :40, validator :119), ignition/cli/serve.py:487, and docs/cli-design.md:1348; thinking_token_budget likewise spans schema :23, built-in :39, validator :138, serve.py:486, and template :192. The new key copies the Rust half of that chain (flare/src/configuration.rs:34, flare/src/settings.rs:224, flare/src/controller.rs:2566, flare-cli/src/config.rs:73-75, flare-cli/src/main.rs:355-357, helios/src/server/config.rs:353-357) and drops the Python half.

Verified from the code above. Would be settled by running ignition export (or tests/cli/test_config.py) with a config file containing [server]\nper_request_metrics = true; no test in tests/cli/ mentions the key.

#16 [high] Report of 2026-11-28, run 3 (head 046aaef): 1 blocker, no should-fix, 4 nits

Review of PR #560 — conventions and duplication lens (head 046aaef)

PR #560 "Emit vLLM-compatible per-request metrics from runtime instants", open, head 046aaef, base main, 22 files, +1757/−77. Supersedes entries #11 and #14 (same head, but a new blocking finding below).

Verdict

Blocking: 1. Should fix: 0. Nits: 4.

Blocking

B1 — [server] per_request_metrics is absent from Ignition's configuration schema, so every Ignition command rejects it. ignition/cli/config.py:21-33 (_SECTIONS["server"] omits the key), :37-53 (_BUILT_IN omits server.per_request_metrics), :112-114 (_validate → unknown key {key} in [{section}]), :183-213 (write_initial emits the other four server keys at :189-192, not this one). That validation runs on every Ignition path: ignition/cli/serve.py:127,174,264,431,590, ignition/cli/publishing.py:31,73,174,194, ignition/cli/bench.py:144.

Why it matters: the PR documents the key in the shared file — docs/api.md:1007 ("[server] per_request_metrics = true in the host configuration"), docs/cli-design.md:1349 (the sample config.toml) — while docs/cli-design.md:1313 says "Ignition and native Flare read this file" and :1385 says "Ignition rejects any section or key outside its schema. Native Flare ignores keys it does not use". A user who uncomments the documented key breaks ignition export, the documented preparation path. Every other [server] key exists in all four places (thinking_token_budget: schema :23, built-in :39, validator :138, template :192; scheduler_checkpoint_extra_work_fraction: :24, :40, :119, and serve.py:487), and the Rust reader flare/src/configuration.rs:26-35 has no deny_unknown_fields, so the two readers now disagree about one file.

Fix: add "per_request_metrics": bool to _SECTIONS["server"], "server.per_request_metrics": False to _BUILT_IN, a commented line in write_initial, and the options["per_request_metrics"] = ... forwarding beside ignition/cli/serve.py:486-487 if debug-serve is meant to honour it; cover it in tests/cli/test_config.py:151-177.

Precedent/lens: the previous head ce44060 deliberately had no config key, mirroring --bypass-performance-check/--verify-weights. Commit f0ccabcc added the key on the Rust chain only (flare/src/configuration.rs:34, flare/src/settings.rs:224, flare/src/controller.rs:2566, flare-cli/src/config.rs:73-75, flare-cli/src/main.rs:355-357, helios/src/server/config.rs:353-357), leaving the Python half of the same setting's precedent out.

Nits (unchanged from entry #11)

  1. helios/src/server/runtime/phase_tests.rs:4541-4543 — third copy of the "step commits a generated token" expression (:452-454, :5028-5030); extract a helper beside completion (:372).
  2. helios/src/server/runtime/phase_tests.rs:4563-4610 — served_through_worker re-implements http_generation_request_observed (:4488-4517) instead of wrapping it, and the n=2 block at :4795-4849 copies it again; the file's precedent is the thin wrapper (http_generation :4358, http_generation_request :4477).
  3. helios/src/server/metrics.rs:211-322 — new Buckets<N>/Histogram<N> migrates only latency.rs (:36,101,121); the host-cache histograms keep the old mechanism (HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS :199-209, host_cost_sums :475, host_lookup_cost :819-841, bespoke render at :1198-1214), so two histogram implementations coexist in one module.
  4. helios/src/server/config.rs:353-357 — re-spells the three-arm boolean match at :183-187 (history_drafts); observation.rs:78-84 (flag) is the third. config.rs has integer() (:56) and optional_text() (:303) but no boolean().

Checked and conventional (no finding)

Not verified by execution

No GPU, exported core, live server, llama-swap, Windows build, cargo test, or pytest run; CI on 046aaef reports no checks. B1 is read from the code and its own docs; pytest tests/cli/test_config.py with a per_request_metrics key would demonstrate it directly, and no test in tests/cli/ mentions the key.

#17 [high] Entry status map for the report writer (head 046aaef, run 3)

Use entry #16 as the report for the current head 046aaef; entry #15 holds the new blocking finding in full detail.

Counts: blocking 1, should fix 0, nits 4. Rules cited: docs/cli-design.md:1313,1385 (one file, two readers; Ignition rejects unknown keys), docs/api.md:1007 and docs/cli-design.md:1349 (the docs that name the key), docs/design-review.md:31 (principle 3), AGENTS.md:346-351, charter line 12.

#18 [high] Research summary

Reviewed PR #560 at head 046aaef through the conventions-and-duplication lens (all 22 changed files read in context, compared against each construct's closest precedent in the repository). The two should-fix findings from the earlier head ce44060 are fixed and are not reported.

Verdict: 1 blocking, 0 should fix, 4 nits.

Blocking: the new documented [server] per_request_metrics key exists only in the Rust reader, not in Ignition's Python configuration schema, so every Ignition command rejects it — ignition/cli/config.py:21-33 _SECTIONS["server"], :37-53 _BUILT_IN, :112-114 _validate ("unknown key … in [server]"), :183-213 write_initial, and Configuration.load runs that validation at ignition/cli/serve.py:127,174,264,431,590, ignition/cli/publishing.py:31 (not opened),73,174,194, ignition/cli/bench.py:144 (not opened). The PR documents the key in the shared file (docs/api.md:1007, docs/cli-design.md:1349) while docs/cli-design.md:1313 says Ignition and native Flare both read it and :1385 says Ignition rejects unknown keys; the neighbouring thinking_token_budget and scheduler_checkpoint_extra_work_fraction are present in all four places, and this one copies only the Rust half of the chain. A user who uncomments the documented key breaks ignition export.

Nits: (1) helios/src/server/runtime/phase_tests.rs:4541-4543 is a third copy of the "step commits a generated token" expression (:452-454, :5028-5030); (2) phase_tests.rs:4563-4610 (served_through_worker) and the n=2 block at :4795-4849 re-implement http_generation_request_observed (:4488-4517) instead of wrapping it as http_generation (:4358) does; (3) helios/src/server/metrics.rs:211-322 adds Buckets<N>/Histogram<N> but migrates only latency.rs, leaving the three host-cache histograms on the old mechanism (:199-209, :475, :819-841, render :1198-1214); (4) helios/src/server/config.rs:353-357 re-spells the three-arm boolean parse at :183-187, with observation.rs:78-84 a third instance and no boolean() helper beside integer() (:56).

Everything else checked out against precedent: the Rust-side per_request_metrics plumbing follows thinking_token_budget one-for-one, the CLI flag reaches rank zero like --api-key-file, first_scheduled_ns extends the existing timing tuple, Finished/Committed follow existing variant style with one source of values, and the docs replace stale claims rather than narrating history. No GPU, live server, llama-swap, cargo test or pytest run was possible; CI on the head commit reports no checks, so every finding is read from the code. Scratchpad entries #15 (blocking finding), #16 (the report) and #17 (entry status map) hold the detail.

#19 [high] Confirmation: no per_request_metrics anywhere under ignition/

Final verification for B1 (entry #15) at head 046aaef:

This is the decisive evidence for the blocking severity: the key the PR's own docs tell users to write (docs/api.md:1007, docs/cli-design.md:1349) is rejected by every command that loads the shared configuration file, including ignition export (ignition/cli/serve.py:127).

Report-ready conclusion unchanged: 1 blocking, 0 should fix, 4 nits, per entry #16.

#2 [medium] Should fix: Timing.streaming duplicates Encoder.streaming

helios/src/server/protocol/encode.rs: Encoder already carries streaming: bool (declared line 97, set only by set_logprobs line 192 from the same decoded.stream). The new per-request-metrics state adds Timing.streaming (line 80), set from the separate argument of enable_request_metrics(streaming) (lines 244-252), and then read by record_commit (line 257) and metrics_value's doc/behaviour (lines 268-294).

Two booleans in one struct answer "is this a stream". In http.rs both are fed decoded.stream (line 352 encoder.set_logprobs(..., decoded.stream) and line 363 encoder.enable_request_metrics(decoded.stream)), so today they agree, but nothing enforces it: set_logprobs is public and called by tests directly (helios/src/server/protocol/tests.rs), so a future caller can set one without the other and record_commit will silently drop or keep commit instants against the wrong mode.

Fix: drop Timing.streaming and read self.streaming in record_commit/metrics_value, taking only include_usage/protocol/choices into enable_request_metrics (or have that function take no streaming argument at all).

#3 [medium] Nit: new Histogram/Buckets leaves the host-cache histograms on the old bespoke code

Two histogram implementations now coexist in helios/src/server/metrics.rs at head ce44060.

Pre-existing (still present, lines 199-209, 475-477, 819-841, 1178-1214): HOST_TIME_BUCKETS/HOST_TOKEN_BUCKETS ([u64; 8]), the host_missing_tokens/host_transfer_ns/host_prefill_ns arrays, host_cost_sums: [AtomicU64; 3], Metrics::host_lookup_cost doing .position(|limit| value <= *limit).unwrap(), and a bespoke 37-line render loop emitting _bucket/_count/_sum.

New in this PR (lines 211-322): Buckets<const N> + Histogram<const N> with observe, absorb, render. latency.rs was converted to use it (FirstResponseSamples field at latency.rs:36, observe at :121, render_histogram at :101).

So the PR adds the general mechanism and migrates one of the three existing hand-rolled histograms, leaving the host-cache trio on the old one. The earlier autobot review of the stacked PR #548 made exactly this point as a subtractive suggestion ("Convert the three host-cache histograms to Histogram<8>/Buckets<8> ... ~40 lines"). Not filed as a blocker: the host histograms' exposed unit is nanoseconds/tokens, not the scale grid Buckets assumes, so the conversion is scale: 1.0 plus u64 bounds for the time histograms — worth doing in this PR only if the maintainer wants one mechanism; otherwise the duplication is real and should be noted.

Cite: metrics.rs:199-209 vs :211-322; metrics.rs:819-841 vs :271-321; latency.rs:34-37.

#9 [medium] Nit: timed_pass copies the step-generates predicate now in three places

At head 046aaef the expression deciding whether a step commits a generated token appears three times in helios/src/server/runtime/phase_tests.rs:

let generates = matches!(step.kind, GraphKind::Decode | GraphKind::Resume)
    || (step.kind == GraphKind::Prefill
        && lane.start_position + lane.tokens as u64 == live.prompt_tokens as u64);

This PR copies the pre-existing shape into a second harness function instead of extracting the predicate. The real semantics live in the scheduler (helios/src/model/tests.rs:1705 let emits = plan.kind.is_prefill() || plan.kind == GraphKind::Resume;, helios/src/scheduler/lifecycle_tests.rs:49), so a test-side helper fn commits(step: &ScheduledStep, lane: &ScheduledLane, live: &LiveRequest) -> bool (or reuse of the existing completion() in the same file, which already derives generated_tokens from sampled.is_some()) would keep the three harness loops consistent when the sampling graph set changes. Severity: nit (test-only duplication, but it is the third copy and the new copy is this PR's).

Fix: extract one helper beside completion (phase_tests.rs:372) and call it from budget_pass, timed_pass and the cancellation test.

#10 [medium] Nit: served_through_worker duplicates http_generation_request_observed setup

helios/src/server/runtime/phase_tests.rs:4563-4610 (served_through_worker, new) repeats the HTTP-drive scaffolding of http_generation_request_observed (:4488-4517, pre-existing):

both create mpsc::sync_channel, http_state_for(...), acquire state.ingress_slots.clone().acquire_owned(), build axum::http::Request with content-type: application/json, tokio::spawn(http::generate(State(state), Extension(ingress), request)), then tokio::task::spawn_blocking(move || receiver.recv_timeout(5s)).

Differences are only the return values (an Arc<HttpState> plus the group and the raw response future, versus the axum Response handle) and the per_request_metrics mutation via Arc::get_mut. http_generation (:4358) and http_generation_request (:4477) are already thin wrappers over the same path, which is the precedent for extending it rather than writing a second driver.

Same duplication in the n = 2 case in per_request_metrics_are_absent_without_the_option_and_null_for_several_choices (:4810-4850), which re-spells the whole 40-line setup inline rather than calling either helper.

Fix (nit): have served_through_worker call http_generation_request_observed for the state/ingress/request/group part and add the two differences (metrics flag, raw response future) as parameters, or return the response future from one shared helper. Test-only; no production behaviour involved.

#4 [low] Nit: per_request_metrics parse duplicates the history_drafts boolean arm

helios/src/server/config.rs:353-357 parses the new key as

per_request_metrics: match object.get("per_request_metrics") {
    None => false,
    Some(Value::Bool(value)) => *value,
    Some(_) => return Err("server configuration per_request_metrics must be a boolean".into()),
},

The nearest precedent for a boolean server key is history_drafts a few hundred lines above, config.rs:183-187:

history_drafts: match object.get("history_drafts") {
    None => false,
    Some(Value::Bool(value)) => *value,
    _ => return Err("history_drafts must be a boolean".into()),
},

and observation.rs:78-84 flag() is the third instance of the same three-arm match (there it also accepts null, because those are request fields). The new arm is a copy with an error string in the "server configuration must be …" form used by optional_text (config.rs:303-307) and the integer helper — i.e. the error style matches the file, but the parse shape is duplicated rather than shared. Also note config.rs has an integer(name, default) helper but no boolean(name, default) helper; two boolean keys now exist and the third will copy again.

Suggestion (nit, not blocking): add fn boolean(name, default) beside integer and use it for both history_drafts and per_request_metrics. Severity: nit.