Who is responsible when AI-written code is wrong?
You are. The reviewer, the client and the user all go to the person whose name is on the change. The model cannot take the blame, so its code has to pass through your judgment before it ships
A pull request written with AI passed the tests and one review. The second reviewer spotted the problem in a minute. What the AI got wrong, and why the name on the change is still yours
The code it wrote, the code it should have written and a check, for every episode
When code that AI wrote is wrong, the person who shipped it answers for it. Nobody accepts "the AI wrote it" as a reason. Treat every line it writes as your own: read it, understand it, and fix it before you open the pull request.
You are. The reviewer, the client and the user all go to the person whose name is on the change. The model cannot take the blame, so its code has to pass through your judgment before it ships
Because the code worked. Tests check that the result is right. They do not check that the code is clear or that it does no extra work, and that is what a careful reviewer looks at
No. Use it, then review what it wrote as if a stranger wrote it. If you cannot explain a line, you are not ready to ship it
The same idea in a short video. It plays here, and nothing loads until you press play
One of us had a bug to fix while three pull requests were open at the same time, so AI wrote the fix. The job was simple: wait for a service to go down, then wait for it to come back up. The code worked, the tests passed, and one engineer approved it.
The second reviewer, one of the best engineers we have worked with, looked at it once and asked for it as two separate loops. He knew AI wrote it before anyone said so. He was kind about it, and it still stung, because the code had our name on it.
It put both waits into one endless loop and steered it with a single flag:
// One loop, two jobs, one flag
let wentDown = false;
while (true) {
const up = await isUp();
if (!wentDown && !up) wentDown = true;
if (wentDown && up) break;
await sleep(1000);
}
It works. It is also hard to read, easy to break the next time someone changes it, and it keeps asking questions it already has the answer to. Any engineer who writes modular code would split it into the two steps it actually is:
// Two waits, in order, one job each
async function waitUntil(check, everyMs = 1000) {
while (!(await check())) await sleep(everyMs);
}
await waitUntil(async () => !(await isUp())); // it went down
await waitUntil(isUp); // it came back up
In real code, both waits also need a time limit, so a service that never comes back cannot hang the job forever.
Code is read many more times than it is written. The next person to touch this, maybe you in three months, has to work out what the flag means before they can change anything safely. That cost is the same whether a person or a model wrote the code. AI writes code that works far more often than it writes code that is good, and the gap between the two is where reviews, bugs and late nights come from.
The rest of the Fix AI Slop Code series covers the problems AI leaves in apps most often, like rate limits that do not limit and retries that act twice.
The code it wrote, the code it should have written and a check, for every episode



You’ll leave the call knowing what’s risky and what to do next