Teaching the Trail: How to Review AI-Assisted Pull Requests Safely
Originally published on The Trail by Grupa VII . I have reviewed plenty of AI-assisted pull requests that looked spotless, read cleanly from top to bottom, and came with a green test suite. Two of them stand out. In one JavaScript change, reconnection logic for a SharedWorker passed every automated

Posted on Dec 2 • Originally published at grupavii.eu • AI-assisted
Originally published on The Trail by Grupa VII.
I have reviewed plenty of AI-assisted pull requests that looked spotless, read cleanly from top to bottom, and came with a green test suite. Two of them stand out.
Both diffs were tidy. Both had passing tests. Both broke when they met reality.
My stance on AI-assisted code is simple: I don't care whether you wrote a function by hand or generated it in ten seconds. I care whether you understand what it commits us to in production, and whether you can prove it survives real failure modes. Code is cheap to regenerate. A broken API contract, a locked production table, or a reconnect storm is expensive to unwind.
In Old Growth, New Trails, shared patterns gave incoming teams a safe path into a large migration. Code review is the daily version of that work: making engineering judgment explicit so the team catches high-consequence failures without routing every decision through one senior engineer.
Formatting, naming nits, and basic lint rules belong in CI. If a human reviewer is spending twenty minutes debating variable names on a 400-line AI-generated PR, nobody is checking the boundaries that can page on-call at 2 AM.
I put review time into three places where reverting a git commit does not undo the damage:
Start with the business invariant and the consumers already in production. Does an event mean "requested" or "completed"? Is a missing JSON field treated differently from null? If a PR renames a field or shifts an error code, can older clients and services still talk to it during a rolling deploy?
Be skeptical of tests built exclusively around freshly generated mocks. A generated test suite will happily confirm that the producer and its own mock agree while hiding that a real consumer (or a real Spring autoconfiguration path) behaves differently. Ask for evidence from the actual boundary: contract tests against supported versions, representative production payloads, or verification in a real runtime context.
A migration script that passes against an empty test container can still lock a hot table in production. Check constraints and defaults against existing rows, inspect the query plan at realistic volume, and check whether old and new application instances can coexist while the deployment rolls out.
Keep risky schema changes in three safe stages:
AI tools are remarkably good at writing the happy path and remarkably bad at writing bounded failure loops. The SharedWorker reconnect storm looked something like this in spirit:
// Passes unit tests that simulate a single disconnect, // but spirals endlessly when the worker keeps dying in a live tab. function connect ( ) { const worker = new SharedWorker ( '/sync-worker.js' ); worker. port. start ( ); worker. port. onmessage = ( { data } ) => { if ( data. type === 'disconnected' ) setTimeout ( connect, 200 ); }; worker. onerror = ( ) => setTimeout ( connect, 200 ); } Enter fullscreen mode Exit fullscreen mode The unit test simulated one drop, saw connect() fire, and turned green. Under real browser lifecycle events, there was no exponential backoff, no retry cap, no single-flight guard against overlapping timers, and no circuit breaker to surface a degraded state to the user. A bounded version makes those limits explicit (illustrative pattern):
let attempt = 0; // reset to 0 after a healthy handshake let reconnectTimer = null; const MAX_ATTEMPTS = 7; function scheduleReconnect ( onDegraded ) { if ( reconnectTimer!== null ) return; // single-flight guard if ( attempt >= MAX_ATTEMPTS ) return onDegraded ( ); const baseMs = Math. min ( 30_000, 500 * 2 ** attempt ++ ); const jitterMs = Math. floor ( Math. random ( ) * 250 ); reconnectTimer = setTimeout ( ( ) => { reconnectTimer = null; connect ( onDegraded ); }, baseMs + jitterMs ); } Enter fullscreen mode Exit fullscreen mode Whenever a PR touches networking, workers, queues, or infrastructure config, look directly at timeouts, backoff ceilings, retry caps, and blast radius. Check whether permissions are scoped to what the workload actually needs and what alert will fire when the feature degrades silently.
Checking contracts, rollouts, and retry limits takes real focus, and that focus collapses the moment someone drops a 400-line AI-assisted diff with a blank description.
If an author opens a large AI-assisted PR with an empty description and expects me to reverse-engineer the intent from the diff, I send it back. Before I dive into the code, I want four short answers in the PR description:
Skip that four-question template on small, reversible internal refactors, copy tweaks, or test-only PRs that touch no external contract, database schema, retry loop, or permission boundary. Requiring heavy ceremony on trivial diffs breeds rubber-stamping; reserving it for high-consequence boundaries keeps reviewers sharp where failure actually hurts.
That handoff gives me a map, then I still trace the risky paths myself: walk a request through authorization and state transitions, trace what happens on duplicate delivery, and look closely at loops and retry branches.
One trap I see teams fall into: using a second AI reviewer to rubber-stamp AI-written code. An LLM reviewer is fine for spotting obvious null checks or suggesting an edge case to investigate, and I use it as a helper. It has zero accountability for production and no context on the legacy consumer sitting in another repo. Generated code plus generated tests plus an AI review can still encode the exact same wrong assumption three times.
Rule of thumb: Treat generated tests as proof that the code compiles and matches the prompt, not proof that it survives production. If a PR changes a schema, external contract, or retry loop, demand one piece of evidence from outside mocks before approving.
Catching a risky boundary protects today's deploy, yet how you write the review comment decides whether you will catch the exact same mistake again next Tuesday.
Review comments should make urgency unmistakable. Label items clearly: Blocker for correctness, security, compatibility, or reliability issues; Question for missing context; Suggestion for optional improvements. Never disguise a blocker as a polite suggestion, and never bury a real risk under twelve style comments.
Here is the difference between feedback that creates a back-and-forth and feedback that teaches how to think about production risk.
After: " Blocker: This renames status to state. Which deployed consumers still read status? Keep both fields during rollout or show compatibility against the current consumer version, since the new mock only covers the renamed shape."
After: " Blocker: This adds NOT NULL before the backfill completes. What happens to existing null rows and writes from old instances mid-deploy? Split the additive column, backfill, and NOT VALID constraint, and note how we recover if the backfill stalls."
Good comments name the failure mode and ask for evidence. When a thread turns into a design debate, stop typing in GitHub, jump on a ten-minute call or pair on the boundary, and write the decision back into the PR so the next engineer can read the reasoning.
Crucially, let the author do the investigation and fix the code. If I rewrite the PR myself to save twenty minutes, I ship one change faster and guarantee I'll review the exact same mistake next week.
Over time, graduate engineers from reviewing bounded, low-risk PRs to owning high-risk boundaries while keeping required approvals and security checks intact. That is the core of technical leadership, and the only way team augmentation scales without turning your most senior engineer into a permanent merge bottleneck.
When I'm about to hit Approve on an AI-assisted pull request, I check three things:
If all three answers are solid, ship it. If any one is hand-waved, hold the merge and work through it together. Tidy diffs and green generated tests are effortless now; these three checks are what keep reality from breaking them.
Building a team that can review and own AI-assisted changes with confidence? Explore technical leadership, team augmentation, and our fixed-scope 2-Week Architecture Review, or let's talk about your team.