Skip to content

ci: add Antigravity PR reviewer (self-hosted, Ultra) - #49

Merged
doublegate merged 1 commit into
mainfrom
chore/antigravity-review
Jul 22, 2026
Merged

ci: add Antigravity PR reviewer (self-hosted, Ultra)#49
doublegate merged 1 commit into
mainfrom
chore/antigravity-review

Conversation

@doublegate

Copy link
Copy Markdown
Owner

What this adds

The Antigravity PR reviewer — a self-hosted, Google AI Ultra-backed
auto-reviewer that replaces the retired Gemini Code Assist app. Installed from
the template at ~/Code/Local_Only-Projects/antigravity-pr-review via
install-into-repo.sh --with-style-guide.

  • .github/workflows/antigravity-review.yml — triggers on PR open and on an
    /agy-review comment; runs on the self-hosted runner labelled agy.
  • scripts/agy-review.sh + scripts/_agy_print.sh — the reviewer (diff →
    adversarial prompt + style guide → agy CLI → PR comment) and its PTY helper.
  • .github/agy-review.md — the starter review style guide.

No repository secrets: the job posts with GITHUB_TOKEN and runs the model on
the machine's cached agy OAuth session (Ultra rate limits, not a metered API
key). .gitignore is intentionally untouched — the reviewer writes only to temp
dirs.

Live test

Opening this PR fires the opened trigger from this branch, so this PR is
its own end-to-end test — a "Antigravity review (Gemini via Ultra)" comment
should post within a minute or two now that the agy runner is online. Merging
to main is what enables auto-review-on-open and the /agy-review trigger for
every future PR.

🤖 Generated with Claude Code

Installs the Antigravity PR reviewer from the template at
~/Code/Local_Only-Projects/antigravity-pr-review via install-into-repo.sh
--with-style-guide:

- .github/workflows/antigravity-review.yml — triggers on PR open + /agy-review
  comment, runs on the self-hosted `agy`-labelled runner.
- scripts/agy-review.sh + scripts/_agy_print.sh — the reviewer (diff → prompt →
  agy → PR comment) and its PTY fallback helper.
- .github/agy-review.md — the starter review style guide.

No repository secrets: the job uses GITHUB_TOKEN to post and the local agy OAuth
session for the model. .gitignore is intentionally left untouched (the reviewer
writes only to temp dirs).

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

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added automated pull request reviews triggered when pull requests are opened or updated through /agy-review comments.
    • Reviews now analyse changes, apply project-specific guidance, and post structured feedback directly to the pull request.
    • Added fallback support to improve review generation when standard terminal output tools are unavailable.
  • Documentation

    • Added a review style guide defining priorities and feedback categories, including blocking issues, suggestions, and nitpicks.

Walkthrough

Adds an Antigravity-based GitHub Actions review flow. It loads repository review guidance, resolves pull-request events, fetches and truncates diffs, runs the CLI with PTY fallbacks, recovers empty output from SQLite, and replaces earlier automated review comments.

Changes

Antigravity review flow

Layer / File(s) Summary
Review triggers and configuration
.github/agy-review.md, .github/workflows/antigravity-review.yml
Adds review guidance, PR and /agy-review comment triggers, concurrency control, permissions, runner selection, checkout, and configurable execution variables.
PR input and prompt construction
scripts/agy-review.sh
Resolves the PR, retrieves metadata and the unified diff, truncates oversized diffs, and builds the review prompt with the optional style guide.
Headless review execution and recovery
scripts/agy-review.sh, scripts/_agy_print.sh
Runs agy through PTY-compatible paths, normalises output, and recovers assistant text from the local SQLite conversation database when needed.
Comment assembly and publication
scripts/agy-review.sh
Creates the marked automated review comment, removes prior marked comments, and posts the replacement through gh.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHub
  participant Workflow
  participant agy-review.sh
  participant gh
  participant agy
  GitHub->>Workflow: trigger on PR event or /agy-review comment
  Workflow->>agy-review.sh: execute review script
  agy-review.sh->>gh: fetch PR metadata and diff
  agy-review.sh->>agy: submit review prompt
  agy->>agy-review.sh: return review text
  agy-review.sh->>gh: delete marked comment and post new review
Loading
🚥 Pre-merge checks | ✅ 7 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title matches the change, but it does not satisfy the required Conventional Commits type(scope): subject format. Change it to ci(<scope>): add Antigravity PR reviewer or another valid type(scope): subject form, and keep it under 72 characters.
Changelog Entry For User-Visible Changes ⚠️ Warning Violates the CHANGELOG rule: this user-visible reviewer/workflow ships with no Unreleased entry; CHANGELOG.md is untouched and has no Antigravity/agy note. Add an Unreleased bullet for the new PR reviewer/workflow and any user-facing behaviour change before merge.
Measured, Never Tuned ⚠️ Warning FAIL: AGY_PRINT_TIMEOUT=5m and MAX_DIFF_BYTES=200000 are new timing/size constants with no manual/wiki citation or docs/accuracy-ledger.md provenance, contrary to the ledger rule. Add a manual/wiki citation or record each constant in docs/accuracy-ledger.md with how it was measured; otherwise avoid checked-in defaults for tuned values.
✅ Passed checks (7 passed)
Check name Status Explanation
Description check ✅ Passed The description is on-topic and matches the workflow, scripts, and style guide added here.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Oracle Number Is Stated ✅ Passed PASS: the diff is limited to workflow, review scripts, and a style guide; no emulation behaviour changes, so the oracle-number rule is not applicable.
Docs-As-Spec Sync ✅ Passed Not applicable: the diff only touches .github and scripts; no crates/rustyn64-* code changed, so no docs/.md sync was required.
Unsafe Stays Out Of The Chip Crates ✅ Passed PR only changes workflow/docs/shell; no Rust files were touched, and the diff contains no unsafe or forbid(unsafe_code) edits.

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

Antigravity review (Gemini via Ultra)

This PR adds a self-hosted GitHub Actions workflow, style guide, and helper Bash scripts to run automated code reviews via the Antigravity CLI (agy) and post review comments to GitHub PRs.

Blocking issues

  • Unquoted path expansion in script -c command string (scripts/agy-review.sh:108)
    $here is unquoted inside the -c argument passed to script: script -qfec "$here/_agy_print.sh '$prompt_file' ${flags[*]}" "$raw". If the repository workspace directory contains spaces, shell word splitting will break script execution or result in unexpected command execution.
  • Data exposure and race condition in SQLite fallback (scripts/agy-review.sh:124-128)
    ls -t "$CONV_DIR"/*.db | head -1 selects the most recently modified database file from the shared user directory $HOME/.gemini/antigravity-cli/conversations. On a self-hosted runner handling concurrent jobs or interactive tasks, this risks posting review output or prompt context from an unrelated pull request or private local session.
  • Diff/prompt exposure via process table (scripts/_agy_print.sh:9, scripts/agy-review.sh:105)
    Passing --print "$(cat "$prompt_file")" expands the full prompt and PR diff directly into process arguments. Any process running on the host machine can view the full contents of the diff via ps aux or /proc.

Suggestions

  • Missing tests for new script behavior (Style guide rule 4)
    The style guide requires tests to accompany behavior changes. There are no tests verifying PR event parsing, diff truncation, or comment posting logic in scripts/agy-review.sh.
  • Large argument payload risks (scripts/_agy_print.sh:9)
    Expanding up to 200 KB of text via $(cat "$prompt_file") as a CLI flag argument risks exceeding system ARG_MAX limits depending on environmental constraints. Pass the file path or pipe the prompt via standard input instead.
  • Swallowed execution errors (scripts/agy-review.sh:105, scripts/agy-review.sh:108)
    Appending || true to the execution of unbuffer and script swallows environment failures (such as missing execution permissions or broken PTY allocation) without logging explicit error details before downstream validation.

Nitpicks

  • scripts/agy-review.sh:36: jq -r '.pull_request.number' returns the string "null" if the field is missing, which bypasses [ -n "$PR" ] checks and fails downstream in gh pr diff.
  • scripts/agy-review.sh:157: Silently ignoring failures when deleting previous review comments (|| true) can result in duplicate review comments if gh api DELETE fails due to scope permissions.

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

@doublegate
doublegate merged commit 6bcf426 into main Jul 22, 2026
9 of 10 checks passed
@doublegate
doublegate deleted the chore/antigravity-review branch July 22, 2026 04:02

@coderabbitai coderabbitai 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.

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/agy-review.md:
- Line 17: Update the Conventional Commits requirement in the commit-format
guidance to explicitly require <type>(<scope>): <subject>, including a mandatory
scope, an imperative subject, and a maximum subject length of 72 characters.

In @.github/workflows/antigravity-review.yml:
- Around line 20-23: Update the workflow permissions block to change
pull-requests access from write to read, while retaining contents: read and
issues: write for reading repository data and publishing comments.
- Around line 27-32: Restrict the workflow trigger in
.github/workflows/antigravity-review.yml lines 27-32 to trusted comment authors
and prevent fork PRs from reaching the privileged runner; in lines 34-49, check
out and execute only scripts from the trusted base ref, never the PR head. In
scripts/agy-review.sh lines 93-100, remove --dangerously-skip-permissions,
isolate the agy agent, and keep the publication token out of its process
environment.
- Line 35: Update the actions/checkout step in the workflow to use the immutable
commit pin 11d5960a326750d5838078e36cf38b85af677262 instead of the mutable `@v4`
reference.

In `@scripts/agy-review.sh`:
- Around line 155-159: Update the comment-cleanup pipeline in
scripts/agy-review.sh to resolve the authenticated automation account login,
then filter API results by both .user.login matching that login and .body
containing MARKER before deleting IDs. Preserve the existing pagination and
deletion behavior for comments owned by the automation.
- Around line 124-136: Update the SQLite fallback around the conversation
database lookup to persist and reuse the current agy conversation ID for this
invocation, then constrain each assistant-message query to that conversation
record rather than selecting the newest database and latest global row. If the
ID is unavailable or no matching record can be queried, fail closed without
writing unrelated conversation content to out_file.
- Around line 93-109: Update the agy invocation in the unbuffer execution path
to prevent untrusted PR diffs from reaching a tool-enabled, credentialed
session: either run it inside a disposable sandbox with no host credentials or
invoke it without tool access and without --dangerously-skip-permissions.
Preserve the existing prompt and output-capture behavior while ensuring
malicious diff content cannot access local files or post GitHub changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8e412793-2d34-4ca1-b977-6db0e2c9aa49

📥 Commits

Reviewing files that changed from the base of the PR and between c3e5291 and 746a101.

📒 Files selected for processing (4)
  • .github/agy-review.md
  • .github/workflows/antigravity-review.yml
  • scripts/_agy_print.sh
  • scripts/agy-review.sh

Comment thread .github/agy-review.md
4. Tests accompany behavior changes.

## Conventions
- Conventional Commits (`feat|fix|docs|refactor|test|chore|perf|build|ci`).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Specify the mandated Conventional Commit format.

This permits scope-less messages and omits the imperative-subject and 72-character requirements. Require <type>(<scope>): <subject> explicitly.

As per coding guidelines, “Use Conventional Commits with <type>(<scope>): <subject>, an imperative subject of at most 72 characters”.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/agy-review.md at line 17, Update the Conventional Commits
requirement in the commit-format guidance to explicitly require <type>(<scope>):
<subject>, including a mandatory scope, an imperative subject, and a maximum
subject length of 72 characters.

Source: Coding guidelines

Comment on lines +20 to +23
permissions:
contents: read
pull-requests: write
issues: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Security Misconfiguration (CWE-250)

Reachability: External

Reduce pull-requests to read access.

The supplied script reads PR metadata/diffs but writes only issue comments. pull-requests: write unnecessarily expands the token available to this job; use pull-requests: read and retain issues: write only for comment publication.

As per path instructions, workflows must have least-privilege permissions: blocks.

🧰 Tools
🪛 zizmor (1.26.1)

[error] 22-22: overly broad permissions (excessive-permissions): pull-requests: write is overly broad at the workflow level

(excessive-permissions)


[error] 23-23: overly broad permissions (excessive-permissions): issues: write is overly broad at the workflow level

(excessive-permissions)


[warning] 22-22: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment

(undocumented-permissions)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/antigravity-review.yml around lines 20 - 23, Update the
workflow permissions block to change pull-requests access from write to read,
while retaining contents: read and issues: write for reading repository data and
publishing comments.

Sources: Path instructions, Linters/SAST tools

Comment on lines +27 to +32
# PR opened/reopened, OR an `/agy-review` comment on a PR.
if: >-
github.event_name == 'pull_request' ||
(github.event.issue.pull_request != null &&
startsWith(github.event.comment.body, '/agy-review'))
runs-on: [self-hosted, agy]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🔴 Critical | 🏗️ Heavy lift

LLM Security (CWE-74): Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')

Reachability: External

Keep untrusted PR input out of the privileged runner and agent.

An external PR can trigger this job, alter the checked-out scripts that Lines 48-49 execute, and inject instructions through the raw diff. The same step exports GH_TOKEN and invokes agy with permission checks disabled.

  • .github/workflows/antigravity-review.yml#L27-L32: restrict comment-triggered reviews to trusted repository associations and do not dispatch untrusted fork PRs to the agy runner.
  • .github/workflows/antigravity-review.yml#L34-L49: execute only scripts checked out from a trusted base ref; never execute PR-head scripts on this runner.
  • scripts/agy-review.sh#L93-L100: remove --dangerously-skip-permissions; isolate the agent and keep the publication token outside its process environment.
🧰 Tools
🪛 actionlint (1.7.12)

[error] 32-32: label "agy" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2025-vs2026", "windows-2022", "windows-11-arm", "ubuntu-slim", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "macos-latest", "macos-latest-xlarge", "macos-latest-large", "macos-26-intel", "macos-26-xlarge", "macos-26-large", "macos-26", "macos-15-intel", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xlarge", "macos-14-large", "macos-14", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)

📍 Affects 2 files
  • .github/workflows/antigravity-review.yml#L27-L32 (this comment)
  • .github/workflows/antigravity-review.yml#L34-L49
  • scripts/agy-review.sh#L93-L100
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/antigravity-review.yml around lines 27 - 32, Restrict the
workflow trigger in .github/workflows/antigravity-review.yml lines 27-32 to
trusted comment authors and prevent fork PRs from reaching the privileged
runner; in lines 34-49, check out and execute only scripts from the trusted base
ref, never the PR head. In scripts/agy-review.sh lines 93-100, remove
--dangerously-skip-permissions, isolate the agy agent, and keep the publication
token out of its process environment.

runs-on: [self-hosted, agy]
steps:
- name: Check out repo (for the style guide + scripts)
uses: actions/checkout@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

gh api repos/actions/checkout/git/ref/tags/v4 --jq '.object'

Repository: doublegate/RustyN64

Length of output: 331


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

sha="$(gh api repos/actions/checkout/git/ref/tags/v4 --jq '.object.sha')"
gh api "repos/actions/checkout/commits/$sha" --jq '.sha'

Repository: doublegate/RustyN64

Length of output: 198


Security Misconfiguration (CWE-829): Inclusion of Functionality from Untrusted Control Sphere

Reachability: External

Pin actions/checkout to 11d5960a326750d5838078e36cf38b85af677262. @v4 is a mutable ref; the workflow should use an immutable commit pin for third-party actions.

🧰 Tools
🪛 zizmor (1.26.1)

[error] 35-35: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/antigravity-review.yml at line 35, Update the
actions/checkout step in the workflow to use the immutable commit pin
11d5960a326750d5838078e36cf38b85af677262 instead of the mutable `@v4` reference.

Sources: Path instructions, Linters/SAST tools

Comment thread scripts/agy-review.sh
Comment on lines +93 to +109
printf '\n--- UNIFIED DIFF ---\n'
cat "$diff_file"
} > "$prompt_file"

# --- run agy headless, under a PTY (works around agy issue #76: -p drops --------
# stdout when stdout is not a TTY, e.g. piped/redirected/subprocess) ---------
flags=( --print-timeout "$AGY_PRINT_TIMEOUT" --sandbox --dangerously-skip-permissions )
[ -n "$AGY_MODEL" ] && flags+=( --model "$AGY_MODEL" )
[ -n "$AGY_EFFORT" ] && flags+=( --effort "$AGY_EFFORT" )

out_file="$(mktemp)"
here="$(cd "$(dirname "$0")" && pwd)"
: > "$LOG"

if command -v unbuffer >/dev/null 2>&1; then
log "running agy via unbuffer (allocates a PTY)"
unbuffer "$AGY_BIN" "${flags[@]}" --print "$(cat "$prompt_file")" > "$out_file" 2>>"$LOG" || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Inspecting scripts/agy-review.sh and related references...\n'
wc -l scripts/agy-review.sh
sed -n '80,125p' scripts/agy-review.sh
printf '\n--- search references ---\n'
rg -n --hidden --no-ignore-vcs "dangerously-skip-permissions|AGY_BIN|agy-review\.sh|prompt_file|diff_file" .

Repository: doublegate/RustyN64

Length of output: 4153


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Inspecting workflow and prompt framing...\n'
wc -l .github/workflows/antigravity-review.yml scripts/agy-review.sh
printf '\n--- workflow ---\n'
sed -n '1,220p' .github/workflows/antigravity-review.yml
printf '\n--- prompt framing ---\n'
sed -n '70,110p' scripts/agy-review.sh

Repository: doublegate/RustyN64

Length of output: 3766


LLM Security

Reachability: External

Do not feed untrusted diffs to a tool-enabled agent
This job runs on a self-hosted runner with the logged-in agy session and a write-scoped GITHUB_TOKEN (pull-requests: write, issues: write). Passing the raw PR diff into the prompt while --dangerously-skip-permissions is enabled gives a malicious PR a practical prompt-injection path to local files and to posted review output. Run the reviewer in a disposable sandbox with no host credentials, or remove tool access for this pass.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/agy-review.sh` around lines 93 - 109, Update the agy invocation in
the unbuffer execution path to prevent untrusted PR diffs from reaching a
tool-enabled, credentialed session: either run it inside a disposable sandbox
with no host credentials or invoke it without tool access and without
--dangerously-skip-permissions. Preserve the existing prompt and output-capture
behavior while ensuring malicious diff content cannot access local files or post
GitHub changes.

Comment thread scripts/agy-review.sh
Comment on lines +124 to +136
if ! have_text "$out_file"; then
log "print output empty; trying SQLite conversation fallback"
if command -v sqlite3 >/dev/null 2>&1 && [ -d "$CONV_DIR" ]; then
db="$(ls -t "$CONV_DIR"/*.db 2>/dev/null | head -1 || true)"
if [ -n "${db:-}" ]; then
for q in \
"SELECT text FROM messages WHERE role='assistant' ORDER BY rowid DESC LIMIT 1;" \
"SELECT content FROM messages WHERE role='assistant' ORDER BY rowid DESC LIMIT 1;" \
"SELECT body FROM message WHERE role='assistant' ORDER BY rowid DESC LIMIT 1;"; do
sqlite3 "$db" "$q" > "$out_file" 2>/dev/null && have_text "$out_file" && break
done
fi
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

find "$HOME/.gemini/antigravity-cli/conversations" \
  -maxdepth 1 -type f -name '*.db' -print0 |
while IFS= read -r -d '' db; do
  printf '\n== %s ==\n' "$db"
  sqlite3 "$db" '.schema'
done

Repository: doublegate/RustyN64

Length of output: 245


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Map the target file and related symbols.
ast-grep outline scripts/agy-review.sh --view expanded

printf '\n--- CONV_DIR / sqlite3 / invocation references ---\n'
rg -n "CONV_DIR|sqlite3|invocation|conversation|assistant|messages" scripts/agy-review.sh scripts -g '!**/*.md'

Repository: doublegate/RustyN64

Length of output: 2337


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Read the relevant slice with line numbers once we know the file size.
wc -l scripts/agy-review.sh
sed -n '1,220p' scripts/agy-review.sh | cat -n | sed -n '100,170p'

Repository: doublegate/RustyN64

Length of output: 3319


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

sed -n '1,220p' scripts/agy-review.sh | cat -n | sed -n '100,170p'
rg -n "CONV_DIR|sqlite3|invocation|conversation|assistant|messages" scripts/agy-review.sh scripts -g '!**/*.md'

Repository: doublegate/RustyN64

Length of output: 5385


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Show the target file contents around the reported lines and locate any scoping logic.
nl -ba scripts/agy-review.sh | sed -n '110,150p'

printf '\n--- symbol search ---\n'
rg -n "CONV_DIR|invocation|conversation|messages|assistant|sqlite3" scripts/agy-review.sh

Repository: doublegate/RustyN64

Length of output: 197


Information Disclosure (CWE-200): Exposure of Sensitive Information to an Unauthorized Actor

Reachability: External

Scope the SQLite fallback to the current agy conversation. Picking the newest .db and latest assistant row is not tied to this run, so overlapping jobs can post another review’s content to the wrong PR. Persist the conversation ID for this invocation and query only that record; otherwise fail closed.

🧰 Tools
🪛 Shellcheck (0.11.0)

[info] 127-127: Use find instead of ls to better handle non-alphanumeric filenames.

(SC2012)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/agy-review.sh` around lines 124 - 136, Update the SQLite fallback
around the conversation database lookup to persist and reuse the current agy
conversation ID for this invocation, then constrain each assistant-message query
to that conversation record rather than selecting the newest database and latest
global row. If the ID is unavailable or no matching record can be queried, fail
closed without writing unrelated conversation content to out_file.

Comment thread scripts/agy-review.sh
Comment on lines +155 to +159
gh api "repos/${REPO}/issues/${PR}/comments" --paginate \
--jq ".[] | select(.body | contains(\"${MARKER}\")) | .id" 2>/dev/null \
| while read -r cid; do
[ -n "$cid" ] && gh api -X DELETE "repos/${REPO}/issues/comments/${cid}" >/dev/null 2>&1 || true
done

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Delete only comments owned by this automation.

The marker is not an ownership check: any human or other bot comment containing it is selected for deletion. Resolve the authenticated bot login and filter on both .user.login and the marker.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/agy-review.sh` around lines 155 - 159, Update the comment-cleanup
pipeline in scripts/agy-review.sh to resolve the authenticated automation
account login, then filter API results by both .user.login matching that login
and .body containing MARKER before deleting IDs. Preserve the existing
pagination and deletion behavior for comments owned by the automation.

Repository owner deleted a comment from gemini-code-assist Bot Jul 22, 2026
doublegate added a commit that referenced this pull request Jul 22, 2026
* fix(ci): harden the Antigravity reviewer per its own review of #49

The Antigravity (github-actions) review on #49 flagged real issues in the
vendored reviewer scripts; I merged #49 without adjudicating them. This applies
the safe, inspection-verifiable fixes to this repo's deployed copy:

- SQLite conversation fallback is now opt-in (AGY_SQLITE_FALLBACK=1, default
  off) and only considers a db modified in the last two minutes. It read the
  newest .db from a shared per-user dir, which on a busy runner could surface an
  unrelated PR's or a private local conversation. The PTY path is the normal
  route, so defaulting the fallback off costs nothing in practice.
- The pull_request PR-number lookup uses `// empty` + an explicit guard, so a
  missing field skips cleanly instead of passing the string "null" downstream.
- `"$here"` is single-quoted inside the script(1) fallback command string, so a
  workspace path with spaces stays one token.

Deferred (not fixed here): the primary path passes the prompt+diff via
`--print "$(cat ...)"`, exposing it in the process table. The template's
in-progress `_agy_pty.py` ("argv-safe") is the correct fix; this repo re-vendors
it once that migration lands. See the PR for the full finding adjudication.

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

* ci: re-vendor the updated Antigravity reviewer (concurrency + flock/retry)

Replaces the manual stopgap hardening with the authoritative upstream template
(~/Code/Local_Only-Projects/antigravity-pr-review), which now fixes the actual
root cause of the "agy fails fast" review failures I diagnosed:

- Job-level concurrency in the workflow, so an issue_comment run (e.g. a
  CodeRabbit comment landing mid-review) no longer cancels an in-progress
  pull_request review — the cancellation race that killed the #48/#50 runs.
- agy is serialized across concurrent review jobs with flock, and the whole
  attempt retries on empty output — agy runs a singleton local server per user,
  so two --print calls at once collide and one reports the backend unavailable.

The template is internally consistent again (all references resolve to
_agy_print.sh). .gitignore untouched. This supersedes the earlier manual jq /
SQLite / quoting fixes on this branch with the maintained versions.

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

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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