You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This updates the Duel setup to Duel 0.1.8, which is now on RubyGems, so the duel gemfile and Gemfile.lock ask for it, as the nightly run's new baseline needs.
A pull request from a fork never got a comment, because its token can't write one. Now the comment comes from a second workflow, Perf comment, which runs once Perf has finished, with a token that can write. It checks out none of the pull request's code. It installs Duel from RubyGems and runs duel comment, which trusts only what the Duel job could have said, and posts the report as Markdown, a fork's too. Since the comment comes from a Duel release rather than a shell script in the workflow, a fix to how it comments arrives with a new version of Duel. Once it posts a comment, it hides Duel's earlier ones on the pull request as outdated, so the newest is the one in view. It has to be on main before it runs at all, so this pull request won't get a comment from it. The Perf workflow also runs in a merge queue now, and a new push to a pull request cancels the run for the old one.
A push to main is now compared with the last commit Duel passed, instead of the commit right before it, so slowdowns too small to fail any one push still add up until one fails. The workflow marks that commit with a duel/passed/main branch, and moves it forward after each push that passes. It never moves it back, and it runs one at a time, so two pushes that finish together can't leave it on the older one or both try to create it.
When a pull request is slower on purpose, adding the duel: accept label lets it through, and adding or removing the label runs Duel again on its own. A run the label let through says so in its heading, and the nightly run then compares with the last change merged with that label since the last release, so an accepted slowdown doesn't fail every night until the next release. The label doesn't exist here yet, and I can't create it without write access, so it needs adding (duel: accept, any color).
Runs will take longer, since Duel now starts more worker processes and warms each benchmark up until it's steady, so the results are steadier. Where that many workers wouldn't fit in the runner's memory, it measures fewer benchmarks at once instead of running the runner out.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A critical issue remains in .github/workflows/perf.yml: concurrent forced ref updates can move duel/passed/ backward and lose accepted performance history.
Updates the Duel integration to version 0.1.2 and enhances performance workflows for merge queues, cumulative push baselines, accepted regressions, and fork-safe pull-request comments.
Changes:
Requires Duel 0.1.2 and updates the locked dependency.
Adds merge-queue support, commit reporting, label handling, and passed-baseline tracking.
Adds a trusted workflow for commenting on pull requests after performance runs.
File
Summary
gemfiles/modular/duel.gemfile
Raises the minimum Duel dependency to 0.1.2.
Gemfile.lock
Locks Duel at version 0.1.2 with its updated checksum.
.github/workflows/perf.yml
Adds merge-queue support, label handling, commit comments, and passed-baseline branch updates. The concurrent forced ref updates present a critical race, and the read-then-post logic can produce duplicate comments.
.github/workflows/perf-comment.yml
Adds a privileged workflow for commenting on pull requests after Perf completes.
.duel.rb
Enables accepted-regression labels and last-passed push baselines. The commented c.fail_on setting prevents the push comment path from working as intended.
Duel 0.1.2 asks a project to regenerate its workflows with `duel init`.
The Perf workflow loses its Comment job to a new Perf comment workflow,
which runs once Perf has, with a token that can write, so a pull request
from a fork gets a comment too. The regenerated Perf workflow also runs
for a merge queue, cancels a pull request's stale runs, and no longer
checks for a missing commit before a push, which Duel now does itself.
The action version pins are carried over from the old workflow.
.duel.rb takes up the new settings. A push to main is compared with
the last commit Duel passed (duel/passed/main), so small slowdowns add
up until one fails, and a pull request with the "duel: accept" label
passes with a regression. A regression still fails every run, since
main takes changes only through pull requests.
The Mark the commit passed job moved the branch with force=true, so
when two pushes ran at once and the older one finished last, the
branch went back to the older push, and the next push was compared
with it. Now the job moves it only where it's behind the push (or
history was rewritten), as Duel 0.1.3 and later write it.
A fork's report is now shown in the pull request's comment as text, in
a code block fenced with more backticks than any run of them in it, so
the fork's code can't make it mention anyone, link anywhere or show an
image. The report loses any NUL bytes first, which would otherwise hide
its backticks from grep.
The Comment on the commit job is gone, as Duel 0.1.5 writes it only
where .duel.rb sets c.fail_on = :pull_requests, which this project
doesn't, and it asked for contents: write.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
An active race in the performance workflow can cause a valid passing push run to fail when concurrent runs initialize the same ref, so the existing-ref case must be handled or serialized.
Before duel/passed/main exists, two pushes that pass at once could both
find no branch and try to make it, and the second failed. The job now
runs one at a time for each branch, and where making the branch fails,
it looks for it again before it says another branch blocks it, as Duel
writes it from its next release.
Before the branch that marks the last commit Duel passed existed, two
pushes that passed at once could both find no branch and try to make
it. The second failed, and said another branch kept it from being
made, though none did. Copilot found this in a review of
ruby-oauth/oauth2#789.
The Mark the commit passed job now runs one at a time for each branch
(a concurrency group, as the badge's job has), and where making the
branch fails, it looks for it again, and moves it forward from there,
before it blames another branch. GitLab's job, which deletes the branch
and makes it again, runs one at a time too (a resource group).
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Two moderate issues remain in the workflow’s report-truncation logic: large reports can fail under pipefail, and long backtick runs can still produce comments exceeding GitHub’s size limit.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Large reports trigger SIGPIPE before truncation completes
.github/workflows/perf-comment.yml:65
When the fork-generated report is larger than 60,000 bytes, this pipeline is run under GitHub Actions' bash -e -o pipefail: head exits after the limit and tr receives SIGPIPE, so the pipeline returns 141 and the step stops before the report can be posted. This contradicts the intended truncation behavior; write the NUL-stripped stream to a temporary file and truncate that file in a separate command.
Backtick fence can push the comment over GitHub’s size limit
.github/workflows/perf-comment.yml:66
The 60,000-byte truncation does not bound the final comment size: a fork can put a long run of backticks in the first 60,000 bytes, and this computes a fence one character longer than that run, then emits both the fence and the full text. For example, 30,000 backticks produces a comment over GitHub's 65,536-character limit, so the API call fails instead of posting the sanitized report. Reserve space for the fence/prefix (or cap the fence and escape/encode the report) before constructing the comment.
Adding the duel: accept label to a pull request, or taking it off, runs
the Duel job again, so it no longer needs running again by hand. On a
schedule, the job compares with the last change merged with the label
since the last release, instead of the release itself, so a slowdown
accepted in its pull request doesn't fail every nightly run until the
next release. The step that finds the pull request's labels runs first
now, as the step that finds the baseline's Ruby needs that change.
sferik
changed the title
Update Duel to 0.1.5
Update Duel to 0.1.6
Nov 9, 2026
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because critical hidden findings affect workflow trust boundaries and can allow stale or fork-controlled data to be associated with the wrong pull request or branch baseline.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The security-sensitive workflow, artifact, token, event, and mutable-ref interactions require hosted end-to-end validation that is unavailable in this review environment.
0.1.7 is out, so the duel gemfile asks for it, and Gemfile.lock locks
it. It fits its workers to the memory a runner has, measuring fewer
benchmarks at once where they wouldn't all fit.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because the privileged workflow may trust an untrusted PR number and post a report to a different PR sharing the same head commit.
0.1.8 is out, so the duel gemfile asks for it, and Gemfile.lock locks
it. The Perf comment workflow now runs duel comment, installed from
RubyGems, instead of a shell script, so a fix to how it comments comes
with a release of Duel. It hides Duel's earlier comments on the pull
request as outdated, so the newest is the one in view, and posts a
fork's report as Markdown, like any other, instead of as text in a
code block. The workflow is as duel init writes it in 0.1.8, with the
actions pinned as before.
.duel.rb no longer says to run the workflow again after adding the
duel: accept label, as adding it, or taking it off, does that since
Duel 0.1.6.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human validation is needed for the security-sensitive workflow_run/pull_request_target automation, especially write-token handling of fork-generated artifacts, event and concurrency behavior, and ref mutations that local review cannot exercise end to end.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates the Duel setup to Duel 0.1.8, which is now on RubyGems, so the duel gemfile and Gemfile.lock ask for it, as the nightly run's new baseline needs.
A pull request from a fork never got a comment, because its token can't write one. Now the comment comes from a second workflow, Perf comment, which runs once Perf has finished, with a token that can write. It checks out none of the pull request's code. It installs Duel from RubyGems and runs
duel comment, which trusts only what the Duel job could have said, and posts the report as Markdown, a fork's too. Since the comment comes from a Duel release rather than a shell script in the workflow, a fix to how it comments arrives with a new version of Duel. Once it posts a comment, it hides Duel's earlier ones on the pull request as outdated, so the newest is the one in view. It has to be onmainbefore it runs at all, so this pull request won't get a comment from it. The Perf workflow also runs in a merge queue now, and a new push to a pull request cancels the run for the old one.A push to
mainis now compared with the last commit Duel passed, instead of the commit right before it, so slowdowns too small to fail any one push still add up until one fails. The workflow marks that commit with aduel/passed/mainbranch, and moves it forward after each push that passes. It never moves it back, and it runs one at a time, so two pushes that finish together can't leave it on the older one or both try to create it.When a pull request is slower on purpose, adding the
duel: acceptlabel lets it through, and adding or removing the label runs Duel again on its own. A run the label let through says so in its heading, and the nightly run then compares with the last change merged with that label since the last release, so an accepted slowdown doesn't fail every night until the next release. The label doesn't exist here yet, and I can't create it without write access, so it needs adding (duel: accept, any color).Runs will take longer, since Duel now starts more worker processes and warms each benchmark up until it's steady, so the results are steadier. Where that many workers wouldn't fit in the runner's memory, it measures fewer benchmarks at once instead of running the runner out.