Maybe I’m a glutton for pain. I quite like having an agent complain about my pull requests (PRs). Don’t get me wrong though. This is unusual even for me, since I get much more value per comment from a person. Somebody who knows the codebase can half-look at a change, think of half a dozen ways it could go wrong, and leave me the one comment I ought to do something about for sure. With an agent I’ll get a dozen or more, but those dozen are useful when nobody else is free to review my PRs.
Many months ago, I found myself reviewing changes in a codebase I barely knew. Some of them involved running migrations on an esoteric version of Postgres. I had very little experience with that particular flavour of SQL, so I cranked out an agent to follow the change through the code and point out things I might want to look into. I could read what it found, follow up on the bits that seemed relevant, and get on with the review. I remember some concerns coming up about how the migration was being done, but nothing that made me think twice about approving the PR. I wish I could say I was young and naive, but yes, that change blew up when I was on call.
A few weeks later, as a side project, I fed an agent roughly two weeks’ worth of PRs from the same codebase. I was trying to get a feel for where we were doing work over again. My questions were fairly loose. Which changes were we coming back to fix? Were we undoing something another PR had just done? Were people having the same discussion on several different changes? I’d only reviewed a fraction of these PRs, and I was curious what I’d missed.
One suggestion came with links to three migration PRs, including the one I remembered from my on-call shift. Somebody had put up a fix, and we’d needed a third PR because the fix had missed something too. By the third PR the comments were all messed up, so naturally I’d ended up contributing a fourth PR to fix those. Maybe I should check again to see what the count is now.
I’d reviewed two of those PRs, and neither mentioned a previous issue. The agent, on the other hand, had the considerable advantage of hindsight. Given the same PRs and a bit of reading time, I probably could have figured this out. I’m less sure I’d have known to go looking for those PRs in the first place. Who’s got time for that?
The agent suggested a check for backward and forward compatibility in migrations. I’ve since forgotten the exact rule, but with a few tweaks we got it into CI, where it caught issues surprisingly high amount of times. I’m even less sure I’d have had the time to put that check in place within minutes instead of shoving it into “a backlog”.
I then found myself doing some version of this across many repos. I’d let the agent look fairly widely across reviews and changes. There was a lot to sift through, with bot reviewers leaving more comments than the count of rubber duckies filling up a container ship. People tended to be more selective, but the bots covered a lot more ground. When the same concerns kept turning up, I could look more closely at those PRs. Sometimes it was a problem people were working around by hand. Sometimes it was a comment the agent was unbearably fond of. As a side note, it’s a sobering experience to realize what crazy things your younger self was up to. Head-in-your-hands stuff that I’m even more uncertain I’d ever make time for.
The agents could spot whatever patterns they fancied, but I’d usually want to see five examples before I’d take a look. Fewer if it had cost someone time and effort. From there I’d have the agent try its hand at writing a deterministic check. Seeing the rule tells me a fair bit about whether I want it. If I can already imagine the conversations we’ll be having when it starts rejecting reasonable PRs, I’ll park it. If it’s a small check, I’m happy to put it in and have one less thing to remember about how esoteric relational databases do their migrations. And this was just one example in one codebase. In reality there’s a stampede of engineers backed by hordes of multithreaded agents cobbling together footguns at breakneck pace.
Given enough time working across our codebases, I might have started to recognize these patterns myself. Given a bit more, I might even have added the guardrails by hand. But it’s nice to know that what used to take months or years, I can now scrappily do in hours or less by sifting through the horde’s wake and scaling hindsight.