-
-
Notifications
You must be signed in to change notification settings - Fork 0
ci: add Antigravity PR reviewer (self-hosted, Ultra) #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+464
−0
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ecba9d6
ci: add Antigravity PR reviewer (self-hosted, Ultra)
doublegate 0237135
ci(review): harden reviewer — gate triggers, argv-safe PTY, drop racy…
doublegate 9875dab
ci(review): re-sync reviewer to template — job-level concurrency, agy…
doublegate e5ccbc9
ci(review): re-harden the Antigravity reviewer after the template re-…
doublegate 675fa52
ci(review): drop the shared conversation-store fallback; state the tr…
doublegate 98d0162
ci(review): close the fork-PR hole on the /agy-review comment path
doublegate File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Review Style Guide (example) | ||
|
|
||
| Copy this to **`.github/agy-review.md`** in any repo that uses the Antigravity PR | ||
| reviewer (a dedicated filename, so it never collides with an existing `GEMINI.md` | ||
| or `AGENTS.md`). Everything here is fed to the reviewer as project-specific rules | ||
| to enforce. Delete what does not apply and add your own. Override the path with | ||
| the `STYLE_GUIDE` env var in the workflow if you prefer a different location. | ||
|
|
||
| ## Priorities (in order) | ||
|
|
||
| 1. Correctness and data integrity. | ||
| 2. Security: validate all external input at boundaries; no secrets in code, logs, | ||
| or error messages; prefer allowlists. | ||
| 3. Clear error handling: typed results over panics/`unwrap` on untrusted input. | ||
| 4. Tests accompany behavior changes. | ||
|
|
||
| ## Conventions | ||
|
|
||
| - Conventional Commits (`feat|fix|docs|refactor|test|chore|perf|build|ci`). | ||
| - Match surrounding code style; smallest correct change; reuse existing utilities. | ||
| - No emojis in code, comments, commits, or docs. | ||
| - Public APIs and non-obvious decisions are documented in the same change. | ||
|
|
||
| ## What to flag as BLOCKING | ||
|
|
||
| - Unvalidated external input reaching a sink (SQL, shell, filesystem, network). | ||
| - Hardcoded credentials or tokens. | ||
| - Breaking changes to a public API or on-disk/wire format without a version bump. | ||
| - Silent failure paths (swallowed errors, ignored return values). | ||
|
|
||
| ## What to keep as SUGGESTION / NITPICK | ||
|
|
||
| - Naming, structure, and readability. | ||
| - Missing tests for non-critical paths. | ||
| - Performance ideas without a measurement (note: profile before optimizing). |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # Antigravity PR Review -- copy this file (and the scripts/ dir) into any repo. | ||
| # Runs a Gemini review on a self-hosted runner using your `agy` OAuth session, | ||
| # so it draws on your Google AI Ultra limits instead of a paid API key. | ||
| # | ||
| # Requires a self-hosted runner registered with the label `agy` on a machine | ||
| # where `agy` is logged in. See ../../README.md for the full setup. | ||
| name: Antigravity PR Review | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened] | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| jobs: | ||
| review: | ||
| # SECURITY GATE (a self-hosted runner on a PUBLIC repo executes on real hardware | ||
| # and spends the owner's Google AI Ultra quota, so "who can start a run" is the | ||
| # primary control): | ||
| # - pull_request: only from a branch in THIS repo. A FORK PR must never schedule | ||
| # work on the self-hosted host. GitHub's "require approval for outside | ||
| # collaborators" setting is belt-and-suspenders, not the gate — its default only | ||
| # covers *first-time* contributors, so a returning outside contributor would | ||
| # otherwise get a runner. | ||
| # - issue_comment: only `/agy-review` from someone with write access | ||
| # (OWNER/MEMBER/COLLABORATOR), so a stranger cannot trigger execution by | ||
| # commenting. `scripts/agy-review.sh` re-checks this defensively. | ||
| if: >- | ||
| (github.event_name == 'pull_request' && | ||
| github.event.pull_request.head.repo.full_name == github.repository) || | ||
| (github.event_name == 'issue_comment' && | ||
| github.event.issue.pull_request != null && | ||
| startsWith(github.event.comment.body, '/agy-review') && | ||
| contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) | ||
| # Concurrency at the JOB level (NOT workflow level): a job skipped by the `if:` | ||
| # above never enters the group, so an unrelated `issue_comment` on the PR (e.g. | ||
| # another review bot commenting) can't cancel an in-progress review. And | ||
| # cancel-in-progress:false means a second *real* review queues behind the first | ||
| # instead of killing it. Fixes the race where any comment on the PR aborted the | ||
| # running review mid-`agy`. | ||
| concurrency: | ||
| group: agy-review-${{ github.event.pull_request.number || github.event.issue.number }} | ||
| cancel-in-progress: false | ||
| runs-on: [self-hosted, agy] | ||
| 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, | ||
| # so taking those scripts from the PR would let the reviewed change rewrite its own | ||
| # reviewer. The review content is unaffected: the diff is fetched from the API by | ||
| # `gh pr diff`, not from the working tree. Consequence worth knowing: a PR that | ||
| # edits the reviewer or the style guide is reviewed by the version already on main. | ||
| - name: Check out repo (for the style guide + scripts) | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ github.event.repository.default_branch }} | ||
| fetch-depth: 1 | ||
| # Repo-wide rule (PR #319): no checkout persists credentials. Nothing here | ||
| # performs an authenticated git network operation — `gh` uses GH_TOKEN. | ||
| persist-credentials: false | ||
|
|
||
| - name: Run Antigravity review | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| # --- optional overrides (uncomment to change) --- | ||
| # AGY_MODEL: gemini-3-pro # default: agy's configured model | ||
| AGY_EFFORT: high # low|medium|high | ||
| # Diff budget. The prompt is passed to agy as a SINGLE argv string, and Linux | ||
| # caps one argument at MAX_ARG_STRLEN = 32 * PAGE_SIZE = 128 KiB (this is a | ||
| # separate, much lower ceiling than ARG_MAX). 90 KB leaves room for the | ||
| # instruction boilerplate + style guide; the script enforces the total cap. | ||
| MAX_DIFF_BYTES: "90000" | ||
| # STYLE_GUIDE: .github/agy-review.md # style guide, loaded if present | ||
| run: | | ||
| chmod +x scripts/agy-review.sh scripts/_agy_print.sh | ||
| scripts/agy-review.sh | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # _agy_print.sh -- inner helper for the script(1) PTY fallback in agy-review.sh. | ||
| # Only used when `unbuffer` (from the `expect` package) is unavailable. | ||
| # | ||
| # Invoked as: _agy_print.sh <prompt_file> [agy flags...] | ||
| # (agy-review.sh passes it through `script -qfec` so agy runs attached to a PTY, | ||
| # working around agy issue #76 where `-p` drops stdout on a non-TTY.) | ||
| set -euo pipefail | ||
| prompt_file="$1"; shift | ||
| exec "${AGY_BIN:-agy}" "$@" --print "$(cat "$prompt_file")" |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.