Recommendation: Changes Requested
This +21/−4 change to scripts/benchmark_scheduler.py is well-scoped, safe, and leaves the default continuous benchmark path behavior-identical with zero runtime or dependency impact. However, two concrete issues should be fixed before merge: (1) omitting --requests-per-lane with --idle-seconds writes "requests_per_lane": null into the JSONL configuration header while silently running 1 via an implicit or 1 default—and the unexercised --requests-per-lane > 1 path runs requests sequentially per lane while flattening all rounds into ttft_median_seconds/burst_gap_*, diluting the post-idle first-request latency it aims to measure; and (2) the new CLI validation and burst path have no automated test coverage in tests/ (which is all .github/workflows/python-cpu.yml (not opened) runs), leaving the locally described stub-server smoke check unverifiable in CI. Both are small fixes, and the cleanest resolution for (1) is simply deleting --requests-per-lane so each burst issues one request per lane.
Merge Risk
Level: Low
- Client-side benchmark script only (
scripts/benchmark_scheduler.py, +21/−4); zero changes to Helios Rust runtime, scheduler, caches, CUDA graphs, wire formats, or dependencies (mathwas already imported at:11). - Default continuous mode (
--idle-secondsomitted) is unchanged (scripts/benchmark_scheduler.py:220-221), and nothing intests/,docs/, or.github/workflows/imports or invokes this script. - Failure blast radius is confined to manual operator runs of
scripts/benchmark_scheduler.pywith--idle-seconds; invalid CLI values fail loudly viaparser.error(...)(:198-201).
Walkthrough
scripts/benchmark_scheduler.py:140-158: Adds keyword-onlyrequests_per_lane=Nonetotrial(); switches worker loop termination from deadline-bounded (time.perf_counter() < deadline[0]) to request-count-bounded (len(results) < requests_per_lane) when set, and guardsdeadline[0] = start + (duration or 0).scripts/benchmark_scheduler.py:187-190, 198-201: Adds opt-in--idle-secondsand--requests-per-laneCLI flags withparser.error(...)validation requiring finite positive--idle-secondsand requiring--requests-per-lane >= 1only when--idle-secondsis set.scripts/benchmark_scheduler.py:220-228: Keeps the existing continuoustrial(..., args.seconds)path as the default; when--idle-secondsis set, sleepsargs.idle_secondsbefore each measured burst, callstrial(..., None, requests_per_lane=args.requests_per_lane or 1), and recordsidle_seconds_before_burst(min(row['started']) - pause_started) on the trial row.
Pre-merge Checks
- [PASS] Security / malicious screen: Pure stdlib Python CLI change in
scripts/benchmark_scheduler.py; no new dependencies, network targets, shell execution, or untrusted input sinks. - [PASS] Charter & value fit: Small opt-in instrumentation tool aligned with the open live-Helios idle/resume qualification item in
docs/TODO.txt:110-114(following #540), though removing the unexercised--requests-per-laneswitch and implicitordefaults improves compliance with the charter's "Be explicit / No magic defaults" andAGENTS.md:188-193. - [PASS] Related / duplicate / conflict check: No other open or recent PR touches
scripts/benchmark_scheduler.py; complements #540's simulator scenarios without duplication or conflict. - [WARN] Tests & verification evidence: No automated test covers the new flags/burst mode under
.github/workflows/python-cpu.yml(not opened) (pytest tests/ -q), the local SSE stub run in Evidence is unattached, liveflare runserving was not run (honestly disclosed), and commita0467e2DCOSigned-off-by(CONTRIBUTING.md:9-20) could not be inspected from review metadata—verify before merge.
Blockers
None.
Should Fix
-
Fix recorded JSONL
configurationprovenance mismatch and implicitordefaults (best fixed by removing--requests-per-lane) —scripts/benchmark_scheduler.py:147-151, 156, 189-190, 214, 225-226- Verified behavior & impact:
--requests-per-laneadvertises(default: 1)in help text (:190) but leaves argparse's default asNone, then relies onrequests_per_lane=args.requests_per_lane or 1(:226) alongsideduration or 0(:156). Because:214serializes{**vars(args), ...}into the JSONL header before the trial loop, an idle run that omits--requests-per-lanerecords"requests_per_lane": nullin its measurement artifact while actually executing 1 request per lane (and logs"seconds": 120even though--secondsis unused in burst mode and each trial row records"issue_duration_seconds": nullat:164). In addition, when--requests-per-lane > 1, each worker lane issues requests synchronously in awhileloop (:147-151) andtrial()flattens all rounds intottft_median_seconds/ttft_p99_seconds/burst_gap_*(:158-171) with no round/ordinal marker—so rounds 2..N are non-idle back-to-back requests that dilute the post-idle first-request latency summary, and the> 1path was never exercised in Evidence. - Fix: Prefer deleting
--requests-per-lane(see## Subtract / Simplifybelow) so each idle burst always issues one request per lane with zero implicit defaults. If--requests-per-laneis intentionally kept, resolve its effective integer value before loggingconfigurationat:214, replaceduration or 0at:156withif duration is not None: deadline[0] = start + duration, emitrequests_per_laneon burst trial rows, and document in the flag help that values> 1issue sequential follow-up requests per lane whose timings are aggregated into the trial summary.
- Verified behavior & impact:
-
Add a CPU unit test exercising CLI validation and idle/continuous modes against a local SSE server —
scripts/benchmark_scheduler.py:140-158, 198-201, 220-228- Verified behavior & impact:
.github/workflows/python-cpu.yml:33(not opened) runs.venv/bin/python -m pytest tests/ -q, and nothing intests/importsscripts/benchmark_scheduler.py. The PR's Evidence section relies on a manual, unattached local SSE stub run, so neither the newparser.error(...)guards nor the burst-mode JSONL output andidle_seconds_before_burstcalculation are verified by CI or protected against regression. - Fix: Add a focused test module (e.g.,
tests/test_benchmark_scheduler.py(not opened), loading the script viaimportlib.util.spec_from_file_locationas intests/preparation/test_setup_preparation.py:15-18) with a small localhttp.serverSSE handler covering: (a) rejection of non-finite /<= 0--idle-seconds(and--requests-per-lanemisuse if retained), (b) idle-mode burst execution emittingidle_seconds_before_burst >= idle_seconds, exact per-lane request count, and accurateconfigurationmetadata, and (c) continuous-mode control output remaining deadline-bounded.
- Verified behavior & impact:
Subtract / Simplify
- Delete
--requests-per-laneand collapsetrial()to a single explicitduration is Noneburst branch —scripts/benchmark_scheduler.py:140-158, 189-190, 200-201, 225-226- Deleting
--requests-per-laneremoves an unexercised CLI switch (AGENTS.md:188-193), eliminates the sequential-round TTFT dilution footgun, fixes the"requests_per_lane": nullconfiguration provenance mismatch, and removes both implicitordefaults (duration or 0andargs.requests_per_lane or 1). Operators already control the number of post-idle samples via--trials. - Clean, bug-free replacement in
trial(url, bodies, duration):
and calldef trial(url, bodies, duration): ... def worker(lane, body): results = [] barrier.wait() while (not results if duration is None else time.perf_counter() < deadline[0]): row = request(url, body, stream=True) row['lane'] = lane results.append(row) return results with concurrent.futures.ThreadPoolExecutor(max_workers=len(bodies)) as pool: jobs = [pool.submit(worker, lane, body) for lane, body in enumerate(bodies)] start = time.perf_counter() if duration is not None: deadline[0] = start + duration barrier.wait() rows = [row for job in jobs for row in job.result()]trial(args.base_url, bodies[:concurrency], None)in the idle branch (:225). Continuous mode (duration=args.seconds) remains byte-for-byte identical in behavior, while burst mode (duration=None) runs exactly one request per lane without touchingdeadline.
- Deleting
Nits
- Note in
--idle-secondshelp text (or the PR description) that exercising Helios's stale-cost timing-refresh wakeup requires an idle pause longer thanestimate_ttl_ns(30 s,helios/src/scheduler/policy.rs:38), and referencedocs/TODO.txt:110-114in the PR's Why section so reviewers can trace the live-qualification context directly. - Confirm commit
a0467e2carries aSigned-off-bytrailer perCONTRIBUTING.md:9-20.
Dropped on verification
- Correctness Finding 1.1 (
idle_seconds_before_burstmislabeled as latency / includes DNS+connect / proposedfirst_token_after_idle_secondsfix): Dropped. The PR description accurately states the field records "the observed interval from the start of the pause to the first request, alongside the existing streaming metrics"—it never claimsidle_seconds_before_burstis first-token latency. In addition,connection(url)(scripts/benchmark_scheduler.py:19-22) constructs a lazyhttp.client.HTTPConnectionwithout connecting (TCP connect happens insideclient.request()at:29, afterstart = time.perf_counter()at:27), and the upstream proposed fixmin(row['groups'][0]['seconds'] for row in rows) - pause_startedis mathematically broken becausegroup['seconds'](:40, :56) is already relative tostart, not an absoluteperf_counter()timestamp. - Correctness Finding 2.1 ("by construction the burst cannot reach the funded-refresh episode / homogeneous run only executes one
cost::Key"): Dropped.--idle-secondsaccepts any positive float (operators can pass> 30s to exceedestimate_ttl_ns = 30_000_000_000athelios/src/scheduler/policy.rs:38; the 100 ms figure was only the author's local mock smoke test). The claim that a run only ever executes onecost::Keyis false for a real Helios server: default--concurrency 1,2,4,8,16,32(:181), multi-phase request lifecycles (prefill, mixed, full-batch and tail decode/speculative widths), and initialPlanOrigin::Discoverypopulate multiplecost::Keyentries, and #540 also retainsacceptance_learningcredit across idle (helios/src/scheduler/refresh.rs:11, 76,helios/src/scheduler/policy.rs:1275), which does not depend onstale_keys(). - Correctness Finding 2.2 ("pause window contaminated by two blocking
/metricsscrapes before sleep / must poll/metricsfor server quiescence"): Dropped. The upstream scrape ordering was misread:metrics_afterof trial k-1 (:174) runs beforepause_started(:223), whilemetrics_beforeof trial k (:141) runs aftertime.sleep(args.idle_seconds)(:224)—which is actually the right place so the burst'smetrics_after - metrics_beforedelta excludes post-previous-trial drain. Requiring Prometheus scraping/polling in the driver would add coupling contrary to the script's raw-capture design (AGENTS.md:512). - Correctness Finding 2.3 ("probe-episode counters fetched and never parsed"): Dropped.
scripts/benchmark_scheduler.py:174, 233already persists the full rawmetrics_beforeandmetrics_afterPrometheus blobs (which includeflare_scheduler_executions_total/flare_scheduler_execution_nanoseconds_totalfromhelios/src/server/metrics.rs:931-939) on every JSONL row for offline analysis; adding in-driver Prometheus parsing is unnecessary scope creep. - Correctness Finding 1.2 (part claiming
tokens_per_secondpreviously divided by--seconds): Dropped as overstated. Even in continuous mode,tokens_per_seconddivides byelapsed(time.perf_counter() - startat:159, including drain tail), not--seconds; in burst modetokens / elapsedremains well-defined burst throughput (generated_tokens / elapsed_seconds). The real schema asymmetry (issue_duration_seconds: null+requests_per_lane: nullinconfiguration) is captured in Should Fix #1. - Subtraction Suggestion 1's proposed code snippet (
while len(results) < requests_per_lane and time.perf_counter() < deadline[0]withduration=0.0): Dropped and replaced. Passingduration=0.0setsdeadline[0] = start, which is already expired by the time worker threads exitbarrier.wait(), causing 0 requests to run and crashingstatistics.median(ttfts)withStatisticsError. A correct bug-free replacement is provided under## Subtract / Simplify. - Subtraction Suggestion 2 ("drop
idle_seconds_before_burstor replacemin(row['started'])withtime.perf_counter()aftertrial()"): Dropped. Recording the actual observed pre-burst pause (min(row['started']) - pause_started) is a reasonable, cheap 2-line per-trial sanity measurement (and the upstream alternativetime.perf_counter() - pause_startedaftertrial()returns would have erroneously included the entire burst duration!). - Value Proposition requirement to attach a live GPU
flare runmeasurement and add a row todocs/core-design.md(not opened): Dropped as disproportionate scope creep for a +21/−4 CLI utility PR that makes no performance claim and honestly discloses live GPU serving was not run; a CPU unit test against a local SSE server is the right verification bar here.