Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
285 changes: 203 additions & 82 deletions .github/AGY-REVIEWER.md

Large diffs are not rendered by default.

48 changes: 36 additions & 12 deletions .github/workflows/antigravity-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ jobs:
# for a large one handed over as a file. The cap must still exceed the
# script's own worst case -- lock wait + every retry at its maximum timeout +
# backoff -- or the job is killed mid-retry and posts nothing. With the
# settings below that is 300 + 2 x 900 + 15 = 2115 s, under 45 minutes with
# settings below that is 1860 + 2 x 900 + 15 = 3675 s, under 80 minutes with
# room for checkout and the diff fetch; the selftest checks this sum against
# this value.
timeout-minutes: 45
# this value. (Until 2026-11-15: 300 + 2 x 900 + 15 = 2115 s under 45
# minutes; see AGY_LOCK_WAIT for why the wait grew.)
timeout-minutes: 80
steps:
# Check out the DEFAULT BRANCH, never the PR head. This job runs the checked-out
# `scripts/agy-review.sh` on a self-hosted runner with a token in the environment,
Expand All @@ -96,17 +97,30 @@ jobs:
# needs on demand, so a full history clone would be paid on every run for a path
# most runs never take.
fetch-depth: 1
# No checkout should persist credentials: agy executes with the repo as its
# workspace, so a token left in .git/config would be reachable by anything the
# review runs. The large-diff fallback still performs an authenticated fetch, but
# No checkout should persist credentials: a token left in .git/config would be
# readable by anything that can read the checkout. (agy itself now runs from a
# private sandbox outside it, with no job credentials in its environment.) The large-diff fallback still performs an authenticated fetch, but
# supplies the token per command via `http.extraheader` rather than persisting it.
persist-credentials: false

# The template's first-install BOOTSTRAP steps are deliberately omitted here: the reviewer
# is already on this repository's default branch, so they could never fire, and their
# PR-head checkout trips CodeQL's actions/untrusted-checkout (high) on every scan.
# Re-add them only for a repository that has never had the reviewer on its default branch.
# The template's first-install BOOTSTRAP steps are deliberately omitted: the reviewer is
# already on this repository's default branch, so they could never fire, and their
# PR-head checkout trips CodeQL's actions/untrusted-checkout (high). Re-add them only for
# a repository that has never had the reviewer on its default branch.
# If the default branch has no reviewer (it was removed, or a fresh install), report it as a visible
# warning and skip, rather than a red check that only means "not installed yet". Only the
# absence of the script is tolerated; any failure inside it is not.
- name: Check the reviewer is present
id: reviewer
run: |
if [ -f scripts/agy-review.sh ]; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
echo "::warning title=Antigravity review skipped::scripts/agy-review.sh is not on the default branch yet, so this PR cannot be reviewed. Reviews run once the reviewer is merged."
echo "present=false" >> "$GITHUB_OUTPUT"
fi
- name: Run Antigravity review
if: steps.reviewer.outputs.present == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# --- optional overrides (uncomment to change) ---
Expand All @@ -115,7 +129,7 @@ jobs:
# A large diff goes to agy as a file, and reading it at high effort costs 6-8
# minutes almost whatever its size (1.15 MB: 465 s; 426 KB timed out three times at
# 397 s under the old 240 s/MiB scaling). The scaling is now 900 s/MiB (the
# script's AGY_TIMEOUT_SECONDS_PER_MIB), so 900 s here is reached from ~650 KB.
# script's AGY_TIMEOUT_SECONDS_PER_MIB), so with the 10m base 900 s here is reached from ~340 KB.
AGY_PRINT_TIMEOUT_MAX_SECONDS: "900" # per-attempt cap (default 1800)
# Also set here, not only as the script's default: a pull_request run takes
# this file from the PR branch but the script from the default branch, so a
Expand All @@ -125,7 +139,17 @@ jobs:
# Two attempts, not three: a retry is for a transient backend error; a third
# attempt at the same budget only repeats a timeout.
AGY_RETRIES: "2"
AGY_LOCK_WAIT: "300" # wait for another review's lock (default 600)
# The lock is shared by EVERY repository's review on this host, not only this
# one's (agy is one singleton per user). 300 s was shorter than one review
# elsewhere: on 2026-11-15 RustyNES_MiSTer's PR #79 and RustyNES's PR #664
# opened together, #664's review of a large diff held the lock, and #79's job
# gave up after 300 s ("agy lock timed out") and went red with no review.
# 1860 s outlasts another review's whole hold: the lock is held across both of its
# attempts at the 15-minute cap AND the 15 s pause between them (2 x 900 + 15 =
# 1815 s), plus a margin for process start-up; this is what moved
# timeout-minutes to 80. The runner is self-hosted, so the longer wait
# bills nothing; the wait is a queue, not a fail-open.
AGY_LOCK_WAIT: "1860" # wait for another review's lock (default 600)
# AGY_DIFF_MODE: auto # auto|inline|file — how the diff reaches agy. `auto`
# # (default) inlines a small diff and hands a large one to
# # agy as a file, so PR size never truncates the review.
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion scripts/_agy_comment_body.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,24 @@ agy_body_archive() {
}' || true
}

# How many rounds earlier runs dropped to fit GitHub's comment limit, from the
# "<sub>N earlier round(s) dropped" note; 0 when there is none.
#
# The note sits between the SECTION and START sentinels, outside both regions the next run reads
# back (agy_body_head stops at the section, agy_body_archive starts after START), and the caller's
# count restarted at 0 every run -- so a later round that dropped nothing erased the disclosure
# (agy review of Rusty2600 #53). Only that one region is searched, so a note quoted inside a
# round's review text is never mistaken for the real one.
agy_body_dropped_count() {
awk -v sec="$AGY_ARCHIVE_SECTION" -v s="$AGY_ARCHIVE_START" '
$0 == sec { between = 1; next }
$0 == s { exit }
between && match($0, /^<sub>[0-9]+ earlier round\(s\) dropped/) {
n = substr($0, 6); sub(/[^0-9].*$/, "", n); print n + 0; found = 1; exit
}
END { if (!found) print 0 }'
}

# Prefix of the hidden line that records when a review was posted. The comment head carries
# it so that, when the round is archived on the next run, the summary can say when it was
# REVIEWED; the time of archiving says nothing useful.
Expand All @@ -99,7 +117,7 @@ AGY_REVIEWED_AT_PREFIX='<!-- agy-reviewed-at: '
# ahead of the rounds already archived.
#
# Args: $1 previous head, $2 previous archive (may be empty), $3 time to show when the head
# carries no reviewed-at line (labelled "archived at", because that is all it is).
# carries no reviewed-at line (labeled "archived at", because that is all it is).
#
# A previous archive with no round marker predates markers. It is wrapped as ONE round behind
# its own marker; emitted bare, the only marker would be the new round's, and trimming the
Expand Down
Loading
Loading