Skip to content

ci(bench): compare fresh PR benchmark baselines#999

Merged
jdx merged 2 commits into
mainfrom
codex/bench-pr-fair-baseline
Jul 6, 2026
Merged

ci(bench): compare fresh PR benchmark baselines#999
jdx merged 2 commits into
mainfrom
codex/bench-pr-fair-baseline

Conversation

@jdx

@jdx jdx commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • benchmark the PR base SHA freshly before benchmarking the head SHA
  • restore the hermetic benchmark registry cache in pr-bench
  • enable aube phase timings for the head run and make the benchmark comment footer explicit that base/head were freshly measured

Why

The previous PR benchmark compared a fresh 3-run head measurement against the committed benchmarks/results.json baseline. Warm install timings are filesystem-heavy and noisy on the CI runner, so stale cross-run baselines could look like large regressions even when a same-run A/B does not reproduce them.

Validation

  • actionlint .github/workflows/bench-pr.yml

Note

Low Risk
CI-only workflow changes; longer runs and more reliable A/B comparison with no production code impact.

Overview
PR bench workflow now measures base and head on the same runner instead of comparing head against committed benchmarks/results.json, cutting down false regressions from noisy warm-install timings.

When a base SHA exists, the workflow checks out that commit, builds release, and runs the full hermetic bench (gvs-warm, gvs-cold) into /tmp/aube-bench-base.json with phase timings off (BENCH_PHASES=0). It restores ~/.cache/aube-bench/registry via actions/cache, bumps the job timeout to 45 minutes, and turns phase timings on for the head run only (BENCH_PHASES=1). The PR comment footer now states that base/head were freshly benchmarked and that 2 scenarios are used.

Reviewed by Cursor Bugbot for commit 5d27e19. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Chores
    • Increased the PR benchmark run timeout to reduce timeouts on longer jobs.
    • Updated benchmark handling so the baseline and PR head are measured more reliably when a base commit is available.
    • Refreshed the PR benchmark comment to better reflect the latest run details and scenario count.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The bench-pr.yml GitHub Actions workflow was modified to increase the job timeout, rework baseline benchmarking to freshly measure the PR base commit (via cache restore, checkout, build, and hyperfine) when BASE_SHA is available, adjust head benchmark phase configuration, and update the resulting PR comment text.

Changes

Bench Workflow Update

Layer / File(s) Summary
Job timeout increase
.github/workflows/bench-pr.yml
Job timeout-minutes increased from 25 to 45 to accommodate longer benchmark runs.
Fresh base benchmarking logic
.github/workflows/bench-pr.yml
Baseline step now restores a registry cache and freshly benchmarks the PR base commit (checkout, build, hyperfine with BENCH_PHASES=0, RUNS=3, WARMUP=1) when BASE_SHA exists, else falls back to committed results.json; head benchmark BENCH_PHASES changed from 0 to 1.
PR comment footer update
.github/workflows/bench-pr.yml
Comment footer updated to state base/head were freshly benchmarked and to report 2 scenarios instead of 3.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
    participant Workflow as Bench Workflow
    participant Cache as Registry Cache
    participant Base as PR Base Commit
    participant Head as PR Head Commit
    participant Comment as PR Comment

    Workflow->>Cache: Restore hermetic registry cache
    alt BASE_SHA available
        Workflow->>Base: Checkout, build, run hyperfine (BENCH_PHASES=0)
    else BASE_SHA absent
        Workflow->>Workflow: Copy committed results.json
    end
    Workflow->>Head: Run hyperfine (BENCH_PHASES=1)
    Workflow->>Comment: Post footer noting fresh benchmarks and 2 scenarios
Loading

Poem

A rabbit hopped through YAML fields so wide,
Freshly built the base, no cache to hide 🐇
Forty-five minutes now to run and race,
Two scenarios shown, a tidier place,
Thump-thump goes the benchmark, steady pace!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the workflow change to compare PR benchmarks against a freshly collected baseline.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the PR bench workflow so that the base SHA is benchmarked fresh on the same runner rather than diffed against the committed benchmarks/results.json, eliminating false regressions caused by stale cross-run baselines on syscall-heavy warm installs.

  • Fresh base measurement: The new "Benchmark PR base" step checks out BASE_SHA, builds, and runs the full hermetic bench into /tmp/aube-bench-base.json, then exit 0; the cp results.json fallback is reached only for workflow_dispatch where no PR base SHA exists — this is the correct gate (compared to the old git show condition which silently fell back to stale data when results.json didn't exist in the base commit).
  • Registry cache + timeout: A actions/cache step restores ~/.cache/aube-bench/registry before both runs, and the timeout grows from 25 → 45 minutes to accommodate the doubled benchmark work.
  • Head-only phase timings: BENCH_PHASES is set to 1 for the head run and 0 for the base run; the PR comment footer is updated to reflect 2 scenarios and "freshly benchmarked base/head".

Confidence Score: 5/5

CI-only workflow change; no application runtime impact. The base/head checkout sequencing and fallback paths are correct.

The fix is narrowly scoped: the old git show gate is replaced by the correct [ -n "$BASE_SHA" ] gate with an exit 0 early return, the head step already re-checks out HEAD_SHA so working-directory state is always clean, and the workflow_dispatch fallback path is unchanged. No logic gaps remain.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/bench-pr.yml Replaces stale committed-baseline comparison with a same-runner fresh base/head measurement; adds registry cache restore, bumps timeout to 45 min, and enables phase timings on head only. Logic is correct.

Reviews (2): Last reviewed commit: "ci(bench): always measure PR base benchm..." | Re-trigger Greptile

Comment thread .github/workflows/bench-pr.yml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/bench-pr.yml (1)

52-68: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant existence check writes and discards content.

git show "$BASE_SHA:benchmarks/results.json" > /tmp/aube-bench-base.json is used solely to validate the file exists at BASE_SHA; the captured content is immediately overwritten by the hyperfine RESULTS_JSON output on success. Using git cat-file -e "$BASE_SHA:benchmarks/results.json" (no output redirection needed) would make the intent clearer without the throwaway write.

♻️ Proposed simplification
-          if [ -n "$BASE_SHA" ] && git show "$BASE_SHA:benchmarks/results.json" > /tmp/aube-bench-base.json 2>/dev/null; then
+          if [ -n "$BASE_SHA" ] && git cat-file -e "$BASE_SHA:benchmarks/results.json" 2>/dev/null; then
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/bench-pr.yml around lines 52 - 68, The BASE_SHA existence
check in the bench workflow is doing a throwaway write by using git show solely
to confirm benchmarks/results.json exists, then overwriting that file later in
the same job. Update the conditional in the bench-pr workflow to use a
non-output existence check such as git cat-file -e for benchmarks/results.json,
keeping the surrounding BASE_SHA, RESULTS_JSON, and benchmark execution flow
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/bench-pr.yml:
- Around line 52-68: The BASE_SHA existence check in the bench workflow is doing
a throwaway write by using git show solely to confirm benchmarks/results.json
exists, then overwriting that file later in the same job. Update the conditional
in the bench-pr workflow to use a non-output existence check such as git
cat-file -e for benchmarks/results.json, keeping the surrounding BASE_SHA,
RESULTS_JSON, and benchmark execution flow unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: eab29539-eaa2-4b8c-a728-faf50fd286be

📥 Commits

Reviewing files that changed from the base of the PR and between df1c5ff and e932313.

📒 Files selected for processing (1)
  • .github/workflows/bench-pr.yml

@jdx jdx enabled auto-merge (squash) July 6, 2026 21:33
@jdx jdx disabled auto-merge July 6, 2026 21:33
@jdx jdx enabled auto-merge (squash) July 6, 2026 21:33
@jdx jdx disabled auto-merge July 6, 2026 21:33
@jdx jdx merged commit 10b6ae8 into main Jul 6, 2026
19 checks passed
@jdx jdx deleted the codex/bench-pr-fair-baseline branch July 6, 2026 21:41
@cursor cursor Bot mentioned this pull request Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant