**Tutorial: Split Giant AI PRs into Reviewable Stacks**

老Neo在路上 Advanced 1h ago 22 views 14 likes 2 min read

The biggest time sink in my team's workflow isn't writing code—it's the "AI dump" PR that lands in my lap at 3 PM with 1,800 lines of changes and a one-line summary that says "add search." I stare at it, my reviewer stares at it, and we both know this thing is going to sit for days because nobody wants to mentally parse a thousand lines of generated code in one go.

Coding agents are absurdly productive (Gartner's 50% SDLC productivity projection by 2028 feels conservative), but they ship in big blocks by default. They don't care about review ergonomics. That's on us.

The problem in practice

Last week I asked an agent to add product search to our shopping assistant. The starting state was exactly what you'd expect:

<strong>Tutorial: Split Giant AI PRs into Reviewable Stacks</strong>

  • A mock assistant pulling responses from a random line generator
  • Hardcoded, inconsistent product data scattered across components
  • Zero backend—no catalog module, no API, no data layer
**Tutorial: Split Giant AI PRs into Reviewable Stacks**

What landed in the PR was a monolith: new data model + seed data, API route + validation, client wiring + UI + all the empty/error/fallback states, updated tests. Clocking in at 1,721 lines.

My reviewer's response was predictable: "1,721 lines changed!! This description isn't very helpful. I'll review this later."

Translation: this sits in review limbo for a week, context degrades, feedback quality drops, and the whole thing merges under-reviewed.

Stacked PRs: the actual workflow

The fix isn't to slow down the agent—it's to give the agent a structure to ship into. Stacked pull requests decompose that giant diff into logical layers:

PR 1: Add catalog data model + seed data
  ↓
PR 2: Build /api/search route + validation
  ↓
PR 3: Wire client + render UI states
  ↓
PR 4: Add tests + end-to-end coverage

Each PR is ~300-400 lines, scoped to one concern, and naturally builds on the previous one. Reviewers can move linearly—understand the data layer, then the API, then the UI—without holding the entire feature in their head at once.

The agent still does its job at full speed. We just route its output through a pipeline that humans can actually consume.

Getting started

If you're using GitHub, tools like Stacking.dev or the native GitHub stacked PR experience let you branch from a parent PR, open a child, and link them automatically. The dependency chain keeps itself in sync, and CI runs per-layer.

Start small: pick your next agent-generated feature, break it into 3-4 logical chunks before you even prompt the agent, and watch your review cycle time drop from days to hours.

All Replies (3)

S
SkylerDev Intermediate 1h ago
I tried this once and accidentally stacked the same change twice. My reviewer was not amused.
0 Reply
J
Jules45 Expert 1h ago
Ran into the same "AI dump" problem last month. Now I review each chunk as it lands instead of waiting for the tsunami.
0 Reply
M
Morgan79 Novice 1h ago
How do you handle merge conflicts when the base PR gets updated mid-stack?
0 Reply

Write a Reply

Markdown supported