ci(review): standardize the Antigravity reviewer + fix the large-diff handoff#328
Conversation
… handoff
Lands the fully standardized, hardened, and handoff-fixed Antigravity PR reviewer
on `main` on its own, SEPARATE from the v2.2.4 release content it was riding with
on the release branch. Splitting it out serves two ends: it gets the reviewer fix
onto the default branch (where the workflow always runs it — a PR is reviewed by
the reviewer already on `main`, never the version in the PR), and it lets the
v2.2.4 release PR shrink to pure release content. Only two files change; the diff
is a near-total rewrite of `scripts/agy-review.sh` because it converges onto the
shared cross-repo template.
What this brings to `main`'s reviewer, in one step:
- **Converged onto the shared template** (`scripts/agy-review.sh` +
`.github/workflows/antigravity-review.yml`) — the same canonical version now
used across RustyNES / RustySNES / RustyN64, so the three stop diverging. It
carries: the large-diff file handoff, the 20,000-line `gh pr diff` API-limit
local-`git diff` fallback, the `isCrossRepository` fork gate, fail-closed
metadata, default-branch checkout with `persist-credentials: false`, and the
`synchronize` auto-re-review trigger (was `opened`/`reopened` only).
- **Five security hardenings** the reviewer flagged against itself: a
`printf '%q '`-escaped `script(1)` PTY fallback (was a raw `${flags[*]}` in
`sh -c` — command injection); an author-scoped comment-deletion filter (was
marker-only — arbitrary comment deletion); removal of the unscoped SQLite
conversation-store fallback (shared-runner data-leak vector); `env -u
GH_TOKEN -u GITHUB_TOKEN` stripping the repo tokens from agy's environment
(agy runs under `--dangerously-skip-permissions` on an untrusted diff); and the
`issue_comment` author-association re-check restored in the script.
- **The large-diff handoff made readable** — the headline fix. A diff over the
inline budget is written to a gitignored working-tree scratch dir
(`.agy-review-work/`, relocated from `.git/` after the hidden-dir read risk was
flagged) and agy is told to read it, but that never worked: agy's sandboxed
file tool resolves relative paths against its OWN workspace root, not the shell
CWD, so the file came back "does not exist" and the review was empty (latent
until a diff first crossed the ~90 KB inline budget). Proven on the live agy
runner with a three-way probe under the exact review flags (`--sandbox
--dangerously-skip-permissions`): relative-path-no-add-dir FAILS; relative +
`--add-dir "$PWD"` PASSES; absolute-path-no-add-dir PASSES. Fix applies both,
each independently sufficient: the prompt hands agy an ABSOLUTE path, and
`--add-dir "$PWD"` adds the checkout to agy's sandbox workspace — but only in
file-handoff mode, so an inline review keeps zero filesystem access.
`scripts/_agy_print.sh` and `.gitignore` (which already ignores
`.agy-review-work/`) need no change. Byte-identical to the reviewer files on the
v2.2.4 release branch, so that branch rebases cleanly onto this once merged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 22 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe workflow now reviews synchronized pull requests and uses script defaults for diff sizing. The script adds fail-closed diff fallback, bounded prompt assembly, inline or file delivery, UTF-8 sanitization, PTY retries, environment isolation, and bounded failure output. ChangesAntigravity review automation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Workflow
participant agy-review.sh
participant GitHub
participant agy
Workflow->>agy-review.sh: start review on pull request event
agy-review.sh->>GitHub: request pull request diff
GitHub-->>agy-review.sh: diff or max-lines failure
agy-review.sh->>agy-review.sh: fetch refs and build bounded prompt
agy-review.sh->>agy: run review with isolated credentials
agy-->>agy-review.sh: review output or stderr
agy-review.sh-->>Workflow: publish result or bounded failure details
Possibly related PRs
🚥 Pre-merge checks | ✅ 9✅ Passed checks (9 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
The Antigravity reviewer, run against #328, flagged real robustness gaps in the template it standardizes onto. Three fixed; the one "blocking" finding is a false positive (adjudicated on the PR). - **Negative/zero MAX_PROMPT_BYTES no longer bypasses the E2BIG guard.** The ceiling check was `[ "$MAX_PROMPT_BYTES" -le "$ARG_SIZE_CEILING" ]`, which a negative value satisfies — so the clamp was skipped and the later `head -c "$MAX_PROMPT_BYTES"` prompt cap ran as GNU `head -c -1` (print all-but-last-byte), leaving the prompt effectively uncapped and re-exposing the execve E2BIG failure the cap exists to prevent. Now requires a POSITIVE integer at or below the ceiling; negative, zero, and non-numeric all clamp to the ceiling. - **UTF-8 sanitize no longer risks wiping the prompt.** The iconv / python3 branches did `mv "$prompt_file.utf8" "$prompt_file"` on tool exit 0 without checking the result is non-empty; a sanitizer that exits 0 but emits zero bytes would blank the prompt and hand agy nothing. Both branches now gate the mv on `[ -s "$prompt_file.utf8" ]` and otherwise discard the temp and keep the original. - **Latent clamp-time crash fixed (found while hardening the clamp).** log() was defined AFTER the configuration block, but the MAX_PROMPT_BYTES clamp calls log() — so a clamp that fired died with `log: command not found` under set -e instead of warning and continuing. Moved log() / have_text() above the config block. This never bit in practice only because the default 125000 is valid and never triggers the clamp; the negative-value fix above makes the clamp reachable, so the ordering had to be correct. Not changed (adjudicated on #328): the "blocking" claim that $truncated is never surfaced — it is, at the comment-body assembly (`printf '%s' "$truncated"`); the unbuffer-vs-script prompt passing "inconsistency" — both ultimately pass the same `--print "$(cat "$prompt_file")"` argv (the script path via _agy_print.sh), so it is behaviourally identical; and the pre-truncated-handoff nitpick — MAX_DIFF_BYTES is the 5 MB pathological-diff sanity cap, documented as not-for-bounding-reviews. Mirrors the canonical template byte-identically. #327's copy is synced to main's reviewer when it rebases post-merge. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Adjudicating the Fixed:
Adjudicated — no change:
All fixes ride the canonical template (byte-identical) so the three consuming repos stay in sync. |
Antigravity review (Gemini via Ultra)This PR updates the GitHub Actions workflow and review script to support PR synchronization triggers, raise default diff limits, and hand off large diffs via an on-disk file reference instead of splitting diffs into multi-part prompt chunks. Blocking issues
Suggestions
Nitpicks
Automated first-pass review by |
|
Adjudicating the re-review (on the hardened
CI is green and there are no unresolved review threads; proceeding. |
What
Standardizes the Antigravity PR reviewer onto the shared cross-repo template and fixes the large-diff handoff, landed on
mainon its own — split out of the v2.2.4 release branch (#327) so the reviewer fix reaches the default branch (where the workflow always runs it) independently of the release.Two files change;
agy-review.shis a near-total rewrite because it converges onto the template.Why split it out
The agy workflow always runs the reviewer already on the default branch (it checks out
main, never the PR head), so a fix inside a PR can't review its own PR. Landing the reviewer here first means:maingets the fixed reviewer now, so it can be validated live before the release ships;Contents
gh pr diffAPI-limit local-git difffallback,isCrossRepositoryfork gate, fail-closed metadata, default-branch checkout +persist-credentials: false,synchronizeauto-re-review.printf '%q '-escapedscript(1)fallback (command injection), author-scoped comment deletion, dropped unscoped SQLite fallback (data leak),env -u GH_TOKEN GITHUB_TOKEN, restoredissue_commentauthor re-check.--add-dir "$PWD"scoped to file-handoff mode only.Validation
Root cause + fix proven on the live
agyrunner (three-way probe under the exact--sandbox --dangerously-skip-permissionsflags: relative-no-add-dir FAILS, relative+add-dir PASSES, absolute PASSES; plus a combined production-shaped run reading a realistic diff-shaped file PASSES). This PR's own diff (~42 KB) is inlined, so it also exercises the inline path live.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes