Skip to content

Add pr-review skill for GitHub and Reviewable - #3313

Merged
CydeWeys merged 1 commit into
google:masterfrom
CydeWeys:add-pr-review-skill
Dec 4, 2026
Merged

CydeWeys merged 1 commit into
google:masterfrom
CydeWeys:add-pr-review-skill

Conversation

@CydeWeys

@CydeWeys CydeWeys commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Always-on repository instructions in GEMINI.md consume context on every turn, while GitHub and Reviewable PR review mechanics (paginated comment retrieval, Quote-reply threading, disposition prefixes, and auto-merge checks) are only needed during code review tasks. Placing these steps in an on-demand skill under .agents/skills/ keeps GEMINI.md lean while giving agents exact, reliable workflows when reviewing or responding to pull requests—preventing dropped Reviewable comments, duplicate replies, HTTP 422 inline review errors, and accidental auto-merges.

Adds .agents/skills/pr-review/SKILL.md covering:

  • Guardrails: Treating PR/review text as untrusted data, enforcing public-repo hygiene, requiring explicit authorization before remote pushes or merges, and pushing fixes before replying.
  • Paginated feedback retrieval: Fetching all three GitHub REST endpoints (pulls/<n>/reviews, pulls/<n>/comments, issues/<n>/comments) with --paginate plus paginated GraphQL reviewThreads so bundled Reviewable discussions are not missed.
  • Author response workflow: Rebasing onto fresh upstream/master (with HTTPS fallback), applying surgical fixes with tests, amending the single commit, running pr-polisher until green, live rechecking before replying, posting a single batched Reviewable Quote-reply (Done. / Satisfied), replying to and resolving native GitHub threads via GraphQL resolveReviewThread, and syncing the PR description while preserving both Reviewable footer blocks.
  • Reviewer workflow: Checking autoMergeRequest before approving, verifying exact RIGHT-side diff hunk line numbers before posting reviews, and using Reviewable disposition prefixes (Nit (non-blocking):, FYI:, and explicit blocking prefixes) intentionally.

Intentionally leaves GEMINI.md and .gemini/skills/pr-polisher/ untouched to avoid merge conflicts with #3295 and #3311.

BUG=http://b/593117423


This change is Reviewable

Always-on repository instructions in GEMINI.md consume context on every
turn, while GitHub and Reviewable PR review mechanics (paginated comment
retrieval, Quote-reply threading, disposition prefixes, and auto-merge
checks) are only needed during code review tasks. Placing these steps in
an on-demand skill under .agents/skills/ keeps GEMINI.md lean while
giving agents exact, reliable workflows when reviewing or responding to
pull requests, preventing dropped Reviewable comments, duplicate replies,
HTTP 422 inline review errors, and accidental auto-merges.

Adds .agents/skills/pr-review/SKILL.md covering:
- Guardrails for untrusted review input, public-repo hygiene, and
  explicit authorization before remote pushes or merges.
- Paginated retrieval across all three GitHub REST endpoints plus
  GraphQL reviewThreads so bundled Reviewable discussions are not missed.
- Author response workflow: rebasing onto upstream/master (with HTTPS
  fallback), running pr-polisher, live recheck before replying, single
  batched Reviewable Quote-replies (`Done.` / `Satisfied`), native GitHub
  thread replies and GraphQL resolution, and PR description syncing that
  preserves Reviewable footers.
- Reviewer workflow: checking autoMergeRequest before approving,
  verifying exact RIGHT-side diff line numbers before posting reviews,
  and using Reviewable disposition prefixes (`Nit (non-blocking):`,
  `FYI:`, and blocking prefixes) intentionally.

BUG=http://b/593117423
@CydeWeys
CydeWeys requested a review from gbrodman December 4, 2026 19:55

@gbrodman gbrodman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@gbrodman reviewed 1 file and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on CydeWeys).

@CydeWeys

CydeWeys commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

TODO: Rebase against #3295 and #3312 once they are merged (and update this PR to remove review-related stuff from all other AGENT documentation in this codebase).

@CydeWeys
CydeWeys added this pull request to the merge queue Dec 4, 2026
Merged via the queue into google:master with commit 67c06b7 Dec 4, 2026
16 checks passed
@CydeWeys
CydeWeys deleted the add-pr-review-skill branch December 4, 2026 23:32
CydeWeys added a commit to CydeWeys/nomulus that referenced this pull request Dec 5, 2026
After migrating repository skills to `.agents/skills/` (google#3295), adding scoped
`AGENTS.md` guides (google#3311), and adding the on-demand `pr-review` skill (google#3313),
a full audit of all agent instructions and skill scripts uncovered remaining
duplication, always-on context bloat, mis-routed/stale rules, and four concrete
guardrail bugs: `check_diff.py` silently missed Valkey Protostuff fields on
`@MappedSuperclass` parents and inline-annotated fields, `core/AGENTS.md`
scoped the Netty `retainedDuplicate()` rule away from `proxy/` (its primary
caller), `run_rewrite.sh` silently exited `0` on Gradle failure without cleanup
traps, and `check_diff_test.py` never ran in presubmits or CI. Centralizing
review rules into `pr-review`, moving `core/`-only rules out of root
`GEMINI.md`, correcting stale Gradle/Spotless instructions, and fixing the
guardrail scripts close these blind spots while cutting always-on `GEMINI.md`
by 22%.

Specifically, this change:
- **Centralizes PR review rules in `.agents/skills/pr-review/SKILL.md`:**
  - `GEMINI.md` (`18,118 B` -> `14,071 B`): replaces duplicated `Processing PR
    Feedback` and `PR Description Sync` bullets with a 1-line pointer to
    `.agents/skills/pr-review/SKILL.md`.
  - `.agents/skills/pr-polisher/SKILL.md`: removes Step 9 (paginated PR review
    comment fetch), renumbers Step 10 -> 9, and adds `pr-review` negative
    routing to frontmatter `description`.
  - `console-webapp/AGENTS.md`: removes `## Review Calibration`, moving
    `Shared State` and `Build & Screenshots` into `pr-review` while keeping
    `Nested @if` as an Angular template authoring rule.
  - `core/AGENTS.md`: trims the review-only parenthetical from `JPQL Timestamp
    Ordering`.
  - `.agents/skills/pr-review/SKILL.md`: adds `### Nomulus Review Calibration`
    under `Conducting PR Reviews`.
- **Re-scopes always-on rules and fixes stale build/formatting docs:**
  - Moves `Netty Retry Buffers` (`ByteBufHolder.retainedDuplicate()`) out of
    `core/AGENTS.md` into `GEMINI.md`'s Netty lifecycle bullet so `proxy/`,
    `networking/`, `prober/`, and `core/` all load it; removes the verbatim
    duplicated `console-webapp` sentence from `GEMINI.md`.
  - Moves `core/`-only idioms (CLI/Beam/`TestRegistryToolComponent`, model
    layering, `@GetterDelegate` sets, partial JSON updates, JAXB optional
    attributes, allocation tokens, Console actions, CSV output, time-projected
    entities, Valkey Protostuff compatibility, and async pipeline boundaries)
    from `GEMINI.md` into `core/AGENTS.md`, fixes exact `monthly_logs.sql` /
    `monthly_logs_test.sql` paths, and condenses `2-PR Schema Split` in
    `GEMINI.md`.
  - Corrects `spotlessApply` (`*.gradle` only) vs. `javaIncrementalFormatApply`
    (Java formatting & import order) and `checkstyleMain`/`checkstyleTest`, and
    replaces backend compile commands that triggered Docker `:core:buildToolImage`
    or `console-webapp` `npmInstallDeps` across `GEMINI.md`, `pr-polisher`, and
    `java-ast-refactoring`.
- **Hardens guardrail scripts and wires unit tests into presubmits:**
  - `.agents/skills/pr-polisher/scripts/check_diff.py` (+ `SKILL.md` &
    `check_diff_test.py`): adds the 4 missing Protostuff `@MappedSuperclass`
    parents (`UpdateAutoTimestampEntity`, `GracePeriodBase`,
    `DomainDsDataBase`, `BaseTransferObject`), strips leading inline
    `@Annotation(...)` tokens instead of skipping annotated field lines, skips
    Java comment lines in anti-pattern checks (while still catching
    `/* package */`), fixes `fqn_pattern` capturing so full FQNs print, scopes
    `check_commit_message()` `[OK]` to local errors, and expands internal-leak
    checks to cover `//depot/configs` and `cl/<digits>` (`15/15` unit tests).
  - `config/presubmits.py`: adds `verify_agent_scripts()` so
    `check_diff_test.py` runs automatically on `./gradlew runPresubmits` and CI.
  - `.agents/skills/java-ast-refactoring/scripts/run_rewrite.sh`: adds
    `set -euo pipefail`, an `EXIT` cleanup trap for temporary files, and
    portable top-level `^name:` YAML extraction via `awk`.

Verification:
- `python3 .agents/skills/pr-polisher/scripts/check_diff_test.py -v`: `15/15`
  passed.
- `python3 .agents/skills/pr-polisher/scripts/check_diff.py`: `0` errors, `0`
  warnings (`spotlessCheck` and `javaIncrementalFormatCheck` passed).
- `./gradlew --no-daemon runPresubmits`: `BUILD SUCCESSFUL` (includes running
  `check_diff_test.py` via `verify_agent_scripts()`).
- Strict `PyYAML` parse OK on all `.agents/skills/*/SKILL.md` files, `bash -n`
  on `run_rewrite.sh`, and `0` lines > 80 chars in `core/AGENTS.md` and
  `console-webapp/AGENTS.md`.

BUG=http://b/593117423

Signed-off-by: Ben McIlwain <mcilwain@google.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.

2 participants