Skip to content

Tighten agent docs, review skill, and guardrails - #3315

Open
CydeWeys wants to merge 1 commit into
google:masterfrom
CydeWeys:centralize-pr-review-rules
Open

CydeWeys wants to merge 1 commit into
google:masterfrom
CydeWeys:centralize-pr-review-rules

Conversation

@CydeWeys

@CydeWeys CydeWeys commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

After migrating repository skills to .agents/skills/ (#3295), adding scoped AGENTS.md guides (#3311), and adding the on-demand pr-review skill (#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%.

Summary of Changes

  • Centralize 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-scope always-on rules and fix 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.
  • Harden guardrail scripts and wire 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


This change is Reviewable

@CydeWeys
CydeWeys requested a review from gbrodman December 5, 2026 04:09
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>
@CydeWeys
CydeWeys force-pushed the centralize-pr-review-rules branch from 62f8e09 to c66643a Compare December 5, 2026 04:30
@CydeWeys CydeWeys changed the title Centralize PR review rules in pr-review skill Tighten agent docs, review skill, and guardrails Dec 5, 2026
@CydeWeys
CydeWeys enabled auto-merge December 5, 2026 04:40

This branch has not been deployed

No deployments
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