A large agent PR can mix a real feature, generated files, refactors and unrelated cleanup in one diff. Green checks and a longer summary won't make it reviewable. Preserve the work, list its independent decisions, then choose a smaller PR, a stack of dependent PRs, or a justified exception. The example is a 40-file settings feature; file count is a cue to look, not a limit.

Freeze the branch and inventory the patch
Ask the agent to stop editing and record the PR head, base branch and worktree. Read the changed files, commits, generated artifacts, dependency changes, migrations and deleted tests. Keep the original branch until a reviewed replacement exists.
Generated code or a mechanical migration can justify a large change. GitHub recommends small, focused PRs because their purpose and risk are easier to see; splitting is about review capacity, not blame.
- Mark files that implement the request, support it, or are unrelated.
- Flag auth, payments, data and config changes for specialist review.
Split by decisions and dependencies
The settings patch might hold a profile API change, form UI, visual polish and an unrelated lint refactor. The lint refactor can be a follow-up, or dropped. The API and UI can often be two layers if the API has a stable contract and tests. A migration may need to come first, with its own rollback review.
Don't split by file count. Each PR needs a coherent reason, an acceptance check and a reviewer who can decide it.
| Slice | Dependency | Review question |
|---|---|---|
| Profile API and tests | Base branch | Does save enforce ownership and return the agreed result? |
| Settings form and UI checks | Profile API slice | Do success, failure and retry work in the browser? |
| Unrelated lint cleanup | None | Is it needed for this feature, or a separate issue? |
| Generated client output | Source schema or generator | Was it produced by the documented command from reviewed input? |
Choose separate PRs or a stack
Independent slices branch from the normal base. Dependent slices can be stacked: GitHub describes a bottom PR against trunk and higher PRs targeting the branch below, so each layer shows its own diff. GitHub's stacked PRs are in public preview, with repository and client requirements. Canopy's v0.3.4 release notes list asynchronous stacked PR merges.
Without GitHub stacks, dependent branches still need explicit bases and a review order. Don't force-push a shared PR history without agreeing it with the owner and reviewers.
- Put foundational contracts below the code that uses them.
- Link the original PR while you rebuild the sequence.
Have the agent deliver one slice at a time
Give the agent the approved split: purpose, allowed files, starting branch, tests and stop point. It prepares one diff and stops for review. A second agent can review each slice read-only against the issue without expanding scope.
In Canopy, check each agent's checkout, branch, changed files and running app. Test after each commit move, and keep the 40-file branch until all intended behavior is accounted for.
- Keep generated files with the source change that produces them.
- Check changed tests for weakened assertions.
Check the combined result before the final merge
Each PR needs passing checks on its latest commit. After lower layers merge, retest dependent branches on their new base. Then run the original workflow on the integrated code: a valid save persists, another user can't edit it, and a failed request can be retried.
Compare the final diff with the original inventory so nothing useful is lost and nothing unrelated slips in. A neat stack can still ship a broken feature if nobody tests the whole path.
- Re-review affected layers when a lower contract changes.
- Record who owns the final merge and any deferred cleanup.
Copyable resources
Agree this with the PR owner before rewriting any published branch history.
Original PR / head / base / worktree: [ ]
Original issue and acceptance checks: [ ]
Changed files grouped by behavior, generated output, tests, config, migration, unrelated work: [ ]
Risky paths and reviewer: [ ]
Slice A: purpose [ ]; base [ ]; files/behavior [ ]; check [ ]
Slice B: purpose [ ]; dependency [ ]; files/behavior [ ]; check [ ]
Follow-up or rejected scope: [ ]
Stacks available in this GitHub repo/client? [yes/no/unknown]
Canopy version and stacked-PR behavior tested: [ ]
Original branch kept until: [ ]
Latest checks per PR and integrated user journey: [ ]
Final owner and merge order: [ ]Frequently asked questions
Is a 40-file AI pull request automatically bad?
No. Generated or mechanical changes can be large for a good reason. Check whether the diff holds one understandable decision, reviewable source, meaningful checks and a clear owner.
Should I ask the agent to split the PR by file count?
No. Split by purpose and dependency. A file cap can leave half a behavior, or generated output, in the wrong PR.
When are stacked PRs useful?
When one reviewable change depends on another unmerged one. Each PR targets the branch below and shows a focused layer. Check GitHub's availability and your team's merge process.
Can I force-push the original branch after splitting it?
Agree it with the PR owner and reviewers first. Keep the original state until replacement branches, diffs and checks are confirmed.