Skip to content

Add guidance on sizing and splitting PRs to AGENTS.md - #2494

Merged
cjluo-nv merged 2 commits into
mainfrom
chenjiel/agents-md-pr-splitting
Sep 22, 2026
Merged

cjluo-nv merged 2 commits into
mainfrom
chenjiel/agents-md-pr-splitting

Conversation

@cjluo-nv

@cjluo-nv cjluo-nv commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Type of change: documentation

Adds a ## Sizing and splitting PRs section to AGENTS.md (symlinked as CLAUDE.md) so AI-assisted work stops producing one giant PR that nobody wants to review.

The new guidance tells the agent to:

  • Keep each PR that goes up for review under ~500 changed lines of source, and check the size before opening.
  • Propose the split before opening an oversized PR rather than after.
  • Split on file/directory/module boundaries first and fall back to feature boundaries (enabling refactor first, then one PR per behavior it unlocks).
  • Keep the series acyclic and linearly ordered — no circular dependencies between sub-PRs — and state the merge order.
  • Prefix sub-PR titles with [x/N] so reviewers know the PR is one slice of a planned split, and link the siblings.
  • Make every sub-PR stand on its own: it builds, carries unit tests for the code it introduces, and passes CI without the later PRs.
  • Optionally submit the whole change as a reference-only draft PR for the big picture, cross-linked with the sub-PRs.

Usage

N/A — no API or flag change.

Testing

pre-commit run --files AGENTS.md (markdownlint and the other applicable hooks pass).

Before your PR is "Ready for review"

  • Is this change backward compatible?: ✅
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: N/A
  • Did you write any new necessary tests?: N/A
  • Did you update Changelog?: N/A
  • Did you get Claude approval on this PR?: ❌

Additional Information

This PR is itself well under the new budget (26 added lines in one file), so no split applies.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated pull request sizing guidance to allow oversized changes when they cannot be meaningfully split.
    • Clarified that draft aggregate pull requests are optional and intended for reference only when splitting would reduce clarity.
    • Added examples covering self-contained changes and new models or backends without a functional intermediate state.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Chenjie Luo <chenjiel@nvidia.com>
@cjluo-nv
cjluo-nv requested a review from a team as a code owner September 21, 2026 22:32
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: NVIDIA/Model-Optimizer/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0e0d9a55-8aa5-414f-ac58-48cdbd3f7faa

📥 Commits

Reviewing files that changed from the base of the PR and between 18676f0 and f26e5c7.

📒 Files selected for processing (1)
  • AGENTS.md

Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review.


📝 Walkthrough

Walkthrough

AGENTS.md expands exceptions to the approximate 500-line source-change budget and makes aggregate draft pull requests optional when splitting harms comprehensibility.

Changes

PR sizing guidance

Layer / File(s) Summary
Sizing and splitting guidance
AGENTS.md
The guide adds exceptions for self-contained examples and new models or backends without a working intermediate state. It makes the full-change draft pull request optional while retaining its reference-only requirements.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other

Suggested reviewers: kevalmorabia97

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding PR sizing and splitting guidance to AGENTS.md.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
Security Anti-Patterns ✅ Passed The pull request changes only AGENTS.md (+29 lines). The authoritative diff contains no modelopt or examples Python changes and no pyproject.toml or requirements changes. Therefore, none of th…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

@meenchen meenchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bot review (claude-opus-5) — DM the bot to share feedback.

Nudge — the docs-only addition is clean and doesn't duplicate anything in CONTRIBUTING.md or the skills tree, but the final bullet reads as a mandate that contradicts an earlier rule.

Needs action:

  • Reconcile the last bullet in AGENTS.md ("Submit the whole change as a draft PR") with the PR body, which calls it optional, and with the earlier "don't open the big one and ask afterwards" rule — as written an agent will always open the oversized draft.
  • Confirm the ~500-line budget is the number the eng meeting agreed on; this repo regularly lands cohesive 1000+ line PRs (recipe renames, ONNX capability splits), so the "cannot be split" exception may need to name those cases.

No action needed:

  • No licensing, API, or test surface is touched; pre-commit/markdownlint concerns are covered (MD013 is disabled).
  • CLAUDE.md is a symlink to AGENTS.md, so the new section propagates without a second edit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Chenjie Luo <chenjiel@nvidia.com>
@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.14%. Comparing base (051d6ad) to head (f26e5c7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2494   +/-   ##
=======================================
  Coverage   71.14%   71.14%           
=======================================
  Files         603      603           
  Lines       66739    66739           
=======================================
  Hits        47482    47482           
  Misses      19257    19257           
Flag Coverage Δ
unit 58.21% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cjluo-nv

Copy link
Copy Markdown
Collaborator Author

Thanks — pushed f26e5c7 addressing the first item; pushing back on part of the second.

Reconcile the draft-PR bullet — addressed. You're right that it read as a mandate: an agent would have opened an oversized reference draft on every PR, including ones that were never split. The last bullet now reads "When a split makes the whole hard to follow, the full change may also go up as a draft PR — for reference only, never as a second review request," which scopes it to the split case and removes the tension with "don't open the big one and ask afterwards." The PR body's "optionally" now matches the file.

Confirm the ~500-line budget — keeping 500; exception list widened. 500 is the number the repo owner asked for in this change, so I've left it as-is rather than re-deriving it. The premise behind the second half checks out, though. Over the last 100 first-parent commits on main (excluding CHANGELOG.rst and lockfiles):

  • median 200 lines, p75 632, p90 1752
  • 30% exceed 500 lines, 17% exceed 1000

The median PR fits the budget, but the large tail is real and often genuinely atomic — Add PETR ONNX PTQ example (1991), Add IQ quantization codecs and backend (1650), Add Kimi-K3 NVFP4 experts recipe (2681). The original exception list ("a mechanical rename or generated files") was too narrow for those, so it now also names "a self-contained drop such as a new example or a new model/backend that has no working intermediate state." The ONNX capability split (#2468) you cited is a case the guidance would still ask to split — and it was, per its title.

Also worth noting for the [x/N] bullet: this codifies existing practice rather than inventing a convention — [1/n] Adds skip-softmax calibration (#1992), FSDP2 calibration with hf_ptq.py [1/2] (#1563), [2/3][Feat]: Offline DFlash training (#1343).

🤖 Generated with Claude Code

@meenchen meenchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bot review (claude-opus-5) — DM the bot to share feedback.

Approve — both prior concerns are settled in the current AGENTS.md, and this stays a docs-only change with no licensing, API, or test surface.

No action needed:

  • ✔️ Resolved since the last review: the draft-PR bullet now reads "may also go up as a draft PR … for reference only", removing the conflict with "don't open the big one and ask afterwards"; and the 500-line budget is confirmed as the owner's number with the exception list widened to cover self-contained example/model/backend drops.
  • CLAUDE.md is a symlink to AGENTS.md, so the new section propagates without a second edit.

@cjluo-nv
cjluo-nv merged commit 7a35cad into main Sep 22, 2026
32 checks passed
@cjluo-nv
cjluo-nv deleted the chenjiel/agents-md-pr-splitting branch September 22, 2026 05:52
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-22 05:53 UTC

cjluo-nv added a commit that referenced this pull request Sep 23, 2026
### What does this PR do?

Type of change: documentation

Adds an `## Updating skills` section to `AGENTS.md` (symlinked as
`CLAUDE.md`). Skills are loaded into agent context, so each extra line
costs tokens every time the skill runs. The new guidance tells the agent
to:

- Keep skill edits concise: add only what changes agent behavior, and
tighten existing text instead of appending more.
- Do a final compression pass over the skill diff before opening a PR:
drop unnecessary explanations and examples, cut redundancy, and merge
overlapping guidance.

### Usage

N/A — no API or flag change.

### Testing

`pre-commit run --files AGENTS.md` (markdownlint and the other
applicable hooks pass).

### Before your PR is "*Ready for review*"

- Is this change backward compatible?: ✅
- If you copied code from any other sources or added a new PIP
dependency, did you follow guidance in `CONTRIBUTING.md`: N/A
- Did you write any new necessary tests?: N/A <!-- documentation-only
change -->
- Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?:
N/A <!-- agent instructions only, not user-facing -->
- Did you get Claude approval on this PR?: ❌ <!-- will run /claude
review if reviewers want it -->

### Additional Information

Follows #2494, which added the PR sizing guidance to the same file.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Added guidance for keeping skill updates focused on behavior changes
and reviewing edits for unnecessary detail.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Chenjie Luo <chenjiel@nvidia.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
cjluo-nv added a commit that referenced this pull request Oct 1, 2026
### What does this PR do?

Type of change: documentation

Changes the PR sizing rule in `AGENTS.md` to count only **added source**
lines toward the ~500-line budget, instead of total changed lines.
Deletions are cheap to review, so a PR that mostly removes code
shouldn't be pushed into a split. Tests and docs are excluded too, since
every sub-PR has to carry its own tests. The check uses the insertions
count from `git diff --shortstat` with a pathspec that excludes `tests/`
and `docs/`.

### Usage

```bash
git diff --shortstat origin/main...HEAD -- . ':!tests' ':!docs'
# N files changed, X insertions(+), Y deletions(-)  -> compare X against ~500
```

### Testing

- `pre-commit run --files AGENTS.md` (markdownlint passes).
- Ran the pathspec against recent commits (#2595, #2513) to confirm it
drops test and doc lines from the count.

### Before your PR is "*Ready for review*"

- Is this change backward compatible?: N/A
- If you copied code from any other sources or added a new PIP
dependency, did you follow guidance in `CONTRIBUTING.md`: N/A
- Did you write any new necessary tests?: N/A
- Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?:
N/A
- Did you get Claude approval on this PR?: N/A

### Additional Information

Follow-up to #2494, which introduced the sizing guidance.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Updated review guidance to measure pull request size by added source
lines, excluding deletions, tests, and documentation. The guidance
retains the recommendation to check the size before opening a review.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Chenjie Luo <chenjiel@nvidia.com>
Co-authored-by: Claude Opus 5.5 (1M context) <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.

2 participants