Skip to content

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

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

doublegate merged 4 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 and how self-hosted runner jobs fetch diffs and post comments; mistakes could block reviews or weaken gates, but scope is CI tooling only.

Overview
Reinstalls the Antigravity PR reviewer from the upstream template: new .github/AGY-REVIEWER.md, refreshed workflow, and updated scripts/* (existing .github/agy-review.md is unchanged).

Workflow trims permissions (issues: write removed), raises job timeout to 45m, and pins diff-scaled timeouts (900 s/MiB, 900 s per-attempt cap, 2 retries, 300 s lock wait). Security comments now stress fork approval and that agy_has_write_access is the real /agy-review gate.

Reviewer behavior hardens failure modes: any line-1 Error: / truncated tool notice and [agy] print timeout no longer post as reviews; shared truncation + agy_scrub_utf8 (iconv with python3 fallback) on prompt and output; timeouts scale with diff size; large-diff fallback uses GIT_CONFIG_* auth, agy_fetch on all fetches, and safer merge-base handling; agy_has_write_access replaces author_association for comment triggers.

Comment archives fix nested <details> via AGY_ARCHIVE_SECTION, agy_assemble_archive, reviewed-at timestamps, paginated comment merge (jq -s add), and visible API/jq errors instead of silent fallbacks.

Self-test grows into broad regression coverage for the above; _agy_print.sh adds usage checks and safer prompt reads.

Reviewed by Cursor Bugbot for commit 80a85bc. 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

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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-14T11:00:05.340497Z d7a30d1 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: 45731643-434c-47ff-b949-3c944b6505f6)

@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: d7a30d169a

ℹ️ 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_comment_body.sh Outdated
Comment on lines +91 to +94
if (line[i] ~ /^<details>/) opens++
if (line[i] == "</details>") closes++
}
if (closes > opens) n--

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 Restrict wrapper removal to legacy archive layouts

If an archived review contains a valid <details open> block, this counter ignores its opening tag but counts its </details>. Consequently, agy_body_archive removes the round's own closing tag even from a correctly formatted, newly generated archive. This reproduces with one round containing one nested <details open> block and leaves the comment's collapsible sections unbalanced on the next review. Detect the legacy wrapper explicitly rather than inferring its presence from incomplete HTML tag counts.

Useful? React with 👍 / 👎.

Comment on lines +340 to +342
for t in python3 mv rm; do ln -sf "$(command -v "$t")" "$TMPD/noiconv/$t"; done
printf 'abc\xe2\x82' > "$TMPD/split"
( PATH="$TMPD/noiconv"; agy_scrub_utf8 "$TMPD/split" )

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 Preserve interpreter dependencies in the no-iconv test

When python3 resolves to a pyenv shim, symlinking it into this directory and replacing PATH with only that directory prevents the shim's #!/usr/bin/env bash interpreter from being found. The fallback therefore never runs, and the self-test reports a UTF-8 regression despite the production helper working correctly. This is reproducible in the provided environment: bash scripts/agy-review-selftest.sh fails only this assertion. Resolve the actual Python interpreter or retain the executables required by the shim while hiding iconv.

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: e3f5b5c4-b682-4103-b8ea-36126f826f76)

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: 2cd7062e-50b9-4527-878c-65398e2bfd5b)

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Antigravity review (Gemini via Ultra)

Synchronizes the repository's Antigravity PR review workflow, scripts, self-test suite, and documentation (.github/AGY-REVIEWER.md) with the upstream reviewer template, adding collaborator write-permission verification, diff-size timeout scaling, archive sentinel separation, byte-cap/UTF-8 truncation helpers, and token-redacted / environment-passed git fetches.

Blocking issues

None found.

Suggestions

  • scripts/agy-review.sh:223-242, scripts/agy-review.sh:281, scripts/agy-review.sh:1123: normalise_numeric_env was added to guard arithmetic expansions against non-numeric values and leading-zero octal interpretation, and is applied to AGY_TIMEOUT_SECONDS_PER_MIB, AGY_PRINT_TIMEOUT_MAX_SECONDS, AGY_LOCK_WAIT, AGY_RETRIES, and AGY_RETRY_DELAY. However, MAX_PROMPT_BYTES, MAX_BODY_BYTES, MAX_DIFF_BYTES, and AGY_ERROR_MAX_BYTES are not passed through normalise_numeric_env. In particular, a leading-zero value such as MAX_PROMPT_BYTES=090000 passes [ "$MAX_PROMPT_BYTES" -gt 0 ] && [ "$MAX_PROMPT_BYTES" -le "$ARG_SIZE_CEILING" ] (where [ parses decimal) and then aborts the script under set -e at style_cap=$(( MAX_PROMPT_BYTES - 8192 )) (value too great for base), and MAX_BODY_BYTES reaches $(( MAX_BODY_BYTES - 4096 )) unvalidated. Normalizing those byte-limit variables with normalise_numeric_env would close the same class of failure across all numeric env overrides.
  • scripts/agy-review.sh:647-664 and .github/AGY-REVIEWER.md:81: As the comment on agy_scrub_utf8 notes, GNU iconv -c writes the scrubbed output to $1.utf8 but exits 1 when it drops an incomplete trailing multi-byte sequence at EOF. Because the iconv branch requires exit status 0 (iconv -c ... && [ -s "$1.utf8" ]), on glibc systems iconv always fails on a byte-cut split sequence, removes $1.utf8, and relies entirely on the python3 fallback. Either include python in the prerequisite package check in .github/AGY-REVIEWER.md:81 or avoid discarding non-empty iconv -c output when python3 is unavailable.
  • scripts/agy-review.sh:327-357 and scripts/agy-review.sh:602: In agy_has_write_access, _login, _perm_err, _login_enc, and _perm are globals rather than local, and neither _perm_err nor compare_err (line 602) is tracked by the cleanup EXIT trap if the script receives a signal while gh api is running. Declare those variables local and either pre-declare the temp files in cleanup's list or allocate a single shared scratch file up front.

Nitpicks

  • scripts/agy-review.sh:556-578: The comment above agy_fetch states that every fetch on this path goes through agy_fetch, but the initial fetch_refspecs fetch immediately below it still inlines GIT_CONFIG_COUNT=1 ... git fetch directly instead of calling agy_fetch.
  • .github/AGY-REVIEWER.md:77: The prerequisites comment still lists sqlite3 (# gh jq sqlite3 col script + unbuffer), although the SQLite conversation-store fallback was removed from scripts/agy-review.sh.

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:59 UTC

Antigravity review (Gemini via Ultra)

Synchronizes the repository's Antigravity PR review workflow, scripts, self-tests, and documentation with the upstream reviewer template, adding API-based write-permission checks, diff-size timeout scaling, archive wrapper migration, and UTF-8 truncation scrubbing.

Blocking issues

None found.

Suggestions

  • scripts/agy-review.sh:226-244 — Default MAX_PROMPT_BYTES exceeds the new ARG_SIZE_CEILING: ARG_SIZE_CEILING was lowered from 128000 to 120000, but MAX_PROMPT_BYTES still defaults to 125000 on line 226 (and in .github/AGY-REVIEWER.md:277 and .github/workflows/antigravity-review.yml:135). Every run with default settings now fails [ "$MAX_PROMPT_BYTES" -le "$ARG_SIZE_CEILING" ], logs a spurious "MAX_PROMPT_BYTES='125000' invalid, non-positive, or above the 120000-byte ceiling; clamping" warning, and clamps to 120000. Lower the default to 120000 (or below) and update the docs/workflow comments to match.
  • scripts/_agy_comment_body.sh:68-97 — agy_body_archive tail filter can strip a valid </details> from post-migration archives: The second awk stage removes a trailing </details> whenever closes > opens across the whole archive, even when the first awk stage found the first round marker at index 0 (first == 0, meaning no leading pre-migration <details> wrapper was skipped). If an archived review contains a literal </details> line inside a fenced code block (e.g., when reviewing this script), closes > opens is true on a healthy archive and the oldest round's closing </details> is stripped. Only trim a trailing </details> when first > 0 actually discarded an opening <details> before the first round marker, and add a self-test covering both AGY_ARCHIVE_SECTION in agy_body_head and the pre-migration wrapper healing in agy_body_archive (scripts/agy-review-selftest.sh:177-185 still tests only the legacy layout).
  • scripts/agy-review.sh:698-710 — agy_scrub_utf8 always discards iconv output on glibc when a trailing multi-byte character is split: As noted in the comment on lines 693-697, GNU iconv -c writes the scrubbed output and exits 1 when it encounters an incomplete multi-byte sequence at EOF (the exact case byte truncation produces). Guarding mv "$1.utf8" "$1" on iconv exiting 0 means the iconv branch always fails and deletes $1.utf8 on glibc whenever a trailing character was split, spawning python3 every time and leaving invalid UTF-8 un-scrubbed on minimal glibc environments without python3.
  • scripts/agy-review.sh:327-357 — Unscoped variables and untracked temp files in agy_has_write_access: _login, _perm_err, _login_enc, and _perm are not declared local, and agy_has_write_access runs at line 379 before trap cleanup EXIT is registered at line 459. Declare those variables local and register the EXIT trap before agy_has_write_access (and track _perm_err, compare_err at line 607, and trimmed at line 1208 or clean them in the trap) so an interrupted gh api call does not leak temp files.

Nitpicks

  • scripts/agy-review.sh:558-577: The comment states "Every fetch on this path goes through agy_fetch", but lines 571-577 duplicate the GIT_CONFIG_COUNT=1 ... git fetch invocation inline instead of calling agy_fetch.
  • .github/AGY-REVIEWER.md:37: The fenced diagram block has no language identifier (text), which trips markdownlint MD040 if enabled.

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: daedce5a-02d4-4c81-9f03-b5bbb803cd3e)

@doublegate
doublegate merged commit b39e7e4 into main Nov 14, 2026
19 of 21 checks passed
@doublegate
doublegate deleted the ci/agy-reviewer-sync branch November 14, 2026 13:28
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