Skip to content

ci: sync the Antigravity PR reviewer with the current template - #262

Merged
doublegate merged 5 commits into
mainfrom
ci/agy-reviewer-sync
Nov 14, 2026
Merged

doublegate merged 5 commits into
mainfrom
ci/agy-reviewer-sync

Conversation

@doublegate

@doublegate doublegate commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

What and why

This PR re-installs the Antigravity PR reviewer from the current antigravity-pr-review template (b8501ed). The copy it replaces was an unmodified older template version: every overwritten file matched a template commit byte for byte. So nothing specific to this repo is lost, and the existing style guide (.github/agy-review.md) is kept.

Fixes it brings:

  • UTF-8 cleanup actually works on Linux now. GNU iconv -c exits 1 whenever it drops bytes. That's exactly what happens after a byte cut, and the old code threw iconv's output away on failure, so the cleanup did nothing and agy could be handed a split UTF-8 sequence. It now falls back to python3, and one helper serves both the prompt and the review-output paths. The self-test covers it, including with iconv hidden.
  • Token on every fetch. The shallow merge-base fetches in the large-diff path now send the token header, so that path works on private repos.
  • Docs. .github/AGY-REVIEWER.md (the template README) is added or updated, and its file table now matches what the installer copies.
  • Every template fix made since this copy was installed.

Testing

  • bash scripts/agy-review-selftest.sh passes on this branch.
  • actionlint .github/workflows/antigravity-review.yml is clean.
  • The reviewer job on this PR runs the default branch's existing copy of the scripts, as designed; the new copy takes effect after merge.

🤖 Generated with Claude Code


Note

Medium Risk
Changes who can trigger reviews on a self-hosted runner and how tokens are passed to git/GitHub APIs—security-sensitive CI paths—but behavior is fail-closed and heavily self-tested.

Overview
Replaces the repo’s Antigravity PR reviewer with the current antigravity-pr-review template: adds .github/AGY-REVIEWER.md, refreshes the workflow and all scripts/* reviewer code, and leaves .github/agy-review.md unchanged per the PR description.

The workflow drops issues: write, bumps timeout-minutes to 45, and pins diff-size timeouts (AGY_TIMEOUT_SECONDS_PER_MIB: 900, AGY_PRINT_TIMEOUT_MAX_SECONDS: 900, AGY_RETRIES: 2, AGY_LOCK_WAIT: 300).

agy-review.sh gains agy_has_write_access (GitHub permissions API for /agy-review, not just author_association), safer authenticated git fetch via GIT_CONFIG_* instead of token-on-argv, local-diff fallback for both 20k-line and 300-file gh pr diff 406s, shared truncation + UTF-8 scrub (agy_scrub_utf8 with python3 when iconv “succeeds” but exits 1), diff-scaled print timeouts, stricter handling of backend errors, tool truncation notices, and agy print timeouts (no green checks on junk output), plus richer logging instead of swallowed 2>/dev/null. Review comments use a fixed edit-in-place archive (agy_assemble_archive, section sentinel) and reviewed-at metadata.

agy-review-selftest.sh grows to execute regression tests for the above; _agy_print.sh adds usage/readability checks.

Reviewed by Cursor Bugbot for commit eb37110. Bugbot is set up for automated code reviews on this repo. Configure here.

Re-installs antigravity-pr-review (template b8501ed) over a copy that was
an unmodified older template version, so nothing repo-specific is lost.
The headline fix: the UTF-8 scrub after byte caps was a no-op on glibc,
because GNU `iconv -c` exits 1 whenever it drops bytes and the old code
discarded its output, so agy could be handed a split UTF-8 sequence. It
now falls back to python3 and is shared by the prompt and review-output
paths. Also: the shallow merge-base fetches carry the token header, the
README (installed as .github/AGY-REVIEWER.md) lists the real file set, and
every template fix since this copy was installed comes along.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T10:59:56.081942Z bb9e316 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 0f0ac44f-919d-44f7-a282-34ebfb229775)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb9e316dc8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/agy-review.sh
# Cap prompt file $1 at $2 bytes, keeping room for a notice written after the cut.
agy_cap_prompt() {
local notice=$'\n\n--- NOTE: TRUNCATED PROMPT ---\nThe prompt, including the diff, was cut at the argument-size limit; you have NOT seen\nthe rest. Say at the top of your review that it covers a truncated diff, and do not state or\nimply that the whole change was reviewed.\n'
agy_cut_file "$1" "$(( $2 - ${#notice} ))" || return 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check the full prompt budget before reserving notice space

When AGY_DIFF_MODE=inline produces a prompt just below MAX_PROMPT_BYTES, this helper unnecessarily truncates the diff because it compares the file size against the budget minus the notice length rather than against the full budget first. For example, a 119,923-byte prompt with a 120,000-byte budget loses its final changes and becomes a 120,000-byte truncated prompt, even though the original fits. Check whether the prompt exceeds the full budget before cutting it to reserve space for the notice.

Useful? React with 👍 / 👎.

The workflow comment no longer calls the outside-contributor approval
setting "belt-and-suspenders": for a pull_request event a fork controls
the workflow file, so that setting is the gate. The self-test now fails if
the workflow ever has more than one timeout-minutes, which would make its
budget check read the wrong value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 9ac38f91-5c4d-49ae-a4b9-8c9edadb025b)

The reviewer is already on this repository's default branch, so the three
bootstrap steps (a PR-head checkout and install that only fire while the
default branch has no reviewer) can never run here. Keeping them leaves a
PR-head checkout path in the workflow, which CodeQL flags as
actions/untrusted-checkout (high). The comment and the AGY-REVIEWER.md
note match RustyNES, VeridianOS and switch2-hub-patcher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 95b8265e-c034-41ad-9136-38d79f0e67c2)

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Antigravity review (Gemini via Ultra)

This PR syncs the Antigravity PR reviewer workflow, scripts, self-test suite, and documentation with the upstream template, adding write-permission verification for /agy-review commenters, diff-size timeout scaling, archive sentinel separation, and expanded truncation/error guards.

Blocking issues

None found.

Suggestions

  • scripts/agy-review.sh:223-246, scripts/agy-review.sh:277, scripts/agy-review.sh:1123 — Incomplete numeric env normalization (MAX_PROMPT_BYTES, MAX_BODY_BYTES, AGY_ERROR_MAX_BYTES): normalize_numeric_env was added so numeric overrides cannot pass leading-zero octal values (08, 09) or non-digits into $(( ... )), but MAX_PROMPT_BYTES is still validated only with [[ "$MAX_PROMPT_BYTES" =~ ^[0-9]+$ ]] (which admits 080000 and then crashes style_cap=$(( MAX_PROMPT_BYTES - 8192 )) and inline_budget=$(( MAX_PROMPT_BYTES - head_bytes - 512 )) under set -e), and MAX_BODY_BYTES is not validated at all before the newly added $(( MAX_BODY_BYTES - 4096 )) expansion at line 1123 (nor bounded so MAX_BODY_BYTES <= 4096 cannot underflow the round budget). Run normalize_numeric_env on MAX_PROMPT_BYTES, MAX_BODY_BYTES, MAX_DIFF_BYTES, and AGY_ERROR_MAX_BYTES as well.
  • scripts/agy-review.sh:680-701, scripts/agy-review.sh:796-805 — Split UTF-8 sequences in file mode and iconv -c exit status in agy_scrub_utf8:
    1. When agy_cut_file "$diff_file" "$MAX_DIFF_BYTES" truncates a diff at line 697 and use_file=1 copies it to $agy_diff_file (line 800), agy_scrub_utf8 is only called later on $prompt_file (line 842), leaving any split multi-byte UTF-8 sequence at the tail of $agy_diff_file unscrubbed.
    2. As noted in the comment at lines 673-677, GNU iconv -c writes the scrubbed output to $1.utf8 but exits 1 whenever it drops an incomplete trailing sequence. Because line 682 chains && iconv -c ... && [ -s "$1.utf8" ], the iconv branch always fails on glibc when a split sequence is actually present and deletes $1.utf8 at line 685, relying entirely on python3 being installed.
  • scripts/agy-review.sh:327-357, scripts/agy-review.sh:386, scripts/agy-review.sh:597 — Unscoped variables in agy_has_write_access and untracked temp files on interrupt: _login, _perm_err, _login_enc, and _perm in agy_has_write_access() are not declared local. In addition, agy_has_write_access creates _perm_err="$(mktemp)" at line 330 before trap cleanup EXIT is registered at line 456, and neither _perm_err nor compare_err="$(mktemp)" (line 597) is included in the pre-declared doomed list in cleanup().

Nitpicks

  • scripts/agy-review.sh:556-574: The comment states that every fetch on the fallback path goes through agy_fetch, but the initial origin "${fetch_refspecs[@]}" fetch at lines 566-572 still duplicates the GIT_CONFIG_COUNT=1 ... call inline instead of calling agy_fetch.
  • .github/AGY-REVIEWER.md:71 vs. .github/AGY-REVIEWER.md:145: Line 71 states that install-into-repo.sh appends /.agy-review-work/ to .gitignore, whereas line 145 states that it "leaves the target's .gitignore untouched".
  • .github/AGY-REVIEWER.md:299, .github/AGY-REVIEWER.md:311: The troubleshooting commands use systemctl --user restart github-agy-runner and systemctl --user status github-agy-runner, omitting the @<repo> instance suffix required by the github-agy-runner@.service template unit from section 3.

Automated first-pass review by agy on a self-hosted runner -- not a human review.

Earlier review rounds (newest first)
Round reviewed at 2026-11-14 13:37 UTC

Antigravity review (Gemini via Ultra)

This PR updates the Antigravity PR reviewer workflow, scripts, self-test suite, and documentation to enforce collaborator write-access checks via the GitHub API, scale print timeouts by diff size, isolate archive wrapper sentinels, avoid exposing tokens in git process arguments, and harden error and truncation handling.

Blocking issues

None found.

Suggestions

  • scripts/agy-review.sh:203-227, 274, 681, 717, 1123 — Incomplete numeric environment validation: normalise_numeric_env was added to prevent octal parsing crashes and variable-name indirection inside $(( ... )), but MAX_BODY_BYTES (line 274) is never validated before $(( MAX_BODY_BYTES - 4096 )) at line 1123, and MAX_PROMPT_BYTES (lines 224-227) is only checked with [, which accepts leading-zero values (e.g. 080000) as decimal before they crash $(( MAX_PROMPT_BYTES - 8192 )) at line 681 under set -e. Run normalise_numeric_env on MAX_BODY_BYTES, MAX_PROMPT_BYTES, MAX_DIFF_BYTES (line 203), and AGY_ERROR_MAX_BYTES (line 74) as well.
  • scripts/agy-review.sh:669-673, 742 — Split UTF-8 sequence left in $agy_diff_file after MAX_DIFF_BYTES truncation: When agy_cut_file "$diff_file" "$MAX_DIFF_BYTES" cuts an oversized diff on a byte boundary, agy_scrub_utf8 is only called later on $prompt_file (line 781) and $out_file (line 1125). Because a 5 MB diff takes the file-handoff path (cp "$diff_file" "$agy_diff_file" at line 742), a multi-byte UTF-8 sequence split at the end of $diff_file is never scrubbed. Call agy_scrub_utf8 "$diff_file" inside the if agy_cut_file "$diff_file" "$MAX_DIFF_BYTES" block.
  • scripts/agy-review.sh:247-277, 369, 407-411, 572 — Unscoped variables and untracked temp files in API helpers: agy_has_write_access assigns _login, _perm_err, _login_enc, and _perm as globals rather than local variables, and neither _perm_err (line 250, created before trap cleanup EXIT is installed at line 426) nor compare_err (line 572) is included in the pre-declared temp-file list (line 369) or cleanup()'s doomed array. If the job is cancelled or interrupted while gh api is in flight, those temp files leak.
  • scripts/agy-review.sh:531-550, 583-584 — Duplicated fetch logic and swallowed errors in agy_fetch: The comment at line 528 states that every fetch on the fallback path goes through agy_fetch, but the initial refspec fetch at lines 541-549 duplicates the GIT_CONFIG_COUNT=1 ... git fetch command inline. Additionally, agy_fetch redirects stderr to /dev/null on both attempts (lines 536, 539), so if both merge-base fetches at lines 583-584 fail, the underlying git fetch error is silently discarded.

Nitpicks

  • .github/AGY-REVIEWER.md:293, 305: systemctl --user restart github-agy-runner and systemctl --user status github-agy-runner omit the @<repo> instance suffix required by the github-agy-runner@.service template unit shown in step 3 (lines 114-121).
  • scripts/_agy_comment_body.sh:65, 119, 148: AGY_ROUND_MARK is referenced inside agy_body_archive and agy_assemble_archive before it is defined at line 148; moving the constant definition above both functions makes the dependency order explicit.

Automated first-pass review by agy on a self-hosted runner -- not a human review.

Earlier review rounds (newest first)
Round reviewed at 2026-11-14 12:33 UTC

Antigravity review (Gemini via Ultra)

Synchronizes the repository's Antigravity PR reviewer workflow, helper scripts, self-test suite, and documentation with the current upstream template (adding collaborator write-access verification, diff-size timeout scaling, archive section sentinels, and UTF-8/truncation helpers).

Blocking issues

None found.

Suggestions

  • Default MAX_PROMPT_BYTES exceeds ARG_SIZE_CEILING and triggers a clamp warning on every default run (scripts/agy-review.sh:225-245, .github/AGY-REVIEWER.md:275): ARG_SIZE_CEILING was lowered from 128000 to 120000, but MAX_PROMPT_BYTES still defaults to 125000. Whenever MAX_PROMPT_BYTES is not explicitly set in the environment, [ "$MAX_PROMPT_BYTES" -le "$ARG_SIZE_CEILING" ] fails, logs a warning (MAX_PROMPT_BYTES='125000' invalid, non-positive, or above the 120000-byte ceiling; clamping), and clamps it to 120000. Update the default MAX_PROMPT_BYTES to 120000 (and update the table in .github/AGY-REVIEWER.md:275 accordingly).
  • Dropped-round disclosure is lost on subsequent rounds that do not drop additional rounds (scripts/agy-review.sh:1200-1227, scripts/_agy_comment_body.sh:60-80): Moving <sub>%d earlier round(s) dropped...</sub> into AGY_ARCHIVE_SECTION (outside AGY_ARCHIVE_START) and stripping everything before the first AGY_ROUND_MARK in agy_body_archive fixes the nested <details> bug, but dropped only counts rounds dropped during the current invocation. If round $N$ drops old rounds and round $N+1$ is short enough that combined_size <= MAX_BODY_BYTES without dropping another round, dropped is 0 on round $N+1$ and the disclosure note from round $N$ is erased. Persist a cumulative dropped count (e.g. in an HTML comment sentinel or parsed from the existing notice) so earlier truncations remain disclosed across later rounds.
  • agy_cap_prompt truncates prompts that are already under MAX_PROMPT_BYTES (scripts/agy-review.sh:675-679): Unlike agy_cap_round (scripts/agy-review.sh:681-689), which checks [ "$size" -gt "$2" ] || return 1 before cutting to $(( $2 - ${#notice} - 1 )), agy_cap_prompt directly calls agy_cut_file "$1" "$(( $2 - ${#notice} ))". A prompt whose byte length is between MAX_PROMPT_BYTES - ${#notice} + 1 and MAX_PROMPT_BYTES is within budget yet gets cut and receives the truncation notice. Guard agy_cap_prompt with [ "$(wc -c < "$1")" -gt "$2" ] || return 1 before calling agy_cut_file.
  • GNU iconv -c branch in agy_scrub_utf8 always fails when a trailing UTF-8 sequence is split (scripts/agy-review.sh:701-713): As the comment above agy_scrub_utf8 notes, GNU iconv -c writes the scrubbed prefix to $1.utf8 but exits 1 on an incomplete multibyte sequence at EOF. Because the condition chains && iconv -c -f UTF-8 -t UTF-8 "$1" > "$1.utf8" 2>/dev/null && [ -s "$1.utf8" ], iconv always takes the failure branch on glibc whenever a byte cut actually split a multibyte character, deletes $1.utf8, and relies entirely on python3. Prefer python3 first or tolerate exit code 1 from iconv -c when $1.utf8 is non-empty and within a few bytes of $1.
  • Scope variables as local in agy_has_write_access and register remaining mktemp files in cleanup (scripts/agy-review.sh:327-357, scripts/agy-review.sh:399, scripts/agy-review.sh:607): _login, _perm_err, _login_enc, and _perm in agy_has_write_access are globals (local is omitted), and _perm_err (:330), compare_err (:607), and trimmed (:1208) are not listed in the cleanup() trap array if the process is interrupted mid-command.

Nitpicks

  • scripts/agy-review.sh:561-579: agy_fetch is defined with the comment # Every fetch on this path goes through agy_fetch, but the initial refspec fetch immediately below it still duplicates the GIT_CONFIG_COUNT=1 ... git fetch call inline instead of using agy_fetch.
  • scripts/agy-review-selftest.sh:510-511: wf_val and sh_default use GNU sed's T command (;T;q), which fails on BSD/macOS sed; a pattern address like /^[[:space:]]*$1:/{s/.../\1/p;q;} is POSIX-portable.
  • scripts/_agy_comment_body.sh:68,153: AGY_ROUND_MARK is referenced in agy_body_archive and agy_assemble_archive before its definition at the bottom of the file; moving the constant definition alongside AGY_ARCHIVE_START/AGY_ARCHIVE_END at the top improves readability.

Automated first-pass review by agy on a self-hosted runner -- not a human review.

From the Antigravity reviews of these template-sync PRs; each fix has a
self-test check that failed before it:

- agy_body_archive no longer drops a clean round's closing </details>
  when the round quotes a standalone </details> or uses <details open>.
- agy_cap_prompt checks the size first, so a prompt that already fits is
  not cut and the model is not told its diff was truncated.
- agy_cut_file refuses a non-positive size rather than handing GNU
  `head -c -N` a negative count.
- The self-test budget uses a pinned AGY_PRINT_TIMEOUT when one is set.
- MAX_PROMPT_BYTES defaults to 120000 (its ceiling), ending the spurious
  clamp warning on every run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 396237db-fe77-4528-8d7a-171651720fe3)

Template f492f3e's en-US conversion (behaviour, labelled, normalise --
normalise_numeric_env becomes normalize_numeric_env -- capitalisation,
canonicalise*, artefact, summarises, (un)recognised, honour(s)), applied
to this PR's copies without pulling in any other template change, plus
the flow diagram's code fence labelled `text` (markdownlint MD040).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: f3c8b524-7ff9-40c6-baf6-ad24f68c08f4)

@doublegate
doublegate merged commit 5f9b71a into main Nov 14, 2026
18 checks passed
@doublegate
doublegate deleted the ci/agy-reviewer-sync branch November 14, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant