From 0ec26e32837f3f8624aa672e7f6085deb93cddef Mon Sep 17 00:00:00 2001 From: DoubleGate Date: Sun, 15 Nov 2026 02:14:46 -0500 Subject: [PATCH 1/3] ci(review): wait out another repository's review for the agy lock The agy lock (~/.gemini/antigravity-cli/.agy-review.lock) serialises EVERY repository's review on the host, because agy is one singleton language server per user. AGY_LOCK_WAIT was 300 s, shorter than one review elsewhere. Observed 2026-11-15: RustyNES_MiSTer PR #79 and RustyNES PR #664 opened together, #664's review of a large diff took the lock, and #79's job gave up ("agy lock timed out after 300s", run 43685337620) and went red without reviewing anything. Any two PRs opened at once in two repositories on the same runner host can hit it, from either side. AGY_LOCK_WAIT 300 -> 1800 s, which outlasts another review's two attempts at a 15-minute cap; timeout-minutes 45 -> 80 so the worst case still fits: 1800 + 2 x 900 + 15 = 3615 s ("worst case 3615s 80m (job timeout) fits with 2 minutes to spare" from scripts/agy-review-selftest.sh; all checks passed; actionlint clean). The runner is self-hosted, so the longer wait bills nothing, and the lock still fails closed: a timeout exits rather than running agy unserialised. The same change landed on RustyNES_MiSTer #79 (fa3dbbb), where both reviews after it ran green; this applies it here, at the maintainer's request. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014qfTKi2M3swo7qnwvYCkDj --- .github/workflows/antigravity-review.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/antigravity-review.yml b/.github/workflows/antigravity-review.yml index c4d94d7a..784b814e 100644 --- a/.github/workflows/antigravity-review.yml +++ b/.github/workflows/antigravity-review.yml @@ -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 1800 + 2 x 900 + 15 = 3615 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, @@ -125,7 +126,15 @@ 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. + # 1800 s outlasts another review's two attempts at a 15-minute cap, and 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: "1800" # 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. From 9e7c7110a029dbd0e7e709cef634a0e7a59f41e9 Mon Sep 17 00:00:00 2001 From: DoubleGate Date: Sun, 15 Nov 2026 11:41:34 -0500 Subject: [PATCH 2/3] ci(review): wait 1860 s for the agy lock, which outlasts a whole hold Antigravity on RustyNES #665: the comment said 1800 s "outlasts another review's two attempts at a 15-minute cap", but agy-review.sh holds the flock across the whole retry loop, the 15 s pause between attempts included, so another review can hold it for 2 x 900 + 15 = 1815 s plus process start-up. AGY_LOCK_WAIT 1800 -> 1860; the comment now gives the real arithmetic. Worst case 1860 + 2 x 900 + 15 = 3675 s, inside the 80-minute job timeout ("worst case 3675s 80m (job timeout) fits with 2 minutes to spare"; selftest: all checks passed). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014qfTKi2M3swo7qnwvYCkDj --- .github/workflows/antigravity-review.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/antigravity-review.yml b/.github/workflows/antigravity-review.yml index 784b814e..d1c4eef0 100644 --- a/.github/workflows/antigravity-review.yml +++ b/.github/workflows/antigravity-review.yml @@ -69,7 +69,7 @@ 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 1800 + 2 x 900 + 15 = 3615 s, under 80 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. (Until 2026-11-15: 300 + 2 x 900 + 15 = 2115 s under 45 # minutes; see AGY_LOCK_WAIT for why the wait grew.) @@ -131,10 +131,12 @@ jobs: # 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. - # 1800 s outlasts another review's two attempts at a 15-minute cap, and is what - # moved timeout-minutes to 80. The runner is self-hosted, so the longer wait + # 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: "1800" # wait for another review's lock (default 600) + 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. From 59005c3e91ff9b6f4a1ce15f358faa71ff530898 Mon Sep 17 00:00:00 2001 From: DoubleGate Date: Sun, 15 Nov 2026 12:01:28 -0500 Subject: [PATCH 3/3] docs(review): document AGY_LOCK_WAIT and the "agy lock timed out" failure Antigravity on #665 (no blocking issues): the configuration table and the troubleshooting section did not mention AGY_LOCK_WAIT, so a repository using the template had no way to learn that the lock is shared by every repository's review on the host, how the wait interacts with timeout-minutes, or what the red "agy lock timed out after Ns" job means. Added a table row (default 600, workflow 1860; why 1860 outlasts one review's whole hold; that raising it means raising timeout-minutes, which the selftest checks) and a troubleshooting entry (cause, re-run, how to size the wait, fail-closed). Its other suggestion, that 1860 s can still be exceeded when three or more repositories queue large diffs at once, is left as is: the reviewer itself says no change is needed unless that becomes common, and a longer wait would only lengthen every job's worst case. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014qfTKi2M3swo7qnwvYCkDj --- .github/AGY-REVIEWER.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/AGY-REVIEWER.md b/.github/AGY-REVIEWER.md index 3e768779..b554dc52 100644 --- a/.github/AGY-REVIEWER.md +++ b/.github/AGY-REVIEWER.md @@ -272,6 +272,7 @@ runner, so disable fork workflows there or gate them the same way. | `AGY_TIMEOUT_SECONDS_PER_MIB` | `900` | extra seconds per MiB of diff. A diff handed over as a file costs agy 6-8 minutes almost whatever its size, so this is deliberately steep (240 left a 426 KB diff at 397 s, too little) | | `AGY_PRINT_TIMEOUT_MAX_SECONDS` | `1800` (workflow: `900`) | ceiling on one attempt after the raise | | `AGY_RETRIES` | `3` (workflow: `2`) | attempts; a retry is for a transient backend error, so more of them at the same budget only repeat a timeout | +| `AGY_LOCK_WAIT` | `600` (workflow: `1860`) | seconds to wait for the host-wide agy lock before giving up. Every repository's review on the host shares it (agy is one singleton per user), and a review holds it across all its attempts and the pauses between them, so the wait must outlast another review's whole hold: 1860 s covers one review at two 900 s attempts plus the 15 s pause. It counts toward the job's worst case, so raising it means raising `timeout-minutes` (the selftest checks the sum) | | `AGY_DIFF_MODE` | `auto` | how the diff reaches agy: `inline` (in the `--print` prompt), `file` (written to a file agy reads with its tools), or `auto` (inline if it fits the arg-size budget, else file — so **large PRs are never truncated**) | | `MAX_DIFF_BYTES` | `5000000` | sanity cap on a pathological diff (5 MB). Not the arg-size limit — a large diff goes to agy as a file, not an argv value | | `MAX_PROMPT_BYTES` | `120000` | the inline/file threshold in `auto` mode, and a hard backstop on the **inlined** prompt. agy takes an inlined prompt as a `--print` argv value, and a single `execve` argument cannot exceed `MAX_ARG_STRLEN` (128 KiB); over it `execve` fails with E2BIG before agy starts. Clamped below 128 KiB | @@ -281,6 +282,14 @@ runner, so disable fork workflows there or gate them the same way. ## Troubleshooting +- **"agy lock timed out after Ns" and a red job with no review:** another + review on the same host held the agy lock longer than `AGY_LOCK_WAIT`. The + lock is shared by every repository's review there, so two PRs opened at once + in different repositories queue behind each other; with a wait shorter than + one review (the old 300 s), the second gives up. Re-run the job once the other + review finishes, and keep `AGY_LOCK_WAIT` above another review's worst-case + hold (`AGY_RETRIES` x the per-attempt cap, plus the pauses). The lock fails + closed: a timeout exits rather than running two agy processes at once. - **Review comment never appears / job succeeds but empty:** the classic Antigravity **issue #76** — `agy -p` drops stdout when it isn't attached to a TTY. This template runs `agy` under a PTY (`unbuffer`, or `scripts/_agy_print.sh`