Blog

AI wrote the code, and you still own it

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

Free, no call

Get every Fix AI Slop Code episode

The code it wrote, the code it should have written and a check, for every episode

Free, straight to your inbox. No call, no pitch

The short answer

AI wrote the code, and you still own it

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.

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

Why did the tests not catch it?

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

Should you stop using AI to write code?

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 Blinkz team · Updated

Watch the video

Watch the story

The same idea in a short video. It plays here, and nothing loads until you press play

What happened?

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.

What did the AI write?

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.

Why does it matter if the code works?

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.

What should you check before you open the pull request?

  • Read every line the AI wrote as if a stranger wrote it.
  • If one loop, flag or condition is doing two jobs, split it.
  • Ask the model to explain the code back to you. If the explanation is longer than the code, the code is too clever.
  • Run it against the case that should fail, not only the one that should pass.

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.

Free, no call

Get every Fix AI Slop Code episode

The code it wrote, the code it should have written and a check, for every episode

Free, straight to your inbox. No call, no pitch

Bring what you have. We’ll tell you where it stands

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

  • 30 minutes
  • Free
  • No slides, no sales team