Final review report · NVIDIA/hyperflare-inference #634

Raw Markdown for agents: https://autobot.eidonix.com/p/0641ed97-47af-4bc1-9764-bdef1d3ec162.md

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

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Fix recorded JSONL configuration provenance mismatch and implicit or defaults (best fixed by removing --requests-per-lane) — scripts/benchmark_scheduler.py:147-151, 156, 189-190, 214, 225-226

    • Verified behavior & impact: --requests-per-lane advertises (default: 1) in help text (:190) but leaves argparse's default as None, then relies on requests_per_lane=args.requests_per_lane or 1 (:226) alongside duration or 0 (:156). Because :214 serializes {**vars(args), ...} into the JSONL header before the trial loop, an idle run that omits --requests-per-lane records "requests_per_lane": null in its measurement artifact while actually executing 1 request per lane (and logs "seconds": 120 even though --seconds is unused in burst mode and each trial row records "issue_duration_seconds": null at :164). In addition, when --requests-per-lane > 1, each worker lane issues requests synchronously in a while loop (:147-151) and trial() flattens all rounds into ttft_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 > 1 path was never exercised in Evidence.
    • Fix: Prefer deleting --requests-per-lane (see ## Subtract / Simplify below) so each idle burst always issues one request per lane with zero implicit defaults. If --requests-per-lane is intentionally kept, resolve its effective integer value before logging configuration at :214, replace duration or 0 at :156 with if duration is not None: deadline[0] = start + duration, emit requests_per_lane on burst trial rows, and document in the flag help that values > 1 issue sequential follow-up requests per lane whose timings are aggregated into the trial summary.
  2. 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 in tests/ imports scripts/benchmark_scheduler.py. The PR's Evidence section relies on a manual, unattached local SSE stub run, so neither the new parser.error(...) guards nor the burst-mode JSONL output and idle_seconds_before_burst calculation 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 via importlib.util.spec_from_file_location as in tests/preparation/test_setup_preparation.py:15-18) with a small local http.server SSE handler covering: (a) rejection of non-finite / <= 0 --idle-seconds (and --requests-per-lane misuse if retained), (b) idle-mode burst execution emitting idle_seconds_before_burst >= idle_seconds, exact per-lane request count, and accurate configuration metadata, and (c) continuous-mode control output remaining deadline-bounded.

Subtract / Simplify

  1. Delete --requests-per-lane and collapse trial() to a single explicit duration is None burst branch — scripts/benchmark_scheduler.py:140-158, 189-190, 200-201, 225-226
    • Deleting --requests-per-lane removes an unexercised CLI switch (AGENTS.md:188-193), eliminates the sequential-round TTFT dilution footgun, fixes the "requests_per_lane": null configuration provenance mismatch, and removes both implicit or defaults (duration or 0 and args.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):
      def 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()]
      
      and call 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 touching deadline.

Nits

Dropped on verification